Revision 30231 branches/v2_0_0_prep/extensions/org.gvsig.oracle/src/org/gvsig/fmap/dal/store/oracle/OracleStoreParameters.java
OracleStoreParameters.java | ||
---|---|---|
1 | 1 |
/* gvSIG. Geographic Information System of the Valencian Government |
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 2 |
|
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 |
*/ |
|
2 |
*
|
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
|
4 |
* of the Valencian Government (CIT)
|
|
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 2
|
|
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 |
*/
|
|
22 | 22 |
|
23 | 23 |
/* |
24 | 24 |
* AUTHORS (In addition to CIT): |
... | ... | |
37 | 37 |
|
38 | 38 |
public class OracleStoreParameters extends JDBCStoreParameters implements |
39 | 39 |
OracleConnectionParameters { |
40 |
|
|
41 |
public static final String DYNCLASS_NAME = "OracleStoreParameters"; |
|
42 | 40 |
|
43 |
/** |
|
44 |
* register dynclass |
|
45 |
*/ |
|
46 |
protected static void registerDynClass() { |
|
41 |
public static final String DYNCLASS_NAME = "OracleStoreParameters"; |
|
42 |
|
|
43 |
/** |
|
44 |
* register dynclass |
|
45 |
*/ |
|
46 |
protected static void registerDynClass() { |
|
47 | 47 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
48 | 48 |
DynClass dynClass = dynman.get(DYNCLASS_NAME); |
49 | 49 |
DynField field; |
... | ... | |
58 | 58 |
|
59 | 59 |
} |
60 | 60 |
|
61 |
/**
|
|
62 |
* constructor oracle store parameters
|
|
63 |
*/
|
|
61 |
/**
|
|
62 |
* constructor oracle store parameters
|
|
63 |
*/
|
|
64 | 64 |
public OracleStoreParameters() { |
65 | 65 |
super(); |
66 | 66 |
initialize(); |
67 | 67 |
} |
68 | 68 |
|
69 | 69 |
/** |
70 |
* initilize
|
|
70 |
* initilize |
|
71 | 71 |
*/ |
72 | 72 |
protected void initialize() { |
73 | 73 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
... | ... | |
76 | 76 |
.createDynObject(dynClass); |
77 | 77 |
} |
78 | 78 |
|
79 |
|
|
80 | 79 |
public String getDataStoreName() { |
81 | 80 |
return OracleStoreProvider.NAME; |
82 | 81 |
} |
... | ... | |
88 | 87 |
public Boolean getUseSSL() { |
89 | 88 |
return (Boolean) this.getDynValue(DYNFIELDNAME_USESSL); |
90 | 89 |
} |
91 |
|
|
90 |
|
|
92 | 91 |
public String getOraDriverType() { |
93 | 92 |
return (String) this.getDynValue(DYNFIELDNAME_ORADRIVERTYPE); |
94 | 93 |
} |
... | ... | |
100 | 99 |
public void setUseSSL(boolean useSSL) { |
101 | 100 |
this.setDynValue(DYNFIELDNAME_USESSL, new Boolean(useSSL)); |
102 | 101 |
} |
103 |
|
|
102 |
|
|
104 | 103 |
public void setOraDriverType(String oraDriverType) { |
105 | 104 |
this.setDynValue(DYNFIELDNAME_ORADRIVERTYPE, oraDriverType); |
106 | 105 |
} |
107 | 106 |
|
108 |
|
|
109 | 107 |
public void validate() throws ValidateDataParametersException { |
110 | 108 |
if (getJDBCDriverClassName() == null) { |
111 | 109 |
setJDBCDriverClassName(OracleLibrary.DEFAULT_JDCB_DRIVER_NAME); |
112 | 110 |
} |
113 | 111 |
if (getUrl() == null) { |
114 |
setUrl(OracleLibrary.getJdbcUrl(getOraDriverType(), getHost(), getPort(),
|
|
115 |
getDBName())); |
|
112 |
setUrl(OracleLibrary.getJdbcUrl(getOraDriverType(), getHost(), |
|
113 |
getPort(), getDBName()));
|
|
116 | 114 |
} |
117 | 115 |
|
118 | 116 |
if (getPort() == null) { |
119 | 117 |
setPort(new Integer(1521)); |
120 | 118 |
} |
121 |
|
|
119 |
|
|
122 | 120 |
String oraDriverType = getOraDriverType(); |
123 |
if (oraDriverType.compareToIgnoreCase("THIN")==0 || oraDriverType.compareToIgnoreCase("OCI")==0) { |
|
121 |
if (oraDriverType.compareToIgnoreCase("THIN") == 0 |
|
122 |
|| oraDriverType.compareToIgnoreCase("OCI") == 0) { |
|
124 | 123 |
this.setOraDriverType(oraDriverType); |
125 |
} |
|
126 |
else{ |
|
124 |
} else { |
|
127 | 125 |
this.setOraDriverType("THIN"); |
128 | 126 |
} |
129 |
|
|
130 |
|
|
127 |
|
|
131 | 128 |
super.validate(); |
132 | 129 |
} |
133 | 130 |
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 | 131 |
} |
Also available in: Unified diff