Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / DataServerExplorer.java @ 42775

History | View | Annotate | Download (4.58 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.dal;
25

    
26
import java.util.List;
27

    
28
import org.gvsig.fmap.dal.exception.DataException;
29
import org.gvsig.tools.dispose.Disposable;
30

    
31
/**
32
 * DataServerExplorer is an abstraction for any type of data server. It allows
33
 * connecting to the server and browsing its contents.
34
 *
35
 * More specifically, this interface provides a list of the available data
36
 * stores in a server.
37
 */
38
public interface DataServerExplorer extends Disposable {
39

    
40
        /**
41
         * Returns the DataServerExplorer's name
42
         *
43
         * @return String containing this DataServerExplorer's name
44
         */
45
        public String getProviderName();
46

    
47
        /**
48
         * Indicates whether this DataServerExplorer can create a new DataStore in the
49
         * server.
50
         *
51
         * @return true if this DataServerExplorer can be created or false otherwise.
52
         */
53
        public boolean canAdd();
54

    
55
        /**
56
         * Indicates whether this DataServerExplorer can create a new DataStore in
57
         * the server, given the store name.
58
         *
59
         * @param storeName
60
         *            store name.
61
         *
62
         * @return true if this DataServerExplorer can create a new store or false
63
         *         otherwise.
64
         *
65
         * @throws DataException
66
         */
67
        public boolean canAdd(String storeName)
68
                        throws DataException;
69

    
70
        /**
71
         * Provides a list of available stores in the server.
72
         *
73
         * @return list of DataStoreParameters
74
         *
75
         * @throws DataException
76
         */
77
        public List list() throws DataException;
78

    
79
        public DataStoreParameters get(String name) throws DataException;
80
        
81
        public static final int MODE_ALL = 0;
82
        public static final int MODE_FEATURE = 1;
83
        public static final int MODE_GEOMETRY = 2;
84
        public static final int MODE_RASTER = 4;
85

    
86
        /**
87
         * Provides a list of available stores in the server of a type.
88
         * 
89
         * @param mode
90
         *            , filter store from a type: {@link #MODE_ALL},
91
         *            {@link #MODE_FEATURE}, {@link #MODE_FEATURE_GEOMETRY},
92
         *            {@link #MODE_RASTER}
93
         * 
94
         * @return list of DataStoreParameters
95
         * 
96
         * @throws DataException
97
         */
98
        public List list(int mode) throws DataException;
99

    
100
        /**
101
         * Creates a new DataStore in this server.
102
         *
103
         * @param parameters
104
         *            , an instance of DataStoreParameters from
105
         *            {@link DataServerExplorer#getAddParameters(String)} that
106
         *            describes the new DataStore.
107
         * @param overwrite
108
         *            if the store already exists
109
         *
110
         * @return true if the DataStoreParameters were successfully added, false
111
         *         otherwise.
112
         *
113
         * @throws DataException
114
         */
115
        public boolean add(String provider, NewDataStoreParameters parameters, boolean overwrite)
116
                        throws DataException;
117

    
118
        /**
119
         * Removes a store from the server given its DataStoreParameters. If the
120
         * store is a file then this method deletes the file, if it is a table in a
121
         * database then this method drops the table, and so on.
122
         *
123
         * @param parameters
124
         * @throws DataException
125
         */
126
        void remove(DataStoreParameters parameters) throws DataException;
127

    
128
        /**
129
         * Given the store's name, returns its parameters for creation.
130
         *
131
         * @param storeName
132
         *
133
         * @return parameters to create a store
134
         *
135
         * @throws DataException
136
         */
137
        public NewDataStoreParameters getAddParameters(String storeName)
138
                        throws DataException;
139

    
140
        /**
141
         * Returns this DataServerExplorer parameters
142
         *
143
         * @return an instance of DataServerExplorerParameters containing this
144
         *         DataServerExplorer parameters.
145
         */
146
        public DataServerExplorerParameters getParameters();
147

    
148
        /**
149
         * Return the list of provider names that this server allow.
150
         *  
151
         * @return List of provider names
152
         */
153
        public List getDataStoreProviderNames();
154

    
155
}