svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extWFS2 / src / org / gvsig / fmap / dal / store / wfs / WFSStoreParameters.java @ 28430
History | View | Annotate | Download (9.3 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 {Iver T.I.} {Task}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.fmap.dal.store.wfs; |
29 |
|
30 |
import org.gvsig.fmap.dal.DataParameters; |
31 |
import org.gvsig.fmap.dal.DataStoreParameters; |
32 |
import org.gvsig.fmap.dal.DataTypes; |
33 |
import org.gvsig.fmap.dal.exception.InitializeException; |
34 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
35 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
36 |
import org.gvsig.tools.ToolsLocator; |
37 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
38 |
import org.gvsig.tools.dynobject.DynClass; |
39 |
import org.gvsig.tools.dynobject.DynField; |
40 |
import org.gvsig.tools.dynobject.DynObjectManager; |
41 |
|
42 |
/**
|
43 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
44 |
*/
|
45 |
public class WFSStoreParameters extends AbstractDataParameters implements |
46 |
DataStoreParameters{ |
47 |
protected static DynClass DYNCLASS = null; |
48 |
public static final String DYNCLASS_NAME = "WFSStoreParameters"; |
49 |
|
50 |
public static final String DYNFIELDNAME_URL = "url"; |
51 |
public static final String DYNFIELDNAME_VERSION = "version"; |
52 |
public static final String DYNFIELDNAME_TYPENAME = "typeName"; |
53 |
public static final String DYNFIELDNAME_NAMESPACE = "namespace"; |
54 |
public static final String DYNFIELDNAME_NAMESPACEPREFIX = "namespacePrefix"; |
55 |
public static final String DYNFIELDNAME_FIELDS = "fields"; |
56 |
public static final String DYNFIELDNAME_FILTERENCODING = "filterEncoding"; |
57 |
public static final String DYNFIELDNAME_MAXFEATURES = "maxFeatures"; |
58 |
public static final String DYNFIELDNAME_TIMEOUT = "timeOut"; |
59 |
public static final String DYNFIELDNAME_USER = "user"; |
60 |
public static final String DYNFIELDNAME_PASSWORD = "password"; |
61 |
|
62 |
public WFSStoreParameters() {
|
63 |
super();
|
64 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
|
65 |
.getDynObjectManager().createDynObject( |
66 |
WFSStoreParameters.DYNCLASS); |
67 |
} |
68 |
|
69 |
public WFSStoreParameters(DataParameters dataParameters) throws InitializeException, ProviderNotRegisteredException{ |
70 |
this();
|
71 |
setUrl((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_URL));
|
72 |
String namespace = null; |
73 |
String namespacePrefix = null; |
74 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_NAMESPACE)){
|
75 |
namespace = (String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_NAMESPACE);
|
76 |
} |
77 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_NAMESPACEPREFIX)){
|
78 |
namespacePrefix = (String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_NAMESPACEPREFIX);
|
79 |
} |
80 |
setFeatureType(namespacePrefix, namespace, |
81 |
(String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_TYPENAME));
|
82 |
// setVersion((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_VERSION));
|
83 |
// setUser((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_USER));
|
84 |
// setPassword((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_PASSWORD));
|
85 |
} |
86 |
|
87 |
protected static void registerDynClass() { |
88 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
89 |
DynClass dynClass; |
90 |
DynField field; |
91 |
if (DYNCLASS == null) { |
92 |
dynClass = dynman.add(DYNCLASS_NAME); |
93 |
field = dynClass.addDynField(DYNFIELDNAME_URL); |
94 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
95 |
field.setDescription("URL of the WFS server");
|
96 |
field.setType(DataTypes.STRING); |
97 |
field.setMandatory(true);
|
98 |
|
99 |
field = dynClass.addDynField(DYNFIELDNAME_VERSION); |
100 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
101 |
field.setDescription("Version of the WFS server");
|
102 |
field.setType(DataTypes.STRING); |
103 |
field.setMandatory(false);
|
104 |
|
105 |
field = dynClass.addDynField(DYNFIELDNAME_TYPENAME); |
106 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
107 |
field.setDescription("Feature type to retrieve");
|
108 |
field.setType(DataTypes.STRING); |
109 |
field.setMandatory(true);
|
110 |
|
111 |
field = dynClass.addDynField(DYNFIELDNAME_NAMESPACE); |
112 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
113 |
field.setDescription("Namespace of the feature type to retrieve");
|
114 |
field.setType(DataTypes.STRING); |
115 |
field.setMandatory(false);
|
116 |
|
117 |
field = dynClass.addDynField(DYNFIELDNAME_NAMESPACEPREFIX); |
118 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
119 |
field.setDescription("Prefix of the namespace of the feature type to retrieve");
|
120 |
field.setType(DataTypes.STRING); |
121 |
field.setMandatory(false);
|
122 |
|
123 |
field = dynClass.addDynField(DYNFIELDNAME_FIELDS); |
124 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
125 |
field.setDescription("Fields to retrieve separated by ','");
|
126 |
field.setType(DataTypes.STRING); |
127 |
field.setMandatory(false);
|
128 |
|
129 |
field = dynClass.addDynField(DYNFIELDNAME_FILTERENCODING); |
130 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
131 |
field.setDescription("Filter encoding request");
|
132 |
field.setType(DataTypes.STRING); |
133 |
field.setMandatory(false);
|
134 |
|
135 |
field = dynClass.addDynField(DYNFIELDNAME_MAXFEATURES); |
136 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
137 |
field.setDescription("Number of features to retrieve");
|
138 |
field.setType(DataTypes.INT); |
139 |
field.setMandatory(false);
|
140 |
|
141 |
field = dynClass.addDynField(DYNFIELDNAME_TIMEOUT); |
142 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
143 |
field.setDescription("Timeout");
|
144 |
field.setType(DataTypes.INT); |
145 |
field.setMandatory(false);
|
146 |
|
147 |
field = dynClass.addDynField(DYNFIELDNAME_USER); |
148 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
149 |
field.setDescription("User name (not used at this moment)");
|
150 |
field.setType(DataTypes.STRING); |
151 |
field.setMandatory(false);
|
152 |
|
153 |
field = dynClass.addDynField(DYNFIELDNAME_PASSWORD); |
154 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
155 |
field.setDescription("Passwrod (not used at this moment");
|
156 |
field.setType(DataTypes.STRING); |
157 |
field.setMandatory(false);
|
158 |
|
159 |
DYNCLASS = dynClass; |
160 |
} |
161 |
} |
162 |
|
163 |
/* (non-Javadoc)
|
164 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName()
|
165 |
*/
|
166 |
public String getDataStoreName() { |
167 |
return WFSStoreProvider.NAME;
|
168 |
} |
169 |
|
170 |
/* (non-Javadoc)
|
171 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDescription()
|
172 |
*/
|
173 |
public String getDescription() { |
174 |
return WFSStoreProvider.DESCRIPTION;
|
175 |
} |
176 |
|
177 |
/* (non-Javadoc)
|
178 |
* @see org.gvsig.fmap.dal.DataStoreParameters#isValid()
|
179 |
*/
|
180 |
public boolean isValid() { |
181 |
// TODO Auto-generated method stub
|
182 |
return false; |
183 |
} |
184 |
|
185 |
public String getUrl(){ |
186 |
return (String) this.getDynValue(DYNFIELDNAME_URL); |
187 |
} |
188 |
|
189 |
public void setUrl(String url){ |
190 |
this.setDynValue(DYNFIELDNAME_URL, url);
|
191 |
} |
192 |
|
193 |
public String getVersion(){ |
194 |
return (String) this.getDynValue(DYNFIELDNAME_VERSION); |
195 |
} |
196 |
|
197 |
public void setVersion(String version){ |
198 |
this.setDynValue(DYNFIELDNAME_VERSION, version);
|
199 |
} |
200 |
|
201 |
public String getFeatureType(){ |
202 |
return (String) this.getDynValue(DYNFIELDNAME_TYPENAME); |
203 |
} |
204 |
|
205 |
public void setFeatureType(String featureType){ |
206 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType);
|
207 |
} |
208 |
|
209 |
public void setFeatureType(String namespace, String featureType){ |
210 |
this.setDynValue(DYNFIELDNAME_NAMESPACE, namespace);
|
211 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType);
|
212 |
} |
213 |
|
214 |
public void setFeatureType(String prefix, String namespace, String featureType){ |
215 |
this.setDynValue(DYNFIELDNAME_NAMESPACEPREFIX, prefix);
|
216 |
this.setDynValue(DYNFIELDNAME_NAMESPACE, namespace);
|
217 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType);
|
218 |
} |
219 |
|
220 |
public String getFeatureNamespace(){ |
221 |
return (String) this.getDynValue(DYNFIELDNAME_NAMESPACE); |
222 |
} |
223 |
|
224 |
public String getFeaturePrefix(){ |
225 |
return (String) this.getDynValue(DYNFIELDNAME_NAMESPACEPREFIX); |
226 |
} |
227 |
|
228 |
public String getFields(){ |
229 |
return (String) this.getDynValue(DYNFIELDNAME_FIELDS); |
230 |
} |
231 |
|
232 |
public void setFields(String fields){ |
233 |
this.setDynValue(DYNFIELDNAME_FIELDS, fields);
|
234 |
} |
235 |
|
236 |
public String getFilterEncoding(){ |
237 |
return (String) this.getDynValue(DYNFIELDNAME_FILTERENCODING); |
238 |
} |
239 |
|
240 |
public void setFilterEncoding(String filter){ |
241 |
this.setDynValue(DYNFIELDNAME_FILTERENCODING, filter);
|
242 |
} |
243 |
|
244 |
public Integer getMaxFeatures(){ |
245 |
return (Integer) this.getDynValue(DYNFIELDNAME_MAXFEATURES); |
246 |
} |
247 |
|
248 |
public void setMaxFeatures(Integer maxFeatures){ |
249 |
this.setDynValue(DYNFIELDNAME_MAXFEATURES, maxFeatures);
|
250 |
} |
251 |
|
252 |
public Integer getTimeOut(){ |
253 |
return (Integer) this.getDynValue(DYNFIELDNAME_TIMEOUT); |
254 |
} |
255 |
|
256 |
public void setTimeOut(Integer timeOut){ |
257 |
this.setDynValue(DYNFIELDNAME_TIMEOUT, timeOut);
|
258 |
} |
259 |
|
260 |
public String getUser(){ |
261 |
return (String) this.getDynValue(DYNFIELDNAME_USER); |
262 |
} |
263 |
|
264 |
public void setUser(String user){ |
265 |
this.setDynValue(DYNFIELDNAME_USER, user);
|
266 |
} |
267 |
|
268 |
public String getPassword(){ |
269 |
return (String) this.getDynValue(DYNFIELDNAME_PASSWORD); |
270 |
} |
271 |
|
272 |
public void setPassword(String password){ |
273 |
this.setDynValue(DYNFIELDNAME_PASSWORD, password);
|
274 |
} |
275 |
} |
276 |
|