Class EmfAppSchemaParser


  • public class EmfAppSchemaParser
    extends Object
    Utility class to parse FeatureType given by an XML schema location and the name of the Feature Element whose type is the one needed.

    Currently only simple FeatureTypes are supported. In the feature, complex schemas may be supported by porting the EmfAppSchemaParser class in the community schema datastore module, depending on the availability of complex Feature support on the mainstream GeoTools distribution.

    Since:
    2.5.x
    Author:
    Gabriel Roldan
    • Constructor Detail

      • EmfAppSchemaParser

        public EmfAppSchemaParser()
    • Method Detail

      • parseSimpleFeatureType

        public static SimpleFeatureType parseSimpleFeatureType​(Configuration wfsConfiguration,
                                                               QName featureName,
                                                               URL schemaLocation,
                                                               CoordinateReferenceSystem crs,
                                                               Map<QName,​Class<?>> mappedBindings)
                                                        throws IOException
        Parses the FeatureType pointed out by the schemaLocation URL and returns a subset consisting only of the simple attributes found on the original schema.

        Aditionally, the default properties inherited from gml:AbstractFeatureType (ie, gml:name, gml:location, etc), will be ignored.

        The returned SimpleFeatureType default geometry, thus, will be the first geometric attribute distinct from gml:location. Note: this code is borrowed and adapted from ParserHandler.startDocument()

        Parameters:
        wfsConfiguration - the WFS configuration for the parser to grab Bindings from.
        featureName - the qualified name of the Feature element in the schema, for which the feature type is to be parsed.
        schemaLocation - the location of the root schema file from where to parse the feature type.
        crs - the CRS to be assigned to the geometric attributes in the parsed feature type. This information shall be provided here as the schema itself has no knowledge of the CRS used.
        Throws:
        IOException
      • parse

        public static SimpleFeatureType parse​(Configuration wfsConfiguration,
                                              QName featureName,
                                              URL schemaLocation,
                                              CoordinateReferenceSystem crs,
                                              Map<QName,​Class<?>> mappedBindings)
                                       throws IOException
        Parses the FeatureType pointed out by the schemaLocation URL and returns it.

        The returned FeatureType default geometry, will be the first geometric attribute distinct from gml:location, or gml:location if no additional geometric property is found. Note: this code is borrowed and adapted from ParserHandler.startDocument()

        Parameters:
        wfsConfiguration - the WFS configuration for the parser to grab Bindings from.
        featureName - the qualified name of the Feature element in the schema, for which the feature type is to be parsed.
        schemaLocation - the location of the root schema file from where to parse the feature type.
        crs - the CRS to be assigned to the geometric attributes in the parsed feature type. This information shall be provided here as the schema itself has no knowledge of the CRS used.
        Throws:
        IOException