Class TLcdISO19139MetadataEncoder

java.lang.Object
com.luciad.format.metadata.xml.TLcdISO19139MetadataEncoder
All Implemented Interfaces:
ILcdOutputStreamFactoryCapable

public class TLcdISO19139MetadataEncoder extends Object implements ILcdOutputStreamFactoryCapable
This class represents an ISO 19139 data source encoder.

ISO 19139 defines the XML encoding for the metadata model ISO 19115. An implementation and domain model for ISO 19115 is available in the model package.

This encoder can encode any instance of classes in the metadata domain model.

Encoding

There are 2 encoding methods available:
  • encodeMetadata: use this method to encode a single metadata entity (TLcdISO19115Metadata)
  • encodeObject: use this method for all other metadata objects (e.g. TLcdISO19115DataSet, TLcdISO19115Series, ...)

Extensions

This encoder also supports extension schemas of the ISO 19139 schemas. The encoder may be preconfigured for a particular extension schema, as illustrated in the following snippet:
   TLcdXMLDataModelBuilder dataModelBuilder = new TLcdXMLDataModelBuilder( TLcdISO19115DataTypes.getDataModel() );
   dataModelBuilder.setEntityResolver( new TLcdXMLEntityResolver() );
   TLcdDataModel dataModel = dataModelBuilder.createDataModel(
     "http://myextensionnamespace.com", "http://myextensionnamespace.com", "/myextensionschemalocation.xsd" );
   TLcdISO19139MetadataEncoder encoder = new TLcdISO19139MetadataEncoder( dataModel );
 

Supported versions and specifications

The reference of the currently supported ISO 19139 specification is ISO/TC 19139:2007(E). For more information, see http://www.isotc211.org/.

This encoder uses Java's StAX (Streaming API for XML) API. See Oracle's StAX tutorial for more information on the use of StAX.

Since:
10.0
See Also:
  • Constructor Details

    • TLcdISO19139MetadataEncoder

      public TLcdISO19139MetadataEncoder()
      Creates a new TLcdISO19139MetadataEncoder instance. This encoder is configured for encoding any data type in the ISO19115 data model.
      See Also:
    • TLcdISO19139MetadataEncoder

      public TLcdISO19139MetadataEncoder(TLcdDataModel aDataModel)
      Creates a new TLcdISO19139MetadataEncoder instance, configured for encoding the given ISO19115 extension. The initialized encoder also supports all data types in the ISO19115 data model.
      Parameters:
      aDataModel - a data model representing an ISO191115 extension. The data model should be built from an XML schema using TLcdXMLDataModelBuilder, and should depend on the ISO19115 data model.
      See Also:
  • Method Details

    • getOutputStreamFactory

      public ILcdOutputStreamFactory getOutputStreamFactory()
      Returns the ILcdOutputStreamFactory that is used for creating output streams.
      Specified by:
      getOutputStreamFactory in interface ILcdOutputStreamFactoryCapable
      Returns:
      the ILcdOutputStreamFactory that is used for creating output streams.
      See Also:
    • setOutputStreamFactory

      public void setOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory)
      Sets the ILcdOutputStreamFactory to be used for creating output streams. This output stream factory is used for output streams for both the data files and the XSD schemas.
      Specified by:
      setOutputStreamFactory in interface ILcdOutputStreamFactoryCapable
      Parameters:
      aOutputStreamFactory - the output stream factory to be used by this model encoder.
      See Also:
    • getXMLOutputFactory

      public XMLOutputFactory getXMLOutputFactory()
      Returns the javax.xml.stream.XMLOutputFactory that is used by this encoder for creating javax.xml.stream.XMLStreamWriter instances.
      Returns:
      the javax.xml.stream.XMLOutputFactory that is used by this encoder for creating javax.xml.stream.XMLStreamWriter instances.
    • setXMLOutputFactory

      public void setXMLOutputFactory(XMLOutputFactory aXMLOutputFactory)
      Sets the javax.xml.stream.XMLOutputFactory to be used by this encoder for creating javax.xml.stream.XMLStreamWriter instances.
      Parameters:
      aXMLOutputFactory - the javax.xml.stream.XMLOutputFactory to be used by this encoder for creating javax.xml.stream.XMLStreamWriter instances.
    • getEntityResolver

      public EntityResolver2 getEntityResolver()
      Returns the org.xml.sax.ext.EntityResolver2 that is used for creating input sources for XSD schemas.
      Returns:
      the entity resolver to be used for creating input sources for XSD schemas.
    • setEntityResolver

      public void setEntityResolver(EntityResolver2 aEntityResolver)
      Sets the org.xml.sax.ext.EntityResolver2 to be used for creating input sources for XSD schemas. This entity resolver is only used for retrieving runtime extension schemas.
      Parameters:
      aEntityResolver - the entity resolver to be used for creating input sources for XSD schemas.
    • isUseApplicationSchemaCache

      public boolean isUseApplicationSchemaCache()

      Returns if application schemas are cached. When application schemas are cached, the encoder caches all applications schemas it encounters. When a certain schema is referenced during decoding, only if the schema is not found in the cache, it will be resolved. The default is true.

      Note that in case multiple application schemas use the same namespace URI, it is not possible to turn on application schema caching because the encoder will not be able to discern between the different schemas.

      Returns:
      if application schemas are cached
      Since:
      2017.1
    • setUseApplicationSchemaCache

      public void setUseApplicationSchemaCache(boolean aUseCache)
      Enables or disables application schema caching depending on the parameter value.
      Parameters:
      aUseCache - if true, application schema caching is turned on. If false, caching is turned off.
      Since:
      2017.1
    • encodeMetadata

      public void encodeMetadata(TLcdISO19115Metadata aMetadata, String aDestination) throws IOException
      Encodes an ISO 19115 metadata domain object to an ISO 19139 data source.
      Parameters:
      aMetadata - the ISO 19115 metadata domain object to be encoded.
      aDestination - the location where the ISO 19139 data should be saved.
      Throws:
      IOException - if an I/O error occurs during encoding.
    • encodeObject

      public void encodeObject(ILcdDataObject aMetadataObject, String aDestination) throws IOException
      Encodes an ISO 19115 domain object to an ISO 19139 data source. The given domain object should be an instance of a class in the com.luciad.format.metadata.model package or any of its subpackages.
      Parameters:
      aMetadataObject - the ISO 19115 metadata domain object to be encoded.
      aDestination - the location where the ISO 19139 data should be saved.
      Throws:
      IOException - if an I/O error occurs during encoding.