Revision 29932 branches/v2_0_0_prep/extensions/org.gvsig.oracle/src/org/gvsig/fmap/dal/store/oracle/OracleResourceParameters.java
OracleResourceParameters.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): |
... | ... | |
34 | 34 |
import org.gvsig.tools.dynobject.DynField; |
35 | 35 |
import org.gvsig.tools.dynobject.DynObjectManager; |
36 | 36 |
|
37 |
public class OracleResourceParameters extends JDBCResourceParameters |
|
38 |
implements OracleConnectionParameters {
|
|
37 |
public class OracleResourceParameters extends JDBCResourceParameters implements
|
|
38 |
OracleConnectionParameters { |
|
39 | 39 |
|
40 | 40 |
private static DynClass DYNCLASS = null; |
41 | 41 |
|
42 |
public static final String DYNCLASS_NAME = "OracleSpatialResourceParameters";
|
|
42 |
public static final String DYNCLASS_NAME = "OracleResourceParameters"; |
|
43 | 43 |
|
44 | 44 |
public OracleResourceParameters() { |
45 | 45 |
super(); |
46 | 46 |
} |
47 | 47 |
|
48 |
public OracleResourceParameters(String url, String host, Integer port,
|
|
48 |
public OracleResourceParameters(String url, String host, Integer port,
|
|
49 | 49 |
String dbName, String user, String password, |
50 |
String jdbcDriverClassName, Boolean ssl) { |
|
50 |
String jdbcDriverClassName, Boolean ssl, String oraDriverType) {
|
|
51 | 51 |
super(url, host, port, dbName, user, password, jdbcDriverClassName); |
52 | 52 |
if (ssl != null) { |
53 | 53 |
this.setUseSSL(ssl.booleanValue()); |
54 | 54 |
} |
55 |
if (oraDriverType.compareToIgnoreCase("THIN")==0 && oraDriverType.compareToIgnoreCase("OCI")==0) { |
|
56 |
this.setOraDriverType(oraDriverType); |
|
57 |
} |
|
58 |
else{ |
|
59 |
this.setOraDriverType("THIN"); |
|
60 |
} |
|
55 | 61 |
} |
56 | 62 |
|
63 |
/** |
|
64 |
* register dynamic class |
|
65 |
*/ |
|
57 | 66 |
protected static void registerDynClass() { |
58 | 67 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
59 | 68 |
DynClass dynClass = dynman.get(DYNCLASS_NAME); |
... | ... | |
76 | 85 |
field.setType(DataTypes.STRING); |
77 | 86 |
field.setDefaultValue(OracleLibrary.DEFAULT_JDCB_DRIVER_NAME); |
78 | 87 |
|
88 |
field = dynClass.addDynField(DYNFIELDNAME_JDBC_DRIVER_CLASS_NAME); |
|
89 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
|
90 |
field.setDescription("ora Driver"); |
|
91 |
field.setMandatory(true); |
|
92 |
field.setType(DataTypes.STRING); |
|
93 |
field.setDefaultValue(OracleLibrary.DEFAULT_JDCB_DRIVER_NAME); |
|
79 | 94 |
|
80 | 95 |
} |
81 | 96 |
DYNCLASS = dynClass; |
82 | 97 |
} |
83 | 98 |
|
84 |
|
|
85 | 99 |
public String getUrl() { |
86 |
return OracleLibrary.getJdbcUrl(getHost(), |
|
87 |
getPort(), |
|
100 |
return OracleLibrary.getJdbcUrl(getOraDriverType(), getHost(), getPort(), |
|
88 | 101 |
getDBName()); |
89 | 102 |
} |
90 | 103 |
|
... | ... | |
96 | 109 |
return (Boolean) this.getDynValue(DYNFIELDNAME_USESSL); |
97 | 110 |
} |
98 | 111 |
|
112 |
public String getOraDriverType() { |
|
113 |
return (String) this.getDynValue(DYNFIELDNAME_ORADRIVERTYPE); |
|
114 |
} |
|
115 |
|
|
99 | 116 |
public void setUseSSL(Boolean useSSL) { |
100 | 117 |
this.setDynValue(DYNFIELDNAME_USESSL, useSSL); |
101 | 118 |
} |
... | ... | |
103 | 120 |
public void setUseSSL(boolean useSSL) { |
104 | 121 |
this.setDynValue(DYNFIELDNAME_USESSL, new Boolean(useSSL)); |
105 | 122 |
} |
123 |
|
|
124 |
public void setOraDriverType(String oraDriverType) { |
|
125 |
this.setDynValue(DYNFIELDNAME_ORADRIVERTYPE, oraDriverType); |
|
126 |
} |
|
106 | 127 |
|
107 | 128 |
protected String getDynClassName() { |
108 | 129 |
return DYNCLASS_NAME; |
109 | 130 |
} |
131 |
|
|
110 | 132 |
} |
Also available in: Unified diff