Package com.luciad.reference
Class TLcdModelReferenceDecoder
java.lang.Object
com.luciad.reference.TLcdModelReferenceDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelReferenceDecoder
@LcdService(service=ILcdModelReferenceDecoder.class,
priority=20000)
public class TLcdModelReferenceDecoder
extends Object
implements ILcdModelReferenceDecoder, ILcdInputStreamFactoryCapable
This
ILcdModelReferenceDecoder
decodes model references
based on .ref property files corresponding to the given source files.
It first tries to find a .ref file by replacing the extension of the
source file by .ref
, or adding the suffix '.ref' if there
was no extension. It preserves upper or lower case of the replaced extension.
If this fails, it tries to find a directory.ref
file next to
the source file.
If this fails, it tries to find a DIRECTORY.REF
file next to
the source file.
If this fails, it throws an IOException
.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.luciad.model.ILcdModelReferenceDecoder
ILcdModelReferenceDecoder.ModelReferenceWithSource
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondecodeModelReference
(String aDataSourceName) Returns the model reference, associated with the specified data source.findAndDecodeModelReference
(String aSource) Locates and decodes a model reference file based on the location of the data file.Returns the input stream factory that is used for accessing .ref files.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory that will be used for accessing .ref files.
-
Constructor Details
-
TLcdModelReferenceDecoder
public TLcdModelReferenceDecoder()
-
-
Method Details
-
setInputStreamFactory
Sets the input stream factory that will be used for accessing .ref files.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the factory responsible to generate input streams from which the model reference will be decoded.- See Also:
-
getInputStreamFactory
Returns the input stream factory that is used for accessing .ref files.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the factory responsible to generate input streams from which the model reference will be decoded.
- See Also:
-
decodeModelReference
Returns the model reference, associated with the specified data source. This implementation delegates tofindAndDecodeModelReference(java.lang.String)
and returns the resulting model reference.- Specified by:
decodeModelReference
in interfaceILcdModelReferenceDecoder
- Parameters:
aDataSourceName
- a data source for which to return the model reference; typically a file name or a URL.- Returns:
- the
ILcdModelReference
associated with the data source. Whilenull
is allowed, implementors are advised to throw an error instead. - Throws:
IOException
- if theILcdModelReference
cannot be decoded.
When the thread on which this method is called is interrupted, it is recommended to stop the decoding and throw anInterruptedIOException
. This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding through the UI.
-
findAndDecodeModelReference
public ILcdModelReferenceDecoder.ModelReferenceWithSource findAndDecodeModelReference(String aSource) throws IOException Locates and decodes a model reference file based on the location of the data file. Location of the model reference file is done by- replacing the suffix by '.ref', or adding the suffix '.ref' if there was no suffix. It preserves upper or lower case of the replaced extension.
- looking for a 'directory.ref' in the same directory,
- looking for a 'DIRECTORY.REF' in the same directory.
- Specified by:
findAndDecodeModelReference
in interfaceILcdModelReferenceDecoder
- Parameters:
aSource
- the location of the data file for which to locate and decode a reference file.- Returns:
- an
ILcdModelReference
decoded from one of the files as described above, along with the location of that file. - Throws:
IOException
- if none of the files as described above exists, or when the file found cannot be decoded as a properties file.
-