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 @ 43371
History | View | Annotate | Download (5.07 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 | |||
32 | /**
|
||
33 | * DataServerExplorer is an abstraction for any type of data server. It allows
|
||
34 | * connecting to the server and browsing its contents.
|
||
35 | *
|
||
36 | * More specifically, this interface provides a list of the available data
|
||
37 | * stores in a server.
|
||
38 | */
|
||
39 | 43020 | jjdelcerro | public interface DataServerExplorer extends Disposable, DataFactoryUnit { |
40 | 40435 | jjdelcerro | |
41 | /**
|
||
42 | * Returns the DataServerExplorer's name
|
||
43 | *
|
||
44 | * @return String containing this DataServerExplorer's name
|
||
45 | */
|
||
46 | public String getProviderName(); |
||
47 | |||
48 | /**
|
||
49 | * Indicates whether this DataServerExplorer can create a new DataStore in the
|
||
50 | * server.
|
||
51 | *
|
||
52 | * @return true if this DataServerExplorer can be created or false otherwise.
|
||
53 | */
|
||
54 | public boolean canAdd(); |
||
55 | |||
56 | /**
|
||
57 | * Indicates whether this DataServerExplorer can create a new DataStore in
|
||
58 | * the server, given the store name.
|
||
59 | *
|
||
60 | * @param storeName
|
||
61 | * store name.
|
||
62 | *
|
||
63 | * @return true if this DataServerExplorer can create a new store or false
|
||
64 | * otherwise.
|
||
65 | *
|
||
66 | * @throws DataException
|
||
67 | */
|
||
68 | public boolean canAdd(String storeName) |
||
69 | throws DataException;
|
||
70 | |||
71 | /**
|
||
72 | * Provides a list of available stores in the server.
|
||
73 | *
|
||
74 | * @return list of DataStoreParameters
|
||
75 | *
|
||
76 | * @throws DataException
|
||
77 | */
|
||
78 | public List list() throws DataException; |
||
79 | |||
80 | 42775 | jjdelcerro | public DataStoreParameters get(String name) throws DataException; |
81 | |||
82 | 40435 | jjdelcerro | public static final int MODE_ALL = 0; |
83 | public static final int MODE_FEATURE = 1; |
||
84 | public static final int MODE_GEOMETRY = 2; |
||
85 | public static final int MODE_RASTER = 4; |
||
86 | |||
87 | /**
|
||
88 | * Provides a list of available stores in the server of a type.
|
||
89 | *
|
||
90 | * @param mode
|
||
91 | * , 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 list(int mode) throws DataException; |
||
100 | |||
101 | /**
|
||
102 | * Creates a new DataStore in this server.
|
||
103 | *
|
||
104 | * @param parameters
|
||
105 | * , an instance of DataStoreParameters from
|
||
106 | * {@link DataServerExplorer#getAddParameters(String)} that
|
||
107 | * describes the new DataStore.
|
||
108 | * @param overwrite
|
||
109 | * if the store already exists
|
||
110 | *
|
||
111 | * @return true if the DataStoreParameters were successfully added, false
|
||
112 | * otherwise.
|
||
113 | *
|
||
114 | * @throws DataException
|
||
115 | */
|
||
116 | public boolean add(String provider, NewDataStoreParameters parameters, boolean overwrite) |
||
117 | throws DataException;
|
||
118 | |||
119 | /**
|
||
120 | * Removes a store from the server given its DataStoreParameters. If the
|
||
121 | * store is a file then this method deletes the file, if it is a table in a
|
||
122 | * database then this method drops the table, and so on.
|
||
123 | *
|
||
124 | * @param parameters
|
||
125 | * @throws DataException
|
||
126 | */
|
||
127 | void remove(DataStoreParameters parameters) throws DataException; |
||
128 | |||
129 | /**
|
||
130 | * Given the store's name, returns its parameters for creation.
|
||
131 | *
|
||
132 | * @param storeName
|
||
133 | *
|
||
134 | * @return parameters to create a store
|
||
135 | *
|
||
136 | * @throws DataException
|
||
137 | */
|
||
138 | public NewDataStoreParameters getAddParameters(String storeName) |
||
139 | throws DataException;
|
||
140 | |||
141 | /**
|
||
142 | * Returns this DataServerExplorer parameters
|
||
143 | *
|
||
144 | * @return an instance of DataServerExplorerParameters containing this
|
||
145 | * DataServerExplorer parameters.
|
||
146 | */
|
||
147 | public DataServerExplorerParameters getParameters();
|
||
148 | |||
149 | /**
|
||
150 | * Return the list of provider names that this server allow.
|
||
151 | *
|
||
152 | * @return List of provider names
|
||
153 | */
|
||
154 | public List getDataStoreProviderNames(); |
||
155 | |||
156 | 42879 | jjdelcerro | /**
|
157 | * Return the file resource associated to this name and store.
|
||
158 | * If the resource not exists or the explorer don't support this opperation
|
||
159 | * return null.
|
||
160 | *
|
||
161 | * @param dataStore
|
||
162 | * @param resourceName
|
||
163 | * @return file resource or null
|
||
164 | * @throws DataException
|
||
165 | */
|
||
166 | public File getResourcePath(DataStore dataStore, String resourceName) throws DataException; |
||
167 | 43020 | jjdelcerro | |
168 | 40435 | jjdelcerro | } |