WFSDataStoreFactory implements DataStoreFactorySpi { @Override public WFSDataStore createDataStore(final Map<String, Serializable> params) throws IOException { final WFSConfig config = WFSConfig.fromParams(params); { String user = config.getUser(); String password = config.getPassword(); if (((user == null) && (password != null)) || ((config.getPassword() == null) && (config.getUser() != null))) { throw new IOException( "Cannot define only one of USERNAME or PASSWORD, must define both or neither"); } } final HTTPClient http = new SimpleHttpClient(); http.setUser(config.getUser()); http.setPassword(config.getPassword()); int timeoutMillis = config.getTimeoutMillis(); http.setConnectTimeout(timeoutMillis / 1000); final URL capabilitiesURL = (URL) URL.lookUp(params); WFSClient wfsClient; try { wfsClient = new WFSClient(capabilitiesURL, http, config); } catch (ServiceException e) { throw new IOException(e); } WFSDataStore dataStore = new WFSDataStore(wfsClient); dataStore.setFilterFactory(CommonFactoryFinder.getFilterFactory(null)); dataStore.setGeometryFactory(new GeometryFactory( PackedCoordinateSequenceFactory.DOUBLE_FACTORY)); dataStore.setFeatureTypeFactory(new FeatureTypeFactoryImpl()); dataStore.setFeatureFactory(CommonFactoryFinder.getFeatureFactory(null)); dataStore.setDataStoreFactory(this); dataStore.setNamespaceURI(config.getNamespaceOverride()); return dataStore; }  @Override WFSDataStore createDataStore(final Map<String, Serializable> params); @Override DataStore createNewDataStore(final Map<String, Serializable> params); @Override String getDisplayName(); @Override String getDescription(); @Override Param[] getParametersInfo(); @Override boolean canProcess(@SuppressWarnings("rawtypes") final Map params); static URL createGetCapabilitiesRequest(URL host, Version version); static URL createGetCapabilitiesRequest(final URL host); boolean isAvailable(); Map<java.awt.RenderingHints.Key, ?> getImplementationHints(); static final String AXIS_ORDER_EAST_NORTH; static final String AXIS_ORDER_NORTH_EAST; static final String AXIS_ORDER_COMPLIANT; static final WFSFactoryParam<URL> URL; static final WFSFactoryParam<Boolean> PROTOCOL; static final WFSFactoryParam<String> USERNAME; static final WFSFactoryParam<String> PASSWORD; static final WFSFactoryParam<String> ENCODING; static final WFSFactoryParam<Integer> TIMEOUT; static final WFSFactoryParam<Integer> BUFFER_SIZE; static final WFSFactoryParam<Boolean> TRY_GZIP; static final WFSFactoryParam<Boolean> LENIENT; static final WFSFactoryParam<Integer> MAXFEATURES; static final WFSFactoryParam<Integer> FILTER_COMPLIANCE; static final WFSFactoryParam<String> WFS_STRATEGY; static final WFSFactoryParam<String> NAMESPACE; static final WFSFactoryParam<Boolean> USEDEFAULTSRS; static final WFSFactoryParam<String> AXIS_ORDER; static final WFSFactoryParam<String> AXIS_ORDER_FILTER; static final WFSFactoryParam<String> OUTPUTFORMAT; }
@Test public void testCreateDataStore() throws IOException { testCreateDataStore("CubeWerx_4.12.6/1.0.0/GetCapabilities.xml", Versions.v1_0_0); testCreateDataStore("CubeWerx_4.12.6/1.1.0/GetCapabilities.xml", Versions.v1_1_0); testCreateDataStore("CubeWerx_4.7.5/1.1.0/GetCapabilities.xml", Versions.v1_1_0); testCreateDataStore("CubeWerx_5.6.3/1.1.0/GetCapabilities.xml", Versions.v1_1_0); testCreateDataStore("CubeWerx_nsdi/1.1.0/GetCapabilities.xml", Versions.v1_1_0); testCreateDataStore("Deegree_unknown/1.1.0/GetCapabilities.xml", Versions.v1_1_0); testCreateDataStore("Galdos_unknown/1.0.0/GetCapabilities.xml", Versions.v1_0_0); testCreateDataStore("GeoServer_1.7.x/1.1.0/GetCapabilities.xml", Versions.v1_1_0); testCreateDataStore("GeoServer_2.0/1.1.0/GetCapabilities.xml", Versions.v1_1_0); testCreateDataStore("GeoServer_2.2.x/1.0.0/GetCapabilities.xml", Versions.v1_0_0); testCreateDataStore("Ionic_unknown/1.0.0/GetCapabilities.xml", Versions.v1_0_0); testCreateDataStore("Ionic_unknown/1.1.0/GetCapabilities.xml", Versions.v1_1_0); testCreateDataStore("MapServer_4.2-beta1/1.0.0/GetCapabilities.xml", Versions.v1_0_0); testCreateDataStore("MapServer_5.6.5/1.0.0/GetCapabilities.xml", Versions.v1_0_0); testCreateDataStore("MapServer_5.6.5/1.1.0/GetCapabilities.xml", Versions.v1_1_0); testCreateDataStore("PCIGeoMatics_unknown/1.0.0/GetCapabilities.xml", Versions.v1_0_0); }