com.apama.memorystore
Event Row


Represents an ordered and typed set of named fields in a table, with a key that uniquely identifies the row within the table.

A Row is an atomic snapshot of the data in the table and once returned, a Row's contents are guaranteed to be consistent and unchanging.

Any changes the user makes to a Row are local until commit is called.
See Also:
com.apama.memorystore.Table - A table holds a collection of rows.

Action Summary
 voidcommit()

Try to commit changes from this Row back to the table, which could result in an exception being thrown if the Row is not up to date.
 voidcopy(com.apama.memorystore.Row other)

Copy the contents of the specified other Row into this one.
 booleangetBoolean(string name)

Get the value of the specified field in this row (must only be used on boolean fields).
 decimalgetDecimal(string name)

Get the value of the specified field in this row (must only be used on decimal fields).
 floatgetFloat(string name)

Get the value of the specified field in this row (must only be used on float fields).
 integergetInteger(string name)

Get the value of the specified field in this row (must only be used on integer fields).
 stringgetKey()

Get the key for this Row.
 stringgetStoreName()

Get the name of the Store that contains this Row's Table.
 stringgetString(string name)

Get the value of the specified field in this row (must only be used on string fields).
 stringgetTableName()

Get the name of the Table that contains this Row.
 booleaninTable()

Indicate whether this row was in the table when the Row was created or updated.
 voidremove()

Mark the row for deletion when the table is committed.
 voidsetBoolean(string name, boolean b)

Set the value of the specified field in this row (must only be used on boolean fields).
 voidsetDecimal(string name, decimal d)

Set the value of the specified field in this row (must only be used on decimal fields).
 voidsetFloat(string name, float f)

Set the value of the specified field in this row (must only be used on float fields).
 voidsetInteger(string name, integer i)

Set the value of the specified field in this row (must only be used on integer fields).
 voidsetString(string name, string s)

Set the value of the specified field in this row (must only be used on string fields).
 booleantryCommit()

Try to commit changes from this Row back to the table, returning false if the Row is not up to date.
 booleantryCommitOrUpdate()

Try to commit, or update if not.
 voidupdate()

Update the local Row event to reflect the current state of the shared MemoryStore table, losing any local modifications.
 
Action Detail

commit

void commit()
Try to commit changes from this Row back to the table, which could result in an exception being thrown if the Row is not up to date.

If nothing else has modified the row in the table since this Row was created, the changes are committed so other users can see them.

Otherwise, the monitor instance terminates with an error and the table is left unchanged.

If there is any chance that the same row may be written to concurrently - for example by multiple correlator contexts, and/or if using a distributed MemoryStore - use Row.tryCommit() instead of Row.commit() so that it is possible to recover from this situation when it occurs.

Note that a MemoryStore commit operation synchronously writes changes made to the local Row instance back to the table which is shared by all monitors inside the Correlator (or the distributed store), but does not cause a persistent write to disk (see Table#persist).
See Also:
com.apama.memorystore.Row#tryCommit() - 
com.apama.memorystore.Row#tryCommitOrUpdate() - 

copy

void copy(com.apama.memorystore.Row other)
Copy the contents of the specified other Row into this one.

The two rows that these Row events represent must have the same schema but they need not be in the same table.

r1.copy(r2) is a more efficient equivalent to r1.setX("a", r2.getX("a")) for every field.

You cannot copy a row between a correlator-persistent store and an in-memory, on-disk or distributed store.
Parameters:
other

getBoolean

boolean getBoolean(string name)
Get the value of the specified field in this row (must only be used on boolean fields).
Parameters:
name

getDecimal

decimal getDecimal(string name)
Get the value of the specified field in this row (must only be used on decimal fields).
Parameters:
name

getFloat

float getFloat(string name)
Get the value of the specified field in this row (must only be used on float fields).
Parameters:
name

getInteger

integer getInteger(string name)
Get the value of the specified field in this row (must only be used on integer fields).
Parameters:
name

getKey

string getKey()
Get the key for this Row.

It cannot be changed.

getStoreName

string getStoreName()
Get the name of the Store that contains this Row's Table.

getString

string getString(string name)
Get the value of the specified field in this row (must only be used on string fields).
Parameters:
name

getTableName

string getTableName()
Get the name of the Table that contains this Row.

inTable

boolean inTable()
Indicate whether this row was in the table when the Row was created or updated.

It is possible to construct a Row that has no corresponding entry in the table, in which case all fields have default values.

Calling commit on a Row for which inTable()=false will create the row.

remove

void remove()
Mark the row for deletion when the table is committed.

Fields cannot be accessed after this call, until the removal is successfully committed (or reverted using update).

setBoolean

void setBoolean(string name, boolean b)
Set the value of the specified field in this row (must only be used on boolean fields).
Parameters:
name
b

setDecimal

void setDecimal(string name, decimal d)
Set the value of the specified field in this row (must only be used on decimal fields).
Parameters:
name
d

setFloat

void setFloat(string name, float f)
Set the value of the specified field in this row (must only be used on float fields).
Parameters:
name
f

setInteger

void setInteger(string name, integer i)
Set the value of the specified field in this row (must only be used on integer fields).
Parameters:
name
i

setString

void setString(string name, string s)
Set the value of the specified field in this row (must only be used on string fields).
Parameters:
name
s

tryCommit

boolean tryCommit()
Try to commit changes from this Row back to the table, returning false if the Row is not up to date.

If nothing else has modified the row in the table since this Row was created, the changes are committed so other users can see them and true is returned.

Otherwise, false is returned and the table is left unchanged. Do not repeatedly call tryCommit() without also calling update(), or use the more efficient Row.tryCommitOrUpdate().

Note that a MemoryStore commit operation synchronously writes changes made to the local Row instance back to the table which is shared by all monitors inside the Correlator (or the distributed store), but does not cause a persistent write to disk (see Table#persist).
Returns:
true if the table was modified; false if an error occurred and the table was not changed.
See Also:
com.apama.memorystore.Row#tryCommitOrUpdate() - 

tryCommitOrUpdate

boolean tryCommitOrUpdate()
Try to commit, or update if not.

This is a more efficient equivalent to calling tryCommit then calling update if returning false.

Note that a MemoryStore commit operation synchronously writes changes made to the local Row instance back to the table which is shared by all monitors inside the Correlator (or the distributed store), but does not cause a persistent write to disk (see Table#persist).
Returns:
true if the commit succeeded, false if the commit failed but the row has been updated ready for a retry attempt.

update

void update()
Update the local Row event to reflect the current state of the shared MemoryStore table, losing any local modifications.

row.update() has a very similar effect to r := t.get(r.getKey()), but is more efficient and doesn't require access to the table.