public abstract class Record extends Object implements IPumpable, Serializable
Records that are handled by the gRS2 set of components. All implementations
of this abstract class must define a default constructor without arguments as instances of these classes will be instantiated
using reflection based on the existence of a default no arguments constructor. One thing that distinguishes the records
belonging to one IBuffer, is the id. This id is set from within the framework once the record is bound to an
IBuffer as described in bind(IBuffer). This means that the id of each Record represents the
index of the Record within the virtually infinite array of Records managed by the IBuffer| Constructor and Description |
|---|
Record() |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(IBuffer buffer)
|
void |
deflate(DataOutput out)
Deflates the state and data of the implementor in a from capable of reconstructing the exact same instance
|
void |
dispose()
Disposes all internally kept state, calls
extendDispose() and then for every hosted Field, calls
Field.dispose() |
abstract void |
extendDeflate(DataOutput out)
The method all
Record implementations should implement to add any information they keep during deflate |
abstract void |
extendDispose()
Method to be implemented by
Record extenders to dispose any internally kept state |
abstract void |
extendInflate(DataInput in,
boolean reset)
The method all
Record implementations should implement to read any information they deflated |
protected abstract void |
extendMakeLocal()
The method all
Record implementations should implement to reset additional information they keep concerning transfers performed |
abstract void |
extendReceive(DataInput in)
The method all
Record implementations should implement to read any information they send during transfer |
abstract void |
extendSend(DataOutput out)
The method all
Record implementations should implement to add any information they keep during transfer |
void |
fromXML(Element element) |
RecordDefinition |
getDefinition()
Retrieves the
RecordDefinition associated with this Record. |
int |
getDefinitionIndex()
|
Field |
getField(int index)
Retrieve the
Field with the specified index in the fields array |
Field |
getField(String name)
Retrieve the
Field with the specified name |
Field[] |
getFields()
|
long |
getID()
Retrieves the id of the
Record |
void |
hide()
|
void |
inflate(DataInput in)
Inflate the state and data of the implementor as was previously deflated using
IPumpable.deflate(DataOutput) |
void |
inflate(DataInput in,
boolean reset)
Inflate the state and data of the implementor as was previously deflated using
IPumpable.deflate(DataOutput) |
boolean |
isBoundTo(IBuffer buffer)
|
boolean |
isRemoteCopy()
Retrieves if this is the remote copy of the record
|
void |
makeAvailable()
For all hosted
Fields, the method makeAvailable(int) |
void |
makeAvailable(int fieldIndex)
For the specified
Field with the set index, the method Record#makeAvailable(TransportOverride, int) with a
value of IBuffer.TransportOverride.Override |
void |
makeAvailable(String fieldName)
For the specified
Field with the set name, the method Record#makeAvailable(TransportOverride, int) with a
value of IBuffer.TransportOverride.Override |
void |
makeLocal()
Called by
RecordWriter.importRecord(T). |
void |
markActivity()
|
void |
prebind(IBuffer buffer)
|
void |
receive(DataInput in)
Receives the state and payload of the
Record from a remote sender. |
void |
receiveFromXML(Element element) |
void |
requestPartial(IBuffer.TransportOverride override,
int fieldIndex)
|
IBuffer.TransportDirective |
resolveTransportDirective()
Resolves the
IBuffer.TransportDirective that should be used fir this record. |
void |
send(DataOutput out)
Sends the state and payload of the
Record to a remote requester. |
Element |
sendToXML(Document doc) |
void |
setDefinitionIndex(int index)
|
void |
setFields(Field[] fields)
|
void |
setID(long id) |
void |
setRemoteCopy(boolean remoteCopy)
|
void |
show()
|
Element |
toXML(Document doc) |
void |
unbind()
|
public long getID()
Recordpublic void setID(long id)
public RecordDefinition getDefinition() throws GRS2RecordDefinitionException, GRS2BufferException
RecordDefinition associated with this Record. This operation is only available
after the bind(IBuffer) method is invoked. This method is typically invoked when a Record
is added to an IBufferGRS2RecordDefinitionException - if the Record was not properly bind to a IBufferGRS2BufferException - the available definitions could not be retrieved from the IBufferpublic int getDefinitionIndex()
Record in the record definitions array provided to the IBufferpublic void setDefinitionIndex(int index)
Record in the record definitions array provided to the IBufferindex - the indexpublic void setFields(Field[] fields)
fields - the fieldspublic Field[] getFields()
public Field getField(String name) throws GRS2RecordDefinitionException, GRS2BufferException
Field with the specified namename - the name of the field as is defined in the Field's FieldDefinitionGRS2RecordDefinitionException - If there was a problem retrieving the available fields definitionsGRS2BufferException - If there was a problem retrieving the definitions from the IBufferpublic Field getField(int index)
Field with the specified index in the fields arrayindex - the field indexpublic void bind(IBuffer buffer) throws GRS2BufferException, GRS2RecordDefinitionException
Record to the provided IBuffer. If the record has no definition index defined and the buffer's
record definitions only contain a single definition, the only available definition is used by default. The id of the record
is set as IBuffer.totalRecords()-1. Therefore the id always coincides with the virtual index of the Record
if one considers the Record as being available in an unbounded array of Records. For every Field
available in the Record, the Field.setDefinitionIndex(int) as well as Field.bind(Record) method
is invoked.buffer - the IBuffer to bind this record toGRS2BufferException - the IBuffer state does not permit this operation to be completedGRS2RecordDefinitionException - no usable definition could be found and associated with the Recordpublic void unbind()
public void hide()
public void show()
public boolean isBoundTo(IBuffer buffer)
public void prebind(IBuffer buffer)
Record to the provided IBuffer to enable the invocation of some
other method that needs to have the IBuffer of the record available but before adding the record to the IBuffer
properlybuffer - the IBuffer to pre-bind topublic void markActivity()
public void setRemoteCopy(boolean remoteCopy)
remoteCopy - whether or not this is the remote copypublic boolean isRemoteCopy()
public IBuffer.TransportDirective resolveTransportDirective() throws GRS2RecordDefinitionException, GRS2BufferException
IBuffer.TransportDirective that should be used fir this record. In case the defined IBuffer.TransportDirective
is set to IBuffer.TransportDirective.Inherit, a call to the bound IBuffer's IBuffer.resolveTransportDirective()IBuffer.TransportDirectiveGRS2RecordDefinitionException - the record definition is not availableGRS2BufferException - the buffer is unavailablepublic final void deflate(DataOutput out) throws GRS2RecordSerializationException
Record to the provided stream. After deflating the internally kept
information, a call to extendDeflate(DataOutput) is made and then for each field hosted, a call to
Field.deflate(DataOutput) is madedeflate in interface IPumpableout - the stream to deflate toGRS2RecordSerializationException - there was a problem serializing the informationpublic final void send(DataOutput out) throws GRS2RecordSerializationException
Record to a remote requester. After writing the internally managed information,
a call to extendSend(DataOutput) is made, and for every Field hosted, a call to Field.send(DataOutput)
is madeout - the stream to send toGRS2RecordSerializationException - there was a problem serializing the informationpublic Element sendToXML(Document doc) throws GRS2RecordSerializationException
GRS2RecordSerializationExceptionpublic final void inflate(DataInput in) throws GRS2RecordSerializationException
IPumpable.deflate(DataOutput)
Similar as calling inflate(DataInput, boolean) with a reset parameter of falseinflate in interface IPumpablein - the stream to inflate fromGRS2RecordSerializationException - the inflate could not be completedinflate(DataInput, boolean),
IPumpable.inflate(java.io.DataInput)public final void inflate(DataInput in, boolean reset) throws GRS2RecordSerializationException
IPumpable.deflate(DataOutput)
Inflates the Record from the provided stream as it was previously deflated using the method deflate(DataOutput).
After deflating the internally kept information, the stream is passed to extendDeflate(DataOutput) and then the
serializations of the hosted Fields are read by the respective Field.inflate(DataInput, boolean)inflate in interface IPumpablein - the stream to inflate fromreset - whether or not the inflated information should be reset to drop any information previously stored concerning transfers
performed by the RecordGRS2RecordSerializationException - there was a problem deserializing the informationpublic final void receive(DataInput in) throws GRS2RecordSerializationException
Record from a remote sender. After reading the internally managed information,
a call to extendReceive(DataInput) is made, and for every Field hosted, a call to Field.receive(DataInput)
is madein - the stream to receive fromGRS2RecordSerializationException - there was a problem deserializing the informationpublic final void makeLocal()
RecordWriter.importRecord(T). External usage is unnecessary and discouraged.
Resets all internally kept information concerning transfers performed by the Record and makes it behave as it were local.
For all Fields, Field.makeLocal() is invoked, therefore if partial transfers are involved Field.makeAvailable()
should be invoked beforehand in case the full payload is needed.
Field.makeLocal()public abstract void extendSend(DataOutput out) throws GRS2RecordSerializationException
Record implementations should implement to add any information they keep during transferout - the stream to transfer throughGRS2RecordSerializationException - Information serialization problempublic abstract void extendReceive(DataInput in) throws GRS2RecordSerializationException
Record implementations should implement to read any information they send during transferin - the stream to read fromGRS2RecordSerializationException - Information deserialization errorpublic abstract void extendDeflate(DataOutput out) throws GRS2RecordSerializationException
Record implementations should implement to add any information they keep during deflateout - the stream to deflate toGRS2RecordSerializationException - Information serialization problempublic abstract void extendInflate(DataInput in, boolean reset) throws GRS2RecordSerializationException
Record implementations should implement to read any information they deflatedin - the stream to inflate fromreset - whether or not the inflated information should be reset to drop any information previously stored concerning transfers
performed by the FieldGRS2RecordSerializationException - Information deserialization errorprotected abstract void extendMakeLocal()
Record implementations should implement to reset additional information they keep concerning transfers performedpublic void dispose()
extendDispose() and then for every hosted Field, calls
Field.dispose()public abstract void extendDispose()
Record extenders to dispose any internally kept statepublic void requestPartial(IBuffer.TransportOverride override, int fieldIndex) throws GRS2ProxyMirrorException
IBuffer has a IMirror set, then the IMirror#requestPartial(long, int, TransportOverride, Object)
method is used to request additional payload for the specific Field of the Record. Requests for more of partial
content can only be issued against Fields of a Record and not for Records themselvesoverride - the IBuffer.TransportOverride directivefieldIndex - the field index to request data forGRS2ProxyMirrorException - The state of the IMirror does not allow for this operation to be completedpublic void makeAvailable()
throws GRS2RecordDefinitionException,
GRS2ProxyMirrorException,
GRS2BufferException
Fields, the method makeAvailable(int)GRS2RecordDefinitionException - the record definition could not be retrievedGRS2ProxyMirrorException - There was an error during the mirroring processGRS2BufferException - the IBuffer state does not allow for this operation to be completedpublic void makeAvailable(String fieldName) throws GRS2RecordDefinitionException, GRS2ProxyMirrorException, GRS2BufferException
Field with the set name, the method Record#makeAvailable(TransportOverride, int) with a
value of IBuffer.TransportOverride.OverridefieldName - the name of the field to make availableGRS2RecordDefinitionException - the record definition could not be retrievedGRS2ProxyMirrorException - There was an error during the mirroring processGRS2BufferException - the IBuffer state does not allow for this operation to be completedpublic void makeAvailable(int fieldIndex)
throws GRS2RecordDefinitionException,
GRS2ProxyMirrorException,
GRS2BufferException
Field with the set index, the method Record#makeAvailable(TransportOverride, int) with a
value of IBuffer.TransportOverride.OverridefieldIndex - the index of the fieldGRS2RecordDefinitionException - the record definition could not be retrievedGRS2ProxyMirrorException - There was an error during the mirroring processGRS2BufferException - the IBuffer state does not allow for this operation to be completedpublic final Element toXML(Document doc) throws GRS2RecordSerializationException
toXML in interface IPumpableGRS2RecordSerializationExceptionpublic void receiveFromXML(Element element) throws GRS2RecordSerializationException
GRS2RecordSerializationExceptionpublic final void fromXML(Element element) throws GRS2RecordSerializationException
fromXML in interface IPumpableGRS2RecordSerializationExceptionCopyright © 2014. All Rights Reserved.