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 @ 44297
History | View | Annotate | Download (5.46 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.io.File; |
27 |
import java.util.List; |
28 |
|
29 |
import org.gvsig.fmap.dal.exception.DataException; |
30 |
import org.gvsig.tools.dispose.Disposable; |
31 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
32 |
|
33 |
/**
|
34 |
* DataServerExplorer is an abstraction for any type of data server. It allows
|
35 |
* connecting to the server and browsing its contents.
|
36 |
*
|
37 |
* More specifically, this interface provides a list of the available data
|
38 |
* stores in a server.
|
39 |
*/
|
40 |
public interface DataServerExplorer extends Disposable, DataFactoryUnit { |
41 |
|
42 |
/**
|
43 |
* Returns the DataServerExplorer's name
|
44 |
*
|
45 |
* @return String containing this DataServerExplorer's name
|
46 |
*/
|
47 |
public String getProviderName(); |
48 |
|
49 |
/**
|
50 |
* Indicates whether this DataServerExplorer can create a new DataStore in
|
51 |
* the server.
|
52 |
*
|
53 |
* @return true if this DataServerExplorer can be created or false
|
54 |
* otherwise.
|
55 |
*/
|
56 |
public boolean canAdd(); |
57 |
|
58 |
/**
|
59 |
* Indicates whether this DataServerExplorer can create a new DataStore in
|
60 |
* the server, given the store name.
|
61 |
*
|
62 |
* @param storeName store name.
|
63 |
*
|
64 |
* @return true if this DataServerExplorer can create a new store or false
|
65 |
* otherwise.
|
66 |
*
|
67 |
* @throws DataException
|
68 |
*/
|
69 |
public boolean canAdd(String storeName) |
70 |
throws DataException;
|
71 |
|
72 |
/**
|
73 |
* Provides a list of available stores in the server.
|
74 |
*
|
75 |
* @return list of DataStoreParameters
|
76 |
*
|
77 |
* @throws DataException
|
78 |
*/
|
79 |
public List<DataStoreParameters> list() throws DataException; |
80 |
|
81 |
public DataStoreParameters get(String name) throws DataException; |
82 |
|
83 |
public static final int MODE_ALL = 0; |
84 |
public static final int MODE_FEATURE = 1; |
85 |
public static final int MODE_GEOMETRY = 2; |
86 |
public static final int MODE_RASTER = 4; |
87 |
|
88 |
/**
|
89 |
* Provides a list of available stores in the server of a type.
|
90 |
*
|
91 |
* @param mode , filter store from a type: {@link #MODE_ALL},
|
92 |
* {@link #MODE_FEATURE}, {@link #MODE_FEATURE_GEOMETRY},
|
93 |
* {@link #MODE_RASTER}
|
94 |
*
|
95 |
* @return list of DataStoreParameters
|
96 |
*
|
97 |
* @throws DataException
|
98 |
*/
|
99 |
public List<DataStoreParameters> list(int mode) throws DataException; |
100 |
|
101 |
/**
|
102 |
* Creates a new DataStore in this server.
|
103 |
*
|
104 |
* @param provider
|
105 |
* @param parameters , an instance of DataStoreParameters from
|
106 |
* {@link DataServerExplorer#getAddParameters(String)} that describes the
|
107 |
* new DataStore.
|
108 |
* @param overwrite 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<String> getDataStoreProviderNames(); |
154 |
|
155 |
/**
|
156 |
* Return the file resource associated to this name and store. If the
|
157 |
* resource not exists or the explorer don't support this opperation return
|
158 |
* null.
|
159 |
*
|
160 |
* @param dataStore
|
161 |
* @param resourceName
|
162 |
* @return file resource or null
|
163 |
* @throws DataException
|
164 |
* @deprecated use getResourcesStorage
|
165 |
*/
|
166 |
public File getResourcePath(DataStore dataStore, String resourceName) throws DataException; |
167 |
|
168 |
public ResourcesStorage getResourcesStorage(DataStore dataStore);
|
169 |
} |