org.deegree.feature.types
Class GenericAppSchema

java.lang.Object
  extended by org.deegree.feature.types.GenericAppSchema
All Implemented Interfaces:
AppSchema
Direct Known Subclasses:
MappedAppSchema

public class GenericAppSchema
extends Object
implements AppSchema

Generic AppSchema implementation, can be used for representing arbitrary application schemas.

Version:
$Revision:$, $Date:$
Author:
Markus Schneider , last edited by: $Author:$

Constructor Summary
GenericAppSchema(FeatureType[] fts, Map<FeatureType,FeatureType> ftToSuperFt, Map<String,String> prefixToNs, GMLSchemaInfoSet xsModel)
          Creates a new GenericAppSchema instance from the given FeatureTypes and their derivation hierarchy.
 
Method Summary
 Map<QName,org.apache.xerces.xs.XSElementDeclaration> getAllowedChildElementDecls(org.apache.xerces.xs.XSComplexTypeDefinition type)
          Returns the child elements that the given complex type definition allows for.
 Set<String> getAppNamespaces()
          Returns the application namespaces.
 FeatureType[] getConcreteSubtypes(FeatureType ft)
          Retrieves all concrete substitutions for the given feature type.
 ObjectPropertyType getCustomElDecl(org.apache.xerces.xs.XSElementDeclaration elDecl)
          Returns the ObjectPropertyType for the given element declaration (if it defines an object property).
 FeatureType[] getDirectSubtypes(FeatureType ft)
          Retrieves the direct subtypes for the given feature type.
 FeatureType getFeatureType(QName ftName)
          Retrieves the feature type with the given name.
 FeatureType[] getFeatureTypes()
          Returns all feature types that are defined in this application schema.
 List<FeatureType> getFeatureTypes(String namespace, boolean includeCollections, boolean includeAbstracts)
          Returns all feature types that are defined in this application schema, limited by the options.
 Map<FeatureType,FeatureType> getFtToSuperFt()
           
 GMLSchemaInfoSet getGMLSchema()
          Returns the underlying GMLSchemaInfoSet
 Map<String,String> getNamespaceBindings()
          Returns the preferred namespace bindings for all namespaces.
 List<String> getNamespacesDependencies(String ns)
          Returns the namespaces that the definitions in the given namespace depend upon (excluding transitive dependencies).
 List<PropertyType> getNewPropertyDecls(FeatureType ft)
          Returns the PropertyTypes from the specified FeatureType declaration that are *not* present in the parent FeatureType or its ancestors.
 FeatureType getParent(FeatureType ft)
          Retrieves the parent feature type for the specified feature type.
 FeatureType[] getRootFeatureTypes()
          Returns all root feature types that are defined in this application schema.
 FeatureType[] getSubtypes(FeatureType ft)
          Retrieves all substitutions (abstract and non-abstract ones) for the given feature type.
 boolean isSubType(FeatureType ft, FeatureType substitution)
          Determines whether a feature type is substitutable for another feature type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericAppSchema

public GenericAppSchema(FeatureType[] fts,
                        Map<FeatureType,FeatureType> ftToSuperFt,
                        Map<String,String> prefixToNs,
                        GMLSchemaInfoSet xsModel)
                 throws IllegalArgumentException
Creates a new GenericAppSchema instance from the given FeatureTypes and their derivation hierarchy.

Parameters:
fts - all application feature types (abstract and non-abstract), this must not include any GML base feature types (e.g. gml:_Feature or gml:FeatureCollection), must not be null
ftToSuperFt - key: feature type A, value: feature type B (A extends B), this must not include any GML base feature types (e.g. gml:_Feature or gml:FeatureCollection), can be null
xsModel - full XML schema infoset (e.g. for custom property type definitions, etc.), may be null
prefixToNs - preferred namespace prefixes to use, key: prefix, value: namespace, may be null
Throws:
IllegalArgumentException - if a feature type cannot be resolved (i.e. it is referenced in a property type, but not defined)
Method Detail

getFeatureTypes

public FeatureType[] getFeatureTypes()
Description copied from interface: AppSchema
Returns all feature types that are defined in this application schema.

Specified by:
getFeatureTypes in interface AppSchema
Returns:
all feature types, never null

getFeatureTypes

public List<FeatureType> getFeatureTypes(String namespace,
                                         boolean includeCollections,
                                         boolean includeAbstracts)
Description copied from interface: AppSchema
Returns all feature types that are defined in this application schema, limited by the options.

Specified by:
getFeatureTypes in interface AppSchema
Parameters:
namespace - may be null (include all feature types from all namespaces)
includeCollections - set to true, if feature collection types shall be included, false otherwise
includeAbstracts - set to true, if abstract types shall be included, false otherwise
Returns:
all feature types, never null

getRootFeatureTypes

public FeatureType[] getRootFeatureTypes()
Description copied from interface: AppSchema
Returns all root feature types that are defined in this application schema.

Specified by:
getRootFeatureTypes in interface AppSchema
Returns:
all root feature types, never null

getFeatureType

public FeatureType getFeatureType(QName ftName)
Description copied from interface: AppSchema
Retrieves the feature type with the given name.

Specified by:
getFeatureType in interface AppSchema
Parameters:
ftName - feature type name to look up, must not be null
Returns:
the feature type with the given name, or null if no such feature type exists

getDirectSubtypes

public FeatureType[] getDirectSubtypes(FeatureType ft)
Description copied from interface: AppSchema
Retrieves the direct subtypes for the given feature type.

Specified by:
getDirectSubtypes in interface AppSchema
Parameters:
ft - feature type, must not be null
Returns:
the direct subtypes of the given feature type (abstract and non-abstract)

getParent

public FeatureType getParent(FeatureType ft)
Description copied from interface: AppSchema
Retrieves the parent feature type for the specified feature type.

Specified by:
getParent in interface AppSchema
Parameters:
ft - feature type, must not be null
Returns:
parent feature type, can be null

getSubtypes

public FeatureType[] getSubtypes(FeatureType ft)
Description copied from interface: AppSchema
Retrieves all substitutions (abstract and non-abstract ones) for the given feature type.

Specified by:
getSubtypes in interface AppSchema
Parameters:
ft - feature type, must not be null
Returns:
all substitutions for the given feature type, never null

getConcreteSubtypes

public FeatureType[] getConcreteSubtypes(FeatureType ft)
Description copied from interface: AppSchema
Retrieves all concrete substitutions for the given feature type.

Specified by:
getConcreteSubtypes in interface AppSchema
Parameters:
ft - feature type, must not be null
Returns:
all concrete substitutions for the given feature type, never null

getGMLSchema

public GMLSchemaInfoSet getGMLSchema()
Description copied from interface: AppSchema
Returns the underlying GMLSchemaInfoSet

Specified by:
getGMLSchema in interface AppSchema
Returns:
the underlying GML schema, can be null (not based on a GML schema)

isSubType

public boolean isSubType(FeatureType ft,
                         FeatureType substitution)
Description copied from interface: AppSchema
Determines whether a feature type is substitutable for another feature type.

This is true, iff substitution is either:

Specified by:
isSubType in interface AppSchema
Parameters:
ft - base feature type, must be part of this schema
substitution - feature type to be checked, must be part of this schema
Returns:
true, if the second feature type is a valid substitution for the first one

getNewPropertyDecls

public List<PropertyType> getNewPropertyDecls(FeatureType ft)
Description copied from interface: AppSchema
Returns the PropertyTypes from the specified FeatureType declaration that are *not* present in the parent FeatureType or its ancestors.

Specified by:
getNewPropertyDecls in interface AppSchema
Parameters:
ft - feature type, must not be null
Returns:
list of property declarations, may be empty, but never null

getFtToSuperFt

public Map<FeatureType,FeatureType> getFtToSuperFt()
Specified by:
getFtToSuperFt in interface AppSchema

getNamespaceBindings

public Map<String,String> getNamespaceBindings()
Description copied from interface: AppSchema
Returns the preferred namespace bindings for all namespaces.

Specified by:
getNamespaceBindings in interface AppSchema
Returns:
the preferred namespace bindings for all namespaces, never null

getAllowedChildElementDecls

public Map<QName,org.apache.xerces.xs.XSElementDeclaration> getAllowedChildElementDecls(org.apache.xerces.xs.XSComplexTypeDefinition type)
Description copied from interface: AppSchema
Returns the child elements that the given complex type definition allows for.

TODO: Respect order and cardinality of child elements.

Specified by:
getAllowedChildElementDecls in interface AppSchema
Parameters:
type - complex type definition, must not be null
Returns:
the child elements, never null

getAppNamespaces

public Set<String> getAppNamespaces()
Description copied from interface: AppSchema
Returns the application namespaces.

NOTE: This excludes the GML core namespaces.

Specified by:
getAppNamespaces in interface AppSchema
Returns:
the application namespaces, never null

getNamespacesDependencies

public List<String> getNamespacesDependencies(String ns)
Description copied from interface: AppSchema
Returns the namespaces that the definitions in the given namespace depend upon (excluding transitive dependencies).

Specified by:
getNamespacesDependencies in interface AppSchema
Parameters:
ns - application namespace, must not be null
Returns:
namespace dependencies, may be empty, but never null

getCustomElDecl

public ObjectPropertyType getCustomElDecl(org.apache.xerces.xs.XSElementDeclaration elDecl)
Description copied from interface: AppSchema
Returns the ObjectPropertyType for the given element declaration (if it defines an object property).

Specified by:
getCustomElDecl in interface AppSchema
Parameters:
elDecl - element declaration, must not be null
Returns:
property declaration or null (if the element does not declare an ObjectPropertyType)


Copyright © 2011. All Rights Reserved.