Revision 21885
branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/data/DataManager.java | ||
---|---|---|
54 | 54 |
* @throws InitializeException TODO |
55 | 55 |
**/ |
56 | 56 |
public DataStoreParameters createDataStoreParameters(String name) throws InitializeException{ |
57 |
|
|
57 |
|
|
58 | 58 |
RegisterInfo registerInfo = this.getRegisterByName(name); |
59 | 59 |
if (registerInfo == null){ |
60 | 60 |
throw new InitializeException("Not registered in manager",name); |
... | ... | |
151 | 151 |
throw new InitializeException(parameters.getDataExplorerName(),e); |
152 | 152 |
} |
153 | 153 |
} |
154 |
|
|
154 |
|
|
155 | 155 |
private RegisterInfo getRegisterByName(String name){ |
156 | 156 |
Iterator iterator=registers.iterator(); |
157 | 157 |
while (iterator.hasNext()) { |
... | ... | |
164 | 164 |
} |
165 | 165 |
|
166 | 166 |
|
167 |
|
|
167 |
|
|
168 | 168 |
public int registerDataStoreOperation(String storeName, String operationName, DataStoreOperation operation) { |
169 | 169 |
if (operationName == null){ |
170 | 170 |
throw new IllegalArgumentException("operationName cannot be null."); |
... | ... | |
172 | 172 |
if (operation == null){ |
173 | 173 |
throw new IllegalArgumentException("operation cannot be null."); |
174 | 174 |
} |
175 |
|
|
175 |
|
|
176 | 176 |
RegisterInfo register = this.getRegisterByName(storeName); |
177 | 177 |
if (register == null){ |
178 | 178 |
throw new IllegalArgumentException(storeName + " not registered"); |
179 | 179 |
} |
180 | 180 |
int index = registerGeometryOperationName(operationName); |
181 |
|
|
181 |
|
|
182 | 182 |
register.registerOperation(index, operation); |
183 |
|
|
183 |
|
|
184 | 184 |
return index; |
185 | 185 |
} |
186 |
|
|
186 |
|
|
187 | 187 |
private int registerGeometryOperationName(String operationName) { |
188 | 188 |
if (operationName == null) |
189 | 189 |
throw new IllegalArgumentException("operationName cannot be null."); |
... | ... | |
195 | 195 |
} |
196 | 196 |
return index; |
197 | 197 |
} |
198 |
|
|
198 |
|
|
199 | 199 |
private int getOperationIndex(String operationName) { |
200 | 200 |
return dataStoreOperations .indexOf(operationName); |
201 | 201 |
} |
... | ... | |
210 | 210 |
throw new DataStoreOperationNotSupportedException(code,(String)this.dataStoreOperations.get(code),store.getName()); |
211 | 211 |
} |
212 | 212 |
return operation.invoke(store, context); |
213 |
|
|
213 |
|
|
214 | 214 |
} |
215 |
|
|
215 |
|
|
216 | 216 |
public Object invokeDataStoreOperation(DataStore store,String operationName,DataStoreOperationContext context) throws DataStoreOperationException, DataStoreOperationNotSupportedException{ |
217 | 217 |
return this.invokeDataStoreOperation(store, this.getOperationIndex(operationName), context); |
218 | 218 |
} |
... | ... | |
240 | 240 |
} |
241 | 241 |
|
242 | 242 |
public void registerOperation(int index, DataStoreOperation operation){ |
243 |
|
|
243 |
|
|
244 | 244 |
while (index > operations.size()) { |
245 | 245 |
operations.add(null); |
246 | 246 |
} |
247 |
|
|
247 |
|
|
248 | 248 |
if (index == operations.size()) { |
249 | 249 |
operations.add(operation); |
250 |
} else {
|
|
250 |
} else { |
|
251 | 251 |
operations.set(index, operation); |
252 | 252 |
} |
253 | 253 |
} |
254 |
|
|
254 |
|
|
255 | 255 |
public DataStoreOperation getOperation(int index){ |
256 | 256 |
try{ |
257 | 257 |
return (DataStoreOperation) this.operations.get(index); |
... | ... | |
278 | 278 |
return true; |
279 | 279 |
} |
280 | 280 |
|
281 |
public String[] getRegisters() { |
|
282 |
String[] reg=new String[registers.size()]; |
|
283 |
for (int i = 0; i < registers.size(); i++) { |
|
284 |
reg[i]=((RegisterInfo)registers.get(i)).name; |
|
285 |
} |
|
286 |
return reg; |
|
287 |
} |
|
288 |
|
|
281 | 289 |
} |
Also available in: Unified diff