Revision 23774 branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/impl/DefaultDataManager.java
DefaultDataManager.java | ||
---|---|---|
15 | 15 |
import org.gvsig.fmap.data.DataStoreProvider; |
16 | 16 |
import org.gvsig.fmap.data.ResourceManager; |
17 | 17 |
import org.gvsig.fmap.data.exceptions.InitializeException; |
18 |
import org.gvsig.fmap.data.exceptions.NotResgisteredStore; |
|
18 | 19 |
import org.gvsig.tools.evaluator.Evaluator; |
19 | 20 |
import org.gvsig.tools.operations.Operation; |
20 | 21 |
import org.gvsig.tools.operations.OperationContext; |
... | ... | |
72 | 73 |
* en la instancia y la devuelve. |
73 | 74 |
* |
74 | 75 |
* @throws InitializeException |
76 |
* @throws NotResgisteredStore |
|
75 | 77 |
**/ |
76 |
public DataStoreParameters createDataStoreParameters(String name) throws InitializeException{ |
|
78 |
public DataStoreParameters createDataStoreParameters(String name) |
|
79 |
throws InitializeException, NotResgisteredStore { |
|
77 | 80 |
|
78 | 81 |
RegisterInfo registerInfo = this.getRegisterByName(name); |
79 | 82 |
if (registerInfo == null){ |
80 |
throw new InitializeException("Not registered in manager",name);
|
|
83 |
throw new NotResgisteredStore(name);
|
|
81 | 84 |
} else if (registerInfo.type != RegisterInfo.TYPE_STORE) { |
82 |
throw new InitializeException("Not register as Store", name);
|
|
85 |
throw new NotResgisteredStore(name);
|
|
83 | 86 |
} |
84 | 87 |
|
85 | 88 |
try { |
... | ... | |
97 | 100 |
* @see org.gvsig.fmap.data.DataManager#createDataStoreParameters(com.iver.utiles.XMLEntity) |
98 | 101 |
*/ |
99 | 102 |
public DataStoreParameters createDataStoreParameters(XMLEntity xmlEntity) |
100 |
throws InitializeException { |
|
103 |
throws InitializeException, NotResgisteredStore {
|
|
101 | 104 |
String name; |
102 | 105 |
try { |
103 | 106 |
name = xmlEntity.getStringProperty("dataStoreName"); |
104 | 107 |
} catch (NotExistInXMLEntity e) { |
105 |
throw new InitializeException("dataStoreName property not set", |
|
106 |
"DataManager"); |
|
108 |
throw new InitializeException(e); |
|
107 | 109 |
} |
108 | 110 |
|
109 | 111 |
DataStoreParameters params = this.createDataStoreParameters(name); |
... | ... | |
114 | 116 |
} |
115 | 117 |
|
116 | 118 |
/** |
117 |
* Levanta la instancia del datasource, |
|
118 |
* levanta una instancia del driver que precisa el datasource
|
|
119 |
* y por ultimo invoca al metodo init del datasource.
|
|
119 |
* Levanta la instancia del datasource, levanta una instancia del driver que
|
|
120 |
* precisa el datasource y por ultimo invoca al metodo init del datasource.
|
|
121 |
* |
|
120 | 122 |
* @throws InitializeException |
123 |
* @throws NotResgisteredStore |
|
121 | 124 |
**/ |
122 | 125 |
/* (non-Javadoc) |
123 | 126 |
* @see org.gvsig.fmap.data.DataManager#createDataStore(org.gvsig.fmap.data.impl.DataStoreParameters) |
124 | 127 |
*/ |
125 |
public DataStore createDataStore(DataStoreParameters parameters) throws InitializeException { |
|
128 |
public DataStore createDataStore(DataStoreParameters parameters) |
|
129 |
throws InitializeException, NotResgisteredStore { |
|
126 | 130 |
String name = parameters.getDataStoreName(); |
127 | 131 |
|
128 | 132 |
RegisterInfo registerInfo = this.getRegisterByName(name); |
129 | 133 |
if (registerInfo == null){ |
130 |
throw new InitializeException("Not registered in manager",name);
|
|
134 |
throw new NotResgisteredStore(name);
|
|
131 | 135 |
} |
132 | 136 |
|
133 | 137 |
try { |
... | ... | |
145 | 149 |
* @see org.gvsig.fmap.data.DataManager#createDataStore(com.iver.utiles.XMLEntity) |
146 | 150 |
*/ |
147 | 151 |
public DataStore createDataStore(XMLEntity xmlEntity) |
148 |
throws InitializeException { |
|
149 |
String name; |
|
152 |
throws InitializeException, NotResgisteredStore {
|
|
153 |
String name = null;
|
|
150 | 154 |
try { |
151 | 155 |
name = xmlEntity.getStringProperty("dataStoreName"); |
152 | 156 |
} catch (NotExistInXMLEntity e) { |
153 |
throw new InitializeException("dataStoreName property not set", |
|
154 |
"DataManager"); |
|
157 |
throw new InitializeException(e); |
|
155 | 158 |
} |
156 | 159 |
|
157 | 160 |
RegisterInfo registerInfo = this.getRegisterByName(name); |
158 | 161 |
if (registerInfo == null) { |
159 |
throw new InitializeException("Not registered in manager", name);
|
|
162 |
throw new NotResgisteredStore(name);
|
|
160 | 163 |
} |
161 | 164 |
|
162 | 165 |
try { |
... | ... | |
215 | 218 |
} |
216 | 219 |
|
217 | 220 |
/** |
218 |
* Levanta una instancia de los parametros solicitados |
|
219 |
* inicializa el nombre en la instancia |
|
220 |
* y la devuelve. |
|
221 |
* @throws InitializeException TODO |
|
221 |
* Levanta una instancia de los parametros solicitados inicializa el nombre |
|
222 |
* en la instancia y la devuelve. |
|
223 |
* |
|
224 |
* @throws InitializeException |
|
225 |
* TODO |
|
226 |
* @throws NotResgisteredStore |
|
222 | 227 |
**/ |
223 | 228 |
|
224 |
public DataExplorerParameters createDataExplorerParameters(String name) throws InitializeException { |
|
229 |
public DataExplorerParameters createDataExplorerParameters(String name) |
|
230 |
throws InitializeException, NotResgisteredStore { |
|
225 | 231 |
RegisterInfo registerInfo = this.getRegisterByName(name); |
226 | 232 |
if (registerInfo == null){ |
227 |
throw new InitializeException("Not registered in manager",name);
|
|
233 |
throw new NotResgisteredStore(name);
|
|
228 | 234 |
} else if (registerInfo.type != RegisterInfo.TYPE_EXPLORER) { |
229 |
throw new InitializeException("Not register as Explorer", name);
|
|
235 |
throw new NotResgisteredStore(name);
|
|
230 | 236 |
} |
231 | 237 |
|
232 | 238 |
try { |
... | ... | |
246 | 252 |
*/ |
247 | 253 |
|
248 | 254 |
public DataExplorerParameters createDataExplorerParameters( |
249 |
XMLEntity xmlEntity) throws InitializeException { |
|
255 |
XMLEntity xmlEntity) throws InitializeException, |
|
256 |
NotResgisteredStore { |
|
250 | 257 |
String name = null; |
251 | 258 |
try { |
252 | 259 |
name = xmlEntity.getStringProperty("dataExplorerName"); |
253 | 260 |
} catch (NotExistInXMLEntity e) { |
254 |
throw new InitializeException("dataExplorerName property not set", |
|
255 |
"DataManager"); |
|
261 |
throw new InitializeException(e); |
|
256 | 262 |
} |
257 | 263 |
DataExplorerParameters params = this.createDataExplorerParameters(name); |
258 | 264 |
|
... | ... | |
264 | 270 |
/* (non-Javadoc) |
265 | 271 |
* @see org.gvsig.fmap.data.DataManager#createDataExplorer(org.gvsig.fmap.data.impl.DataExplorerParameters) |
266 | 272 |
*/ |
267 |
public DataExplorer createDataExplorer(DataExplorerParameters parameters) throws InitializeException { |
|
273 |
public DataExplorer createDataExplorer(DataExplorerParameters parameters) |
|
274 |
throws InitializeException, NotResgisteredStore { |
|
268 | 275 |
RegisterInfo registerInfo = this.getRegisterByName(parameters.getDataExplorerName()); |
269 | 276 |
if (registerInfo == null){ |
270 |
throw new InitializeException("Not registered in manager",parameters.getDataExplorerName());
|
|
277 |
throw new NotResgisteredStore(parameters.getDataExplorerName());
|
|
271 | 278 |
} |
272 | 279 |
try { |
273 | 280 |
DataExplorer dataSource= (DataExplorer)registerInfo.clazz.newInstance(); |
... | ... | |
286 | 293 |
|
287 | 294 |
|
288 | 295 |
public DataExplorer createDataExplorer(XMLEntity xmlEntity) |
289 |
throws InitializeException { |
|
296 |
throws InitializeException, NotResgisteredStore {
|
|
290 | 297 |
|
291 | 298 |
String name; |
292 | 299 |
try { |
293 | 300 |
name = xmlEntity.getStringProperty("dataExplorerName"); |
294 | 301 |
} catch (NotExistInXMLEntity e) { |
295 |
throw new InitializeException("dataExplorerName property not set", |
|
296 |
"DataManager"); |
|
302 |
throw new InitializeException(e); |
|
297 | 303 |
} |
298 | 304 |
|
299 | 305 |
RegisterInfo registerInfo = this.getRegisterByName(name); |
300 | 306 |
if (registerInfo == null) { |
301 |
throw new InitializeException("Not registered in manager", |
|
302 |
name); |
|
307 |
throw new NotResgisteredStore(name); |
|
303 | 308 |
} |
304 | 309 |
try { |
305 | 310 |
DataExplorer dataSource = (DataExplorer) registerInfo.clazz |
Also available in: Unified diff