DFDL4S (DFDL for Space Library)
Static Public Member Functions | List of all members
org.esa.s2g.dfdllib.DFDLLib Class Reference

Static Public Member Functions

static void initLib (String timeSettingsPath)
 
static Document interpretDocument (String schemaFile, String dataFile) throws InterruptedException, ErrorLoadingException
 
static Document interpretDocument (String schemaFile, byte[] data)
 
static Document interpretDocument (String schemaFile, byte[] data, InterpreterMonitor interpreterMonitor) throws InterruptedException, ErrorLoadingException
 
static Document interpretDocument (String schemaFile, byte[] data, byte[][] referenceData, byte[][] masksData, HashMap< DataSize, DataSize > offsetCache, String ambiguityChoice, InterpreterMonitor interpreterMonitor) throws InterruptedException, ErrorLoadingException
 
static Document interpretDocument (String schemaFile, String dataFile, InterpreterMonitor interpreterMonitor) throws InterruptedException, ErrorLoadingException
 
static Document interpretDocument (String schemaFile, String dataFile, byte[][] referenceData, byte[][] masksData, HashMap< DataSize, DataSize > offsetCache, String ambiguityChoice, InterpreterMonitor interpreterMonitor) throws InterruptedException, ErrorLoadingException
 
static Document createNewDocument (String schemaFile)
 
static void storeDocument (Document document, String dataFile) throws IOException
 
static void storeDocument (Document document, String file, int start, int packets) throws IOException
 
static byte[] storeDocument (Document document)
 
static void appendElements (Document document, String schema, int nrElements, int elementSize, byte defaultValue, String packetHeader) throws InterruptedException, ErrorLoadingException, IOException
 
static void appendElements (Document document, String schema, byte[] data) throws InterruptedException, ErrorLoadingException, IOException
 
static String getVersion ()
 

Detailed Description

The DFDLlib class provides the capability to interpret the contents of a binary file according the the specifications of a schema.

Member Function Documentation

◆ appendElements() [1/2]

static void org.esa.s2g.dfdllib.DFDLLib.appendElements ( Document  document,
String  schema,
byte[]  data 
) throws InterruptedException, ErrorLoadingException, IOException
static

Adds new elements to a document based on raw data

Parameters
documentthe document to extend
schemathe underlying data schema to consider
datathe raw data to consider
Returns
the list of added Element objects
Exceptions
InterruptedExceptionwhen the thread is interrupted by another thread
ErrorLoadingExceptionwhen problems occurred during model loading
IOExceptionwhen failed or interrupted I/O operations

◆ appendElements() [2/2]

static void org.esa.s2g.dfdllib.DFDLLib.appendElements ( Document  document,
String  schema,
int  nrElements,
int  elementSize,
byte  defaultValue,
String  packetHeader 
) throws InterruptedException, ErrorLoadingException, IOException
static

Adds new elements to a document based on data generation parameters

Parameters
documentthe document to extend
schemathe path to the the underlying data schema to consider
nrElementsthe number of elements to generate
elementSizethe element data size
defaultValuethe element's default value for each given byte
packetHeaderthe value to set in the beginning of each element
Returns
the list of added Element objects
Exceptions
InterruptedExceptionwhen the thread is interrupted by another thread
ErrorLoadingExceptionwhen problems occurred during model loading
IOExceptionwhen failed or interrupted I/O operations

◆ createNewDocument()

static Document org.esa.s2g.dfdllib.DFDLLib.createNewDocument ( String  schemaFile)
static

Create a empty document with the path to the schema specifications

Parameters
schemaFilepath to the schema file
Returns
Document empty

◆ getVersion()

static String org.esa.s2g.dfdllib.DFDLLib.getVersion ( )
static

Returns the version identifier for the Library

Returns
a string

◆ initLib()

static void org.esa.s2g.dfdllib.DFDLLib.initLib ( String  timeSettingsPath)
static

Initialises the DFDLLib:

  • sets the UTC TAI conversion data
Parameters
timeSettingsPaththe path to the directory containing the UTC / TAI file
Returns
the initialised DFDLLib

◆ interpretDocument() [1/6]

static Document org.esa.s2g.dfdllib.DFDLLib.interpretDocument ( String  schemaFile,
byte[]  data 
)
static

Interprets the contents of a memory block according to the specifications of a schema file.

Parameters
schemaFilethe schema definition file path
datathe memory block containing the data to be accessed
Returns
The element (document) containing all element items available in the binary file

◆ interpretDocument() [2/6]

static Document org.esa.s2g.dfdllib.DFDLLib.interpretDocument ( String  schemaFile,
byte[]  data,
byte  referenceData[][],
byte  masksData[][],
HashMap< DataSize, DataSize offsetCache,
String  ambiguityChoice,
InterpreterMonitor  interpreterMonitor 
) throws InterruptedException, ErrorLoadingException
static

** Important Note**

Currently, this method is only available in DFDL4S java version.


Interprets the contents of a binary file according to the specifications of a schema file. The reference and mask data allow the user to synchronize the binary data file, the offset cache contains the expected offset for each reference data that is to synchronize. The ambiguity choice allow the interpretation of binary data in ISP schemas where the APID can have the same value for different product data types. The interpreter monitor allow the user to register the interpretation/load status of binary data file.

Synchronization

To perform the synchronization is necessary to define:

  • matrix containing the byte arrays that represents the data to synchronize in the binary data
  • matrix containing the masks to check when the data is synchronized.

Ambiguity Choice

To perform the interpretation in ISP schemas with different product types containing the same APID, the user can define the parameter ambiguityChoice with the name of the product type chose/select. In that way, the interpretation will consider the product type select. Otherwise, the first product type found with the respective APID will be used.

Interpreter Monitor

The interpreter monitor allow the user to register/defined their own interpretation/load status of the binary data file

User example of Synchronization, Ambiguity Choice and Interpreter Monitor can be found in S2G client.

Parameters
schemaFilethe schema definition file path
datathe byte array containing the data to be interpreted
referenceDatathe matrix containing the byte arrays that represents the data to synchronize in the binary data
masksDatathe matrix containing the masks to check when the data is synchronize
offsetCachethe expected offset for each reference data that is to synchronize
ambiguityChoicea) null:
  • Ambiguity check will not be performed b) Instrument name:
  • In the case of ambiguity, the interpretDocument will interpret an element according to the instrument name choice by user. If the instrument choice by user doesn't exist, an ErrorLoadingException will be throw. The user can analyze the available options with the getOptions() method from the thrown ErrorLoadingException.
interpreterMonitorthe callback object the that allow the user to register the interpretation/load status of binary data file.
Returns
The element (document) containing all element items available in the binary file
Exceptions
InterruptedExceptionwhen the thread is interrupted by another thread
ErrorLoadingExceptionwhen problems occurred during model loading

◆ interpretDocument() [3/6]

static Document org.esa.s2g.dfdllib.DFDLLib.interpretDocument ( String  schemaFile,
byte[]  data,
InterpreterMonitor  interpreterMonitor 
) throws InterruptedException, ErrorLoadingException
static

** Important Note**

Currently, this method is only available in DFDL4S java version.


Interprets the contents of a memory block according to the specifications of a schema file. The interpreter monitor allow the user to register the interpretation/load status of binary data file.

Interpreter Monitor

The interpreter monitor allow the user to register/defined their own interpretation/load status of the binary data file

Parameters
schemaFilethe schema definition file path
datathe byte array containing the data to be interpreted
interpreterMonitorthe callback object the that allow the user to register the interpretation/load status of binary data file.
Returns
The element (document) containing all element items available in the binary file
Exceptions
InterruptedExceptionwhen the thread is interrupted by another thread
ErrorLoadingExceptionwhen problems occurred during model loading

◆ interpretDocument() [4/6]

static Document org.esa.s2g.dfdllib.DFDLLib.interpretDocument ( String  schemaFile,
String  dataFile 
) throws InterruptedException, ErrorLoadingException
static

Interprets the contents of a binary file according to the specifications of a schema file.

Parameters
schemaFilethe schema definition file path
dataFilethe file containing the data to be accessed
Returns
The element (document) containing all element items available in the binary file
Exceptions
InterruptedExceptionwhen the thread is interrupted by another thread
ErrorLoadingExceptionwhen problems occurred during model loading

◆ interpretDocument() [5/6]

static Document org.esa.s2g.dfdllib.DFDLLib.interpretDocument ( String  schemaFile,
String  dataFile,
byte  referenceData[][],
byte  masksData[][],
HashMap< DataSize, DataSize offsetCache,
String  ambiguityChoice,
InterpreterMonitor  interpreterMonitor 
) throws InterruptedException, ErrorLoadingException
static

** Important Note**

Currently, this method is only available in DFDL4S java version.


Interprets the contents of a binary file according to the specifications of a schema file. The reference and mask data allow the user to synchronize the binary data file, the offset cache contains the expected offset for each reference data that is to synchronize. The ambiguity choice allow the interpretation of binary data in ISP schemas where the APID can have the same value for different product data types. The interpreter monitor allow the user to register the interpretation/load status of binary data file.

Synchronization

To perform the synchronization is necessary to define:

  • matrix containing the byte arrays that represents the data to synchronize in the binary data
  • matrix containing the masks to check when the data is synchronized.

Ambiguity Choice

To perform the interpretation in ISP schemas with different product types containing the same APID, the user can define the parameter ambiguityChoice with the name of the product type chose/select. In that way, the interpretation will consider the product type select. Otherwise, the first product type found with the respective APID will be used.

Interpreter Monitor

The interpreter monitor allow the user to register/defined their own interpretation/load status of the binary data file

User example of Synchronization, Ambiguity Choice and Interpreter Monitor can be found in S2G client.

Parameters
schemaFilethe schema definition file path
dataFilethe file containing the data to be accessed
referenceDatathe matrix containing the byte arrays that represents the data to synchronize in the binary data
masksDatathe matrix containing the masks to check when the data is synchronize
offsetCachethe expected offset for each reference data that is to synchronize
ambiguityChoicea) null:
  • Ambiguity check will not be performed b) Instrument name:
  • In the case of ambiguity, the interpretDocument will interpret an element according to the instrument name choice by user. If the instrument choice by user doesn't exist, an ErrorLoadingException will be throw. The user can analyze the available options with the getOptions() method from the thrown ErrorLoadingException.
interpreterMonitorthe callback object the that allow the user to register the interpretation/load status of binary data file.
Returns
The element (document) containing all element items available in the binary file
Exceptions
InterruptedExceptionwhen the thread is interrupted by another thread
ErrorLoadingExceptionwhen problems occurred during model loading

◆ interpretDocument() [6/6]

static Document org.esa.s2g.dfdllib.DFDLLib.interpretDocument ( String  schemaFile,
String  dataFile,
InterpreterMonitor  interpreterMonitor 
) throws InterruptedException, ErrorLoadingException
static

** Important Note**

Currently, this method is only available in DFDL4S java version.


Interprets the contents of a binary file according to the specifications of a schema file. The interpreter monitor allow the user to register the interpretation/load status of binary data file.

Interpreter Monitor

The interpreter monitor allow the user to register/defined their own interpretation/load status of the binary data file

Parameters
schemaFilethe schema definition file path
dataFilethe file containing the data to be accessed
interpreterMonitorthe callback object the that allow the user to register the interpretation/load status of binary data file.
Returns
The element (document) containing all element items available in the binary file
Exceptions
InterruptedExceptionwhen the thread is interrupted by another thread
ErrorLoadingExceptionwhen problems occurred during model loading

◆ storeDocument() [1/3]

static byte [] org.esa.s2g.dfdllib.DFDLLib.storeDocument ( Document  document)
static

Get the byte[] data of the given document

Parameters
document- the parameter representing the document where is to get the byte[]
Returns
byte[] - the content of the document or empty array if invalid document is passed

◆ storeDocument() [2/3]

static void org.esa.s2g.dfdllib.DFDLLib.storeDocument ( Document  document,
String  dataFile 
) throws IOException
static

Store the given document in the dataFile path

Parameters
document- document to be stored
dataFile- Path to the file
Exceptions
IOExceptionwhen failed or interrupted I/O operations

◆ storeDocument() [3/3]

static void org.esa.s2g.dfdllib.DFDLLib.storeDocument ( Document  document,
String  file,
int  start,
int  packets 
) throws IOException
static

Export a given range of packets to a given file.

Parameters
document- document to be stored
filethe file to where export the packets.
startthe index of the first packet to export.
packetsthe number of packets to export.
Exceptions
IOExceptionwhen failed or interrupted I/O operations

The documentation for this class was generated from the following file: