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 @ 44779
History | View | Annotate | Download (5.77 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
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 | 40435 | jjdelcerro | package org.gvsig.fmap.dal; |
25 | |||
26 | 42879 | jjdelcerro | import java.io.File; |
27 | 40435 | jjdelcerro | import java.util.List; |
28 | |||
29 | import org.gvsig.fmap.dal.exception.DataException; |
||
30 | import org.gvsig.tools.dispose.Disposable; |
||
31 | 44297 | jjdelcerro | import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
32 | 40435 | jjdelcerro | |
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 | 43020 | jjdelcerro | public interface DataServerExplorer extends Disposable, DataFactoryUnit { |
41 | 40435 | jjdelcerro | |
42 | 44669 | jjdelcerro | public static final String FILESYSTEM_SERVER_EXPLORER_NAME = "FilesystemExplorer"; |
43 | |||
44 | 44157 | jjdelcerro | /**
|
45 | * Returns the DataServerExplorer's name
|
||
46 | *
|
||
47 | * @return String containing this DataServerExplorer's name
|
||
48 | */
|
||
49 | public String getProviderName(); |
||
50 | 40435 | jjdelcerro | |
51 | 44157 | jjdelcerro | /**
|
52 | * Indicates whether this DataServerExplorer can create a new DataStore in
|
||
53 | * the server.
|
||
54 | *
|
||
55 | * @return true if this DataServerExplorer can be created or false
|
||
56 | * otherwise.
|
||
57 | */
|
||
58 | public boolean canAdd(); |
||
59 | 40435 | jjdelcerro | |
60 | 44157 | jjdelcerro | /**
|
61 | * Indicates whether this DataServerExplorer can create a new DataStore in
|
||
62 | * the server, given the store name.
|
||
63 | *
|
||
64 | * @param storeName store name.
|
||
65 | *
|
||
66 | * @return true if this DataServerExplorer can create a new store or false
|
||
67 | * otherwise.
|
||
68 | *
|
||
69 | * @throws DataException
|
||
70 | */
|
||
71 | public boolean canAdd(String storeName) |
||
72 | throws DataException;
|
||
73 | 40435 | jjdelcerro | |
74 | 44157 | jjdelcerro | /**
|
75 | * Provides a list of available stores in the server.
|
||
76 | *
|
||
77 | * @return list of DataStoreParameters
|
||
78 | *
|
||
79 | * @throws DataException
|
||
80 | */
|
||
81 | 44297 | jjdelcerro | public List<DataStoreParameters> list() throws DataException; |
82 | 40435 | jjdelcerro | |
83 | 44157 | jjdelcerro | public DataStoreParameters get(String name) throws DataException; |
84 | 40435 | jjdelcerro | |
85 | 44329 | jjdelcerro | public boolean exists(DataStoreParameters parameters) throws DataException; |
86 | 44328 | jjdelcerro | |
87 | 44157 | jjdelcerro | public static final int MODE_ALL = 0; |
88 | public static final int MODE_FEATURE = 1; |
||
89 | public static final int MODE_GEOMETRY = 2; |
||
90 | public static final int MODE_RASTER = 4; |
||
91 | 40435 | jjdelcerro | |
92 | 44157 | jjdelcerro | /**
|
93 | * Provides a list of available stores in the server of a type.
|
||
94 | *
|
||
95 | * @param mode , filter store from a type: {@link #MODE_ALL},
|
||
96 | * {@link #MODE_FEATURE}, {@link #MODE_FEATURE_GEOMETRY},
|
||
97 | * {@link #MODE_RASTER}
|
||
98 | *
|
||
99 | * @return list of DataStoreParameters
|
||
100 | *
|
||
101 | * @throws DataException
|
||
102 | */
|
||
103 | 44297 | jjdelcerro | public List<DataStoreParameters> list(int mode) throws DataException; |
104 | 40435 | jjdelcerro | |
105 | 44157 | jjdelcerro | /**
|
106 | * Creates a new DataStore in this server.
|
||
107 | *
|
||
108 | 44297 | jjdelcerro | * @param provider
|
109 | 44157 | jjdelcerro | * @param parameters , an instance of DataStoreParameters from
|
110 | * {@link DataServerExplorer#getAddParameters(String)} that describes the
|
||
111 | * new DataStore.
|
||
112 | * @param overwrite if the store already exists
|
||
113 | *
|
||
114 | * @return true if the DataStoreParameters were successfully added, false
|
||
115 | * otherwise.
|
||
116 | *
|
||
117 | * @throws DataException
|
||
118 | */
|
||
119 | public boolean add(String provider, NewDataStoreParameters parameters, boolean overwrite) |
||
120 | throws DataException;
|
||
121 | 40435 | jjdelcerro | |
122 | 44157 | jjdelcerro | /**
|
123 | * Removes a store from the server given its DataStoreParameters. If the
|
||
124 | * store is a file then this method deletes the file, if it is a table in a
|
||
125 | * database then this method drops the table, and so on.
|
||
126 | *
|
||
127 | * @param parameters
|
||
128 | * @throws DataException
|
||
129 | */
|
||
130 | void remove(DataStoreParameters parameters) throws DataException; |
||
131 | 40435 | jjdelcerro | |
132 | 44157 | jjdelcerro | /**
|
133 | * Given the store's name, returns its parameters for creation.
|
||
134 | *
|
||
135 | * @param storeName
|
||
136 | *
|
||
137 | * @return parameters to create a store
|
||
138 | *
|
||
139 | * @throws DataException
|
||
140 | */
|
||
141 | public NewDataStoreParameters getAddParameters(String storeName) |
||
142 | throws DataException;
|
||
143 | 40435 | jjdelcerro | |
144 | 44157 | jjdelcerro | /**
|
145 | * Returns this DataServerExplorer parameters
|
||
146 | *
|
||
147 | * @return an instance of DataServerExplorerParameters containing this
|
||
148 | * DataServerExplorer parameters.
|
||
149 | */
|
||
150 | public DataServerExplorerParameters getParameters();
|
||
151 | 40435 | jjdelcerro | |
152 | 44157 | jjdelcerro | /**
|
153 | * Return the list of provider names that this server allow.
|
||
154 | *
|
||
155 | * @return List of provider names
|
||
156 | */
|
||
157 | 44297 | jjdelcerro | public List<String> getDataStoreProviderNames(); |
158 | 44157 | jjdelcerro | |
159 | /**
|
||
160 | * Return the file resource associated to this name and store. If the
|
||
161 | * resource not exists or the explorer don't support this opperation return
|
||
162 | * null.
|
||
163 | *
|
||
164 | * @param dataStore
|
||
165 | * @param resourceName
|
||
166 | * @return file resource or null
|
||
167 | * @throws DataException
|
||
168 | 44297 | jjdelcerro | * @deprecated use getResourcesStorage
|
169 | 44157 | jjdelcerro | */
|
170 | public File getResourcePath(DataStore dataStore, String resourceName) throws DataException; |
||
171 | |||
172 | 44419 | jjdelcerro | public ResourcesStorage getResourcesStorage();
|
173 | |||
174 | 44297 | jjdelcerro | public ResourcesStorage getResourcesStorage(DataStore dataStore);
|
175 | 44328 | jjdelcerro | |
176 | public ResourcesStorage getResourcesStorage(DataStoreParameters parameters);
|
||
177 | 40435 | jjdelcerro | } |