@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdASDIModelDecoder extends ALcdASDIDecoder implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
TLcdModelList
, allowing for easy manipulation of that data,
such as replaying, analysis, etc.
An ASDI file can contain a <set time > MM/dd/yyyy HH:mm:ss
command at the first line. If this is the case the corresponding date
is used as the start time for the decoder,
the start time set by ALcdASDIDecoder.setStartTime(long)
is ignored then.
File | Required | Entry point | Description |
---|---|---|---|
*.asdi | x | x | ASDI file containing an ASDI formatted data |
ILcdInputStreamFactory
of this decoder.model list
with a model
for each data type in the input.ILcdModel
objects, depending on the type of messages in
the ASDI feed.ILcd2DBoundsIndexedModel
.ILcdModel
objects have an ILcdModelDescriptor
that is an
ALcdASDIModelDescriptor
. The method ALcdASDIModelDescriptor.getDataType()
allows to distinguish between the different models.TLcdGeodeticReference
.TLcdGeodeticDatum
(WGS-84).TLcdModelList
,
specifying for each a description, the messages taken into account,
the domain objects in the model and the value returned from
ALcdASDIModelDescriptor.getDataType()
:
Model description | ASDI messages | Domain objects | ALcdASDIModelDescriptor.getDataType() |
---|---|---|---|
TZ tracks | TZ | TLcdASDITrajectory |
DATA_TYPE_TZ_TRACK |
TO tracks | TO | TLcdASDITrajectory |
DATA_TYPE_TO_TRACK |
Flight plan data | FZ, AF, DZ, UZ, AZ, RZ and RT | TLcdASDIFlightPlanHistory |
DATA_TYPE_FLIGHT_PLAN |
ILcdModelDecoder decoder = new TLcdASDIModelDecoder();
ILcdModel model = decoder.decode( "asdi_data.asdi" );
Constructor and Description |
---|
TLcdASDIModelDecoder()
Creates a
TLcdASDIModelDecoder , a model decoder for decoding ASDI data. |
Modifier and Type | Method and Description |
---|---|
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.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory that is currently used for creating input streams
given source names.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for creating input streams
given source names.
|
getMessageFilter, getStartTime, setMessageFilter, setStartTime
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public TLcdASDIModelDecoder()
TLcdASDIModelDecoder
, a model decoder for decoding ASDI data.public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.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
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
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)