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 / AbstractDBResourceParameters.java @ 46542
History | View | Annotate | Download (3.53 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 AbstractDBResourceParameters extends AbstractResourceParameters |
39 |
implements DBResourceParameters {
|
40 |
|
41 |
private DelegatedDynObject parameters;
|
42 |
|
43 |
public AbstractDBResourceParameters(String parametersDefinitionName, String typeName) { |
44 |
this.parameters = (DelegatedDynObject) DBHelper.newParameters(parametersDefinitionName);
|
45 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, typeName);
|
46 |
} |
47 |
|
48 |
protected DelegatedDynObject getDelegatedDynObject() {
|
49 |
return parameters;
|
50 |
} |
51 |
|
52 |
@Override
|
53 |
public String getTypeName() { |
54 |
return (String) this.getDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME); |
55 |
} |
56 |
|
57 |
@Override
|
58 |
public String getHost() { |
59 |
return (String) this.getDynValue(HOST_PARAMTER_NAME); |
60 |
} |
61 |
|
62 |
@Override
|
63 |
public Integer getPort() { |
64 |
return (Integer) this.getDynValue(PORT_PARAMTER_NAME); |
65 |
} |
66 |
|
67 |
@Override
|
68 |
public String getDBName() { |
69 |
return (String) this.getDynValue(DBNAME_PARAMTER_NAME); |
70 |
} |
71 |
|
72 |
@Override
|
73 |
public String getUser() { |
74 |
return (String) this.getDynValue(USER_PARAMTER_NAME); |
75 |
} |
76 |
|
77 |
@Override
|
78 |
public String getPassword() { |
79 |
return (String) this.getDynValue(PASSWORD_PARAMTER_NAME); |
80 |
} |
81 |
|
82 |
/**
|
83 |
* Set <code>host</code> parameter value
|
84 |
*
|
85 |
* @param host
|
86 |
*/
|
87 |
@Override
|
88 |
public void setHost(String host) { |
89 |
this.setDynValue(HOST_PARAMTER_NAME, host);
|
90 |
} |
91 |
|
92 |
/**
|
93 |
* Set <code>port</code> parameter value
|
94 |
*
|
95 |
* @param port
|
96 |
*/
|
97 |
@Override
|
98 |
public void setPort(int port) { |
99 |
this.setDynValue(PORT_PARAMTER_NAME, new Integer(port)); |
100 |
} |
101 |
|
102 |
/**
|
103 |
* Set <code>port</code> parameter value
|
104 |
*
|
105 |
* @param port
|
106 |
*/
|
107 |
@Override
|
108 |
public void setPort(Integer port) { |
109 |
this.setDynValue(PORT_PARAMTER_NAME, port);
|
110 |
} |
111 |
|
112 |
/**
|
113 |
* Set <code>data base name</code> parameter value
|
114 |
*
|
115 |
* @param data
|
116 |
* base name
|
117 |
*/
|
118 |
@Override
|
119 |
public void setDBName(String dbName) { |
120 |
this.setDynValue(DBNAME_PARAMTER_NAME, dbName);
|
121 |
} |
122 |
|
123 |
/**
|
124 |
* Set <code>user</code> parameter value
|
125 |
*
|
126 |
* @param user
|
127 |
*/
|
128 |
@Override
|
129 |
public void setUser(String user) { |
130 |
this.setDynValue(USER_PARAMTER_NAME, user);
|
131 |
} |
132 |
|
133 |
/**
|
134 |
* Set <code>password</code> parameter value
|
135 |
*
|
136 |
* @param password
|
137 |
*/
|
138 |
@Override
|
139 |
public void setPassword(String password) { |
140 |
this.setDynValue(PASSWORD_PARAMTER_NAME, password);
|
141 |
} |
142 |
|
143 |
} |