Class TLcdXMLSchemaBasedMapping

java.lang.Object
com.luciad.format.xml.bind.schema.TLcdXMLSchemaBasedMapping
All Implemented Interfaces:
ILcdInputStreamFactoryCapable

public class TLcdXMLSchemaBasedMapping extends Object implements ILcdInputStreamFactoryCapable
Contains information common to XML decoders and encoders.

This includes:

  • information about the elements and types defined in the XML Schemas, supported by XML decoder/encoder.
  • object factories for all types declared in these XML Schemas.
  • Locations where the XML Schemas can be found.

Please refer to this package's documentation and the com.luciad.format.xml.bind package documentation for a general overview of the XML Binding Framework.

Since:
9.0
  • Constructor Details

    • TLcdXMLSchemaBasedMapping

      public TLcdXMLSchemaBasedMapping()
      Creates a new, empty com.luciad.format.xml.bind.schema.TLcdXMLSchemaMapping.
    • TLcdXMLSchemaBasedMapping

      public TLcdXMLSchemaBasedMapping(ILcdXMLSchemaBasedMappingLibrary aLibrary)
      Creates a new com.luciad.format.xml.bind.schema.TLcdXMLSchemaMapping for the specified mapping library.
      Parameters:
      aLibrary - the mapping library for which to create a mapping.
    • TLcdXMLSchemaBasedMapping

      public TLcdXMLSchemaBasedMapping(List<ILcdXMLSchemaBasedMappingLibrary> aLibrary)
      Creates a new com.luciad.format.xml.bind.schema.TLcdXMLSchemaMapping for the specified mapping libraries.
      Parameters:
      aLibrary - the mapping libraries for which to create a mapping.
    • TLcdXMLSchemaBasedMapping

      public TLcdXMLSchemaBasedMapping(ILcdXMLSchemaBasedMappingLibrary... aLibrary)
      Creates a new com.luciad.format.xml.bind.schema.TLcdXMLSchemaMapping for the specified mapping libraries.
      Parameters:
      aLibrary - the mapping libraries for which to create a mapping.
  • Method Details

    • createObject

      public <T> T createObject(TLcdXMLSchemaTypeIdentifier aTypeId, Class<T> aClass, ILcdXMLDocumentContext aDocumentContext)
      Creates a new object instance for the specified XML Schema type, of the specified class (or subclass).

      This method will retrieve the object factory for the specified [XML Schema type, Java class] pair and call the createObject() method of this factory.

      Type Parameters:
      T - the class the created object should be assignable to.
      Parameters:
      aTypeId - the XML Schema type for which to create an object.
      aClass - the Java class the created object should be assignable to.
      aDocumentContext - the document context providing additional information about the document in which the object will be included.
      Returns:
      a new object instance for the specified XML Schema type and Java class.
    • getSchemaSet

      public TLcdXMLSchemaSet getSchemaSet()
      Returns the TLcdXMLSchemaSet object containing all XML Schema information used by this mapping.
      Returns:
      the TLcdXMLSchemaSet object containing all XML Schema information used by this mapping.
    • getTypeObjectFactoryProvider

      public TLcdXMLTypeObjectFactoryProvider getTypeObjectFactoryProvider()
      Returns the schema object factory provider of this mapping.
      Returns:
      the schema object factory provider of this mapping.
    • getNamespaceURIs

      public Set<String> getNamespaceURIs()
      Returns the set of namespaces which are supported by this mapping.
      Returns:
      the set of namespaces which are supported by this mapping.
    • registerNamespaceURI

      public void registerNamespaceURI(String aNamespaceURI)
      Registers the specified namespace on this mapping. Namespaces should be registered to indicate that they are supported by this mapping.
      Parameters:
      aNamespaceURI - the namespace for which object factories and additional information are registered on this mapping.
    • getJavaClassResolver

      public TLcdXMLJavaClassResolver getJavaClassResolver()
      Returns the TLcdXMLJavaClassResolver used by this mapping. See TLcdXMLJavaClassResolver for more information.
      Returns:
      the TLcdXMLJavaClassResolver used by this mapping.
    • getProperty

      public Object getProperty(String aName)
      Returns the custom property with the specified name.
      Parameters:
      aName - the name of the custom property to be returned.
      Returns:
      the custom property registered with the specified name.
    • setProperty

      public void setProperty(String aName, Object aValue)
      Sets the specified custom property on this, to be shared among users of this mapping.
      Parameters:
      aName - the name of the custom property to be set.
      aValue - the property to be set.
    • getDefaultEntityResolver

      public EntityResolver2 getDefaultEntityResolver()

      Returns the default entity resolver to be used for resolving XML Schemas. The default entity resolver configured on this instance will use the schema locations map of this mapping to search for schema locations.

      When the default entity resolver is unable to find a schema (i.e. the resolveEntity method returns null), the getInputStreamFactory() is used to create an appropriate input stream for the given system id of the schema.

      Returns:
      the default entity resolver to be used for resolving XML Schemas.
      See Also:
    • setDefaultEntityResolver

      public void setDefaultEntityResolver(EntityResolver2 aEntityResolver)

      Sets the default entity resolver to be used for resolving XML Schemas.

      When the default entity resolver is unable to find a schema (i.e. the resolveEntity method returns null), the getInputStreamFactory() is used to create an appropriate input stream for the given system id of the schema.

      Parameters:
      aEntityResolver - the default entity resolver to be used for resolving XML Schemas.
      See Also:
    • getSchemaLocations

      public Map<String,String> getSchemaLocations()

      Returns a map containing as keys the namespaces of all mapped XML Schemas, and as values their corresponding schema locations.

      Note that the values for the schema locations should be valid URI's and as such contain no spaces and other control characters.

      Returns:
      a map with a [namespace, schema location] pair for each mapped XML Schema.
    • configure

      public void configure(TLcdDataModel aDataModel)

      Configures this mapping for the given data model and all its dependencies. Configuration is done using all ILcdXMLSchemaBasedMappingLibrary instances that are annotated (see TLcdXMLSchemaMappingAnnotation) on the given data model and its dependencies.

      Note that creating a new mapping and configuring it with a data model is equivalent to creating a mapping with the mapping libraries of the data model and all its dependencies as constructor parameters.

      Parameters:
      aDataModel - the data model for which this mapping is to be configured
    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)

      Sets the ILcdInputStreamFactory that is used to create input streams for schemas that are not handled by the default entity resolver.

      If the default entity resolver is ILcdInputStreamFactoryCapable then the input stream of the entity resolver is also set to this input stream.

      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - the input stream factory that will be used to resolve schemas
      See Also:
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Returns the ILcdInputStreamFactory that is used to create input streams for schemas that are not handled by the default entity resolver.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      aInputStreamFactory the input stream factory that will be used to resolve schemas
      See Also: