Class TLcdS63CatalogueModelDecoder
- All Implemented Interfaces:
ILcdMetadataDecoder,ILcdInputStreamFactoryCapable,ILcdDataSourceModelDecoder,ILcdModelDecoder
ILcdModelDecoder decodes S-57 catalogues, encrypted according to the S-63 standard.
These formats are published by the International Hydrographic
Organization in "IHO Transfer Standard for Digital Hydrographic Data, Special Publications No. 57
and No. 63".
To decode S-63 data, the following properties should be set on the TLcdS63ModelDecoder used by this
catalogue decoder (retrievable via #getS57ModelDecoder()):
- the location of the SA (scheme administrator) public key: this can be done by either
- setting the SA certificate file (
setSACertificateSource(String aSourceName)) or - setting the SA public key file (
setSAPublicKeySource(String aSourceName))
- setting the SA certificate file (
- the location of the permit file(s) containing the cell permit entries: this can be
done by either
- making sure the basic permit file or meta permit file is located in the same directory as the category file. The model decoder will then auto-detect the permit file and use it.
- setting the basic permit file(s) (
setBasicPermitSource(String aSourceName)orsetBasicPermitSources(List<String> aSourceNames)) or - setting the meta permit file(s) (
setMetaPermitSource(String aSourceName)) orsetMetaPermitSources(List<String> aSourceNames)
ILcdModelDescriptor of the decoded model is a
TLcdS57CatalogueModelDescriptor.
Error handling
SeeTLcdS63UnifiedModelDecoder class javadoc for details.- Since:
- 2013.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.luciad.format.s57.TLcdS57CatalogueModelDecoder
TLcdS57CatalogueModelDecoder.LoadingPolicyNested classes/interfaces inherited from interface com.luciad.format.metadata.model.ILcdMetadataDecoder
ILcdMetadataDecoder.MetadataWithSource -
Field Summary
Fields inherited from class com.luciad.format.s57.TLcdS57CatalogueModelDecoder
DEFAULT_DISPLAY_NAME, DEFAULT_EXTENSION -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TLcdS63CatalogueModelDecoder that will delegate the decoding of S-57 cells to aTLcdS63ModelDecoder.TLcdS63CatalogueModelDecoder(TLcdS63ModelDecoder aS63ModelDecoder) Creates a new TLcdS63CatalogueModelDecoder that will delegate the decoding of S-57 cells to the givenTLcdS63ModelDecoder. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeMetadata(String aSourceName) Tells whether this metadata decoder can likely decode metadata for a given source name.booleancanDecodeSource(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.decodeMetadata(String aSourceName) Decodes the metadata from a given source name as an ISO-19115 metadata object.decodeModelMetadata(String aSourceName) Decodes metadata for the specified data source.decodeSource(ILcdDataSource aDataSource) Creates a new model from the given data source.Returns the source URLs of the basic permit files.Returns the factory that will create input streams from which models can be decoded.Returns the source URLs of the meta permit files.Returns the S-57 cell model decoder to which this catalogue model decoder delegates.Returns the source URLs where the SA's digital certificates can be found.Returns the source URLs where the SA's public keys can be found.Returns the S-63 User Permit that is attached to the running license.voidsetBasicPermitSources(List<String> aSourceNames) Sets the source URLs of the basic permit files, containing the cell permits.voidsetDoAuthentication(boolean aDoAuthentication) Specifies whether data should be authenticated, based on the signature file.static voidsetEncryptedHardwareID(String aHardwareID) Sets an encrypted version of the hardware ID (HW_ID) of this system.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Sets the factory that will create input streams from which models can be decoded.voidsetMetaPermitSources(List<String> aSourceNames) Sets the source URLs of the meta permit files, containing the cell permits and meta information.static voidsetS63CustomerSystemID(String aS63CustomerSystemId) Configures the S63 Customer System ID, a unique ID used to identify an S-63 system.voidsetSACertificateSources(List<String> aSourceNames) Sets the source URLs where the SA's digital certificates can be found.voidsetSAPublicKeySources(List<String> aSourceNames) Sets the source URLs where the SA's public keys can be found.static voidsetUnencryptedHardwareID(String aHardwareID) Sets an unencrypted version of the hardware ID (HW_ID) of this system.Methods inherited from class com.luciad.format.s57.TLcdS57CatalogueModelDecoder
canDecodeSource, getAttributeClassMap, getDisplayName, getInvalidCellExceptionHandler, getLoadingPolicy, getObjectClassMap, getSENCCacheDir, isIgnoreInvalidCells, isUseSENCCache, isVerifyChecksum, resetExcludedObjectClasses, resetObjectClassSelection, setAttributeClassMap, setExcludedObjectClasses, setIgnoreInvalidCells, setInvalidCellExceptionHandler, setLoadingPolicy, setObjectClassMap, setObjectClassSelection, setSENCCacheDir, setUseSENCCache, setVerifyChecksumMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.format.metadata.model.ILcdMetadataDecoder
findAndDecodeMetadataMethods inherited from interface com.luciad.model.ILcdModelDecoder
decodeModelMetadata, discoverDataSources
-
Constructor Details
-
TLcdS63CatalogueModelDecoder
public TLcdS63CatalogueModelDecoder()Creates a new TLcdS63CatalogueModelDecoder that will delegate the decoding of S-57 cells to aTLcdS63ModelDecoder. TheTLcdS63ModelDecoderthat is created is not initialized yet for a particular product. You need at least to set an object and attribute class map on this decoder before decoding any data.- See Also:
-
TLcdS63CatalogueModelDecoder
Creates a new TLcdS63CatalogueModelDecoder that will delegate the decoding of S-57 cells to the givenTLcdS63ModelDecoder.
-
-
Method Details
-
getS57ModelDecoder
Description copied from class:TLcdS57CatalogueModelDecoderReturns the S-57 cell model decoder to which this catalogue model decoder delegates.- Overrides:
getS57ModelDecoderin classTLcdS57CatalogueModelDecoder- Returns:
- the S-57 cell model decoder to which this catalogue model decoder delegates.
-
setS63CustomerSystemID
Configures the S63 Customer System ID, a unique ID used to identify an S-63 system. Alternatively, you can set the JVM system propertycom.luciad.format.s63.s63CustomerSystemID:-Dcom.luciad.format.s63.s63CustomerSystemID=mys63id
The system property will be overridden if the setter method is used.
In Lucy, you can also useTLcyS63FormatAddOn.s63CustomerSystemIDconfiguration setting of the S-63 add-on (TLcyS63FormatAddOn.cfg). If your LuciadLightspeed license is not linked to an S-63 Customer System ID, you should not use this method. If your LuciadLightspeed license is linked to an S-63 Customer System ID, you must set the ID before usingcanDecodeSource(java.lang.String)ordecode(java.lang.String), or they will returnfalseand throwIllegalArgumentException, respectively. The ID is verified against the ID linked to your LuciadLightspeed license. If the ID does not match:- This method throws
IllegalArgumentException canDecodeSource(java.lang.String)returnsfalsedecode(java.lang.String)throwsIllegalArgumentException
- Parameters:
aS63CustomerSystemId- The ID to validate with- Throws:
IllegalArgumentException- if the given ID does not match the ID linked with your license.
- This method throws
-
setUnencryptedHardwareID
Sets an unencrypted version of the hardware ID (
HW_ID) of this system. This method will encrypt the hardware ID, and pass it to thesetEncryptedHardwareID(String)method.For convenience, this method is available on all of the S-63 model decoder classes (
TLcdS63UnifiedModelDecoder,TLcdS63CatalogueModelDecoderandTLcdS63ModelDecoder). It is sufficient to call this method once on any of model decoders.- Parameters:
aHardwareID- The 5-digit hexadecimal number. For example "A79AB"- Since:
- 2015.1
- See Also:
-
setEncryptedHardwareID
Sets an encrypted version of the hardware ID (
HW_ID) of this system. This method can only be called when you are a manufacturer of ECDIS systems, and have bought a corresponding license.
You can check whether your license supports this by opening the development_license.txt file (this file is located inside the development_license.jar file). It must contain thes63Manufacturer = truekey-value pair.If you want to specify the hardware ID using the API and do not want to do the encryption yourself, you can use the
setUnencryptedHardwareID(String)method instead.If you want to do the encryption yourself, you can use the following code which uses an RSA encryption:
String hardwareID = ... ;//5-digit hexadecimal number (for example "A79AB") byte[] rsa_n = {0, -51, -16, -29, -89, -15, -58, -106, -80, -113, -6, 64, -111, -85, -60, -10, 47}; byte[] rsa_e = {0, -128, -23}; BigInteger hw_id_encrypted = new BigInteger(hardwareID, 16).modPow(new BigInteger(rsa_e), new BigInteger(rsa_n)); return hw_id_encrypted.toString(16);The encrypted hardware ID can also be specified using a system property. Setting the unencrypted hardware ID using the system property is not supported.
-Dcom.luciad.format.s63.encryptedHardwareID=xxxxxxxThe S-63 specification requires that manufacturers take the necessary precautions to ensure that the
HW_IDremains unknown to the end-user of the system. This method works with an encrypted form of theHW_ID, but this is not sufficient to ensure proper protection of theHW_ID. It is up to the manufacturer using the Luciad API to ensure that the end-user has no access to the runtime environment, and that the (encoded) version of theHW_IDis not accessible by the user.Note: this method should be called before triggering any S-63 related code. Calling this method a second time after any S-63 related code has been triggered has no effect.
For convenience, this method is available on all of the S-63 model decoder classes (
TLcdS63UnifiedModelDecoder,TLcdS63CatalogueModelDecoderandTLcdS63ModelDecoder). It is sufficient to call this method once on any of model decoders.- Parameters:
aHardwareID- The encrypted version of the 5-digit hexadecimal number.- Since:
- 2015.1
- See Also:
-
setSAPublicKeySources
Sets the source URLs where the SA's public keys can be found. If set, these public keys will be preferred over the public key that is extracted from a digital certificate.- Parameters:
aSourceNames- data sources containing the public key of the SA.
-
getSAPublicKeySources
Returns the source URLs where the SA's public keys can be found.- Returns:
- the source URLs where the SA's public keys can be found.
-
setSACertificateSources
Sets the source URLs where the SA's digital certificates can be found.- Parameters:
aSourceNames- data sources containing the SA's digital certificate.
-
getSACertificateSources
Returns the source URLs where the SA's digital certificates can be found.- Returns:
- the source URLs where the SA's digital certificates can be found.
-
setBasicPermitSources
Sets the source URLs of the basic permit files, containing the cell permits. If not set, the system will fall back on the meta permit files.- Parameters:
aSourceNames- list of source URLs of the basic permit files containing the cell permits.
-
getBasicPermitSources
Returns the source URLs of the basic permit files.- Returns:
- the source URLs of the basic permit files
-
setMetaPermitSources
Sets the source URLs of the meta permit files, containing the cell permits and meta information.- Parameters:
aSourceNames- list of source URLs of the meta permit files containing the cell permits plus meta info.
-
getMetaPermitSources
Returns the source URLs of the meta permit files.- Returns:
- the source URLs of the meta permit files
-
setDoAuthentication
public void setDoAuthentication(boolean aDoAuthentication) Specifies whether data should be authenticated, based on the signature file. By default, the decoder will perform authentication.- Parameters:
aDoAuthentication- specifies whether data should be authenticated.
-
getUserPermit
Returns the S-63 User Permit that is attached to the running license.- Returns:
- the S-63 User Permit that is attached to the running license.
-
setInputStreamFactory
Description copied from class:TLcdS57CatalogueModelDecoderSets the factory that will create input streams from which models can be decoded.- Specified by:
setInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Overrides:
setInputStreamFactoryin classTLcdS57CatalogueModelDecoder- Parameters:
aInputStreamFactory- the factory that creates an input stream based on a source name.- See Also:
-
getInputStreamFactory
Description copied from class:TLcdS57CatalogueModelDecoderReturns the factory that will create input streams from which models can be decoded.- Specified by:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Overrides:
getInputStreamFactoryin classTLcdS57CatalogueModelDecoder- Returns:
- the factory that creates an input stream based on a source name.
- See Also:
-
canDecodeSource
Description copied from interface:ILcdModelDecoderChecks whether this model decoder can decode the specified data source. It is acceptable for this method to returntruefor a source name whiledecodethrows an exception for that same source name.For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.
- Specified by:
canDecodeSourcein interfaceILcdModelDecoder- Overrides:
canDecodeSourcein classTLcdS57CatalogueModelDecoder- Parameters:
aSourceName- the data source to be verified; typically a file name or a URL.- Returns:
trueif this decoder can likely decode the data specified by the source name,falseotherwise.- See Also:
-
decode
Description copied from interface:ILcdModelDecoderCreates a new model from the given data source.- Specified by:
decodein interfaceILcdModelDecoder- Overrides:
decodein classTLcdS57CatalogueModelDecoder- Parameters:
aSourceName- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
nullis allowed, implementors are advised to throw an error instead. - Throws:
IOException- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.public ILcdModel decode( String aSourceName ) throws IOException { try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }- See Also:
-
decodeSource
Description copied from interface:ILcdModelDecoderCreates a new model from the given data source.
By default, this method:
- Throws a
NullPointerExceptionwhen anulldata source is passed. - Delegates to the
ILcdModelDecoder.decode(String)method when aTLcdDataSourceis passed. - Throws an IOException in other case.
- Specified by:
decodeSourcein interfaceILcdModelDecoder- Overrides:
decodeSourcein classTLcdS57CatalogueModelDecoder- Parameters:
aDataSource- theILcdDataSourceto be decoded.- Returns:
- a model containing the decoded data. While
nullis allowed, implementors are advised to throw an error instead. - Throws:
IOException- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.public ILcdModel decodeSource(ILcdDataSource aDataSource) throws IOException { try { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }- See Also:
- Throws a
-
canDecodeMetadata
Description copied from interface:ILcdMetadataDecoderTells whether this metadata decoder can likely decode metadata for a given source name.-
If
true, it is likely thatILcdMetadataDecoder.decodeMetadata(String)will return a non-nullTLcdISO19115Metadataobject, but it is not a guarantee. The result is optimistic. -
If
false, it is guaranteed thatILcdMetadataDecoder.decodeMetadata(String)will throw an exception or returnnull.
- Specified by:
canDecodeMetadatain interfaceILcdMetadataDecoder- Overrides:
canDecodeMetadatain classTLcdS57CatalogueModelDecoder- Parameters:
aSourceName- the source name to decode metadata for- Returns:
trueif this metadata decoder can decode metadata for the given source name,falseotherwise
-
If
-
decodeMetadata
Description copied from interface:ILcdMetadataDecoderDecodes the metadata from a given source name as an ISO-19115 metadata object.Note that even if
ILcdMetadataDecoder.canDecodeMetadata(String)returnstrue, this method may yet not be able to decode the given source name. While returningnullis allowed when this decoder couldn't decode the given source name, implementors are advised to throw an error instead.- Specified by:
decodeMetadatain interfaceILcdMetadataDecoder- Overrides:
decodeMetadatain classTLcdS57CatalogueModelDecoder- Parameters:
aSourceName- the source name to decode metadata from- Returns:
- a metadata object
- Throws:
IOException- if the metadata cannot be decoded for some reason- See Also:
-
decodeModelMetadata
Description copied from class:TLcdS57CatalogueModelDecoderDecodes metadata for the specified data source. The resultingTLcdModelMetadataalso includes a metadata instance for every individual cell referenced by the catalogue. These metadata instances can be retrieved withTLcdModelMetadata.discoverDataSeries(), without triggering any additional I/O.- Specified by:
decodeModelMetadatain interfaceILcdModelDecoder- Overrides:
decodeModelMetadatain classTLcdS57CatalogueModelDecoder- Parameters:
aSourceName- the data source for which the model metadata will be decoded.- Returns:
- the model metadata for the data source, never null.
- Throws:
IOException- if the metadata cannot be decoded for some reason.- See Also:
-