Bin2DataStreamer

Overview

Concrete implementation of a Bin2DataStreamer, providing the standard Data Abstract Bin2DataStreamer protocol implementation.

Location

 

constructor

Default constructor that creates an instance of Bin2DataStreamer

 

constructor

 

Bin2DataStreamer()

constructor <clinit>  External

 

class method constructor <clinit>

 

static void constructor <clinit>()

doFinalizeStreamer  protected

Used in write mode, to store offsets of streamed elements.

 

method doFinalizeStreamer

 

void doFinalizeStreamer()

doInitializeStreamer  protected

Initializes the streamer to work in the given mode (second parameter).

 

method doInitializeStreamer(aSource: Object; aMode: StreamerInitialization)

 

void doInitializeStreamer(Object aSource, StreamerInitialization aMode)

Parameters:

  • aSource: A stream to use during streaming. Stream should be seekable.
  • aMode: A mode of the current streamer operation.

doReadDataTable (StreamElementInfo, DataTable)  protected

Fills the instantiated and named instance of the data table (second parameter) with the data from the stream. The data will be read according to the information and offsets provided in StreamElementInfo (first parameter). Loads all data records from the stream without loading table structure/schema.

 

method doReadDataTable(anElement: StreamElementInfo; aDestination: DataTable)

 

void doReadDataTable(StreamElementInfo anElement, DataTable aDestination)

Parameters:

  • anElement: An information about the position of data in the stream.
  • aDestination: A table instance that should be filled with data.

doReadDataTable (StreamElementInfo, DataTable, Boolean)  protected

Fills the instantiated and named instance of the data table (second parameter) with the data from the stream. The data will be read according to the information and offsets provided in StreamElementInfo (first parameter). Loads all data records from the stream.

 

method doReadDataTable(anElement: StreamElementInfo; aDestination: DataTable; ApplySchema: Boolean)

 

void doReadDataTable(StreamElementInfo anElement, DataTable aDestination, Boolean ApplySchema)

Parameters:

  • anElement: An information about the position of data in the stream.
  • aDestination: A table instance that should be filled with data.
  • ApplySchema: Defines whether or not to apply schema from stream to the given table instance. Usually pass true here, if table haven't previously loaded or server's schema has changed.

doReadDataTable (StreamElementInfo, DataTable, Boolean, Boolean)  protected

Fills the instantiated and named instance of the data table (second parameter) with the data from the stream. The data will be read according to the information and offsets provided in StreamElementInfo (first parameter).

 

method doReadDataTable(anElement: StreamElementInfo; aDestination: DataTable; ApplySchema: Boolean; LoadRecords: Boolean)

 

void doReadDataTable(StreamElementInfo anElement, DataTable aDestination, Boolean ApplySchema, Boolean LoadRecords)

Parameters:

  • anElement: An information about the position of data in the stream.
  • aDestination: A table instance that should be filled with data.
  • ApplySchema: Defines whether or not to apply schema from stream to the given table instance. Usually pass true here, if table haven't previously loaded or server's schema has changed.
  • LoadRecords: Defines whether or not to load table data from the stream. Set it to false if you jjust want to have table structure on client.

doReadDataTableSchema  protected

Reads the table's schema by the given table's name.

 

method doReadDataTableSchema(aDataTableName: String): SchemaDataTable

 

SchemaDataTable doReadDataTableSchema(String aDataTableName)

Parameters:

  • aDataTableName: A table name to read schema for.

doReadDelta  protected

Fills the given delta with the data from the stream.

 

method doReadDelta(anElement: StreamElementInfo; aDestination: Delta)

 

void doReadDelta(StreamElementInfo anElement, Delta aDestination)

Parameters:

  • anElement: A structure that contains all required information to find and read delta's data in the stream.
  • aDestination: The delta instance to fill.

doWriteDataTable  protected

Writes the given data table to the related stream.

 

method doWriteDataTable(aTable: DataTable; aTableSchema: SchemaDataTable; aMaxRecords: Integer; aIncludeSchema: Boolean)

 

void doWriteDataTable(DataTable aTable, SchemaDataTable aTableSchema, Integer aMaxRecords, Boolean aIncludeSchema)

Parameters:

  • aTable: The table to write.
  • aTableSchema: A table's schema to use during writing.
  • aMaxRecords: Max number of records from the table to store in the steam.
  • aIncludeSchema: Defines wheter or not to include table's schema in the stream.

doWriteDelta  protected

Writes the given delta the the related stream.

 

method doWriteDelta(aDelta: Delta; aDynamicSelect: Boolean)

 

void doWriteDelta(Delta aDelta, Boolean aDynamicSelect)

Parameters:

  • aDelta: The given delta to write.
  • aDynamicSelect: For Bin2 format this actually defines, whether a Reduced Delta feature will be used for this particular delta.

Elements    (declared in DataStreamer)

 

property Elements: Map<String, StreamElementInfo> read;

 

Map<String, StreamElementInfo> Elements { __get; }

finalizeStreamer    (declared in DataStreamer)

The method finalizes the reading/writing of data. It should be called after all elements are written or when reading is complete.

 

method finalizeStreamer

 

void finalizeStreamer()

getLoggedDeltaFields  protected    (declared in DataStreamer)

The method uses given delta to return the list of SchemaField that should be logged to server and an index that maps schema fields to correspondent positions used by the delta.

 

class method getLoggedDeltaFields(aDelta: Delta; aFields: ReferenceType<array of SchemaField>; aMapping: ReferenceType<array of Integer>)

 

static void getLoggedDeltaFields(Delta aDelta, ReferenceType<array of SchemaField> aFields, ReferenceType<array of Integer> aMapping)

Parameters:

  • aDelta: A delta to work with.
  • aFields: * out param* list of schema fields that should be logged.
  • aMapping: * out param* mapping to find the index for column data.

InitializationMode  protected    (declared in DataStreamer)

 

property InitializationMode: StreamerInitialization read;

 

StreamerInitialization InitializationMode { __get; }

initializeStreamer    (declared in DataStreamer)

This method initializes current streamer object. First parameter should contain the stream or String containing the data to process. All other read/wirte streamer methods will use this given object as a source to read from or as a destination to write to. Second parameter should contain the mode in which this Streamer should be initialized.

 

method initializeStreamer(aSource: Object; aStreamerMode: StreamerInitialization)

 

void initializeStreamer(Object aSource, StreamerInitialization aStreamerMode)

Parameters:

  • aSource: a data for the streamer to worm with(usually a string or a stream).
  • aStreamerMode: an initialization mode of the streamer.

isDbValueAssigned  protected    (declared in DataStreamer)

This method checks if a value was initialized by the DB or the server.

 

class method isDbValueAssigned(aValue: Object): Boolean

 

static Boolean isDbValueAssigned(Object aValue)

Parameters:

  • aValue: avalue to check.

makeTableKey    (declared in DataStreamer)

The method returns a prepered key for the given table name, that will be used internally in the streamer to identify the table.

 

class method makeTableKey(aTableName: String): String

 

static String makeTableKey(String aTableName)

Parameters:

  • aTableName: A name of the data table.

needIncludeValuesToStream  protected    (declared in DataStreamer)

The method checks if specific row value must be included wile streaming data. It can be ommited, if if hasn't been changed. This approach is ussed in Reduced Delta feature of Bin2DataStreamer.

 

method needIncludeValuesToStream(aOldValue: Object; aNewValue: Object; aIsReducedDelta: Boolean; aIsPK: Boolean; aIncludeOld: ReferenceType<Boolean>; aIncludeNew: ReferenceType<Boolean>): Boolean

 

Boolean needIncludeValuesToStream(Object aOldValue, Object aNewValue, Boolean aIsReducedDelta, Boolean aIsPK, ReferenceType<Boolean> aIncludeOld, ReferenceType<Boolean> aIncludeNew)

Parameters:

  • aOldValue: An original field value.
  • aNewValue: A new field value.
  • aIsReducedDelta: A flag defines whether or not the delta should be reduced.
  • aIsPK: The flag used to define whether of not the field belongs to the primary key.
  • aIncludeOld: out param returns whether or not the original value is supposed to be included.
  • aIncludeNew: out param returns whether or not the new value is supposed to be included.

readDataTable    (declared in DataStreamer)

Reads the contents of a DataTable from the stream. This method will throw an exception if no DataTable can be found in the stream by the name passed in the first parameter.

Some cases of usage:

  // to load data without schema (in case table has been previously initialized with the schema):
  streamer.readDataTable("Clients", table, <tt>false</tt>, <tt>true</tt>);
  // to initialize the table column structure without loading the ctual data:
  streamer.readDataTable("Clients", table, <tt>true</tt>, <tt>false</tt>);

 

method readDataTable(aDataTableName: String; aDestination: DataTable; aApplySchema: Boolean; aLoadRecords: Boolean)

 

void readDataTable(String aDataTableName, DataTable aDestination, Boolean aApplySchema, Boolean aLoadRecords)

Parameters:

  • aDataTableName: A name of the data table to be read.
  • aDestination: A data table object to fill with tha data.
  • aApplySchema: The flag defines, if a Schema should be applied to the given table.
  • aLoadRecords: The flag defines, if method should load data for the table.

readDataTableSchema    (declared in DataStreamer)

The method reads the schema for the given table name and returns it.

 

method readDataTableSchema(aDataTableName: String): SchemaDataTable

 

SchemaDataTable readDataTableSchema(String aDataTableName)

Parameters:

  • aDataTableName: A name of the data table.

readDelta (Delta)    (declared in DataStreamer)

The method returns a delta from the provided source. If there is no delta by the name passed it will throw an exception.

 

method readDelta(aDestination: Delta)

 

void readDelta(Delta aDestination)

Parameters:

  • aDestination: A delta object to be filled.

readDelta (Schema, String): Delta    (declared in DataStreamer)

The method creates a new Delta object using the given Schema and fills it from the source associated with the streamer.

 

method readDelta(aSchema: Schema; aTableName: String): Delta

 

Delta readDelta(Schema aSchema, String aTableName)

Parameters:

  • aSchema: A schema for a new delta.
  • aTableName: A table name, that is used to find delta's data in the streamer's source.

SendReducedDelta

 

property SendReducedDelta: Boolean read write;

 

Boolean SendReducedDelta { __get; __set; }

writeDataTable    (declared in DataStreamer)

The method writes a DataTable to the streamer destination. This method will throw an exception if a DataTable by the same name already exists in the stream.

 

method writeDataTable(aTable: DataTable; aTableSchema: SchemaDataTable; aMaxRecords: Integer; aIncludeSchema: Boolean)

 

void writeDataTable(DataTable aTable, SchemaDataTable aTableSchema, Integer aMaxRecords, Boolean aIncludeSchema)

Parameters:

  • aTable: A data table to stream.
  • aTableSchema: A data table's schema to use while streaming.
  • aMaxRecords: A number of maximum table records the server supposed to send back to the client.
  • aIncludeSchema: The flag defines wheter or not server should include table schema in response.

writeDelta (DataTable, Boolean): Delta    (declared in DataStreamer)

 

method writeDelta(aDataTable: DataTable; aDynamicSelect: Boolean): Delta

 

Delta writeDelta(DataTable aDataTable, Boolean aDynamicSelect)

Parameters:

  • aDataTable:
  • aDynamicSelect:

writeDelta (Delta, Boolean)    (declared in DataStreamer)

The method streams the gived delta considering usage of Dynamic Select feature.

 

method writeDelta(aDelta: Delta; aDynamicSelect: Boolean)

 

void writeDelta(Delta aDelta, Boolean aDynamicSelect)

Parameters:

  • aDelta: A delta to be streamed.
  • aDynamicSelect: A flag defines whether or not the streamer should use Dynamic Select feature while writing the delta.

 

Elements    (declared in DataStreamer)

 

property Elements: Map<String, StreamElementInfo> read;

 

Map<String, StreamElementInfo> Elements { __get; }

InitializationMode  protected    (declared in DataStreamer)

 

property InitializationMode: StreamerInitialization read;

 

StreamerInitialization InitializationMode { __get; }

SendReducedDelta

 

property SendReducedDelta: Boolean read write;

 

Boolean SendReducedDelta { __get; __set; }

 

constructor <clinit>  External

 

class method constructor <clinit>

 

static void constructor <clinit>()

getLoggedDeltaFields  protected    (declared in DataStreamer)

The method uses given delta to return the list of SchemaField that should be logged to server and an index that maps schema fields to correspondent positions used by the delta.

 

class method getLoggedDeltaFields(aDelta: Delta; aFields: ReferenceType<array of SchemaField>; aMapping: ReferenceType<array of Integer>)

 

static void getLoggedDeltaFields(Delta aDelta, ReferenceType<array of SchemaField> aFields, ReferenceType<array of Integer> aMapping)

Parameters:

  • aDelta: A delta to work with.
  • aFields: * out param* list of schema fields that should be logged.
  • aMapping: * out param* mapping to find the index for column data.

isDbValueAssigned  protected    (declared in DataStreamer)

This method checks if a value was initialized by the DB or the server.

 

class method isDbValueAssigned(aValue: Object): Boolean

 

static Boolean isDbValueAssigned(Object aValue)

Parameters:

  • aValue: avalue to check.

makeTableKey    (declared in DataStreamer)

The method returns a prepered key for the given table name, that will be used internally in the streamer to identify the table.

 

class method makeTableKey(aTableName: String): String

 

static String makeTableKey(String aTableName)

Parameters:

  • aTableName: A name of the data table.

 

constructor

Default constructor that creates an instance of Bin2DataStreamer

 

constructor

 

Bin2DataStreamer()

doFinalizeStreamer  protected

Used in write mode, to store offsets of streamed elements.

 

method doFinalizeStreamer

 

void doFinalizeStreamer()

doInitializeStreamer  protected

Initializes the streamer to work in the given mode (second parameter).

 

method doInitializeStreamer(aSource: Object; aMode: StreamerInitialization)

 

void doInitializeStreamer(Object aSource, StreamerInitialization aMode)

Parameters:

  • aSource: A stream to use during streaming. Stream should be seekable.
  • aMode: A mode of the current streamer operation.

doReadDataTable (StreamElementInfo, DataTable)  protected

Fills the instantiated and named instance of the data table (second parameter) with the data from the stream. The data will be read according to the information and offsets provided in StreamElementInfo (first parameter). Loads all data records from the stream without loading table structure/schema.

 

method doReadDataTable(anElement: StreamElementInfo; aDestination: DataTable)

 

void doReadDataTable(StreamElementInfo anElement, DataTable aDestination)

Parameters:

  • anElement: An information about the position of data in the stream.
  • aDestination: A table instance that should be filled with data.

doReadDataTable (StreamElementInfo, DataTable, Boolean)  protected

Fills the instantiated and named instance of the data table (second parameter) with the data from the stream. The data will be read according to the information and offsets provided in StreamElementInfo (first parameter). Loads all data records from the stream.

 

method doReadDataTable(anElement: StreamElementInfo; aDestination: DataTable; ApplySchema: Boolean)

 

void doReadDataTable(StreamElementInfo anElement, DataTable aDestination, Boolean ApplySchema)

Parameters:

  • anElement: An information about the position of data in the stream.
  • aDestination: A table instance that should be filled with data.
  • ApplySchema: Defines whether or not to apply schema from stream to the given table instance. Usually pass true here, if table haven't previously loaded or server's schema has changed.

doReadDataTable (StreamElementInfo, DataTable, Boolean, Boolean)  protected

Fills the instantiated and named instance of the data table (second parameter) with the data from the stream. The data will be read according to the information and offsets provided in StreamElementInfo (first parameter).

 

method doReadDataTable(anElement: StreamElementInfo; aDestination: DataTable; ApplySchema: Boolean; LoadRecords: Boolean)

 

void doReadDataTable(StreamElementInfo anElement, DataTable aDestination, Boolean ApplySchema, Boolean LoadRecords)

Parameters:

  • anElement: An information about the position of data in the stream.
  • aDestination: A table instance that should be filled with data.
  • ApplySchema: Defines whether or not to apply schema from stream to the given table instance. Usually pass true here, if table haven't previously loaded or server's schema has changed.
  • LoadRecords: Defines whether or not to load table data from the stream. Set it to false if you jjust want to have table structure on client.

doReadDataTableSchema  protected

Reads the table's schema by the given table's name.

 

method doReadDataTableSchema(aDataTableName: String): SchemaDataTable

 

SchemaDataTable doReadDataTableSchema(String aDataTableName)

Parameters:

  • aDataTableName: A table name to read schema for.

doReadDelta  protected

Fills the given delta with the data from the stream.

 

method doReadDelta(anElement: StreamElementInfo; aDestination: Delta)

 

void doReadDelta(StreamElementInfo anElement, Delta aDestination)

Parameters:

  • anElement: A structure that contains all required information to find and read delta's data in the stream.
  • aDestination: The delta instance to fill.

doWriteDataTable  protected

Writes the given data table to the related stream.

 

method doWriteDataTable(aTable: DataTable; aTableSchema: SchemaDataTable; aMaxRecords: Integer; aIncludeSchema: Boolean)

 

void doWriteDataTable(DataTable aTable, SchemaDataTable aTableSchema, Integer aMaxRecords, Boolean aIncludeSchema)

Parameters:

  • aTable: The table to write.
  • aTableSchema: A table's schema to use during writing.
  • aMaxRecords: Max number of records from the table to store in the steam.
  • aIncludeSchema: Defines wheter or not to include table's schema in the stream.

doWriteDelta  protected

Writes the given delta the the related stream.

 

method doWriteDelta(aDelta: Delta; aDynamicSelect: Boolean)

 

void doWriteDelta(Delta aDelta, Boolean aDynamicSelect)

Parameters:

  • aDelta: The given delta to write.
  • aDynamicSelect: For Bin2 format this actually defines, whether a Reduced Delta feature will be used for this particular delta.

finalizeStreamer    (declared in DataStreamer)

The method finalizes the reading/writing of data. It should be called after all elements are written or when reading is complete.

 

method finalizeStreamer

 

void finalizeStreamer()

initializeStreamer    (declared in DataStreamer)

This method initializes current streamer object. First parameter should contain the stream or String containing the data to process. All other read/wirte streamer methods will use this given object as a source to read from or as a destination to write to. Second parameter should contain the mode in which this Streamer should be initialized.

 

method initializeStreamer(aSource: Object; aStreamerMode: StreamerInitialization)

 

void initializeStreamer(Object aSource, StreamerInitialization aStreamerMode)

Parameters:

  • aSource: a data for the streamer to worm with(usually a string or a stream).
  • aStreamerMode: an initialization mode of the streamer.

needIncludeValuesToStream  protected    (declared in DataStreamer)

The method checks if specific row value must be included wile streaming data. It can be ommited, if if hasn't been changed. This approach is ussed in Reduced Delta feature of Bin2DataStreamer.

 

method needIncludeValuesToStream(aOldValue: Object; aNewValue: Object; aIsReducedDelta: Boolean; aIsPK: Boolean; aIncludeOld: ReferenceType<Boolean>; aIncludeNew: ReferenceType<Boolean>): Boolean

 

Boolean needIncludeValuesToStream(Object aOldValue, Object aNewValue, Boolean aIsReducedDelta, Boolean aIsPK, ReferenceType<Boolean> aIncludeOld, ReferenceType<Boolean> aIncludeNew)

Parameters:

  • aOldValue: An original field value.
  • aNewValue: A new field value.
  • aIsReducedDelta: A flag defines whether or not the delta should be reduced.
  • aIsPK: The flag used to define whether of not the field belongs to the primary key.
  • aIncludeOld: out param returns whether or not the original value is supposed to be included.
  • aIncludeNew: out param returns whether or not the new value is supposed to be included.

readDataTable    (declared in DataStreamer)

Reads the contents of a DataTable from the stream. This method will throw an exception if no DataTable can be found in the stream by the name passed in the first parameter.

Some cases of usage:

  // to load data without schema (in case table has been previously initialized with the schema):
  streamer.readDataTable("Clients", table, <tt>false</tt>, <tt>true</tt>);
  // to initialize the table column structure without loading the ctual data:
  streamer.readDataTable("Clients", table, <tt>true</tt>, <tt>false</tt>);

 

method readDataTable(aDataTableName: String; aDestination: DataTable; aApplySchema: Boolean; aLoadRecords: Boolean)

 

void readDataTable(String aDataTableName, DataTable aDestination, Boolean aApplySchema, Boolean aLoadRecords)

Parameters:

  • aDataTableName: A name of the data table to be read.
  • aDestination: A data table object to fill with tha data.
  • aApplySchema: The flag defines, if a Schema should be applied to the given table.
  • aLoadRecords: The flag defines, if method should load data for the table.

readDataTableSchema    (declared in DataStreamer)

The method reads the schema for the given table name and returns it.

 

method readDataTableSchema(aDataTableName: String): SchemaDataTable

 

SchemaDataTable readDataTableSchema(String aDataTableName)

Parameters:

  • aDataTableName: A name of the data table.

readDelta (Delta)    (declared in DataStreamer)

The method returns a delta from the provided source. If there is no delta by the name passed it will throw an exception.

 

method readDelta(aDestination: Delta)

 

void readDelta(Delta aDestination)

Parameters:

  • aDestination: A delta object to be filled.

readDelta (Schema, String): Delta    (declared in DataStreamer)

The method creates a new Delta object using the given Schema and fills it from the source associated with the streamer.

 

method readDelta(aSchema: Schema; aTableName: String): Delta

 

Delta readDelta(Schema aSchema, String aTableName)

Parameters:

  • aSchema: A schema for a new delta.
  • aTableName: A table name, that is used to find delta's data in the streamer's source.

writeDataTable    (declared in DataStreamer)

The method writes a DataTable to the streamer destination. This method will throw an exception if a DataTable by the same name already exists in the stream.

 

method writeDataTable(aTable: DataTable; aTableSchema: SchemaDataTable; aMaxRecords: Integer; aIncludeSchema: Boolean)

 

void writeDataTable(DataTable aTable, SchemaDataTable aTableSchema, Integer aMaxRecords, Boolean aIncludeSchema)

Parameters:

  • aTable: A data table to stream.
  • aTableSchema: A data table's schema to use while streaming.
  • aMaxRecords: A number of maximum table records the server supposed to send back to the client.
  • aIncludeSchema: The flag defines wheter or not server should include table schema in response.

writeDelta (DataTable, Boolean): Delta    (declared in DataStreamer)

 

method writeDelta(aDataTable: DataTable; aDynamicSelect: Boolean): Delta

 

Delta writeDelta(DataTable aDataTable, Boolean aDynamicSelect)

Parameters:

  • aDataTable:
  • aDynamicSelect:

writeDelta (Delta, Boolean)    (declared in DataStreamer)

The method streams the gived delta considering usage of Dynamic Select feature.

 

method writeDelta(aDelta: Delta; aDynamicSelect: Boolean)

 

void writeDelta(Delta aDelta, Boolean aDynamicSelect)

Parameters:

  • aDelta: A delta to be streamed.
  • aDynamicSelect: A flag defines whether or not the streamer should use Dynamic Select feature while writing the delta.