/** * Parses the gml schema referenced by <code>location</code> into a {@link SchemaIndex} * * @param location the physical location of the root xsd schema that comprises the application * schema to parse. * @throws IOException if any non recoverable problem occurs while parsing the application * schema pointed out by <code>location</code> or one of its dependencies. */ public SchemaIndex parse(final URL location) throws IOException { final String nameSpace = findSchemaNamespace(location); final String schemaLocation = location.toExternalForm(); return parse(nameSpace, schemaLocation); }
public static EmfComplexFeatureReader newInstance() { return new EmfComplexFeatureReader(); } }
/** * Parses the schema referenced by <code>location</code> into a {@link SchemaIndex} * * @param nameSpace the location namespace * @param location the physical location of the root xsd schema that comprises the application * schema to parse. * @throws IOException if any non recoverable problem occurs while parsing the application * schema pointed out by <code>location</code> or one of its dependencies. */ public SchemaIndex parse(String nameSpace, String schemaLocation) throws IOException { AppSchemaConfiguration configuration = new AppSchemaConfiguration(nameSpace, schemaLocation, resolver); return parse(configuration); }
/** * Get the schema parser, creating it first if necessary. * * @return the schema parser. Guaranteed non-null. */ private EmfComplexFeatureReader getSchemaParser() { if (this.schemaParser == null) { this.schemaParser = EmfComplexFeatureReader.newInstance(); SchemaResolver appSchemaResolver; if (this.cacheLocation == null) { appSchemaResolver = new SchemaResolver(); } else { appSchemaResolver = new SchemaResolver( new SchemaCache( this.cacheLocation, /* download: */ true, /* keepQuery: */ true)); } this.schemaParser.setResolver(appSchemaResolver); } return this.schemaParser; }
@Override public FeatureType getSchema(Name name) throws IOException { // If there are no values in this.names it probably means that getNames // hasn't been called yet. if (this.names.size() == 0) { this.getNames(); } // Generate the URL for the feature request: // ----------------------------------------- DescribeFeatureTypeRequest describeFeatureTypeRequest = client.createDescribeFeatureTypeRequest(); QName qname = this.names.get(name); describeFeatureTypeRequest.setTypeName(qname); URL describeRequestURL = describeFeatureTypeRequest.getFinalURL(); // Create type registry and add the schema to it: // ---------------------------------------------- FeatureTypeRegistry typeRegistry = this.getFeatureTypeRegistry(); SchemaIndex schemaIndex = this.getSchemaParser().parse(describeRequestURL); typeRegistry.addSchemas(schemaIndex); // Create the attribute type and cast it as a FeatureType: // ------------------------------------------------------- AttributeDescriptor attributeDescriptor = typeRegistry.getDescriptor(name, null); return (FeatureType) attributeDescriptor.getType(); }