svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.db / org.gvsig.fmap.dal.db.lib / src / main / java / org / gvsig / fmap / dal / resource / db / DBResourceParameters.java @ 40596
History | View | Annotate | Download (3.42 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
|
25 |
package org.gvsig.fmap.dal.resource.db; |
26 |
|
27 |
import org.gvsig.fmap.dal.resource.spi.AbstractResourceParameters; |
28 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
29 |
import org.gvsig.fmap.dal.store.db.DBHelper; |
30 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
31 |
|
32 |
/**
|
33 |
* Base Abstract class to Data Base Resources Parameters
|
34 |
*
|
35 |
* @author jmvivo
|
36 |
*
|
37 |
*/
|
38 |
public abstract class DBResourceParameters extends AbstractResourceParameters |
39 |
implements DBParameters {
|
40 |
|
41 |
public static final String PARAMETERS_DEFINITION_NAME = "DBResourceParameters"; |
42 |
private DelegatedDynObject parameters;
|
43 |
|
44 |
public DBResourceParameters(String parametersDefinitionName, String typeName) { |
45 |
this.parameters = (DelegatedDynObject) DBHelper.newParameters(parametersDefinitionName);
|
46 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, typeName);
|
47 |
} |
48 |
|
49 |
protected DelegatedDynObject getDelegatedDynObject() {
|
50 |
return parameters;
|
51 |
} |
52 |
|
53 |
public String getTypeName() { |
54 |
return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
55 |
} |
56 |
|
57 |
public String getHost() { |
58 |
return (String) this.getDynValue(HOST_PARAMTER_NAME); |
59 |
} |
60 |
|
61 |
public Integer getPort() { |
62 |
return (Integer) this.getDynValue(PORT_PARAMTER_NAME); |
63 |
} |
64 |
|
65 |
public String getDBName() { |
66 |
return (String) this.getDynValue(DBNAME_PARAMTER_NAME); |
67 |
} |
68 |
|
69 |
public String getUser() { |
70 |
return (String) this.getDynValue(USER_PARAMTER_NAME); |
71 |
} |
72 |
|
73 |
public String getPassword() { |
74 |
return (String) this.getDynValue(PASSWORD_PARAMTER_NAME); |
75 |
} |
76 |
|
77 |
/**
|
78 |
* Set <code>host</code> parameter value
|
79 |
*
|
80 |
* @param host
|
81 |
*/
|
82 |
public void setHost(String host) { |
83 |
this.setDynValue(HOST_PARAMTER_NAME, host);
|
84 |
} |
85 |
|
86 |
/**
|
87 |
* Set <code>port</code> parameter value
|
88 |
*
|
89 |
* @param port
|
90 |
*/
|
91 |
public void setPort(int port) { |
92 |
this.setDynValue(PORT_PARAMTER_NAME, new Integer(port)); |
93 |
} |
94 |
|
95 |
/**
|
96 |
* Set <code>port</code> parameter value
|
97 |
*
|
98 |
* @param port
|
99 |
*/
|
100 |
public void setPort(Integer port) { |
101 |
this.setDynValue(PORT_PARAMTER_NAME, port);
|
102 |
} |
103 |
|
104 |
/**
|
105 |
* Set <code>data base name</code> parameter value
|
106 |
*
|
107 |
* @param data
|
108 |
* base name
|
109 |
*/
|
110 |
public void setDBName(String dbName) { |
111 |
this.setDynValue(DBNAME_PARAMTER_NAME, dbName);
|
112 |
} |
113 |
|
114 |
/**
|
115 |
* Set <code>user</code> parameter value
|
116 |
*
|
117 |
* @param user
|
118 |
*/
|
119 |
public void setUser(String user) { |
120 |
this.setDynValue(USER_PARAMTER_NAME, user);
|
121 |
} |
122 |
|
123 |
/**
|
124 |
* Set <code>password</code> parameter value
|
125 |
*
|
126 |
* @param password
|
127 |
*/
|
128 |
public void setPassword(String password) { |
129 |
this.setDynValue(PASSWORD_PARAMTER_NAME, password);
|
130 |
} |
131 |
|
132 |
} |