its.backbone.domain
Class DataFactory

java.lang.Object
  extended byits.backbone.domain.DataFactory
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
TmsDataFactory

public abstract class DataFactory
extends java.lang.Object
implements java.io.Serializable

Defines the interface to a domain-specific data extractor. Extractors must extend this abstract class and implement its methods.

Part of the process of creating a transmitter for a new SDD data stream is creating the Extractor for that data stream. The Extractor is sent over the network to SDD Receivers, which can use it to interpret the incoming data frames.

To create a new extractor,

Author:
Noah S Friedland
See Also:
SddTransmitter.transmitExtractor(java.lang.String), Serialized Form

Constructor Summary
DataFactory()
           
 
Method Summary
abstract  java.lang.String getDataOffsetTableName()
          This method returns the name of the data offset table in the datastream schema.
abstract  java.util.Hashtable getExtractionHashtable(Schema schema, ContentsData dataOffsetTable, ContentsData data)
          To produce the ExtractedData event, the SddReceiver invokes this method on the extractor it has received.
abstract  boolean hasDataOffsetTable()
          Indicates whether the Extractor needs to be provided with a data offset table from the data dictionary (schema and contents) in order to interpret the data frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFactory

public DataFactory()
Method Detail

hasDataOffsetTable

public abstract boolean hasDataOffsetTable()
Indicates whether the Extractor needs to be provided with a data offset table from the data dictionary (schema and contents) in order to interpret the data frame. A data offset table is a relation that specifies the sensor type, its name, and the offset into the data frame where the relevant data is located. If the data frame contains several different types of data, this table also needs to contain the data type (and account for its size). For an example:

Consider a system that produces three types of binary sensor data, all of whom are packaged into a single data frame. The first type is of size 3 bytes, the second type is of 6 bytes and the third type is of 18 bytes. These sensors' readings can appear in arbitrary order within the blob. To gain access to any specific sensor reading a data offset table is required in the SDD data stream's schema. This table should contains columns that describe the following:

For an operational example, consider the "LOOPS" table in the SDD data flow at host sdd.its.washington.edu, port 9033.

Returns:
true if the schema and contents for the SDD stream define a data offset table

getDataOffsetTableName

public abstract java.lang.String getDataOffsetTableName()
This method returns the name of the data offset table in the datastream schema. Please see comments above.

Returns:
the given datastream's data offset table name

getExtractionHashtable

public abstract java.util.Hashtable getExtractionHashtable(Schema schema,
                                                           ContentsData dataOffsetTable,
                                                           ContentsData data)
                                                    throws BadOffsetException
To produce the ExtractedData event, the SddReceiver invokes this method on the extractor it has received. The extractor's responsibility is to produce a hashtable of ContentsData objects, one for each sensor type found within the data, keyed by their associated table names from the schema.

Parameters:
schema - the schema from the SDD datastream.
dataOffsetTable - the table named by getDataOffsetTableName, taken from the Contents frame in the SDD datastream, or null if hasDataOffsetTable returns false.
data - the data frame from the SDD datastream, packaged inside a ContentsData object. This object contains a single column entry named "data". The incoming data frame can be retrieved as follows:
byte[] databytes = (byte[])data.getItem("data");
Throws:
BadOffsetException - thrown if the data offset table contains an offset that is not within the data frame