deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.model.feature.schema
Class GMLSchema

java.lang.Object
  extended by org.deegree.framework.xml.schema.XMLSchema
      extended by org.deegree.model.feature.schema.GMLSchema
Direct Known Subclasses:
MappedGMLSchema

public class GMLSchema
extends XMLSchema

Represents a GML application schema document to provide easy access to it's components, especially the FeatureType definitions.

Version:
$Revision: 18961 $, $Date: 2009-08-06 13:30:10 +0200 (Do, 06. Aug 2009) $
Author:
Markus Schneider , last edited by: $Author: apoth $

Field Summary
protected  Map<QualifiedName,FeatureType> featureTypeMap
           
protected  Map<FeatureType,List<FeatureType>> substitutionMap
           
 
Constructor Summary
protected GMLSchema(ElementDeclaration[] elementDeclarations, URI targetNamespace, SimpleTypeDeclaration[] simpleTypes, ComplexTypeDeclaration[] complexTypes)
           
  GMLSchema(URI targetNamespace, SimpleTypeDeclaration[] simpleTypes, ComplexTypeDeclaration[] complexTypes, ElementDeclaration[] elementDeclarations)
          Creates a new GMLSchema instance from the given parameters.
 
Method Summary
protected  FeatureType buildFeatureType(ElementDeclaration element)
           
protected  void buildFeatureTypeMap(ElementDeclaration[] elementDeclarations)
          Initializes the internal feature type map which is used to lookup feature types by name.
protected  PropertyType buildPropertyType(ElementDeclaration element)
           
protected  void buildSubstitutionMap(ElementDeclaration[] elementDeclarations)
          Initializes the internal feature type substitution map which is used to lookup substitutions for feature types.
protected  int determinePropertyType(ElementDeclaration element)
          Heuristic method that tries to determine the type of GML property that is defined in an XSD element declaration.
 FeatureType getFeatureType(QualifiedName qName)
          Looks up the FeatureType with the given QualifiedName.
 FeatureType getFeatureType(String localName)
          Looks up the FeatureType with the given local name.
 FeatureType[] getFeatureTypes()
          Returns all FeatureTypes that are defined in the schema.
 Set<FeatureType> getSubstitutables(FeatureType substitution)
          Returns all types (abstract or concrete) that are substitutable by the given type.
 FeatureType[] getSubstitutions(FeatureType featureType)
          Returns all non-abstract implementations of a given feature type that are defined in this schema.
 boolean hasSeveralImplementations(FeatureType ft)
          Return whether the given feature type has more than one concrete substitution.
 boolean isValidSubstitution(FeatureType ft, FeatureType substitution)
          Returns whether the specified feature type is a valid substitution for the other specified feature type (according to the schema).
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class org.deegree.framework.xml.schema.XMLSchema
getComplexTypeDeclaration, getComplexTypeDeclaration, getComplexTypeDeclarations, getElementDeclaration, getElementDeclaration, getElementDeclarations, getSimpleTypeDeclaration, getSimpleTypeDeclaration, getSimpleTypeDeclarations, getTargetNamespace, getTypeDeclaration, getTypeDeclaration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

featureTypeMap

protected Map<QualifiedName,FeatureType> featureTypeMap

substitutionMap

protected Map<FeatureType,List<FeatureType>> substitutionMap
Constructor Detail

GMLSchema

public GMLSchema(URI targetNamespace,
                 SimpleTypeDeclaration[] simpleTypes,
                 ComplexTypeDeclaration[] complexTypes,
                 ElementDeclaration[] elementDeclarations)
          throws XMLParsingException,
                 UnknownCRSException
Creates a new GMLSchema instance from the given parameters.

Parameters:
targetNamespace -
simpleTypes -
complexTypes -
elementDeclarations -
Throws:
XMLParsingException
UnknownCRSException

GMLSchema

protected GMLSchema(ElementDeclaration[] elementDeclarations,
                    URI targetNamespace,
                    SimpleTypeDeclaration[] simpleTypes,
                    ComplexTypeDeclaration[] complexTypes)
             throws XMLSchemaException
Throws:
XMLSchemaException
Method Detail

getFeatureTypes

public FeatureType[] getFeatureTypes()
Returns all FeatureTypes that are defined in the schema.

Returns:
all FeatureTypes

getFeatureType

public FeatureType getFeatureType(QualifiedName qName)
Looks up the FeatureType with the given QualifiedName.

Parameters:
qName - the QualifiedName to look up
Returns:
the FeatureType, if it is defined in the document, null otherwise

getFeatureType

public FeatureType getFeatureType(String localName)
Looks up the FeatureType with the given local name.

Parameters:
localName - the name to look up
Returns:
the FeatureType, if it is defined in the document, null otherwise

hasSeveralImplementations

public boolean hasSeveralImplementations(FeatureType ft)
Return whether the given feature type has more than one concrete substitution.

Read as: Is there only one concrete feature type that all instances of this type must have? Or are there several possible concrete subtypes?

Parameters:
ft - feature type to check
Returns:
true, if the feature type has more than once concrete implementations, false otherwise

getSubstitutions

public FeatureType[] getSubstitutions(FeatureType featureType)
Returns all non-abstract implementations of a given feature type that are defined in this schema.

Parameters:
featureType -
Returns:
all non-abstract implementations of the feature type

isValidSubstitution

public boolean isValidSubstitution(FeatureType ft,
                                   FeatureType substitution)
Returns whether the specified feature type is a valid substitution for the other specified feature type (according to the schema).

Parameters:
ft -
substitution -
Returns:
true, if it is valid substitution, false otherwise

getSubstitutables

public Set<FeatureType> getSubstitutables(FeatureType substitution)
Returns all types (abstract or concrete) that are substitutable by the given type. TODO implement this a better way

Parameters:
substitution -
Returns:
all types that are substitutable by substitution

buildFeatureTypeMap

protected void buildFeatureTypeMap(ElementDeclaration[] elementDeclarations)
                            throws XMLParsingException,
                                   UnknownCRSException
Initializes the internal feature type map which is used to lookup feature types by name.

Parameters:
elementDeclarations - element declarations to process, only element declarations that are substitutable for "gml:_Feature" are considered
Throws:
XMLParsingException
UnknownCRSException

buildSubstitutionMap

protected void buildSubstitutionMap(ElementDeclaration[] elementDeclarations)
Initializes the internal feature type substitution map which is used to lookup substitutions for feature types.

NOTE: As this method relies on the feature type map, #initializeFeatureTypeMap(ElementDeclaration[]) must have been executed before.

Parameters:
elementDeclarations - element declarations of the feature types to process
See Also:
buildFeatureTypeMap(ElementDeclaration[])

buildFeatureType

protected FeatureType buildFeatureType(ElementDeclaration element)
                                throws XMLParsingException,
                                       UnknownCRSException
Throws:
XMLParsingException
UnknownCRSException

buildPropertyType

protected PropertyType buildPropertyType(ElementDeclaration element)
                                  throws XMLSchemaException
Throws:
XMLSchemaException

determinePropertyType

protected final int determinePropertyType(ElementDeclaration element)
                                   throws UndefinedXSDTypeException
Heuristic method that tries to determine the type of GML property that is defined in an XSD element declaration.

Parameters:
element - ElementDeclaration that is a GML property definition
Returns:
type code from Types
Throws:
UndefinedXSDTypeException
See Also:
Types

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class XMLSchema
Returns:
a string representation of the object

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org