Package com.luciad.format.metadata.xml
Class TLcdISO19139MetadataEncoder
java.lang.Object
com.luciad.format.metadata.xml.TLcdISO19139MetadataEncoder
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionCreates a newTLcdISO19139MetadataEncoderinstance.TLcdISO19139MetadataEncoder(TLcdDataModel aDataModel) Creates a newTLcdISO19139MetadataEncoderinstance, configured for encoding the given ISO19115 extension. -
Method Summary
Modifier and TypeMethodDescriptionvoidencodeMetadata(TLcdISO19115Metadata aMetadata, String aDestination) Encodes an ISO 19115 metadata domain object to an ISO 19139 data source.voidencodeObject(ILcdDataObject aMetadataObject, String aDestination) Encodes an ISO 19115 domain object to an ISO 19139 data source.Returns theorg.xml.sax.ext.EntityResolver2that is used for creating input sources for XSD schemas.Returns theILcdOutputStreamFactorythat is used for creating output streams.Returns thejavax.xml.stream.XMLOutputFactorythat is used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.booleanReturns if application schemas are cached.voidsetEntityResolver(EntityResolver2 aEntityResolver) Sets theorg.xml.sax.ext.EntityResolver2to be used for creating input sources for XSD schemas.voidsetOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory) Sets theILcdOutputStreamFactoryto be used for creating output streams.voidsetUseApplicationSchemaCache(boolean aUseCache) Enables or disables application schema caching depending on the parameter value.voidsetXMLOutputFactory(XMLOutputFactory aXMLOutputFactory) Sets thejavax.xml.stream.XMLOutputFactoryto be used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.
-
Constructor Details
-
TLcdISO19139MetadataEncoder
public TLcdISO19139MetadataEncoder()Creates a newTLcdISO19139MetadataEncoderinstance. This encoder is configured for encoding any data type in the ISO19115 data model.- See Also:
-
TLcdISO19139MetadataEncoder
Creates a newTLcdISO19139MetadataEncoderinstance, 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
Returns theILcdOutputStreamFactorythat is used for creating output streams.- Specified by:
getOutputStreamFactoryin interfaceILcdOutputStreamFactoryCapable- Returns:
- the
ILcdOutputStreamFactorythat is used for creating output streams. - See Also:
-
setOutputStreamFactory
Sets theILcdOutputStreamFactoryto 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:
setOutputStreamFactoryin interfaceILcdOutputStreamFactoryCapable- Parameters:
aOutputStreamFactory- the output stream factory to be used by this model encoder.- See Also:
-
getXMLOutputFactory
Returns thejavax.xml.stream.XMLOutputFactorythat is used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.- Returns:
- the
javax.xml.stream.XMLOutputFactorythat is used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.
-
setXMLOutputFactory
Sets thejavax.xml.stream.XMLOutputFactoryto be used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.- Parameters:
aXMLOutputFactory- thejavax.xml.stream.XMLOutputFactoryto be used by this encoder for creatingjavax.xml.stream.XMLStreamWriterinstances.
-
getEntityResolver
Returns theorg.xml.sax.ext.EntityResolver2that is used for creating input sources for XSD schemas.- Returns:
- the entity resolver to be used for creating input sources for XSD schemas.
-
setEntityResolver
Sets theorg.xml.sax.ext.EntityResolver2to 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
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
Encodes an ISO 19115 domain object to an ISO 19139 data source. The given domain object should be an instance of a class in thecom.luciad.format.metadata.modelpackage 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.
-