svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.oracle / src / org / gvsig / fmap / dal / store / oracle / OracleResourceParameters.java @ 37896
History | View | Annotate | Download (4.32 KB)
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 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2009 Prodevelop S.L. main development
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.fmap.dal.store.oracle; |
29 |
|
30 |
import org.gvsig.fmap.dal.store.jdbc.JDBCResourceParameters; |
31 |
|
32 |
public class OracleResourceParameters extends JDBCResourceParameters implements |
33 |
OracleConnectionParameters { |
34 |
|
35 |
// private static DynClass DYNCLASS = null;
|
36 |
|
37 |
// public static final String DYNCLASS_NAME = "OracleResourceParameters";
|
38 |
public static final String PARAMETERS_DEFINITION_NAME = "OracleResourceParameters"; |
39 |
|
40 |
|
41 |
public OracleResourceParameters() {
|
42 |
super(PARAMETERS_DEFINITION_NAME,OracleResource.NAME);
|
43 |
} |
44 |
|
45 |
public OracleResourceParameters(String url, String host, Integer port, |
46 |
String dbName, String user, String password, |
47 |
String jdbcDriverClassName, Boolean ssl, String oraDriverType) { |
48 |
|
49 |
super(PARAMETERS_DEFINITION_NAME,OracleResource.NAME,
|
50 |
url, host, port, dbName, user, password, jdbcDriverClassName); |
51 |
|
52 |
if (ssl != null) { |
53 |
this.setUseSSL(ssl.booleanValue());
|
54 |
} |
55 |
if (oraDriverType.compareToIgnoreCase("thin") == 0 |
56 |
&& oraDriverType.compareToIgnoreCase("oci") == 0) { |
57 |
this.setOraDriverType(oraDriverType);
|
58 |
} else {
|
59 |
this.setOraDriverType("thin"); |
60 |
} |
61 |
} |
62 |
|
63 |
/**
|
64 |
* register dynamic class
|
65 |
*/
|
66 |
/*
|
67 |
protected static void registerDynClass() {
|
68 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager();
|
69 |
DynClass dynClass = dynman.get(DYNCLASS_NAME);
|
70 |
DynField field;
|
71 |
if (dynClass == null) {
|
72 |
dynClass = dynman.add(DYNCLASS_NAME);
|
73 |
|
74 |
int n = dynman.getCount();
|
75 |
|
76 |
DynClass pare = dynman.get(PARAMETERS_DEFINITION_NAME, JDBCResource.NAME);
|
77 |
|
78 |
dynClass.extend(PARAMETERS_DEFINITION_NAME, JDBCResource.NAME);
|
79 |
|
80 |
field = dynClass.addDynField(DYNFIELDNAME_USESSL);
|
81 |
field.setTheTypeOfAvailableValues(DynField.ANY);
|
82 |
field.setDescription("use SSL connetion");
|
83 |
field.setType(DataTypes.BOOLEAN);
|
84 |
field.setDefaultDynValue(Boolean.FALSE);
|
85 |
|
86 |
|
87 |
field = dynClass.addDynField(JDBCResourceParameters.JDBC_DRIVER_CLASS_PARAMTER_NAME);
|
88 |
field.setTheTypeOfAvailableValues(DynField.ANY);
|
89 |
field.setDescription("JDBC Driver class");
|
90 |
field.setMandatory(true);
|
91 |
field.setType(DataTypes.STRING);
|
92 |
field.setDefaultDynValue(OracleLibrary.DEFAULT_JDCB_DRIVER_NAME);
|
93 |
|
94 |
field = dynClass.addDynField(DYNFIELDNAME_ORADRIVERTYPE);
|
95 |
field.setTheTypeOfAvailableValues(DynField.ANY);
|
96 |
field.setDescription("Oracle driver type");
|
97 |
field.setType(DataTypes.STRING);
|
98 |
field.setDefaultDynValue("thin");
|
99 |
|
100 |
}
|
101 |
DYNCLASS = dynClass;
|
102 |
}
|
103 |
*/
|
104 |
|
105 |
public String getUrl() { |
106 |
String driType = getOraDriverType();
|
107 |
String host = this.getHost(); |
108 |
Integer port = this.getPort(); |
109 |
String dbName = this.getDBName(); |
110 |
return OracleLibrary.getJdbcUrl(driType, host, port, dbName);
|
111 |
} |
112 |
|
113 |
public String getTypeName() { |
114 |
return OracleResource.NAME;
|
115 |
} |
116 |
|
117 |
public Boolean getUseSSL() { |
118 |
return (Boolean) this.getDynValue(DYNFIELDNAME_USESSL); |
119 |
} |
120 |
|
121 |
public String getOraDriverType() { |
122 |
return (String) this.getDynValue(DYNFIELDNAME_ORADRIVERTYPE); |
123 |
} |
124 |
|
125 |
public void setUseSSL(Boolean useSSL) { |
126 |
this.setDynValue(DYNFIELDNAME_USESSL, useSSL);
|
127 |
} |
128 |
|
129 |
public void setUseSSL(boolean useSSL) { |
130 |
this.setDynValue(DYNFIELDNAME_USESSL, new Boolean(useSSL)); |
131 |
} |
132 |
|
133 |
public void setOraDriverType(String oraDriverType) { |
134 |
this.setDynValue(DYNFIELDNAME_ORADRIVERTYPE, oraDriverType);
|
135 |
} |
136 |
|
137 |
// protected String getDynClassName() {
|
138 |
// return DYNCLASS_NAME;
|
139 |
// }
|
140 |
|
141 |
} |