Revision 37896 branches/v2_0_0_prep/extensions/org.gvsig.oracle/src/org/gvsig/fmap/dal/store/oracle/OracleStoreParameters.java

View differences:

OracleStoreParameters.java
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.exception.ValidateDataParametersException;
31
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
32

  
33
public class OracleStoreParameters extends JDBCStoreParameters implements
34
		OracleConnectionParameters {
35

  
36
	// public static final String DYNCLASS_NAME = "OracleStoreParameters";
37
	public static final String PARAMETERS_DEFINITION_NAME = "OracleStoreParameters";
38
	
39
    public static final String ORA_TABLE_SRID_KEY = "ora_table_srid";
40
    public static final String ORA_AREA_OF_INT_KEY = "filterarea";
41

  
42
	public OracleStoreParameters() {
43
		super(PARAMETERS_DEFINITION_NAME, OracleStoreProvider.NAME);
44
	}
45

  
46
	public OracleStoreParameters(String parametersDefinitionName) {
47
		super(parametersDefinitionName, OracleStoreProvider.NAME);
48
	}
49

  
50
	/**
51
	 * initilize
52
	 */
53
	protected void initialize() {
54
	}
55

  
56
	public String getDataStoreName() {
57
		return OracleStoreProvider.NAME;
58
	}
59

  
60
	public String getDescription() {
61
		return OracleStoreProvider.DESCRIPTION;
62
	}
63
	
64

  
65
	public Boolean getUseSSL() {
66
		return (Boolean) this.getDynValue(DYNFIELDNAME_USESSL);
67
	}
68

  
69
	public String getOraDriverType() {
70
		return (String) this.getDynValue(DYNFIELDNAME_ORADRIVERTYPE);
71
	}
72

  
73
	public void setUseSSL(Boolean useSSL) {
74
		this.setDynValue(DYNFIELDNAME_USESSL, useSSL);
75
	}
76

  
77
	public void setUseSSL(boolean useSSL) {
78
		this.setDynValue(DYNFIELDNAME_USESSL, new Boolean(useSSL));
79
	}
80

  
81
	public void setOraDriverType(String oraDriverType) {
82
		this.setDynValue(DYNFIELDNAME_ORADRIVERTYPE, oraDriverType);
83
	}
84

  
85
	public void validate() throws ValidateDataParametersException {
86
		if (getJDBCDriverClassName() == null) {
87
			setJDBCDriverClassName(OracleLibrary.DEFAULT_JDCB_DRIVER_NAME);
88
		}		
89

  
90
		if (getPort() == null) {
91
			setPort(new Integer(1521));
92
		}
93

  
94
		String oraDriverType = getOraDriverType();
95
		if (oraDriverType.compareToIgnoreCase("thin") == 0
96
				|| oraDriverType.compareToIgnoreCase("oci") == 0) {
97
			this.setOraDriverType(oraDriverType);
98
		} else {
99
			this.setOraDriverType("thin");
100
		}
101
		
102
		if (getUrl() == null) {
103
			setUrl(OracleLibrary.getJdbcUrl(getOraDriverType(), getHost(),
104
					getPort(), getDBName()));
105
		}
106

  
107
		super.validate();
108
	}
109

  
110
}
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.exception.ValidateDataParametersException;
31
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
32
import org.gvsig.tools.dynobject.DynObject;
33

  
34
public class OracleStoreParameters extends JDBCStoreParameters implements
35
		OracleConnectionParameters {
36

  
37
	// public static final String DYNCLASS_NAME = "OracleStoreParameters";
38
	public static final String PARAMETERS_DEFINITION_NAME = "OracleStoreParameters";
39
	
40
    public static final String ORA_TABLE_SRID_KEY = "ora_table_srid";
41
    public static final String ORA_AREA_OF_INT_KEY = "filterarea";
42

  
43
	public OracleStoreParameters() {
44
		super(PARAMETERS_DEFINITION_NAME, OracleStoreProvider.NAME);
45
	}
46

  
47
	public OracleStoreParameters(String parametersDefinitionName) {
48
		super(parametersDefinitionName, OracleStoreProvider.NAME);
49
	}
50

  
51
	/**
52
	 * initilize
53
	 */
54
	protected void initialize() {
55
	}
56

  
57
	public String getDataStoreName() {
58
		return OracleStoreProvider.NAME;
59
	}
60

  
61
	public String getDescription() {
62
		return OracleStoreProvider.DESCRIPTION;
63
	}
64
	
65

  
66
	public Boolean getUseSSL() {
67
		return (Boolean) this.getDynValue(DYNFIELDNAME_USESSL);
68
	}
69

  
70
	public String getOraDriverType() {
71
		return (String) this.getDynValue(DYNFIELDNAME_ORADRIVERTYPE);
72
	}
73

  
74
	public void setUseSSL(Boolean useSSL) {
75
		this.setDynValue(DYNFIELDNAME_USESSL, useSSL);
76
	}
77

  
78
	public void setUseSSL(boolean useSSL) {
79
		this.setDynValue(DYNFIELDNAME_USESSL, new Boolean(useSSL));
80
	}
81

  
82
	public void setOraDriverType(String oraDriverType) {
83
		this.setDynValue(DYNFIELDNAME_ORADRIVERTYPE, oraDriverType);
84
	}
85

  
86
	public void validate() throws ValidateDataParametersException {
87
		if (getJDBCDriverClassName() == null) {
88
			setJDBCDriverClassName(OracleLibrary.DEFAULT_JDCB_DRIVER_NAME);
89
		}		
90

  
91
		if (getPort() == null) {
92
			setPort(new Integer(1521));
93
		}
94

  
95
		String oraDriverType = getOraDriverType();
96
		if (oraDriverType.compareToIgnoreCase("thin") == 0
97
				|| oraDriverType.compareToIgnoreCase("oci") == 0) {
98
			this.setOraDriverType(oraDriverType);
99
		} else {
100
			this.setOraDriverType("thin");
101
		}
102
		
103
		if (getUrl() == null) {
104
			setUrl(OracleLibrary.getJdbcUrl(getOraDriverType(), getHost(),
105
					getPort(), getDBName()));
106
		}
107

  
108
		super.validate();
109
	}
110
	
111
	public void delegate(DynObject deleg) {
112
	    super.delegate(deleg);
113
	    
114
	    delegatedObject = deleg;
115
	}
116
	
117
	private Object delegatedObject = null;
118
	   
119
	public boolean equals(Object obj) {
120
	    
121
	    if (super.equals(obj)) {
122
	        return true;
123
	    } else {
124
	        if (delegatedObject != null && delegatedObject == obj) {
125
	            return true;
126
	        } else {
127
	            return false;
128
	        }
129
	    }
130
	}
131

  
132
}

Also available in: Unified diff