public class TLcdS63CatalogueModelDecoder extends TLcdS57CatalogueModelDecoder
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()
):
setSACertificateSource(String
aSourceName)
) orsetSAPublicKeySource(String aSourceName)
)setBasicPermitSource(String
aSourceName)
or setBasicPermitSources(List<String> aSourceNames)
)
orsetMetaPermitSource(String
aSourceName)
) or setMetaPermitSources(List<String> aSourceNames)
ILcdModelDescriptor
of the decoded model is a
TLcdS57CatalogueModelDescriptor
.
TLcdS63UnifiedModelDecoder
class javadoc for details.TLcdS57CatalogueModelDecoder
,
TLcdS63ModelDecoder
TLcdS57CatalogueModelDecoder.LoadingPolicy
ILcdMetadataDecoder.MetadataWithSource
DEFAULT_DISPLAY_NAME, DEFAULT_EXTENSION
Constructor and Description |
---|
TLcdS63CatalogueModelDecoder()
Creates a new TLcdS63CatalogueModelDecoder that will delegate the decoding
of S-57 cells to a
TLcdS63ModelDecoder . |
TLcdS63CatalogueModelDecoder(TLcdS63ModelDecoder aS63ModelDecoder)
Creates a new TLcdS63CatalogueModelDecoder that will delegate the
decoding of S-57 cells to the given
TLcdS63ModelDecoder . |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeMetadata(String aSourceName)
Tells whether this metadata decoder can likely decode metadata for a given source name.
|
boolean |
canDecodeSource(String aSourceName)
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(String aSourceName)
Creates a new model from the given data source.
|
TLcdISO19115Metadata |
decodeMetadata(String aSourceName)
Decodes the metadata from a given source name as an ISO-19115 metadata object.
|
TLcdModelMetadata |
decodeModelMetadata(String aSourceName)
Decodes metadata for the specified data source.
|
ILcdModel |
decodeSource(ILcdDataSource aDataSource)
Creates a new model from the given data source.
|
List<String> |
getBasicPermitSources()
Returns the source URLs of the basic permit files.
|
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the factory that will create input streams from which models can be
decoded.
|
List<String> |
getMetaPermitSources()
Returns the source URLs of the meta permit files.
|
TLcdS63ModelDecoder |
getS57ModelDecoder()
Returns the S-57 cell model decoder to which this catalogue model decoder delegates.
|
List<String> |
getSACertificateSources()
Returns the source URLs where the SA's digital certificates can be found.
|
List<String> |
getSAPublicKeySources()
Returns the source URLs where the SA's public keys can be found.
|
String |
getUserPermit()
Returns the S-63 User Permit that is attached to the running license.
|
void |
setBasicPermitSources(List<String> aSourceNames)
Sets the source URLs of the basic permit files, containing the cell permits.
|
void |
setDoAuthentication(boolean aDoAuthentication)
Specifies whether data should be authenticated, based on the signature file.
|
static void |
setEncryptedHardwareID(String aHardwareID)
Sets an encrypted version of the hardware ID (
HW_ID ) of this system. |
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the factory that will create input streams from which models can be
decoded.
|
void |
setMetaPermitSources(List<String> aSourceNames)
Sets the source URLs of the meta permit files, containing the cell permits and meta
information.
|
static void |
setS63CustomerSystemID(String aS63CustomerSystemId)
Configures the S63 Customer System ID, a unique ID used to identify an S-63 system.
|
void |
setSACertificateSources(List<String> aSourceNames)
Sets the source URLs where the SA's digital certificates can be found.
|
void |
setSAPublicKeySources(List<String> aSourceNames)
Sets the source URLs where the SA's public keys can be found.
|
static void |
setUnencryptedHardwareID(String aHardwareID)
Sets an unencrypted version of the hardware ID (
HW_ID ) of this system. |
canDecodeSource, getAttributeClassMap, getDisplayName, getInvalidCellExceptionHandler, getLoadingPolicy, getObjectClassMap, getSENCCacheDir, isIgnoreInvalidCells, isUseSENCCache, isVerifyChecksum, resetExcludedObjectClasses, resetObjectClassSelection, setAttributeClassMap, setExcludedObjectClasses, setIgnoreInvalidCells, setInvalidCellExceptionHandler, setLoadingPolicy, setObjectClassMap, setObjectClassSelection, setSENCCacheDir, setUseSENCCache, setVerifyChecksum
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decodeModelMetadata, discoverDataSources
findAndDecodeMetadata
public TLcdS63CatalogueModelDecoder()
TLcdS63ModelDecoder
.
The TLcdS63ModelDecoder
that 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.public TLcdS63CatalogueModelDecoder(TLcdS63ModelDecoder aS63ModelDecoder)
TLcdS63ModelDecoder
.public TLcdS63ModelDecoder getS57ModelDecoder()
TLcdS57CatalogueModelDecoder
getS57ModelDecoder
in class TLcdS57CatalogueModelDecoder
public static void setS63CustomerSystemID(String aS63CustomerSystemId)
com.luciad.format.s63.s63CustomerSystemID
:
-Dcom.luciad.format.s63.s63CustomerSystemID=mys63idThe system property will be overridden if the setter method is used.
TLcyS63FormatAddOn.s63CustomerSystemID
configuration 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 using canDecodeSource(java.lang.String)
or decode(java.lang.String)
, or they will return false
and throw IllegalArgumentException
, respectively.
The ID is verified against the ID linked to your LuciadLightspeed license. If the ID does not match:
IllegalArgumentException
canDecodeSource(java.lang.String)
returns false
decode(java.lang.String)
throws IllegalArgumentException
aS63CustomerSystemId
- The ID to validate withIllegalArgumentException
- if the given ID does not match the ID linked with your license.public static void setUnencryptedHardwareID(String aHardwareID)
Sets an unencrypted version of the hardware ID (HW_ID
) of this system.
This method will encrypt the hardware ID, and pass it to the setEncryptedHardwareID(String)
method.
For convenience, this method is available on all of the S-63 model decoder classes
(TLcdS63UnifiedModelDecoder
, TLcdS63CatalogueModelDecoder
and TLcdS63ModelDecoder
).
It is sufficient to call this method once on any of model decoders.
aHardwareID
- The 5-digit hexadecimal number.
For example "A79AB"setEncryptedHardwareID(String)
public static void setEncryptedHardwareID(String aHardwareID)
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 the s63Manufacturer = true
key-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=xxxxxxx
The S-63 specification requires that manufacturers take the necessary precautions to ensure that the HW_ID
remains unknown to the end-user of the system.
This method works with an encrypted form of the HW_ID
, but this is not sufficient to ensure proper protection
of the HW_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 the HW_ID
is 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
, TLcdS63CatalogueModelDecoder
and TLcdS63ModelDecoder
).
It is sufficient to call this method once on any of model decoders.
aHardwareID
- The encrypted version of the 5-digit hexadecimal number.setUnencryptedHardwareID(String)
public void setSAPublicKeySources(List<String> aSourceNames)
aSourceNames
- data sources containing the public key of the SA.public List<String> getSAPublicKeySources()
public void setSACertificateSources(List<String> aSourceNames)
aSourceNames
- data sources containing the SA's digital certificate.public List<String> getSACertificateSources()
public void setBasicPermitSources(List<String> aSourceNames)
aSourceNames
- list of source URLs of the basic permit files containing the cell permits.public List<String> getBasicPermitSources()
public void setMetaPermitSources(List<String> aSourceNames)
aSourceNames
- list of source URLs of the meta permit files containing the cell permits
plus meta info.public List<String> getMetaPermitSources()
public void setDoAuthentication(boolean aDoAuthentication)
aDoAuthentication
- specifies whether data should be authenticated.public String getUserPermit()
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
TLcdS57CatalogueModelDecoder
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
setInputStreamFactory
in class TLcdS57CatalogueModelDecoder
aInputStreamFactory
- the factory that creates an input stream
based on a source name.TLcdS57CatalogueModelDecoder.getInputStreamFactory()
public ILcdInputStreamFactory getInputStreamFactory()
TLcdS57CatalogueModelDecoder
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
getInputStreamFactory
in class TLcdS57CatalogueModelDecoder
TLcdS57CatalogueModelDecoder.setInputStreamFactory(com.luciad.io.ILcdInputStreamFactory)
public boolean canDecodeSource(String aSourceName)
ILcdModelDecoder
true
for a source name while decode
throws 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.
canDecodeSource
in interface ILcdModelDecoder
canDecodeSource
in class TLcdS57CatalogueModelDecoder
aSourceName
- the data source to be verified; typically a file name or a URL.true
if this decoder can likely decode the data specified by the source name, false
otherwise.ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSourceName) throws IOException
ILcdModelDecoder
decode
in interface ILcdModelDecoder
decode
in class TLcdS57CatalogueModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.null
is allowed, implementors are advised to throw an error instead.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);
}
}
InterruptedIOException
- When the thread on which this method is called is interrupted: it is recommended to stop the decoding
and throw an InterruptedIOException
.
This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding
through the UI.ILcdModelDecoder.canDecodeSource(String)
public ILcdModel decodeSource(ILcdDataSource aDataSource) throws IOException
ILcdModelDecoder
Creates a new model from the given data source.
By default, this method:
NullPointerException
when a null
data source is passed.ILcdModelDecoder.decode(String)
method when a TLcdDataSource
is passed.decodeSource
in interface ILcdModelDecoder
decodeSource
in class TLcdS57CatalogueModelDecoder
aDataSource
- the ILcdDataSource
to be decoded.null
is allowed, implementors are advised to throw an error instead.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);
}
}
ILcdModelDecoder.canDecodeSource(ILcdDataSource)
public boolean canDecodeMetadata(String aSourceName)
ILcdMetadataDecoder
true
, it is likely that ILcdMetadataDecoder.decodeMetadata(String)
will return a non-null TLcdISO19115Metadata
object,
but it is not a guarantee. The result is optimistic.
false
, it is guaranteed that ILcdMetadataDecoder.decodeMetadata(String)
will throw an exception or return null
.
canDecodeMetadata
in interface ILcdMetadataDecoder
canDecodeMetadata
in class TLcdS57CatalogueModelDecoder
aSourceName
- the source name to decode metadata fortrue
if this metadata decoder can decode metadata for the given source name, false
otherwisepublic TLcdISO19115Metadata decodeMetadata(String aSourceName) throws IOException
ILcdMetadataDecoder
Note that even if ILcdMetadataDecoder.canDecodeMetadata(String)
returns true
, this method may yet not be able to
decode the given source name. While returning null
is allowed when this decoder couldn't decode the
given source name, implementors are advised to throw an error instead.
decodeMetadata
in interface ILcdMetadataDecoder
decodeMetadata
in class TLcdS57CatalogueModelDecoder
aSourceName
- the source name to decode metadata fromIOException
- if the metadata cannot be decoded for some reasonTLcdS63UnifiedModelDecoder.decodeMetadata(String)
public TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
TLcdS57CatalogueModelDecoder
TLcdModelMetadata
also includes a metadata
instance for every individual cell referenced by the catalogue. These metadata instances can be retrieved with
TLcdModelMetadata.discoverDataSeries()
, without triggering any additional I/O.decodeModelMetadata
in interface ILcdModelDecoder
decodeModelMetadata
in class TLcdS57CatalogueModelDecoder
aSourceName
- the data source for which the model metadata will be decoded.IOException
- if the metadata cannot be decoded for some reason.ILcdModelDecoder.canDecodeSource(String)