@Test public void testGetSchema() throws IOException { final InputStream schemaStream = TestData.openStream(this, CUBEWERX_GOVUNITCE.SCHEMA); TestHttpResponse httpResponse = new TestHttpResponse("", "UTF-8", schemaStream); TestHttpProtocol mockHttp = new TestHttpProtocol(httpResponse); createTestProtocol(CUBEWERX_GOVUNITCE.CAPABILITIES, mockHttp); URL describeUrl = TestData.getResource(this, CUBEWERX_GOVUNITCE.SCHEMA); wfs.setDescribeFeatureTypeURLOverride(describeUrl); WFS_1_1_0_DataStore ds = new WFS_1_1_0_DataStore(wfs); try { ds.getSchema("nonExistentTypeName"); fail("Expected SchemaNotFoundException"); } catch (SchemaNotFoundException e) { assertTrue(true); } SimpleFeatureType schema = ds.getSchema(CUBEWERX_GOVUNITCE.FEATURETYPENAME); assertNotNull(schema); }
public SimpleFeatureType getSchema(final String prefixedTypeName) throws IOException { SimpleFeatureType ftype = byTypeNameTypes.get(prefixedTypeName); if (ftype == null) { final QName featureDescriptorName; try { featureDescriptorName = wfs.getFeatureTypeName(prefixedTypeName); } catch (IllegalArgumentException e) { throw new SchemaNotFoundException(prefixedTypeName); } final URL describeUrl = wfs.getDescribeFeatureTypeURLGet(prefixedTypeName); System.err.println("DecribeFT URL for " + prefixedTypeName + ": " + describeUrl); final SimpleFeatureType featureType; CoordinateReferenceSystem crs = getFeatureTypeCRS(prefixedTypeName); featureType = EmfAppSchemaParser.parseSimpleFeatureType(featureDescriptorName, describeUrl, crs); SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); builder.setName(prefixedTypeName); builder.setNamespaceURI(featureDescriptorName.getNamespaceURI()); GeometryDescriptor defaultGeometry = featureType.getGeometryDescriptor(); if (defaultGeometry != null) { builder.setDefaultGeometry(defaultGeometry.getLocalName()); builder.setCRS(defaultGeometry.getCoordinateReferenceSystem()); } final SimpleFeatureType adaptedFeatureType = builder.buildFeatureType(); ftype = adaptedFeatureType; byTypeNameTypes.put(prefixedTypeName, ftype); } return ftype; }
WFS_1_1_0_DataStore implements WFSDataStore { public SimpleFeatureType getSchema(final String prefixedTypeName) throws IOException { SimpleFeatureType ftype = byTypeNameTypes.get(prefixedTypeName); if (ftype == null) { final QName featureDescriptorName; try { featureDescriptorName = wfs.getFeatureTypeName(prefixedTypeName); } catch (IllegalArgumentException e) { throw new SchemaNotFoundException(prefixedTypeName); } final URL describeUrl = wfs.getDescribeFeatureTypeURLGet(prefixedTypeName); System.err.println("DecribeFT URL for " + prefixedTypeName + ": " + describeUrl); final SimpleFeatureType featureType; CoordinateReferenceSystem crs = getFeatureTypeCRS(prefixedTypeName); featureType = EmfAppSchemaParser.parseSimpleFeatureType(featureDescriptorName, describeUrl, crs); SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); builder.setName(prefixedTypeName); builder.setNamespaceURI(featureDescriptorName.getNamespaceURI()); GeometryDescriptor defaultGeometry = featureType.getGeometryDescriptor(); if (defaultGeometry != null) { builder.setDefaultGeometry(defaultGeometry.getLocalName()); builder.setCRS(defaultGeometry.getCoordinateReferenceSystem()); } final SimpleFeatureType adaptedFeatureType = builder.buildFeatureType(); ftype = adaptedFeatureType; byTypeNameTypes.put(prefixedTypeName, ftype); } return ftype; } }
WFS_1_1_0_DataStore implements WFSDataStore { public SimpleFeatureType getSchema(final String prefixedTypeName) throws IOException { SimpleFeatureType ftype = byTypeNameTypes.get(prefixedTypeName); if (ftype == null) { final QName featureDescriptorName; try { featureDescriptorName = wfs.getFeatureTypeName(prefixedTypeName); } catch (IllegalArgumentException e) { throw new SchemaNotFoundException(prefixedTypeName); } final URL describeUrl = wfs.getDescribeFeatureTypeURLGet(prefixedTypeName); System.err.println("DecribeFT URL for " + prefixedTypeName + ": " + describeUrl); final SimpleFeatureType featureType; CoordinateReferenceSystem crs = getFeatureTypeCRS(prefixedTypeName); featureType = EmfAppSchemaParser.parseSimpleFeatureType(featureDescriptorName, describeUrl, crs); SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); builder.setName(prefixedTypeName); builder.setNamespaceURI(featureDescriptorName.getNamespaceURI()); GeometryDescriptor defaultGeometry = featureType.getGeometryDescriptor(); if (defaultGeometry != null) { builder.setDefaultGeometry(defaultGeometry.getLocalName()); builder.setCRS(defaultGeometry.getCoordinateReferenceSystem()); } final SimpleFeatureType adaptedFeatureType = builder.buildFeatureType(); ftype = adaptedFeatureType; byTypeNameTypes.put(prefixedTypeName, ftype); } return ftype; } WFS_1_1_0_DataStore(final WFSProtocol wfs); }
WFS_1_1_0_DataStore implements WFSDataStore { public SimpleFeatureType getSchema(final String prefixedTypeName) throws IOException { SimpleFeatureType ftype = byTypeNameTypes.get(prefixedTypeName); if (ftype == null) { final QName featureDescriptorName; try { featureDescriptorName = wfs.getFeatureTypeName(prefixedTypeName); } catch (IllegalArgumentException e) { throw new SchemaNotFoundException(prefixedTypeName); } final URL describeUrl = wfs.getDescribeFeatureTypeURLGet(prefixedTypeName); System.err.println("DecribeFT URL for " + prefixedTypeName + ": " + describeUrl); final SimpleFeatureType featureType; CoordinateReferenceSystem crs = getFeatureTypeCRS(prefixedTypeName); featureType = EmfAppSchemaParser.parseSimpleFeatureType(featureDescriptorName, describeUrl, crs); SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); builder.setName(prefixedTypeName); builder.setNamespaceURI(featureDescriptorName.getNamespaceURI()); GeometryDescriptor defaultGeometry = featureType.getGeometryDescriptor(); if (defaultGeometry != null) { builder.setDefaultGeometry(defaultGeometry.getLocalName()); builder.setCRS(defaultGeometry.getCoordinateReferenceSystem()); } final SimpleFeatureType adaptedFeatureType = builder.buildFeatureType(); ftype = adaptedFeatureType; byTypeNameTypes.put(prefixedTypeName, ftype); } return ftype; } WFS_1_1_0_DataStore(final WFSProtocol wfs); void setMaxFeatures(Integer maxFeatures); Integer getMaxFeatures(); boolean isPreferPostOverGet(); void setPreferPostOverGet(Boolean booleanValue); WFSServiceInfo getInfo(); SimpleFeatureType getSchema(final String prefixedTypeName); SimpleFeatureType getSchema(Name name); List<Name> getNames(); String[] getTypeNames(); void dispose(); FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader(Query query,
            final Transaction transaction); WFSFeatureSource getFeatureSource(final String typeName); LockingManager getLockingManager(); FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter(String typeName,
            Filter filter, Transaction transaction); FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter(String typeName,
            Transaction transaction); FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriterAppend(String typeName,
            Transaction transaction); SimpleFeatureSource getFeatureSource(Name typeName); void updateSchema(Name typeName, SimpleFeatureType featureType); void updateSchema(String typeName, SimpleFeatureType featureType); void createSchema(SimpleFeatureType featureType); QName getFeatureTypeName(String typeName); String getFeatureTypeTitle(String typeName); String getFeatureTypeAbstract(String typeName); ReferencedEnvelope getFeatureTypeWGS84Bounds(String typeName); ReferencedEnvelope getFeatureTypeBounds(String typeName); CoordinateReferenceSystem getFeatureTypeCRS(String typeName); Set<String> getFeatureTypeKeywords(String typeName); URL getDescribeFeatureTypeURL(String typeName); String getServiceAbstract(); Set<String> getServiceKeywords(); URI getServiceProviderUri(); URL getCapabilitiesURL(); String getServiceTitle(); String getServiceVersion(); ReferencedEnvelope getBounds(final Query query); int getCount(final Query query); @Override String toString(); }
WFS_1_1_0_DataStore implements WFSDataStore { public SimpleFeatureType getSchema(final String prefixedTypeName) throws IOException { SimpleFeatureType ftype = byTypeNameTypes.get(prefixedTypeName); if (ftype == null) { final QName featureDescriptorName; try { featureDescriptorName = wfs.getFeatureTypeName(prefixedTypeName); } catch (IllegalArgumentException e) { throw new SchemaNotFoundException(prefixedTypeName); } final URL describeUrl = wfs.getDescribeFeatureTypeURLGet(prefixedTypeName); System.err.println("DecribeFT URL for " + prefixedTypeName + ": " + describeUrl); final SimpleFeatureType featureType; CoordinateReferenceSystem crs = getFeatureTypeCRS(prefixedTypeName); featureType = EmfAppSchemaParser.parseSimpleFeatureType(featureDescriptorName, describeUrl, crs); SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(featureType); builder.setName(prefixedTypeName); builder.setNamespaceURI(featureDescriptorName.getNamespaceURI()); GeometryDescriptor defaultGeometry = featureType.getGeometryDescriptor(); if (defaultGeometry != null) { builder.setDefaultGeometry(defaultGeometry.getLocalName()); builder.setCRS(defaultGeometry.getCoordinateReferenceSystem()); } final SimpleFeatureType adaptedFeatureType = builder.buildFeatureType(); ftype = adaptedFeatureType; byTypeNameTypes.put(prefixedTypeName, ftype); } return ftype; } WFS_1_1_0_DataStore(final WFSProtocol wfs); void setMaxFeatures(Integer maxFeatures); Integer getMaxFeatures(); boolean isPreferPostOverGet(); void setPreferPostOverGet(Boolean booleanValue); WFSServiceInfo getInfo(); SimpleFeatureType getSchema(final String prefixedTypeName); SimpleFeatureType getSchema(Name name); List<Name> getNames(); String[] getTypeNames(); void dispose(); FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader(Query query,
            final Transaction transaction); WFSFeatureSource getFeatureSource(final String typeName); LockingManager getLockingManager(); FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter(String typeName,
            Filter filter, Transaction transaction); FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter(String typeName,
            Transaction transaction); FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriterAppend(String typeName,
            Transaction transaction); SimpleFeatureSource getFeatureSource(Name typeName); void updateSchema(Name typeName, SimpleFeatureType featureType); void updateSchema(String typeName, SimpleFeatureType featureType); void createSchema(SimpleFeatureType featureType); QName getFeatureTypeName(String typeName); String getFeatureTypeTitle(String typeName); String getFeatureTypeAbstract(String typeName); ReferencedEnvelope getFeatureTypeWGS84Bounds(String typeName); ReferencedEnvelope getFeatureTypeBounds(String typeName); CoordinateReferenceSystem getFeatureTypeCRS(String typeName); Set<String> getFeatureTypeKeywords(String typeName); URL getDescribeFeatureTypeURL(String typeName); String getServiceAbstract(); Set<String> getServiceKeywords(); URI getServiceProviderUri(); URL getCapabilitiesURL(); String getServiceTitle(); String getServiceVersion(); ReferencedEnvelope getBounds(final Query query); int getCount(final Query query); @Override String toString();  }