Revision 23540 branches/v2_0_0_prep/libraries/libFMap_dataDB/src/org/gvsig/fmap/data/feature/db/DBStoreParameters.java
DBStoreParameters.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.data.feature.db; |
2 | 2 |
|
3 |
import java.util.HashMap; |
|
4 |
import java.util.Map; |
|
5 |
|
|
3 | 6 |
import org.gvsig.fmap.data.AbstractDataStoreParameters; |
4 | 7 |
import org.gvsig.fmap.data.InitializeException; |
5 | 8 |
import org.gvsig.fmap.geom.primitive.Envelope; |
... | ... | |
9 | 12 |
|
10 | 13 |
public abstract class DBStoreParameters extends AbstractDataStoreParameters |
11 | 14 |
implements DBParameters { |
15 |
|
|
16 |
protected Map internalMap; |
|
17 |
|
|
12 | 18 |
private String user = null; |
13 | 19 |
private String passw = null; |
14 | 20 |
private String schema = null; |
... | ... | |
31 | 37 |
private String SRISD = null; |
32 | 38 |
private String defaultGeometryField = null; |
33 | 39 |
|
40 |
public void clear() { |
|
41 |
user = null; |
|
42 |
passw = null; |
|
43 |
schema = null; |
|
44 |
catalog = null; |
|
45 |
host = null; |
|
46 |
port = null; |
|
47 |
db = null; |
|
34 | 48 |
|
49 |
fields = null; |
|
50 |
fieldsString = null; |
|
35 | 51 |
|
52 |
baseFilter = null; |
|
53 |
baseOrder = null; |
|
54 |
tableName = null; |
|
55 |
fieldsId = null; |
|
56 |
fieldsIdString = null; |
|
57 |
|
|
58 |
sqlSoure = null; |
|
59 |
workingArea = null; |
|
60 |
SRISD = null; |
|
61 |
defaultGeometryField = null; |
|
62 |
|
|
63 |
this.clearInternalMap(); |
|
64 |
} |
|
65 |
|
|
66 |
protected void clearInternalMap() { |
|
67 |
if (this.internalMap != null) { |
|
68 |
this.internalMap.clear(); |
|
69 |
} |
|
70 |
} |
|
71 |
|
|
72 |
|
|
73 |
protected Map getInternalMap() { |
|
74 |
if (this.internalMap == null) { |
|
75 |
this.internalMap = new HashMap(16); |
|
76 |
} |
|
77 |
if (this.internalMap.size() == 0) { |
|
78 |
this.internalMap.put("user", user); |
|
79 |
this.internalMap.put("passw", passw); |
|
80 |
this.internalMap.put("schema", schema); |
|
81 |
this.internalMap.put("catalog", catalog); |
|
82 |
this.internalMap.put("host", host); |
|
83 |
this.internalMap.put("port", port); |
|
84 |
this.internalMap.put("db", db); |
|
85 |
|
|
86 |
this.internalMap.put("fields", fields); |
|
87 |
|
|
88 |
this.internalMap.put("baseFilter", baseFilter); |
|
89 |
this.internalMap.put("baseOrder", baseOrder); |
|
90 |
this.internalMap.put("tableName", tableName); |
|
91 |
this.internalMap.put("fieldsId", fieldsId); |
|
92 |
|
|
93 |
this.internalMap.put("sqlSoure", sqlSoure); |
|
94 |
this.internalMap.put("workingArea", workingArea); |
|
95 |
this.internalMap.put("SRISD", SRISD); |
|
96 |
this.internalMap.put("defaultGeometryField", defaultGeometryField); |
|
97 |
|
|
98 |
} |
|
99 |
return this.internalMap; |
|
100 |
} |
|
101 |
|
|
36 | 102 |
public String getDb() { |
37 | 103 |
return db; |
38 | 104 |
} |
... | ... | |
338 | 404 |
|
339 | 405 |
} |
340 | 406 |
|
407 |
public Object put(Object key, Object value) { |
|
408 |
if (!(key instanceof String)) { |
|
409 |
throw new ClassCastException("key must be String"); |
|
341 | 410 |
|
411 |
} |
|
412 |
String sKey = (String) key; |
|
413 |
Object rValue = null; |
|
414 |
|
|
415 |
|
|
416 |
if (sKey.equalsIgnoreCase("user")) { |
|
417 |
rValue = this.user; |
|
418 |
this.user = (String) value; |
|
419 |
} else if (sKey.equalsIgnoreCase("passw")) { |
|
420 |
rValue = this.passw; |
|
421 |
this.passw = (String) value; |
|
422 |
} else if (sKey.equalsIgnoreCase("schema")) { |
|
423 |
rValue = this.schema; |
|
424 |
this.schema = (String) value; |
|
425 |
} else if (sKey.equalsIgnoreCase("catalog")) { |
|
426 |
rValue = this.catalog; |
|
427 |
this.catalog = (String) value; |
|
428 |
} else if (sKey.equalsIgnoreCase("host")) { |
|
429 |
rValue = this.host; |
|
430 |
this.host = (String) value; |
|
431 |
} else if (sKey.equalsIgnoreCase("port")) { |
|
432 |
rValue = this.port; |
|
433 |
this.port = (String) value; |
|
434 |
} else if (sKey.equalsIgnoreCase("db")) { |
|
435 |
rValue = this.db; |
|
436 |
this.db = (String) value; |
|
437 |
} else if (sKey.equalsIgnoreCase("fields")) { |
|
438 |
rValue = this.fields; |
|
439 |
this.fields = (String[]) value; |
|
440 |
} else if (sKey.equalsIgnoreCase("baseFilter")) { |
|
441 |
rValue = this.baseFilter; |
|
442 |
this.baseFilter = (String) value; |
|
443 |
} else if (sKey.equalsIgnoreCase("baseOrder")) { |
|
444 |
rValue = this.baseOrder; |
|
445 |
this.baseOrder = (String) value; |
|
446 |
} else if (sKey.equalsIgnoreCase("tableName")) { |
|
447 |
rValue = this.tableName; |
|
448 |
this.tableName = (String) value; |
|
449 |
} else if (sKey.equalsIgnoreCase("fieldsId")) { |
|
450 |
rValue = this.fieldsId; |
|
451 |
this.fieldsId = (String[]) value; |
|
452 |
} else if (sKey.equalsIgnoreCase("sqlSoure")) { |
|
453 |
rValue = this.sqlSoure; |
|
454 |
this.sqlSoure = (String) value; |
|
455 |
} else if (sKey.equalsIgnoreCase("workingArea")) { |
|
456 |
rValue = this.workingArea; |
|
457 |
this.workingArea = (Envelope) value; |
|
458 |
} else if (sKey.equalsIgnoreCase("SRISD")) { |
|
459 |
rValue = this.SRISD; |
|
460 |
this.SRISD = (String) value; |
|
461 |
} else if (sKey.equalsIgnoreCase("defaultGeometryField")) { |
|
462 |
rValue = this.defaultGeometryField; |
|
463 |
this.defaultGeometryField = (String) value; |
|
464 |
} else { |
|
465 |
throw new IllegalArgumentException("key:" + sKey); |
|
466 |
} |
|
467 |
this.clearInternalMap(); |
|
468 |
return rValue; |
|
469 |
} |
|
470 |
|
|
342 | 471 |
} |
Also available in: Unified diff