Revision 416
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/test/java/org/gvsig/mobile/extension/wfs/dal/store/WFSMobileTest.java | ||
---|---|---|
50 | 50 |
import org.gvsig.fmap.dal.impl.DefaultDataManager; |
51 | 51 |
import org.gvsig.fmap.dal.resource.impl.DefaultResourceManager; |
52 | 52 |
import org.gvsig.fmap.dal.store.wfs.WFSLibrary; |
53 |
import org.gvsig.fmap.dal.store.wfs.WFSStoreParameters; |
|
53 |
import org.gvsig.fmap.dal.store.wfs.WFSOpenStoreParameters;
|
|
54 | 54 |
import org.gvsig.fmap.dal.store.wfs.WFSStoreProvider; |
55 | 55 |
import org.gvsig.fmap.geom.Geometry; |
56 | 56 |
import org.gvsig.fmap.geom.primitive.Envelope; |
... | ... | |
157 | 157 |
*/ |
158 | 158 |
public DataStoreParameters getDefaultDataStoreParameters() |
159 | 159 |
throws DataException { |
160 |
WFSStoreParameters parameters = null; |
|
160 |
WFSOpenStoreParameters parameters = null;
|
|
161 | 161 |
|
162 |
parameters = (WFSStoreParameters) dataManager |
|
162 |
parameters = (WFSOpenStoreParameters) dataManager
|
|
163 | 163 |
.createStoreParameters(WFSStoreProvider.NAME); |
164 | 164 |
|
165 | 165 |
parameters.setUrl(url); |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/test/java/org/gvsig/fmap/dal/store/wfs/WFSTest.java | ||
---|---|---|
78 | 78 |
*/ |
79 | 79 |
public DataStoreParameters getDefaultDataStoreParameters() |
80 | 80 |
throws DataException { |
81 |
WFSStoreParameters parameters = null; |
|
81 |
WFSOpenStoreParameters parameters = null;
|
|
82 | 82 |
|
83 |
parameters = (WFSStoreParameters) dataManager |
|
83 |
parameters = (WFSOpenStoreParameters) dataManager
|
|
84 | 84 |
.createStoreParameters(WFSStoreProvider.NAME); |
85 | 85 |
|
86 | 86 |
parameters.setUrl(url); |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/wfs/gui/panels/WFSParamsPanel.java | ||
---|---|---|
17 | 17 |
import org.gvsig.fmap.dal.exception.InitializeException; |
18 | 18 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
19 | 19 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer; |
20 |
import org.gvsig.fmap.dal.store.wfs.WFSStoreParameters; |
|
20 |
import org.gvsig.fmap.dal.store.wfs.WFSOpenStoreParameters;
|
|
21 | 21 |
import org.gvsig.fmap.dal.store.wfs.WFSStoreProvider; |
22 | 22 |
import org.gvsig.fmap.geom.Geometry; |
23 | 23 |
import org.gvsig.fmap.geom.primitive.Envelope; |
... | ... | |
615 | 615 |
return dataManager.createCacheParameters(nameCacheProvider); |
616 | 616 |
} |
617 | 617 |
|
618 |
public WFSStoreParameters getDataStoreParameters() throws InitializeException, ProviderNotRegisteredException{ |
|
618 |
public WFSOpenStoreParameters getDataStoreParameters() throws InitializeException, ProviderNotRegisteredException{
|
|
619 | 619 |
DataManager dataManager = DALLocator.getDataManager(); |
620 |
WFSStoreParameters parameters = (WFSStoreParameters) dataManager
|
|
620 |
WFSOpenStoreParameters parameters = (WFSOpenStoreParameters) dataManager
|
|
621 | 621 |
.createStoreParameters(WFSStoreProvider.NAME); |
622 | 622 |
refreshDataStoreParameters(parameters); |
623 | 623 |
return parameters; |
624 | 624 |
} |
625 | 625 |
|
626 |
private void refreshDataStoreParameters(WFSStoreParameters parameters){ |
|
626 |
private void refreshDataStoreParameters(WFSOpenStoreParameters parameters){
|
|
627 | 627 |
WFSSelectedFeature selectedFeature = getSelectedFeature(); |
628 | 628 |
parameters.setUrl(serverExplorer.getUrl()); |
629 | 629 |
parameters.setFeatureType(selectedFeature.getNameSpace(), |
... | ... | |
652 | 652 |
if (ns != null) { |
653 | 653 |
String ns_pre = ns.getPrefix(); |
654 | 654 |
parameters.setDynValue( |
655 |
WFSStoreParameters.DYNFIELDNAME_NAMESPACEPREFIX, ns_pre); |
|
655 |
WFSOpenStoreParameters.DYNFIELDNAME_NAMESPACEPREFIX, ns_pre);
|
|
656 | 656 |
} |
657 | 657 |
// serverExplorer.getServerExplorerProviderServices(); |
658 | 658 |
|
... | ... | |
669 | 669 |
* Sets the forms from a |
670 | 670 |
*/ |
671 | 671 |
public void setDataStore(DataStore dataStore){ |
672 |
WFSStoreParameters storeParameters = |
|
673 |
(WFSStoreParameters)dataStore.getParameters(); |
|
672 |
WFSOpenStoreParameters storeParameters =
|
|
673 |
(WFSOpenStoreParameters)dataStore.getParameters();
|
|
674 | 674 |
WFSSelectedFeature selectedFeature = |
675 | 675 |
selectedFeatureManager.getFeatureInfo(storeParameters.getFeatureNamespace(), |
676 | 676 |
storeParameters.getFeatureType()); |
... | ... | |
848 | 848 |
|
849 | 849 |
DataManager dataManager = DALLocator.getDataManager(); |
850 | 850 |
//Create the datastore parameters and fill them |
851 |
WFSStoreParameters parameters; |
|
851 |
WFSOpenStoreParameters parameters;
|
|
852 | 852 |
try { |
853 |
parameters = (WFSStoreParameters) dataManager |
|
853 |
parameters = (WFSOpenStoreParameters) dataManager
|
|
854 | 854 |
.createStoreParameters(WFSStoreProvider.NAME); |
855 | 855 |
parameters.setUrl(serverExplorer.getUrl()); |
856 | 856 |
parameters.setVersion(serverExplorer.getVersion()); |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/wfs/gui/wizards/WFSWizard.java | ||
---|---|---|
60 | 60 |
import org.gvsig.fmap.dal.DataStoreParameters; |
61 | 61 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer; |
62 | 62 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorerParameters; |
63 |
import org.gvsig.fmap.dal.store.wfs.WFSStoreParameters; |
|
63 |
import org.gvsig.fmap.dal.store.wfs.WFSOpenStoreParameters;
|
|
64 | 64 |
import org.gvsig.gui.beans.Messages; |
65 | 65 |
import org.gvsig.gui.beans.panelGroup.PanelGroupManager; |
66 | 66 |
import org.gvsig.gui.beans.swing.JButton; |
... | ... | |
191 | 191 |
* Fills up the initial WCSWizard controls. |
192 | 192 |
*/ |
193 | 193 |
private void rellenarControles() throws Exception { |
194 |
String url = "(unknow)"; |
|
194 | 195 |
try { |
195 |
String url = cmbHost.getModel().getSelectedItem().toString();
|
|
196 |
url = cmbHost.getModel().getSelectedItem().toString(); |
|
196 | 197 |
|
197 | 198 |
DataManager dataManager = DALLocator.getDataManager(); |
198 | 199 |
|
... | ... | |
241 | 242 |
cacheFeatCombo.addItem(featureCacheProvider); |
242 | 243 |
} |
243 | 244 |
|
244 |
if (!explorer.getServerType().toLowerCase() |
|
245 |
.startsWith("wfs 1.0")) { |
|
245 |
if (!explorer.getServerType().toLowerCase().startsWith("wfs 1.0")) { |
|
246 | 246 |
cacheFeatCombo.setEnabled(true); |
247 | 247 |
} else { |
248 | 248 |
cacheFeatCombo.setEnabled(false); |
... | ... | |
250 | 250 |
wfsParamsPanel.setServerExplorer(explorer); |
251 | 251 |
connected = true; |
252 | 252 |
} catch (Exception e) { |
253 |
logger.warn("Can't connect to '"+url+"'.",e); |
|
253 | 254 |
throw e; |
254 | 255 |
} |
255 | 256 |
} |
... | ... | |
754 | 755 |
public void execute() { |
755 | 756 |
wfsParamsPanel.setSelectedCache(cacheFeatCombo.getSelectedItem().toString()); |
756 | 757 |
String layerName = wfsParamsPanel.getFeaturesPanel().getLayerName(); |
757 |
WFSStoreParameters parameters; |
|
758 |
WFSOpenStoreParameters parameters;
|
|
758 | 759 |
try { |
759 | 760 |
// |
760 | 761 |
// TODO: La proyeccion deberia ir en los parametros ?? !!!!!!!!! |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSStoreParameters.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 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.dal.store.wfs; |
|
29 |
|
|
30 |
import org.apache.commons.lang3.BooleanUtils; |
|
31 |
import org.cresques.cts.IProjection; |
|
32 |
import org.gvsig.fmap.dal.DataParameters; |
|
33 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
34 |
import org.gvsig.fmap.dal.DataTypes; |
|
35 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
36 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
37 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
|
38 |
import org.gvsig.fmap.geom.Geometry; |
|
39 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
40 |
import org.gvsig.tools.ToolsLocator; |
|
41 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
42 |
import org.gvsig.tools.dynobject.DynClass; |
|
43 |
import org.gvsig.tools.dynobject.DynStruct; |
|
44 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
45 |
|
|
46 |
/** |
|
47 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
48 |
*/ |
|
49 |
public class WFSStoreParameters extends AbstractDataParameters implements |
|
50 |
DataStoreParameters{ |
|
51 |
protected static DynClass DYNCLASS = null; |
|
52 |
public static final String DYNCLASS_NAME = "WFSStoreParameters"; |
|
53 |
|
|
54 |
public static final String DYNFIELDNAME_URL = "url"; |
|
55 |
public static final String DYNFIELDNAME_VERSION = "version"; |
|
56 |
public static final String DYNFIELDNAME_TYPENAME = "typeName"; |
|
57 |
public static final String DYNFIELDNAME_NAMESPACE = "namespace"; |
|
58 |
public static final String DYNFIELDNAME_NAMESPACEPREFIX = "namespacePrefix"; |
|
59 |
public static final String DYNFIELDNAME_FIELDS = "fields"; |
|
60 |
public static final String DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE = "filterEncodingByAttribute"; |
|
61 |
public static final String DYNFIELDNAME_MAXFEATURES = "maxFeatures"; |
|
62 |
public static final String DYNFIELDNAME_TIMEOUT = "timeOut"; |
|
63 |
public static final String DYNFIELDNAME_USER = "user"; |
|
64 |
public static final String DYNFIELDNAME_PASSWORD = "password"; |
|
65 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY = "filterByAreaGeometry"; |
|
66 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE = "filterByAreaEnvelope"; |
|
67 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_OPERATION = "filterByAreaOperation"; |
|
68 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE = "filterByAreaAttribute"; |
|
69 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_CRS = "filterByAreaCrs"; |
|
70 |
public static final String DYNFIELDNAME_CRS = "Crs"; |
|
71 |
|
|
72 |
private DelegatedDynObject delegatedDynObject; |
|
73 |
|
|
74 |
public WFSStoreParameters() { |
|
75 |
super(); |
|
76 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator |
|
77 |
.getDynObjectManager().createDynObject( |
|
78 |
WFSStoreParameters.DYNCLASS); |
|
79 |
} |
|
80 |
|
|
81 |
@Override |
|
82 |
protected DelegatedDynObject getDelegatedDynObject() { |
|
83 |
return delegatedDynObject; |
|
84 |
} |
|
85 |
|
|
86 |
public WFSStoreParameters(DataParameters dataParameters) throws InitializeException, ProviderNotRegisteredException{ |
|
87 |
this(); |
|
88 |
setUrl((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_URL)); |
|
89 |
String namespace = null; |
|
90 |
String namespacePrefix = null; |
|
91 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_NAMESPACE)){ |
|
92 |
namespace = (String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_NAMESPACE); |
|
93 |
} |
|
94 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_NAMESPACEPREFIX)){ |
|
95 |
namespacePrefix = (String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_NAMESPACEPREFIX); |
|
96 |
} |
|
97 |
setFeatureType(namespacePrefix, namespace, |
|
98 |
(String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_TYPENAME)); |
|
99 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_MAXFEATURES)){ |
|
100 |
setMaxFeatures((Integer)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_MAXFEATURES)); |
|
101 |
}else{ |
|
102 |
setMaxFeatures(1000); |
|
103 |
} |
|
104 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_TIMEOUT)){ |
|
105 |
setTimeOut((Integer)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_TIMEOUT)); |
|
106 |
}else{ |
|
107 |
setTimeOut(10000); |
|
108 |
} |
|
109 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY)){ |
|
110 |
setFilterByAreaGeometry((Geometry)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY)); |
|
111 |
setFilterByAreaAttribute((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE)); |
|
112 |
setFilterByAreaCrs((IProjection)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_CRS)); |
|
113 |
setFilterByAreaOperation((Integer)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_OPERATION)); |
|
114 |
} |
|
115 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE)){ |
|
116 |
setFilterByAreaEnvelope((Envelope)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE)); |
|
117 |
setFilterByAreaAttribute((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE)); |
|
118 |
setFilterByAreaCrs((IProjection)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_CRS)); |
|
119 |
setFilterByAreaOperation((Integer)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_BY_AREA_OPERATION)); |
|
120 |
} |
|
121 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_VERSION)){ |
|
122 |
setVersion((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_VERSION)); |
|
123 |
} |
|
124 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE)){ |
|
125 |
setFilterEncodingByAttribute((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE)); |
|
126 |
} |
|
127 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_USER)){ |
|
128 |
setUser((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_USER)); |
|
129 |
} |
|
130 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_PASSWORD)){ |
|
131 |
setPassword((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_PASSWORD)); |
|
132 |
} |
|
133 |
if (dataParameters.hasDynValue(WFSStoreParameters.DYNFIELDNAME_CRS)){ |
|
134 |
setCrs((String)dataParameters.getDynValue(WFSStoreParameters.DYNFIELDNAME_CRS)); |
|
135 |
} |
|
136 |
} |
|
137 |
|
|
138 |
protected static void registerDynClass() { |
|
139 |
if (DYNCLASS == null) { |
|
140 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
141 |
DynStruct definition = manager.addDefinition( |
|
142 |
WFSStoreParameters.class, |
|
143 |
DYNCLASS_NAME, |
|
144 |
"WFSStoreParameters Persistence definition", |
|
145 |
null, |
|
146 |
null |
|
147 |
); |
|
148 |
definition.addDynFieldString(DYNFIELDNAME_URL) |
|
149 |
.setDescription("URL of the WFS server") |
|
150 |
.setMandatory(true); |
|
151 |
|
|
152 |
definition.addDynFieldString(DYNFIELDNAME_VERSION) |
|
153 |
.setDescription("Version of the WFS server") |
|
154 |
.setMandatory(false); |
|
155 |
|
|
156 |
definition.addDynFieldString(DYNFIELDNAME_TYPENAME) |
|
157 |
.setDescription("Feature type to retrieve") |
|
158 |
.setMandatory(true); |
|
159 |
|
|
160 |
definition.addDynFieldString(DYNFIELDNAME_NAMESPACE) |
|
161 |
.setDescription("Namespace of the feature type to retrieve") |
|
162 |
.setMandatory(false); |
|
163 |
|
|
164 |
definition.addDynFieldString(DYNFIELDNAME_NAMESPACEPREFIX) |
|
165 |
.setDescription("Prefix of the namespace of the feature type to retrieve") |
|
166 |
.setMandatory(false); |
|
167 |
|
|
168 |
definition.addDynFieldString(DYNFIELDNAME_FIELDS) |
|
169 |
.setDescription("Fields to retrieve separated by ','") |
|
170 |
.setMandatory(false); |
|
171 |
|
|
172 |
definition.addDynFieldString(DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE) |
|
173 |
.setDescription("Filter encoding request") |
|
174 |
.setMandatory(false); |
|
175 |
|
|
176 |
definition.addDynFieldInt(DYNFIELDNAME_MAXFEATURES) |
|
177 |
.setDescription("Number of features to retrieve") |
|
178 |
.setMandatory(false); |
|
179 |
|
|
180 |
definition.addDynFieldInt(DYNFIELDNAME_TIMEOUT) |
|
181 |
.setDescription("Timeout") |
|
182 |
.setMandatory(false); |
|
183 |
|
|
184 |
definition.addDynFieldString(DYNFIELDNAME_USER) |
|
185 |
.setDescription("User name (not used at this moment)") |
|
186 |
.setMandatory(false); |
|
187 |
|
|
188 |
definition.addDynFieldString(DYNFIELDNAME_PASSWORD) |
|
189 |
.setDescription("Password (not used at this moment") |
|
190 |
.setMandatory(false); |
|
191 |
|
|
192 |
definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY) |
|
193 |
.setType(DataTypes.GEOMETRY) |
|
194 |
.setDescription("Geometry used to do the filter") |
|
195 |
.setMandatory(false); |
|
196 |
|
|
197 |
definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE) |
|
198 |
.setType(DataTypes.ENVELOPE) |
|
199 |
.setDescription("Envelope used to do the filter") |
|
200 |
.setMandatory(false); |
|
201 |
|
|
202 |
definition.addDynFieldInt(DYNFIELDNAME_FILTER_BY_AREA_OPERATION) |
|
203 |
.setDescription("Geometry operation used to do the filter") |
|
204 |
.setMandatory(false); |
|
205 |
|
|
206 |
definition.addDynFieldString(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE) |
|
207 |
.setDescription("Attribute that contains the geometry") |
|
208 |
.setMandatory(false); |
|
209 |
|
|
210 |
definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_CRS) |
|
211 |
.setType(DataTypes.CRS) |
|
212 |
.setDescription("CRS to do the spatial filter of the query") |
|
213 |
.setMandatory(false); |
|
214 |
|
|
215 |
definition.addDynFieldString(DYNFIELDNAME_CRS) |
|
216 |
.setDescription("CRS") |
|
217 |
.setMandatory(false); |
|
218 |
|
|
219 |
definition.addDynFieldBoolean("useAxisOrderYX") |
|
220 |
.setDefaultFieldValue("false") |
|
221 |
.setMandatory(false); |
|
222 |
|
|
223 |
definition.addDynFieldBoolean("ignoreCache") |
|
224 |
.setDefaultFieldValue("false") |
|
225 |
.setMandatory(false); |
|
226 |
|
|
227 |
DYNCLASS = (DynClass) definition; |
|
228 |
} |
|
229 |
} |
|
230 |
|
|
231 |
/* (non-Javadoc) |
|
232 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName() |
|
233 |
*/ |
|
234 |
public String getDataStoreName() { |
|
235 |
return WFSStoreProvider.NAME; |
|
236 |
} |
|
237 |
|
|
238 |
/* (non-Javadoc) |
|
239 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDescription() |
|
240 |
*/ |
|
241 |
public String getDescription() { |
|
242 |
return WFSStoreProvider.DESCRIPTION; |
|
243 |
} |
|
244 |
|
|
245 |
/* (non-Javadoc) |
|
246 |
* @see org.gvsig.fmap.dal.DataStoreParameters#isValid() |
|
247 |
*/ |
|
248 |
public boolean isValid() { |
|
249 |
// TODO Auto-generated method stub |
|
250 |
return false; |
|
251 |
} |
|
252 |
|
|
253 |
public String getUrl(){ |
|
254 |
return (String) this.getDynValue(DYNFIELDNAME_URL); |
|
255 |
} |
|
256 |
|
|
257 |
public void setUrl(String url){ |
|
258 |
this.setDynValue(DYNFIELDNAME_URL, url); |
|
259 |
} |
|
260 |
|
|
261 |
public String getVersion(){ |
|
262 |
return (String) this.getDynValue(DYNFIELDNAME_VERSION); |
|
263 |
} |
|
264 |
|
|
265 |
public void setVersion(String version){ |
|
266 |
this.setDynValue(DYNFIELDNAME_VERSION, version); |
|
267 |
} |
|
268 |
|
|
269 |
public String getFeatureType(){ |
|
270 |
return (String) this.getDynValue(DYNFIELDNAME_TYPENAME); |
|
271 |
} |
|
272 |
|
|
273 |
public void setFeatureType(String featureType){ |
|
274 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType); |
|
275 |
} |
|
276 |
|
|
277 |
public void setFeatureType(String namespace, String featureType){ |
|
278 |
this.setDynValue(DYNFIELDNAME_NAMESPACE, namespace); |
|
279 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType); |
|
280 |
} |
|
281 |
|
|
282 |
public void setFeatureType(String prefix, String namespace, String featureType){ |
|
283 |
this.setDynValue(DYNFIELDNAME_NAMESPACEPREFIX, prefix); |
|
284 |
this.setDynValue(DYNFIELDNAME_NAMESPACE, namespace); |
|
285 |
this.setDynValue(DYNFIELDNAME_TYPENAME, featureType); |
|
286 |
} |
|
287 |
|
|
288 |
public String getFeatureNamespace(){ |
|
289 |
return (String) this.getDynValue(DYNFIELDNAME_NAMESPACE); |
|
290 |
} |
|
291 |
|
|
292 |
public String getFeaturePrefix(){ |
|
293 |
return (String) this.getDynValue(DYNFIELDNAME_NAMESPACEPREFIX); |
|
294 |
} |
|
295 |
|
|
296 |
public String getFields(){ |
|
297 |
return (String) this.getDynValue(DYNFIELDNAME_FIELDS); |
|
298 |
} |
|
299 |
|
|
300 |
public void setFields(String fields){ |
|
301 |
this.setDynValue(DYNFIELDNAME_FIELDS, fields); |
|
302 |
} |
|
303 |
|
|
304 |
public String getFilterEncodingByAttribute(){ |
|
305 |
return (String) this.getDynValue(DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE); |
|
306 |
} |
|
307 |
|
|
308 |
public void setFilterEncodingByAttribute(String filter){ |
|
309 |
this.setDynValue(DYNFIELDNAME_FILTER_ENCODING_BY_ATTRIBUTE, filter); |
|
310 |
} |
|
311 |
|
|
312 |
public Integer getMaxFeatures(){ |
|
313 |
return (Integer) this.getDynValue(DYNFIELDNAME_MAXFEATURES); |
|
314 |
} |
|
315 |
|
|
316 |
public void setMaxFeatures(Integer maxFeatures){ |
|
317 |
this.setDynValue(DYNFIELDNAME_MAXFEATURES, maxFeatures); |
|
318 |
} |
|
319 |
|
|
320 |
public Integer getTimeOut(){ |
|
321 |
return (Integer) this.getDynValue(DYNFIELDNAME_TIMEOUT); |
|
322 |
} |
|
323 |
|
|
324 |
public void setTimeOut(Integer timeOut){ |
|
325 |
this.setDynValue(DYNFIELDNAME_TIMEOUT, timeOut); |
|
326 |
} |
|
327 |
|
|
328 |
public String getUser(){ |
|
329 |
return (String) this.getDynValue(DYNFIELDNAME_USER); |
|
330 |
} |
|
331 |
|
|
332 |
public void setUser(String user){ |
|
333 |
this.setDynValue(DYNFIELDNAME_USER, user); |
|
334 |
} |
|
335 |
|
|
336 |
public String getPassword(){ |
|
337 |
return (String) this.getDynValue(DYNFIELDNAME_PASSWORD); |
|
338 |
} |
|
339 |
|
|
340 |
public void setPassword(String password){ |
|
341 |
this.setDynValue(DYNFIELDNAME_PASSWORD, password); |
|
342 |
} |
|
343 |
|
|
344 |
public Geometry getFilterByAreaGeometry(){ |
|
345 |
return (Geometry) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY); |
|
346 |
} |
|
347 |
|
|
348 |
public void setFilterByAreaGeometry(Geometry area){ |
|
349 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY, area); |
|
350 |
} |
|
351 |
|
|
352 |
public Envelope getFilterByAreaEnvelope(){ |
|
353 |
return (Envelope) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE); |
|
354 |
} |
|
355 |
|
|
356 |
public void setFilterByAreaEnvelope(Envelope area){ |
|
357 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE, area); |
|
358 |
} |
|
359 |
|
|
360 |
public Integer getFilterByAreaOperation(){ |
|
361 |
return (Integer) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION); |
|
362 |
} |
|
363 |
|
|
364 |
public void setFilterByAreaOperation(Integer operation){ |
|
365 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION, operation); |
|
366 |
} |
|
367 |
|
|
368 |
public IProjection getFilterByAreaCrs(){ |
|
369 |
return (IProjection) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS); |
|
370 |
} |
|
371 |
|
|
372 |
public void setFilterByAreaCrs(IProjection crs){ |
|
373 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS, crs); |
|
374 |
} |
|
375 |
|
|
376 |
public String getCrs(){ |
|
377 |
return (String) this.getDynValue(DYNFIELDNAME_CRS); |
|
378 |
} |
|
379 |
|
|
380 |
public void setCrs(String crs){ |
|
381 |
this.setDynValue(DYNFIELDNAME_CRS, crs); |
|
382 |
} |
|
383 |
|
|
384 |
public String getFilterByAreaAttribute(){ |
|
385 |
return (String) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE); |
|
386 |
} |
|
387 |
|
|
388 |
public void setFilterByAreaAttribute(String attribute){ |
|
389 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE, attribute); |
|
390 |
} |
|
391 |
|
|
392 |
public boolean getUseAxisOrderYX() { |
|
393 |
Boolean x = (Boolean) this.getDynValue("useAxisOrderYX"); |
|
394 |
return BooleanUtils.isTrue(x); |
|
395 |
} |
|
396 |
|
|
397 |
public void setUseAxisOrderYX(boolean useAxisOrderYX){ |
|
398 |
this.setDynValue("useAxisOrderYX", new Boolean(useAxisOrderYX)); |
|
399 |
} |
|
400 |
|
|
401 |
public boolean getIgnoreCache() { |
|
402 |
Boolean x = (Boolean) this.getDynValue("ignoreCache"); |
|
403 |
return BooleanUtils.isTrue(x); |
|
404 |
} |
|
405 |
|
|
406 |
public void setIgnoreCache(boolean ignoreCache){ |
|
407 |
this.setDynValue("ignoreCache", new Boolean(ignoreCache)); |
|
408 |
} |
|
409 |
} |
|
410 |
|
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSStoreProviderFactory.java | ||
---|---|---|
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 |
package org.gvsig.fmap.dal.store.wfs; |
|
25 |
|
|
26 |
|
|
27 |
import org.slf4j.Logger; |
|
28 |
import org.slf4j.LoggerFactory; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.DataParameters; |
|
31 |
import org.gvsig.fmap.dal.DataStoreProvider; |
|
32 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
33 |
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory; |
|
34 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
35 |
import org.gvsig.tools.dynobject.DynObject; |
|
36 |
|
|
37 |
public class WFSStoreProviderFactory extends AbstractFeatureStoreProviderFactory { |
|
38 |
|
|
39 |
private static final Logger logger = LoggerFactory.getLogger(WFSStoreProviderFactory.class); |
|
40 |
|
|
41 |
protected WFSStoreProviderFactory(String name, String description) { |
|
42 |
super(name, description); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public DataStoreProvider createProvider(DataParameters parameters, |
|
47 |
DataStoreProviderServices providerServices) |
|
48 |
throws InitializeException { |
|
49 |
return new WFSStoreProvider((WFSOpenStoreParameters) parameters, providerServices); |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public DynObject createParameters() { |
|
54 |
return new WFSOpenStoreParameters(); |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public int allowCreate() { |
|
59 |
return NO; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public int allowWrite() { |
|
64 |
return NO; |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public int allowRead() { |
|
69 |
return YES; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public int hasRasterSupport() { |
|
74 |
return NO; |
|
75 |
} |
|
76 |
|
|
77 |
@Override |
|
78 |
public int hasTabularSupport() { |
|
79 |
return YES; |
|
80 |
} |
|
81 |
|
|
82 |
@Override |
|
83 |
public int hasVectorialSupport() { |
|
84 |
return YES; |
|
85 |
} |
|
86 |
|
|
87 |
@Override |
|
88 |
public int allowMultipleGeometryTypes() { |
|
89 |
return YES; |
|
90 |
} |
|
91 |
|
|
92 |
|
|
93 |
@Override |
|
94 |
public int allowEditableFeatureType() { |
|
95 |
return NO; |
|
96 |
} |
|
97 |
|
|
98 |
@Override |
|
99 |
public int useLocalIndexesCanImprovePerformance() { |
|
100 |
return NO; |
|
101 |
} |
|
102 |
|
|
103 |
} |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSOpenStoreParameters.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.store.wfs; |
|
2 |
|
|
3 |
import org.gvsig.fmap.dal.DataParameters; |
|
4 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
5 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
6 |
import org.gvsig.fmap.dal.feature.OpenFeatureStoreParameters; |
|
7 |
|
|
8 |
|
|
9 |
public class WFSOpenStoreParameters |
|
10 |
extends WFSBaseStoreParameters |
|
11 |
implements OpenFeatureStoreParameters |
|
12 |
{ |
|
13 |
|
|
14 |
private static String PARAMETERS_NAME = "WFSStoreParameters"; |
|
15 |
|
|
16 |
public WFSOpenStoreParameters() { |
|
17 |
super(); |
|
18 |
} |
|
19 |
|
|
20 |
public WFSOpenStoreParameters(DataParameters dataParameters) throws InitializeException, ProviderNotRegisteredException{ |
|
21 |
super(dataParameters); |
|
22 |
} |
|
23 |
|
|
24 |
@Override |
|
25 |
protected String getStoreParametersName() { |
|
26 |
return PARAMETERS_NAME; |
|
27 |
} |
|
28 |
|
|
29 |
public static void registerParameterClass() { |
|
30 |
WFSBaseStoreParameters.registerParameterClass(WFSOpenStoreParameters.class, PARAMETERS_NAME); |
|
31 |
} |
|
32 |
} |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSLibrary.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.fmap.dal.store.wfs; |
29 | 29 |
|
30 |
import org.gvsig.fmap.dal.DALFileLocator; |
|
30 | 31 |
import org.gvsig.fmap.dal.DALLibrary; |
31 | 32 |
import org.gvsig.fmap.dal.DALLocator; |
32 | 33 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer; |
34 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorerFactory; |
|
33 | 35 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorerParameters; |
34 | 36 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
35 | 37 |
import org.gvsig.fmap.mapcontext.MapContextLibrary; |
... | ... | |
57 | 59 |
|
58 | 60 |
@Override |
59 | 61 |
protected void doPostInitialize() throws LibraryException { |
60 |
WFSStoreParameters.registerDynClass();
|
|
62 |
WFSOpenStoreParameters.registerParameterClass();
|
|
61 | 63 |
try { |
62 | 64 |
WFSStoreProvider.registerMetadataDefinition(); |
63 | 65 |
} catch (MetadataException e) { |
... | ... | |
65 | 67 |
} |
66 | 68 |
|
67 | 69 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator |
68 |
.getDataManager(); |
|
70 |
.getDataManager();
|
|
69 | 71 |
|
70 |
if (!dataman.getStoreProviders().contains(WFSStoreProvider.NAME)) {
|
|
71 |
dataman.registerStoreProvider(WFSStoreProvider.NAME,
|
|
72 |
WFSStoreProvider.class, WFSStoreParameters.class); |
|
73 |
}
|
|
74 |
|
|
72 |
if (!dataman.getStoreProviders().contains(WFSStoreProvider.NAME)) {
|
|
73 |
dataman.registerStoreProviderFactory(new WFSStoreProviderFactory(WFSStoreProvider.NAME, WFSStoreProvider.DESCRIPTION));
|
|
74 |
|
|
75 |
}
|
|
76 |
|
|
75 | 77 |
if (!dataman.getExplorerProviders().contains(WFSServerExplorer.NAME)){ |
76 |
dataman.registerExplorerProvider(WFSServerExplorer.NAME, |
|
77 |
WFSServerExplorer.class, WFSServerExplorerParameters.class); |
|
78 |
dataman.registerServerExplorerFactory(new WFSServerExplorerFactory()); |
|
78 | 79 |
} |
79 | 80 |
|
80 | 81 |
//Register the WFSStroreParams to be loaded from the catalog extension |
81 |
ExtensionPointManager extensionPointManager = ToolsLocator |
|
82 |
.getExtensionPointManager(); |
|
82 |
ExtensionPointManager extensionPointManager = ToolsLocator.getExtensionPointManager(); |
|
83 | 83 |
ExtensionPoint extensionPoint = extensionPointManager.add("CatalogDataStoreParameters"); |
84 |
extensionPoint.append("OGC:WFS", "Data store parameters to load a WFS layer", WFSStoreParameters.class); |
|
84 |
extensionPoint.append("OGC:WFS", "Data store parameters to load a WFS layer", WFSOpenStoreParameters.class);
|
|
85 | 85 |
} |
86 | 86 |
} |
87 | 87 |
|
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSStoreProvider.java | ||
---|---|---|
152 | 152 |
|
153 | 153 |
private void initParams() throws InitializeException { |
154 | 154 |
try { |
155 |
WFSStoreParameters wfsParameters = getWFSParameters(); |
|
155 |
WFSOpenStoreParameters wfsParameters = getWFSParameters();
|
|
156 | 156 |
try { |
157 | 157 |
if (wfsParameters.getVersion() == null) { |
158 | 158 |
wfsClient = new WFSClient(wfsParameters.getUrl(), |
... | ... | |
217 | 217 |
|
218 | 218 |
private WFSFeature getSelectedWFSFeature() throws ReadException, |
219 | 219 |
WFSException { |
220 |
WFSStoreParameters wfsParameters = getWFSParameters(); |
|
220 |
WFSOpenStoreParameters wfsParameters = getWFSParameters();
|
|
221 | 221 |
|
222 | 222 |
return ((WFSServerExplorer) getExplorer()).getFeatureInfo( |
223 | 223 |
wfsParameters.getFeatureNamespace(), |
... | ... | |
354 | 354 |
return null; |
355 | 355 |
} |
356 | 356 |
|
357 |
private WFSStoreParameters getWFSParameters() { |
|
358 |
return (WFSStoreParameters) getParameters(); |
|
357 |
private WFSOpenStoreParameters getWFSParameters() {
|
|
358 |
return (WFSOpenStoreParameters) getParameters();
|
|
359 | 359 |
} |
360 | 360 |
|
361 | 361 |
/* |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSNewStoreParameters.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.store.wfs; |
|
2 |
|
|
3 |
import org.gvsig.fmap.dal.DataParameters; |
|
4 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
5 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
6 |
import org.gvsig.fmap.dal.feature.OpenFeatureStoreParameters; |
|
7 |
|
|
8 |
|
|
9 |
public class WFSNewStoreParameters |
|
10 |
extends WFSBaseStoreParameters |
|
11 |
implements OpenFeatureStoreParameters |
|
12 |
{ |
|
13 |
|
|
14 |
private static String PARAMETERS_NAME = "WFSNewStoreParameters"; |
|
15 |
|
|
16 |
public WFSNewStoreParameters() { |
|
17 |
super(); |
|
18 |
} |
|
19 |
|
|
20 |
public WFSNewStoreParameters(DataParameters dataParameters) throws InitializeException, ProviderNotRegisteredException{ |
|
21 |
super(dataParameters); |
|
22 |
} |
|
23 |
|
|
24 |
@Override |
|
25 |
protected String getStoreParametersName() { |
|
26 |
return PARAMETERS_NAME; |
|
27 |
} |
|
28 |
|
|
29 |
public static void registerParameterClass() { |
|
30 |
WFSBaseStoreParameters.registerParameterClass(WFSOpenStoreParameters.class, PARAMETERS_NAME); |
|
31 |
} |
|
32 |
} |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/store/wfs/WFSBaseStoreParameters.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.fmap.dal.store.wfs; |
|
3 |
|
|
4 |
import org.apache.commons.lang3.BooleanUtils; |
|
5 |
import org.cresques.cts.IProjection; |
|
6 |
import org.gvsig.fmap.dal.DataParameters; |
|
7 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
8 |
import org.gvsig.fmap.dal.DataTypes; |
|
9 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
10 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
11 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
|
12 |
import org.gvsig.fmap.geom.Geometry; |
|
13 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
14 |
import org.gvsig.tools.ToolsLocator; |
|
15 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
16 |
import org.gvsig.tools.dynobject.DynClass; |
|
17 |
import org.gvsig.tools.dynobject.DynStruct; |
|
18 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
19 |
|
|
20 |
|
|
21 |
public abstract class WFSBaseStoreParameters |
|
22 |
extends AbstractDataParameters |
|
23 |
implements DataStoreParameters |
|
24 |
{ |
|
25 |
protected static DynClass DYNCLASS = null; |
|
26 |
|
|
27 |
public static final String FIELD_URL = "url"; |
|
28 |
public static final String FIELD_VERSION = "version"; |
|
29 |
public static final String FIELD_TYPENAME = "typeName"; |
|
30 |
public static final String FIELD_NAMESPACE = "namespace"; |
|
31 |
public static final String DYNFIELDNAME_NAMESPACEPREFIX = "namespacePrefix"; |
|
32 |
public static final String DYNFIELDNAME_FIELDS = "fields"; |
|
33 |
public static final String FIELD_FILTER_ENCODING_BY_ATTRIBUTE = "filterEncodingByAttribute"; |
|
34 |
public static final String DYNFIELDNAME_MAXFEATURES = "maxFeatures"; |
|
35 |
public static final String DYNFIELDNAME_TIMEOUT = "timeOut"; |
|
36 |
public static final String DYNFIELDNAME_USER = "user"; |
|
37 |
public static final String DYNFIELDNAME_PASSWORD = "password"; |
|
38 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY = "filterByAreaGeometry"; |
|
39 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE = "filterByAreaEnvelope"; |
|
40 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_OPERATION = "filterByAreaOperation"; |
|
41 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE = "filterByAreaAttribute"; |
|
42 |
public static final String DYNFIELDNAME_FILTER_BY_AREA_CRS = "filterByAreaCrs"; |
|
43 |
public static final String DYNFIELDNAME_CRS = "Crs"; |
|
44 |
|
|
45 |
private DelegatedDynObject delegatedDynObject; |
|
46 |
|
|
47 |
public WFSBaseStoreParameters() { |
|
48 |
super(); |
|
49 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator |
|
50 |
.getDynObjectManager().createDynObject(DYNCLASS); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
protected DelegatedDynObject getDelegatedDynObject() { |
|
55 |
return delegatedDynObject; |
|
56 |
} |
|
57 |
|
|
58 |
protected abstract String getStoreParametersName(); |
|
59 |
|
|
60 |
public WFSBaseStoreParameters(DataParameters dataParameters) throws InitializeException, ProviderNotRegisteredException{ |
|
61 |
this(); |
|
62 |
setUrl((String)dataParameters.getDynValue(FIELD_URL)); |
|
63 |
String namespace = null; |
|
64 |
String namespacePrefix = null; |
|
65 |
if (dataParameters.hasDynValue(FIELD_NAMESPACE)){ |
|
66 |
namespace = (String)dataParameters.getDynValue(FIELD_NAMESPACE); |
|
67 |
} |
|
68 |
if (dataParameters.hasDynValue(DYNFIELDNAME_NAMESPACEPREFIX)){ |
|
69 |
namespacePrefix = (String)dataParameters.getDynValue(DYNFIELDNAME_NAMESPACEPREFIX); |
|
70 |
} |
|
71 |
setFeatureType(namespacePrefix, namespace, |
|
72 |
(String)dataParameters.getDynValue(FIELD_TYPENAME)); |
|
73 |
if (dataParameters.hasDynValue(DYNFIELDNAME_MAXFEATURES)){ |
|
74 |
setMaxFeatures((Integer)dataParameters.getDynValue(DYNFIELDNAME_MAXFEATURES)); |
|
75 |
}else{ |
|
76 |
setMaxFeatures(1000); |
|
77 |
} |
|
78 |
if (dataParameters.hasDynValue(DYNFIELDNAME_TIMEOUT)){ |
|
79 |
setTimeOut((Integer)dataParameters.getDynValue(DYNFIELDNAME_TIMEOUT)); |
|
80 |
}else{ |
|
81 |
setTimeOut(10000); |
|
82 |
} |
|
83 |
if (dataParameters.hasDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY)){ |
|
84 |
setFilterByAreaGeometry((Geometry)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY)); |
|
85 |
setFilterByAreaAttribute((String)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE)); |
|
86 |
setFilterByAreaCrs((IProjection)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS)); |
|
87 |
setFilterByAreaOperation((Integer)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION)); |
|
88 |
} |
|
89 |
if (dataParameters.hasDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE)){ |
|
90 |
setFilterByAreaEnvelope((Envelope)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE)); |
|
91 |
setFilterByAreaAttribute((String)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE)); |
|
92 |
setFilterByAreaCrs((IProjection)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS)); |
|
93 |
setFilterByAreaOperation((Integer)dataParameters.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION)); |
|
94 |
} |
|
95 |
if (dataParameters.hasDynValue(FIELD_VERSION)){ |
|
96 |
setVersion((String)dataParameters.getDynValue(FIELD_VERSION)); |
|
97 |
} |
|
98 |
if (dataParameters.hasDynValue(FIELD_FILTER_ENCODING_BY_ATTRIBUTE)){ |
|
99 |
setFilterEncodingByAttribute((String)dataParameters.getDynValue(FIELD_FILTER_ENCODING_BY_ATTRIBUTE)); |
|
100 |
} |
|
101 |
if (dataParameters.hasDynValue(DYNFIELDNAME_USER)){ |
|
102 |
setUser((String)dataParameters.getDynValue(DYNFIELDNAME_USER)); |
|
103 |
} |
|
104 |
if (dataParameters.hasDynValue(DYNFIELDNAME_PASSWORD)){ |
|
105 |
setPassword((String)dataParameters.getDynValue(DYNFIELDNAME_PASSWORD)); |
|
106 |
} |
|
107 |
if (dataParameters.hasDynValue(DYNFIELDNAME_CRS)){ |
|
108 |
setCrs((String)dataParameters.getDynValue(DYNFIELDNAME_CRS)); |
|
109 |
} |
|
110 |
} |
|
111 |
|
|
112 |
protected static void registerParameterClass(Class parametersClass, String parametersName) { |
|
113 |
if (DYNCLASS == null) { |
|
114 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
115 |
DynStruct definition = manager.addDefinition( |
|
116 |
parametersClass, |
|
117 |
parametersName, |
|
118 |
parametersName + " Persistence definition", |
|
119 |
null, |
|
120 |
null |
|
121 |
); |
|
122 |
definition.addDynFieldString(FIELD_URL) |
|
123 |
.setDescription("URL of the WFS server") |
|
124 |
.setMandatory(true); |
|
125 |
|
|
126 |
definition.addDynFieldString(FIELD_VERSION) |
|
127 |
.setDescription("Version of the WFS server") |
|
128 |
.setMandatory(false); |
|
129 |
|
|
130 |
definition.addDynFieldString(FIELD_TYPENAME) |
|
131 |
.setDescription("Feature type to retrieve") |
|
132 |
.setMandatory(true); |
|
133 |
|
|
134 |
definition.addDynFieldString(FIELD_NAMESPACE) |
|
135 |
.setDescription("Namespace of the feature type to retrieve") |
|
136 |
.setMandatory(false); |
|
137 |
|
|
138 |
definition.addDynFieldString(DYNFIELDNAME_NAMESPACEPREFIX) |
|
139 |
.setDescription("Prefix of the namespace of the feature type to retrieve") |
|
140 |
.setMandatory(false); |
|
141 |
|
|
142 |
definition.addDynFieldString(DYNFIELDNAME_FIELDS) |
|
143 |
.setDescription("Fields to retrieve separated by ','") |
|
144 |
.setMandatory(false); |
|
145 |
|
|
146 |
definition.addDynFieldString(FIELD_FILTER_ENCODING_BY_ATTRIBUTE) |
|
147 |
.setDescription("Filter encoding request") |
|
148 |
.setMandatory(false); |
|
149 |
|
|
150 |
definition.addDynFieldInt(DYNFIELDNAME_MAXFEATURES) |
|
151 |
.setDescription("Number of features to retrieve") |
|
152 |
.setMandatory(false); |
|
153 |
|
|
154 |
definition.addDynFieldInt(DYNFIELDNAME_TIMEOUT) |
|
155 |
.setDescription("Timeout") |
|
156 |
.setMandatory(false); |
|
157 |
|
|
158 |
definition.addDynFieldString(DYNFIELDNAME_USER) |
|
159 |
.setDescription("User name (not used at this moment)") |
|
160 |
.setMandatory(false); |
|
161 |
|
|
162 |
definition.addDynFieldString(DYNFIELDNAME_PASSWORD) |
|
163 |
.setDescription("Password (not used at this moment") |
|
164 |
.setMandatory(false); |
|
165 |
|
|
166 |
definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY) |
|
167 |
.setType(DataTypes.GEOMETRY) |
|
168 |
.setDescription("Geometry used to do the filter") |
|
169 |
.setMandatory(false); |
|
170 |
|
|
171 |
definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE) |
|
172 |
.setType(DataTypes.ENVELOPE) |
|
173 |
.setDescription("Envelope used to do the filter") |
|
174 |
.setMandatory(false); |
|
175 |
|
|
176 |
definition.addDynFieldInt(DYNFIELDNAME_FILTER_BY_AREA_OPERATION) |
|
177 |
.setDescription("Geometry operation used to do the filter") |
|
178 |
.setMandatory(false); |
|
179 |
|
|
180 |
definition.addDynFieldString(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE) |
|
181 |
.setDescription("Attribute that contains the geometry") |
|
182 |
.setMandatory(false); |
|
183 |
|
|
184 |
definition.addDynFieldObject(DYNFIELDNAME_FILTER_BY_AREA_CRS) |
|
185 |
.setType(DataTypes.CRS) |
|
186 |
.setDescription("CRS to do the spatial filter of the query") |
|
187 |
.setMandatory(false); |
|
188 |
|
|
189 |
definition.addDynFieldString(DYNFIELDNAME_CRS) |
|
190 |
.setDescription("CRS") |
|
191 |
.setMandatory(false); |
|
192 |
|
|
193 |
definition.addDynFieldBoolean("useAxisOrderYX") |
|
194 |
.setDefaultFieldValue("false") |
|
195 |
.setMandatory(false); |
|
196 |
|
|
197 |
definition.addDynFieldBoolean("ignoreCache") |
|
198 |
.setDefaultFieldValue("false") |
|
199 |
.setMandatory(false); |
|
200 |
|
|
201 |
DYNCLASS = (DynClass) definition; |
|
202 |
} |
|
203 |
} |
|
204 |
|
|
205 |
@Override |
|
206 |
public String getDataStoreName() { |
|
207 |
return WFSStoreProvider.NAME; |
|
208 |
} |
|
209 |
|
|
210 |
@Override |
|
211 |
public String getDescription() { |
|
212 |
return WFSStoreProvider.DESCRIPTION; |
|
213 |
} |
|
214 |
|
|
215 |
@Override |
|
216 |
public boolean isValid() { |
|
217 |
// TODO Auto-generated method stub |
|
218 |
return false; |
|
219 |
} |
|
220 |
|
|
221 |
public String getUrl(){ |
|
222 |
return (String) this.getDynValue(FIELD_URL); |
|
223 |
} |
|
224 |
|
|
225 |
public void setUrl(String url){ |
|
226 |
this.setDynValue(FIELD_URL, url); |
|
227 |
} |
|
228 |
|
|
229 |
public String getVersion(){ |
|
230 |
return (String) this.getDynValue(FIELD_VERSION); |
|
231 |
} |
|
232 |
|
|
233 |
public void setVersion(String version){ |
|
234 |
this.setDynValue(FIELD_VERSION, version); |
|
235 |
} |
|
236 |
|
|
237 |
public String getFeatureType(){ |
|
238 |
return (String) this.getDynValue(FIELD_TYPENAME); |
|
239 |
} |
|
240 |
|
|
241 |
public void setFeatureType(String featureType){ |
|
242 |
this.setDynValue(FIELD_TYPENAME, featureType); |
|
243 |
} |
|
244 |
|
|
245 |
public void setFeatureType(String namespace, String featureType){ |
|
246 |
this.setDynValue(FIELD_NAMESPACE, namespace); |
|
247 |
this.setDynValue(FIELD_TYPENAME, featureType); |
|
248 |
} |
|
249 |
|
|
250 |
public void setFeatureType(String prefix, String namespace, String featureType){ |
|
251 |
this.setDynValue(DYNFIELDNAME_NAMESPACEPREFIX, prefix); |
|
252 |
this.setDynValue(FIELD_NAMESPACE, namespace); |
|
253 |
this.setDynValue(FIELD_TYPENAME, featureType); |
|
254 |
} |
|
255 |
|
|
256 |
public String getFeatureNamespace(){ |
|
257 |
return (String) this.getDynValue(FIELD_NAMESPACE); |
|
258 |
} |
|
259 |
|
|
260 |
public String getFeaturePrefix(){ |
|
261 |
return (String) this.getDynValue(DYNFIELDNAME_NAMESPACEPREFIX); |
|
262 |
} |
|
263 |
|
|
264 |
public String getFields(){ |
|
265 |
return (String) this.getDynValue(DYNFIELDNAME_FIELDS); |
|
266 |
} |
|
267 |
|
|
268 |
public void setFields(String fields){ |
|
269 |
this.setDynValue(DYNFIELDNAME_FIELDS, fields); |
|
270 |
} |
|
271 |
|
|
272 |
public String getFilterEncodingByAttribute(){ |
|
273 |
return (String) this.getDynValue(FIELD_FILTER_ENCODING_BY_ATTRIBUTE); |
|
274 |
} |
|
275 |
|
|
276 |
public void setFilterEncodingByAttribute(String filter){ |
|
277 |
this.setDynValue(FIELD_FILTER_ENCODING_BY_ATTRIBUTE, filter); |
|
278 |
} |
|
279 |
|
|
280 |
public Integer getMaxFeatures(){ |
|
281 |
return (Integer) this.getDynValue(DYNFIELDNAME_MAXFEATURES); |
|
282 |
} |
|
283 |
|
|
284 |
public void setMaxFeatures(Integer maxFeatures){ |
|
285 |
this.setDynValue(DYNFIELDNAME_MAXFEATURES, maxFeatures); |
|
286 |
} |
|
287 |
|
|
288 |
public Integer getTimeOut(){ |
|
289 |
return (Integer) this.getDynValue(DYNFIELDNAME_TIMEOUT); |
|
290 |
} |
|
291 |
|
|
292 |
public void setTimeOut(Integer timeOut){ |
|
293 |
this.setDynValue(DYNFIELDNAME_TIMEOUT, timeOut); |
|
294 |
} |
|
295 |
|
|
296 |
public String getUser(){ |
|
297 |
return (String) this.getDynValue(DYNFIELDNAME_USER); |
|
298 |
} |
|
299 |
|
|
300 |
public void setUser(String user){ |
|
301 |
this.setDynValue(DYNFIELDNAME_USER, user); |
|
302 |
} |
|
303 |
|
|
304 |
public String getPassword(){ |
|
305 |
return (String) this.getDynValue(DYNFIELDNAME_PASSWORD); |
|
306 |
} |
|
307 |
|
|
308 |
public void setPassword(String password){ |
|
309 |
this.setDynValue(DYNFIELDNAME_PASSWORD, password); |
|
310 |
} |
|
311 |
|
|
312 |
public Geometry getFilterByAreaGeometry(){ |
|
313 |
return (Geometry) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY); |
|
314 |
} |
|
315 |
|
|
316 |
public void setFilterByAreaGeometry(Geometry area){ |
|
317 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_GEOMETRY, area); |
|
318 |
} |
|
319 |
|
|
320 |
public Envelope getFilterByAreaEnvelope(){ |
|
321 |
return (Envelope) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE); |
|
322 |
} |
|
323 |
|
|
324 |
public void setFilterByAreaEnvelope(Envelope area){ |
|
325 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_ENVELOPE, area); |
|
326 |
} |
|
327 |
|
|
328 |
public Integer getFilterByAreaOperation(){ |
|
329 |
return (Integer) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION); |
|
330 |
} |
|
331 |
|
|
332 |
public void setFilterByAreaOperation(Integer operation){ |
|
333 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_OPERATION, operation); |
|
334 |
} |
|
335 |
|
|
336 |
public IProjection getFilterByAreaCrs(){ |
|
337 |
return (IProjection) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS); |
|
338 |
} |
|
339 |
|
|
340 |
public void setFilterByAreaCrs(IProjection crs){ |
|
341 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_CRS, crs); |
|
342 |
} |
|
343 |
|
|
344 |
public String getCrs(){ |
|
345 |
return (String) this.getDynValue(DYNFIELDNAME_CRS); |
|
346 |
} |
|
347 |
|
|
348 |
public void setCrs(String crs){ |
|
349 |
this.setDynValue(DYNFIELDNAME_CRS, crs); |
|
350 |
} |
|
351 |
|
|
352 |
public String getFilterByAreaAttribute(){ |
|
353 |
return (String) this.getDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE); |
|
354 |
} |
|
355 |
|
|
356 |
public void setFilterByAreaAttribute(String attribute){ |
|
357 |
this.setDynValue(DYNFIELDNAME_FILTER_BY_AREA_ATTRIBUTE, attribute); |
|
358 |
} |
|
359 |
|
|
360 |
public boolean getUseAxisOrderYX() { |
|
361 |
Boolean x = (Boolean) this.getDynValue("useAxisOrderYX"); |
|
362 |
return BooleanUtils.isTrue(x); |
|
363 |
} |
|
364 |
|
|
365 |
public void setUseAxisOrderYX(boolean useAxisOrderYX){ |
|
366 |
this.setDynValue("useAxisOrderYX", useAxisOrderYX); |
|
367 |
} |
|
368 |
|
|
369 |
public boolean getIgnoreCache() { |
|
370 |
Boolean x = (Boolean) this.getDynValue("ignoreCache"); |
|
371 |
return BooleanUtils.isTrue(x); |
|
372 |
} |
|
373 |
|
|
374 |
public void setIgnoreCache(boolean ignoreCache){ |
|
375 |
this.setDynValue("ignoreCache", ignoreCache); |
|
376 |
} |
|
377 |
|
|
378 |
} |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/wfs/WFSServerExplorerFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.fmap.dal.serverexplorer.wfs; |
|
3 |
|
|
4 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
5 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
6 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
7 |
import org.gvsig.fmap.dal.spi.AbstractDataServerExplorerFactory; |
|
8 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices; |
|
9 |
import org.gvsig.fmap.dal.store.wfs.WFSStoreProvider; |
|
10 |
import org.gvsig.tools.dynobject.DynObject; |
|
11 |
|
|
12 |
public class WFSServerExplorerFactory extends AbstractDataServerExplorerFactory { |
|
13 |
|
|
14 |
public WFSServerExplorerFactory() { |
|
15 |
super(WFSServerExplorer.NAME, WFSStoreProvider.DESCRIPTION); |
|
16 |
} |
|
17 |
|
|
18 |
@Override |
|
19 |
public DynObject createParameters() { |
|
20 |
return new WFSServerExplorerParameters(); |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
public DataServerExplorer create(DataServerExplorerParameters parameters, DataServerExplorerProviderServices explorer) throws InitializeException { |
|
25 |
return new WFSServerExplorer((WFSServerExplorerParameters) parameters, explorer); |
|
26 |
} |
|
27 |
|
|
28 |
} |
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/wfs/WFSServerExplorer.java | ||
---|---|---|
47 | 47 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProvider; |
48 | 48 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices; |
49 | 49 |
import org.gvsig.fmap.dal.store.wfs.WFSFeatureFiller; |
50 |
import org.gvsig.fmap.dal.store.wfs.WFSStoreParameters; |
|
50 |
import org.gvsig.fmap.dal.store.wfs.WFSOpenStoreParameters;
|
|
51 | 51 |
import org.gvsig.fmap.dal.store.wfs.WFSStoreProvider; |
52 | 52 |
import org.gvsig.remoteclient.wfs.WFSClient; |
53 | 53 |
import org.gvsig.remoteclient.wfs.WFSFeature; |
... | ... | |
206 | 206 |
|
207 | 207 |
public DataStoreParameters getParametersFor(WFSFeature feature) |
208 | 208 |
throws DataException { |
209 |
WFSStoreParameters params = (WFSStoreParameters)dataManager
|
|
209 |
WFSOpenStoreParameters params = (WFSOpenStoreParameters)dataManager
|
|
210 | 210 |
.createStoreParameters(WFSStoreProvider.NAME); |
211 | 211 |
params.setUrl(url); |
212 | 212 |
params.setFeatureType(feature.getNamespace().getPrefix(), |
Also available in: Unified diff