Revision 28430
branches/v2_0_0_prep/libraries/libRemoteServices/src/org/gvsig/remoteClient/wfs/WFSClient.java | ||
---|---|---|
107 | 107 |
} |
108 | 108 |
} |
109 | 109 |
|
110 |
public WFSClient(String host, String version) { |
|
110 |
public WFSClient(String host, String version) throws IOException {
|
|
111 | 111 |
setHost(host); |
112 | 112 |
|
113 |
handler = WFSProtocolHandlerFactory.createVersionDriver(version); |
|
113 |
if (version == null){ |
|
114 |
try { |
|
115 |
handler = WFSProtocolHandlerFactory.negotiate(host); |
|
116 |
} catch(ConnectException conE) { |
|
117 |
conE.printStackTrace(); |
|
118 |
throw conE; |
|
119 |
} catch(IOException ioE) { |
|
120 |
ioE.printStackTrace(); |
|
121 |
throw ioE; |
|
122 |
} catch(Exception e) { |
|
123 |
e.printStackTrace(); |
|
124 |
} |
|
125 |
}else{ |
|
126 |
handler = WFSProtocolHandlerFactory.createVersionDriver(version); |
|
127 |
} |
|
114 | 128 |
|
115 | 129 |
if (handler == null){ |
116 | 130 |
throw new UnsupportedOperationException("Unsupported version"); |
branches/v2_0_0_prep/extensions/extWFS2/src/org/gvsig/fmap/dal/store/wfs/WFSStoreProvider.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.fmap.dal.store.wfs; |
29 | 29 |
|
30 |
import java.util.Hashtable;
|
|
30 |
import java.io.IOException;
|
|
31 | 31 |
import java.util.List; |
32 | 32 |
|
33 | 33 |
import org.gvsig.fmap.dal.DALLocator; |
34 | 34 |
import org.gvsig.fmap.dal.DataManager; |
35 | 35 |
import org.gvsig.fmap.dal.DataParameters; |
36 | 36 |
import org.gvsig.fmap.dal.DataServerExplorer; |
37 |
import org.gvsig.fmap.dal.DataTypes; |
|
38 | 37 |
import org.gvsig.fmap.dal.exception.DataException; |
39 | 38 |
import org.gvsig.fmap.dal.exception.InitializeException; |
40 | 39 |
import org.gvsig.fmap.dal.exception.OpenException; |
40 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
41 | 41 |
import org.gvsig.fmap.dal.exception.ReadException; |
42 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
43 | 42 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
44 | 43 |
import org.gvsig.fmap.dal.feature.FeatureType; |
45 | 44 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
... | ... | |
48 | 47 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer; |
49 | 48 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorerParameters; |
50 | 49 |
import org.gvsig.fmap.dal.store.gpe.GPEStoreProvider; |
51 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
52 | 50 |
import org.gvsig.remoteClient.wfs.WFSClient; |
53 |
import org.gvsig.remoteClient.wfs.WFSFeature; |
|
54 | 51 |
import org.gvsig.remoteClient.wfs.WFSStatus; |
55 | 52 |
import org.gvsig.remoteClient.wfs.exceptions.WFSException; |
56 |
import org.gvsig.remoteClient.wfs.schema.XMLElement; |
|
57 |
import org.gvsig.remoteClient.wfs.schema.type.IXMLType; |
|
58 | 53 |
import org.gvsig.tools.ToolsLocator; |
59 | 54 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
60 | 55 |
import org.gvsig.tools.dynobject.DynClass; |
... | ... | |
84 | 79 |
public WFSStoreProvider(DataParameters params) |
85 | 80 |
throws InitializeException { |
86 | 81 |
this(); |
87 |
this.wfsParameters = (WFSStoreParameters) params; |
|
82 |
|
|
83 |
this.wfsParameters = (WFSStoreParameters) params; |
|
88 | 84 |
this.dynObject = (DelegatedDynObject) ToolsLocator |
89 | 85 |
.getDynObjectManager().createDynObject(DYNCLASS); |
90 | 86 |
|
91 |
wfsClient = new WFSClient(wfsParameters.getUrl(), wfsParameters.getVersion()); |
|
87 |
try { |
|
88 |
if (wfsParameters.getVersion() == null){ |
|
89 |
wfsClient = new WFSClient(wfsParameters.getUrl()); |
|
90 |
wfsParameters.setVersion(wfsClient.getVersion()); |
|
91 |
}else{ |
|
92 |
wfsClient = new WFSClient(wfsParameters.getUrl(), wfsParameters.getVersion()); |
|
93 |
} |
|
94 |
} catch (IOException e) { |
|
95 |
throw new InitializeException(e); |
|
96 |
} |
|
92 | 97 |
wfsStatus = new WFSStatus( wfsParameters.getFeatureType(), |
93 | 98 |
wfsParameters.getFeaturePrefix()); |
94 | 99 |
wfsStatus.setNamespace(wfsParameters.getFeatureNamespace()); |
... | ... | |
98 | 103 |
wfsStatus.setBuffer(wfsParameters.getMaxFeatures()); |
99 | 104 |
wfsStatus.setUserName(wfsParameters.getUser()); |
100 | 105 |
wfsStatus.setPassword(wfsParameters.getPassword()); |
101 |
} |
|
106 |
} |
|
107 |
|
|
102 | 108 |
|
103 | 109 |
/* (non-Javadoc) |
104 | 110 |
* @see org.gvsig.fmap.dal.store.gpe.GPEStoreProvider#open() |
branches/v2_0_0_prep/extensions/extWFS2/src/org/gvsig/fmap/dal/store/wfs/WFSStoreParameters.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.fmap.dal.store.wfs; |
29 | 29 |
|
30 |
import org.gvsig.fmap.dal.DataParameters; |
|
30 | 31 |
import org.gvsig.fmap.dal.DataStoreParameters; |
31 | 32 |
import org.gvsig.fmap.dal.DataTypes; |
33 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
34 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
32 | 35 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
33 | 36 |
import org.gvsig.tools.ToolsLocator; |
34 | 37 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
... | ... | |
61 | 64 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator |
62 | 65 |
.getDynObjectManager().createDynObject( |
63 | 66 |
WFSStoreParameters.DYNCLASS); |
64 |
} |
|
67 |
}
|
|
65 | 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 |
|
|
66 | 87 |
protected static void registerDynClass() { |
67 | 88 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
68 | 89 |
DynClass dynClass; |
... | ... | |
79 | 100 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
80 | 101 |
field.setDescription("Version of the WFS server"); |
81 | 102 |
field.setType(DataTypes.STRING); |
82 |
field.setMandatory(true);
|
|
103 |
field.setMandatory(false);
|
|
83 | 104 |
|
84 | 105 |
field = dynClass.addDynField(DYNFIELDNAME_TYPENAME); |
85 | 106 |
field.setTheTypeOfAvailableValues(DynField.SINGLE); |
... | ... | |
137 | 158 |
|
138 | 159 |
DYNCLASS = dynClass; |
139 | 160 |
} |
140 |
} |
|
161 |
}
|
|
141 | 162 |
|
142 | 163 |
/* (non-Javadoc) |
143 | 164 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName() |
branches/v2_0_0_prep/extensions/extWFS2/src/org/gvsig/fmap/dal/store/wfs/WFSLibrary.java | ||
---|---|---|
32 | 32 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorer; |
33 | 33 |
import org.gvsig.fmap.dal.serverexplorer.wfs.WFSServerExplorerParameters; |
34 | 34 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
35 |
import org.gvsig.tools.ToolsLocator; |
|
36 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
37 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
35 | 38 |
import org.gvsig.tools.locator.BaseLibrary; |
36 | 39 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
37 | 40 |
|
... | ... | |
64 | 67 |
if (!dataman.getExplorerProviders().contains(WFSServerExplorer.NAME)){ |
65 | 68 |
dataman.registerExplorerProvider(WFSServerExplorer.NAME, |
66 | 69 |
WFSServerExplorer.class, WFSServerExplorerParameters.class); |
67 |
} |
|
70 |
} |
|
71 |
|
|
72 |
//Register the WFSStroreParams to be loaded from the catalog extension |
|
73 |
ExtensionPointManager extensionPointManager = ToolsLocator |
|
74 |
.getExtensionPointManager(); |
|
75 |
ExtensionPoint extensionPoint = extensionPointManager.add("CatalogDataStoreParameters"); |
|
76 |
extensionPoint.append("OGC:WFS", "Data store parameters to load a WFS layer", WFSStoreParameters.class); |
|
68 | 77 |
} |
69 | 78 |
} |
70 | 79 |
|
Also available in: Unified diff