Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.oracle / src / org / gvsig / fmap / dal / store / oracle / OracleResourceParameters.java @ 29865

History | View | Annotate | Download (3.21 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.DataTypes;
31
import org.gvsig.fmap.dal.store.jdbc.JDBCResourceParameters;
32
import org.gvsig.tools.ToolsLocator;
33
import org.gvsig.tools.dynobject.DynClass;
34
import org.gvsig.tools.dynobject.DynField;
35
import org.gvsig.tools.dynobject.DynObjectManager;
36

    
37
public class OracleResourceParameters extends JDBCResourceParameters
38
                implements OracleConnectionParameters {
39

    
40
        private static DynClass DYNCLASS = null;
41

    
42
        public static final String DYNCLASS_NAME = "OracleSpatialResourceParameters";
43

    
44
        public OracleResourceParameters() {
45
                super();
46
        }
47

    
48
    public OracleResourceParameters(String url, String host, Integer port,
49
                        String dbName, String user, String password,
50
                        String jdbcDriverClassName, Boolean ssl) {
51
                super(url, host, port, dbName, user, password, jdbcDriverClassName);
52
                if (ssl != null) {
53
                        this.setUseSSL(ssl.booleanValue());
54
                }
55
        }
56

    
57
        protected static void registerDynClass() {
58
                DynObjectManager dynman = ToolsLocator.getDynObjectManager();
59
                DynClass dynClass = dynman.get(DYNCLASS_NAME);
60
                DynField field;
61
                if (dynClass == null) {
62
                        dynClass = dynman.add(DYNCLASS_NAME);
63

    
64
                        dynClass.extend(JDBCResourceParameters.DYNCLASS_NAME);
65

    
66
                        field = dynClass.addDynField(DYNFIELDNAME_USESSL);
67
                        field.setTheTypeOfAvailableValues(DynField.SINGLE);
68
                        field.setDescription("use SSL connetion");
69
                        field.setType(DataTypes.BOOLEAN);
70
                        field.setDefaultValue(Boolean.FALSE);
71

    
72
                        field = dynClass.addDynField(DYNFIELDNAME_JDBC_DRIVER_CLASS_NAME);
73
                        field.setTheTypeOfAvailableValues(DynField.SINGLE);
74
                        field.setDescription("JDBC Driver class");
75
                        field.setMandatory(true);
76
                        field.setType(DataTypes.STRING);
77
                        field.setDefaultValue(OracleLibrary.DEFAULT_JDCB_DRIVER_NAME);
78

    
79

    
80
                }
81
                DYNCLASS = dynClass;
82
        }
83

    
84

    
85
        public String getUrl() {
86
                return OracleLibrary.getJdbcUrl(getHost(),
87
                                getPort(),
88
                                getDBName());
89
        }
90

    
91
        public String getTypeName() {
92
                return OracleResource.NAME;
93
        }
94

    
95
        public Boolean getUseSSL() {
96
                return (Boolean) this.getDynValue(DYNFIELDNAME_USESSL);
97
        }
98

    
99
        public void setUseSSL(Boolean useSSL) {
100
                this.setDynValue(DYNFIELDNAME_USESSL, useSSL);
101
        }
102

    
103
        public void setUseSSL(boolean useSSL) {
104
                this.setDynValue(DYNFIELDNAME_USESSL, new Boolean(useSSL));
105
        }
106

    
107
        protected String getDynClassName() {
108
                return DYNCLASS_NAME;
109
        }
110
}