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 @ 44644
History | View | Annotate | Download (5.69 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 | 44157 | jjdelcerro | /**
|
43 | * Returns the DataServerExplorer's name
|
||
44 | *
|
||
45 | * @return String containing this DataServerExplorer's name
|
||
46 | */
|
||
47 | public String getProviderName(); |
||
48 | 40435 | jjdelcerro | |
49 | 44157 | jjdelcerro | /**
|
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 | 40435 | jjdelcerro | |
58 | 44157 | jjdelcerro | /**
|
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 | 40435 | jjdelcerro | |
72 | 44157 | jjdelcerro | /**
|
73 | * Provides a list of available stores in the server.
|
||
74 | *
|
||
75 | * @return list of DataStoreParameters
|
||
76 | *
|
||
77 | * @throws DataException
|
||
78 | */
|
||
79 | 44297 | jjdelcerro | public List<DataStoreParameters> list() throws DataException; |
80 | 40435 | jjdelcerro | |
81 | 44157 | jjdelcerro | public DataStoreParameters get(String name) throws DataException; |
82 | 40435 | jjdelcerro | |
83 | 44329 | jjdelcerro | public boolean exists(DataStoreParameters parameters) throws DataException; |
84 | 44328 | jjdelcerro | |
85 | 44157 | jjdelcerro | public static final int MODE_ALL = 0; |
86 | public static final int MODE_FEATURE = 1; |
||
87 | public static final int MODE_GEOMETRY = 2; |
||
88 | public static final int MODE_RASTER = 4; |
||
89 | 40435 | jjdelcerro | |
90 | 44157 | jjdelcerro | /**
|
91 | * Provides a list of available stores in the server of a type.
|
||
92 | *
|
||
93 | * @param mode , filter store from a type: {@link #MODE_ALL},
|
||
94 | * {@link #MODE_FEATURE}, {@link #MODE_FEATURE_GEOMETRY},
|
||
95 | * {@link #MODE_RASTER}
|
||
96 | *
|
||
97 | * @return list of DataStoreParameters
|
||
98 | *
|
||
99 | * @throws DataException
|
||
100 | */
|
||
101 | 44297 | jjdelcerro | public List<DataStoreParameters> list(int mode) throws DataException; |
102 | 40435 | jjdelcerro | |
103 | 44157 | jjdelcerro | /**
|
104 | * Creates a new DataStore in this server.
|
||
105 | *
|
||
106 | 44297 | jjdelcerro | * @param provider
|
107 | 44157 | jjdelcerro | * @param parameters , an instance of DataStoreParameters from
|
108 | * {@link DataServerExplorer#getAddParameters(String)} that describes the
|
||
109 | * new DataStore.
|
||
110 | * @param overwrite if the store already exists
|
||
111 | *
|
||
112 | * @return true if the DataStoreParameters were successfully added, false
|
||
113 | * otherwise.
|
||
114 | *
|
||
115 | * @throws DataException
|
||
116 | */
|
||
117 | public boolean add(String provider, NewDataStoreParameters parameters, boolean overwrite) |
||
118 | throws DataException;
|
||
119 | 40435 | jjdelcerro | |
120 | 44157 | jjdelcerro | /**
|
121 | * Removes a store from the server given its DataStoreParameters. If the
|
||
122 | * store is a file then this method deletes the file, if it is a table in a
|
||
123 | * database then this method drops the table, and so on.
|
||
124 | *
|
||
125 | * @param parameters
|
||
126 | * @throws DataException
|
||
127 | */
|
||
128 | void remove(DataStoreParameters parameters) throws DataException; |
||
129 | 40435 | jjdelcerro | |
130 | 44157 | jjdelcerro | /**
|
131 | * Given the store's name, returns its parameters for creation.
|
||
132 | *
|
||
133 | * @param storeName
|
||
134 | *
|
||
135 | * @return parameters to create a store
|
||
136 | *
|
||
137 | * @throws DataException
|
||
138 | */
|
||
139 | public NewDataStoreParameters getAddParameters(String storeName) |
||
140 | throws DataException;
|
||
141 | 40435 | jjdelcerro | |
142 | 44157 | jjdelcerro | /**
|
143 | * Returns this DataServerExplorer parameters
|
||
144 | *
|
||
145 | * @return an instance of DataServerExplorerParameters containing this
|
||
146 | * DataServerExplorer parameters.
|
||
147 | */
|
||
148 | public DataServerExplorerParameters getParameters();
|
||
149 | 40435 | jjdelcerro | |
150 | 44157 | jjdelcerro | /**
|
151 | * Return the list of provider names that this server allow.
|
||
152 | *
|
||
153 | * @return List of provider names
|
||
154 | */
|
||
155 | 44297 | jjdelcerro | public List<String> getDataStoreProviderNames(); |
156 | 44157 | jjdelcerro | |
157 | /**
|
||
158 | * Return the file resource associated to this name and store. If the
|
||
159 | * resource not exists or the explorer don't support this opperation return
|
||
160 | * null.
|
||
161 | *
|
||
162 | * @param dataStore
|
||
163 | * @param resourceName
|
||
164 | * @return file resource or null
|
||
165 | * @throws DataException
|
||
166 | 44297 | jjdelcerro | * @deprecated use getResourcesStorage
|
167 | 44157 | jjdelcerro | */
|
168 | public File getResourcePath(DataStore dataStore, String resourceName) throws DataException; |
||
169 | |||
170 | 44419 | jjdelcerro | public ResourcesStorage getResourcesStorage();
|
171 | |||
172 | 44297 | jjdelcerro | public ResourcesStorage getResourcesStorage(DataStore dataStore);
|
173 | 44328 | jjdelcerro | |
174 | public ResourcesStorage getResourcesStorage(DataStoreParameters parameters);
|
||
175 | 40435 | jjdelcerro | } |