root / branches / v2_0_0_prep / libraries / org.gvsig.fmap.dal.db.h2spatial / src / main / java / org / gvsig / fmap / dal / db / h2spatial / impl / H2SpatialStoreParameters.java @ 32684
History | View | Annotate | Download (2.83 KB)
1 |
package org.gvsig.fmap.dal.db.h2spatial.impl; |
---|---|
2 |
|
3 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
4 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
5 |
import org.gvsig.tools.ToolsLocator; |
6 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
7 |
import org.gvsig.tools.dynobject.DynClass; |
8 |
import org.gvsig.tools.dynobject.DynObjectManager; |
9 |
|
10 |
/**
|
11 |
*
|
12 |
* @author Vicente Caballero Navarro
|
13 |
*/
|
14 |
public class H2SpatialStoreParameters extends JDBCStoreParameters implements |
15 |
H2SpatialConnectionParameters { |
16 |
|
17 |
public static final String DYNCLASS_NAME = "H2SpatialStoreParameters"; |
18 |
|
19 |
protected static void registerDynClass() { |
20 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
21 |
DynClass dynClass = dynman.get(DYNCLASS_NAME); |
22 |
if (dynClass == null) { |
23 |
dynClass = dynman.add(DYNCLASS_NAME); |
24 |
|
25 |
dynClass.extend(JDBCStoreParameters.DYNCLASS_NAME); |
26 |
|
27 |
dynClass.extend(H2SpatialResourceParameters.DYNCLASS_NAME); |
28 |
|
29 |
// Register the DynClass in the PersistenceManager
|
30 |
ToolsLocator.getPersistenceManager().registerClass( |
31 |
H2SpatialStoreParameters.class, dynClass); |
32 |
} |
33 |
|
34 |
} |
35 |
|
36 |
private DelegatedDynObject delegatedDynObject;
|
37 |
|
38 |
public H2SpatialStoreParameters() {
|
39 |
super();
|
40 |
initialize(); |
41 |
} |
42 |
|
43 |
/* (non-Javadoc)
|
44 |
* @see org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters#initialize()
|
45 |
*/
|
46 |
protected void initialize() { |
47 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
48 |
DynClass dynClass = dynman.get(DYNCLASS_NAME); |
49 |
this.delegatedDynObject = (DelegatedDynObject) dynman
|
50 |
.createDynObject(dynClass); |
51 |
} |
52 |
|
53 |
/* (non-Javadoc)
|
54 |
* @see org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters#getDelegatedDynObject()
|
55 |
*/
|
56 |
protected DelegatedDynObject getDelegatedDynObject() {
|
57 |
return delegatedDynObject;
|
58 |
} |
59 |
|
60 |
/* (non-Javadoc)
|
61 |
* @see org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters#getDataStoreName()
|
62 |
*/
|
63 |
public String getDataStoreName() { |
64 |
return H2SpatialStoreProvider.NAME;
|
65 |
} |
66 |
|
67 |
/* (non-Javadoc)
|
68 |
* @see org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters#getDescription()
|
69 |
*/
|
70 |
public String getDescription() { |
71 |
return H2SpatialStoreProvider.DESCRIPTION;
|
72 |
} |
73 |
|
74 |
/* (non-Javadoc)
|
75 |
* @see org.gvsig.fmap.dal.db.h2spatial.impl.H2SpatialConnectionParameters#getUseSSL()
|
76 |
*/
|
77 |
public Boolean getUseSSL() { |
78 |
return (Boolean) this.getDynValue(DYNFIELDNAME_USESSL); |
79 |
} |
80 |
|
81 |
public void setUseSSL(Boolean useSSL) { |
82 |
this.setDynValue(DYNFIELDNAME_USESSL, useSSL);
|
83 |
} |
84 |
|
85 |
public void setUseSSL(boolean useSSL) { |
86 |
this.setDynValue(DYNFIELDNAME_USESSL, new Boolean(useSSL)); |
87 |
} |
88 |
|
89 |
|
90 |
/* (non-Javadoc)
|
91 |
* @see org.gvsig.fmap.dal.spi.AbstractDataParameters#validate()
|
92 |
*/
|
93 |
public void validate() throws ValidateDataParametersException { |
94 |
if (getJDBCDriverClassName() == null) { |
95 |
setJDBCDriverClassName(H2SpatialLibrary.DEFAULT_JDCB_DRIVER_NAME); |
96 |
} |
97 |
if (getUrl() == null) { |
98 |
setUrl(H2SpatialLibrary.getJdbcUrl(getDBName())); |
99 |
} |
100 |
|
101 |
super.validate();
|
102 |
} |
103 |
|
104 |
} |