@LcdService(service=ILcdModelReferenceDecoder.class, priority=20000) public class TLcdModelReferenceDecoder extends Object implements ILcdModelReferenceDecoder, ILcdInputStreamFactoryCapable
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
.
ILcdModelReferenceDecoder.ModelReferenceWithSource
Constructor and Description |
---|
TLcdModelReferenceDecoder() |
Modifier and Type | Method and Description |
---|---|
ILcdModelReference |
decodeModelReference(String aDataSourceName)
Returns the model reference, associated with the specified data source.
|
ILcdModelReferenceDecoder.ModelReferenceWithSource |
findAndDecodeModelReference(String aSource)
Locates and decodes a model reference file based on the location of the data file.
|
ILcdInputStreamFactory |
getInputStreamFactory()
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.
|
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the factory responsible to generate input streams from which the
model reference will be decoded.getInputStreamFactory()
public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
setInputStreamFactory(com.luciad.io.ILcdInputStreamFactory)
public ILcdModelReference decodeModelReference(String aDataSourceName) throws IOException
findAndDecodeModelReference(java.lang.String)
and returns the resulting model reference.decodeModelReference
in interface ILcdModelReferenceDecoder
aDataSourceName
- a data source for which to return the model reference; typically a file name or a URL.ILcdModelReference
associated with the data source. While null
is allowed,
implementors are advised to throw an error instead.IOException
- if the ILcdModelReference
cannot be decoded.
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.public ILcdModelReferenceDecoder.ModelReferenceWithSource findAndDecodeModelReference(String aSource) throws IOException
findAndDecodeModelReference
in interface ILcdModelReferenceDecoder
aSource
- the location of the data file for which to locate and decode a reference file.ILcdModelReference
decoded from one of the files as described above, along with the
location of that file.IOException
- if none of the files as described above exists, or when the file found
cannot be decoded as a properties file.