svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_daldb / src / org / gvsig / fmap / dal / serverexplorer / db / DBServerExplorerParameters.java @ 30754
History | View | Annotate | Download (4.4 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 |
* 2008 IVER T.I. S.A. {{Task}}
|
26 |
*/
|
27 |
package org.gvsig.fmap.dal.serverexplorer.db; |
28 |
|
29 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
30 |
import org.gvsig.fmap.dal.resource.db.DBResourceParameters; |
31 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
32 |
import org.gvsig.tools.ToolsLocator; |
33 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
34 |
import org.gvsig.tools.dynobject.DynClass; |
35 |
import org.gvsig.tools.dynobject.DynObjectManager; |
36 |
|
37 |
/**
|
38 |
* Abstract class of {@link DataServerExplorerParameters} for Data Base type
|
39 |
* server
|
40 |
*
|
41 |
* @author jmvivo
|
42 |
*
|
43 |
*/
|
44 |
public abstract class DBServerExplorerParameters extends AbstractDataParameters |
45 |
implements DataServerExplorerParameters, DBConnectionParameter {
|
46 |
|
47 |
public static final String DYNCLASS_NAME = "DBServerExplorerParameters"; |
48 |
|
49 |
|
50 |
/**
|
51 |
* Default constructor
|
52 |
*/
|
53 |
public DBServerExplorerParameters() {
|
54 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
|
55 |
.getDynObjectManager() |
56 |
.createDynObject(this.registerDynClass());
|
57 |
} |
58 |
|
59 |
/**
|
60 |
* Register the DynClass to use
|
61 |
*
|
62 |
* @return
|
63 |
*/
|
64 |
protected DynClass registerDynClass() {
|
65 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
66 |
DynClass dynClass = dynman.get(DYNCLASS_NAME); |
67 |
if (dynClass == null) { |
68 |
dynClass = dynman.add(DYNCLASS_NAME); |
69 |
|
70 |
DynClass dbResourceDynClass = dynman |
71 |
.get(DBResourceParameters.DYNCLASS_NAME); |
72 |
|
73 |
dynClass.extend(dbResourceDynClass); |
74 |
|
75 |
// Register the DynClass in the PersistenceManager
|
76 |
ToolsLocator.getPersistenceManager().registerClass( |
77 |
DBServerExplorerParameters.class, dynClass); |
78 |
|
79 |
} |
80 |
return dynClass;
|
81 |
} |
82 |
|
83 |
|
84 |
/*
|
85 |
* (non-Javadoc)
|
86 |
*
|
87 |
* @see org.gvsig.fmap.dal.resource.db.DBParameters#getHost()
|
88 |
*/
|
89 |
public String getHost() { |
90 |
return (String) this.getDynValue(DYNFIELDNAME_HOST); |
91 |
} |
92 |
|
93 |
/*
|
94 |
* (non-Javadoc)
|
95 |
*
|
96 |
* @see org.gvsig.fmap.dal.resource.db.DBParameters#getPort()
|
97 |
*/
|
98 |
public Integer getPort() { |
99 |
return (Integer) this.getDynValue(DYNFIELDNAME_PORT); |
100 |
} |
101 |
|
102 |
/*
|
103 |
* (non-Javadoc)
|
104 |
*
|
105 |
* @see org.gvsig.fmap.dal.resource.db.DBParameters#getDBName()
|
106 |
*/
|
107 |
public String getDBName() { |
108 |
return (String) this.getDynValue(DYNFIELDNAME_DBNAME); |
109 |
} |
110 |
|
111 |
/*
|
112 |
* (non-Javadoc)
|
113 |
*
|
114 |
* @see org.gvsig.fmap.dal.resource.db.DBParameters#getUser()
|
115 |
*/
|
116 |
public String getUser() { |
117 |
return (String) this.getDynValue(DYNFIELDNAME_USER); |
118 |
} |
119 |
|
120 |
/*
|
121 |
* (non-Javadoc)
|
122 |
*
|
123 |
* @see org.gvsig.fmap.dal.resource.db.DBParameters#getPassword()
|
124 |
*/
|
125 |
public String getPassword() { |
126 |
return (String) this.getDynValue(DYNFIELDNAME_PASSWORD); |
127 |
} |
128 |
|
129 |
/**
|
130 |
* Set <code>host</code> parameter value
|
131 |
*
|
132 |
* @param host
|
133 |
*/
|
134 |
public void setHost(String host) { |
135 |
this.setDynValue(DYNFIELDNAME_HOST, host);
|
136 |
} |
137 |
|
138 |
/**
|
139 |
* Set <code>port/code> parameter value
|
140 |
*
|
141 |
* @param port
|
142 |
*/
|
143 |
public void setPort(int port) { |
144 |
this.setDynValue(DYNFIELDNAME_PORT, new Integer(port)); |
145 |
} |
146 |
|
147 |
/**
|
148 |
* Set <code>port/code> parameter value
|
149 |
*
|
150 |
* @param port
|
151 |
*/
|
152 |
public void setPort(Integer port) { |
153 |
this.setDynValue(DYNFIELDNAME_PORT, port);
|
154 |
} |
155 |
|
156 |
/**
|
157 |
* Set <code>data base name/code> parameter value
|
158 |
*
|
159 |
* @param data
|
160 |
* base name
|
161 |
*/
|
162 |
public void setDBName(String dbName) { |
163 |
this.setDynValue(DYNFIELDNAME_DBNAME, dbName);
|
164 |
} |
165 |
|
166 |
/**
|
167 |
* Set <code>user/code> parameter value
|
168 |
*
|
169 |
* @param user
|
170 |
*/
|
171 |
public void setUser(String user) { |
172 |
this.setDynValue(DYNFIELDNAME_USER, user);
|
173 |
} |
174 |
|
175 |
/**
|
176 |
* Set <code>password/code> parameter value
|
177 |
*
|
178 |
* @param password
|
179 |
*/
|
180 |
public void setPassword(String password) { |
181 |
this.setDynValue(DYNFIELDNAME_PASSWORD, password);
|
182 |
} |
183 |
|
184 |
} |