deegree 2.5 (2011/06/29 09:44 build-8-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: 27623 $, $Date: 2010-10-29 13:46:19 +0200 (Fr, 29 Okt 2010) $
Author:
Markus Schneider , last edited by: $Author: aschmitz $

Field Summary
protected  java.util.Map<QualifiedName,FeatureType> featureTypeMap
           
protected  java.util.Map<FeatureType,java.util.List<FeatureType>> substitutionMap
           
 
Constructor Summary
protected GMLSchema(ElementDeclaration[] elementDeclarations, java.net.URI targetNamespace, SimpleTypeDeclaration[] simpleTypes, ComplexTypeDeclaration[] complexTypes)
           
  GMLSchema(java.net.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(java.lang.String localName)
          Looks up the FeatureType with the given local name.
 FeatureType[] getFeatureTypes()
          Returns all FeatureTypes that are defined in the schema.
 java.util.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).
 java.lang.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 java.util.Map<QualifiedName,FeatureType> featureTypeMap

substitutionMap

protected java.util.Map<FeatureType,java.util.List<FeatureType>> substitutionMap
Constructor Detail

GMLSchema

public GMLSchema(java.net.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,
                    java.net.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(java.lang.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 java.util.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 java.lang.String toString()
Returns a string representation of the object.

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

deegree 2.5 (2011/06/29 09:44 build-8-official)

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