com.apama.dataview
Event DataViewManager


The Data View Manager event is used to configure and control a single DataView.

The user initialises the manager using either define(), which will register the DataView scenario with the Scenario Service and should only be called once, or initialise() if the define() is known to have been called elsewhere (so the scenario is already registered).

The DataViewManager can be used in multi-context environments. It can be initialised in a non-main context, and/or spawned into other contexts as long as onSpawn() is called to register the new context for DataView row/instance discovery.

You can provide key fields during initialisation so adds, updates and deletes are matched using these rather than the itemId (this should be set to -1 to force using key fields).

To delete/cleanup DataViews, you should use uninitialise() when initialise() was used or a spawned instance was created. You should use undefine() when define() was used, and it should only be called once as it unloads the DataView scenario from the Scenario Service.
See Also:
com.apama.dataview.DataViewManager#define() - 
com.apama.dataview.DataViewManager#initialise() - 
com.apama.dataview.DataViewManager#onSpawn() - 
com.apama.dataview.DataViewManager#uninitialise() - 
com.apama.dataview.DataViewManager#undefine() - 

Constant summary
 constant stringMEMORY_STORE_PREFIX := "MEMST_"
 constant stringPREFIX := "DV_"
 constant stringSCENARIO_SERVICE_CHANNEL := "com.apama.scenario"
 
Member summary
 booleanLOG_DEBUG
 booleanLOG_INFO
 booleanLOG_WARN
 booleanLOG_ERROR
 stringdvName
 stringscenarioId
 integerNUM_FIELDS
 sequence<integer>compoundKeyIndexes
 sequence<string>compoundKeyNames
 dictionary<string, integer>compoundKeyInstanceDictionary
 dictionary<integer, com.apama.dataview._Item>instancesDictionary
 dictionary<string, integer>fieldLookupDictionary
 dictionary<string, string>escapeCharMap
 com.apama.scenario.ScenarioServiceUpdaterMultipleInstancesupdater
 listenerrequestInstancesListener
 
Action summary
 com.apama.dataview.DataViewResultaddDataViewItem(string owner, float timeStamp, sequence<string> fieldValues)

Add a new DataViewItem to the current DataView.
 com.apama.dataview.DataViewResultaddOrDeltaUpdateDataViewItem(string owner, float timeStamp, dictionary<integer, string> fieldValues)

Add a new DataViewItem to the current DataView if it does not already exist, or update a SUBSET of the field values of an existing DataViewItem in the current DataView. Attempts to change the owner of an existing item will be rejected.
 com.apama.dataview.DataViewResultaddOrDeltaUpdateDataViewItemByFieldName(string owner, float timeStamp, dictionary<string, string> fieldValues)

Add a new DataViewItem to the current DataView if it does not already exist, or update a SUBSET of the field values of an existing DataViewItem in the current DataView by providing refrence by field name.
 com.apama.dataview.DataViewResultaddOrUpdateDataViewItem(string owner, float timeStamp, sequence<string> fieldValues)

Add a new DataViewItem to the current DataView if it does not already exist, or update it if it does exist. This will ONLY work when keyFields are used. Attempts to change the owner of an existing item will be rejected.
 voiddebug(string msg)
 com.apama.dataview.DataViewResultdefine(string dvName, string dvDisplayName, string dvDescription, sequence<string> fieldNames, sequence<string> fieldTypes, sequence<string> keyFields, context mainCtx)

The define action that checks all the parameters are valid and creates the Scenario for the Data View.
 voiddeleteAllDataViewItems()

Delete all existing DataViewItems from the current DataView.
 com.apama.dataview.DataViewResultdeleteDataViewItem(integer itemId)

Delete an existing DataViewItem from the current DataView.
 com.apama.dataview.DataViewResultdeleteDataViewItemByKeyFields(sequence<string> keyFields)

Delete an existing DataViewItem from the current DataView by matching the supplied key fields.
 voidemitAcknowledgement(integer messageId, com.apama.dataview._Item item)
 voidemitNack(integer messageId, integer scenarioInstanceId)
 voiderror(string msg)
 sequence<string>getDataViewItem(integer itemId)

Retrieve the field values for a DataView item by id.
 sequence<string>getDataViewItemByKeyFields(sequence<string> keyFields)

Retrieve the field values for a DataView with these key fields.
 dictionary<string, integer>getFieldNameToIndex()

Retrieve the helper dictionary to facilitate sequence position lookup by field name.
 booleanhasDataViewItem(integer itemId)

Does a DataView item already exist with this id.
 com.apama.dataview.DataViewResulthasDataViewItemByKeyFields(sequence<string> keyFields)

Does a DataView item already exist with these key fields.
 voidinfo(string msg)
 com.apama.dataview.DataViewResultinitialise(string dvName, string dvDisplayName, string dvDescription, sequence<string> fieldNames, sequence<string> fieldTypes, sequence<string> keyFields, context mainCtx)

The initialisation action that checks all the parameters are valid but DOES NOT create the Scenario for the Data View.
 voidonSpawn()

MUST be called when a DataViewManager is spawned to clear out its instance state and register the context with the ScenarioService.
 voidsetLogLevel(string level)

Change the log level.
 voidundefine()

Deletes an existing DataView and unloads the Scenario. This should be called once per DataView and from the same context which defined the DataView.
 voiduninitialise()

Deletes and cleans up the manager WITHOUT unloading the Scenario. This should be called if initialise() was used..
 com.apama.dataview.DataViewResultupdateDeltaDataViewItem(integer itemId, float timeStamp, dictionary<integer, string> fieldValues)

Update a SUBSET of the field values of an existing DataViewItem in the current DataView.
 com.apama.dataview.DataViewResultupdateDeltaDataViewItemByFieldName(integer itemId, float timeStamp, dictionary<string, string> fieldValues)

Update a SUBSET of the field values of an existing DataViewItem in the current DataView.
 com.apama.dataview.DataViewResultupdateFullDataViewItem(integer itemId, float timeStamp, sequence<string> fieldValues)

Update ALL the field values of an existing DataViewItem in the current DataView.
 voidwarn(string msg)
 
Constant detail

MEMORY_STORE_PREFIX

constant string MEMORY_STORE_PREFIX := "MEMST_"

PREFIX

constant string PREFIX := "DV_"

SCENARIO_SERVICE_CHANNEL

constant string SCENARIO_SERVICE_CHANNEL := "com.apama.scenario"

Member detail

compoundKeyIndexes

sequence<integer> compoundKeyIndexes

compoundKeyInstanceDictionary

dictionary<string, integer> compoundKeyInstanceDictionary

compoundKeyNames

sequence<string> compoundKeyNames

dvName

string dvName

escapeCharMap

dictionary<string, string> escapeCharMap

fieldLookupDictionary

dictionary<string, integer> fieldLookupDictionary

instancesDictionary

dictionary<integer, com.apama.dataview._Item> instancesDictionary

LOG_DEBUG

boolean LOG_DEBUG

LOG_ERROR

boolean LOG_ERROR

LOG_INFO

boolean LOG_INFO

LOG_WARN

boolean LOG_WARN

NUM_FIELDS

integer NUM_FIELDS

requestInstancesListener

listener requestInstancesListener

scenarioId

string scenarioId

updater

com.apama.scenario.ScenarioServiceUpdaterMultipleInstances updater

Action detail

addDataViewItem

com.apama.dataview.DataViewResult addDataViewItem(string owner, float timeStamp, sequence<string> fieldValues)
Add a new DataViewItem to the current DataView.

All Add, Update and Delete actions should be called from the same context that the Add was called from.
Parameters:
owner - The owner of this Data View Item
timeStamp
fieldValues - The initial values for each field
Returns:
A com.apama.dataview.DataViewResult event. If successful, itemId will be set to the new itemId. Success will be set to false if the item cannot be added, and message will identify the problem encountered.

addOrDeltaUpdateDataViewItem

com.apama.dataview.DataViewResult addOrDeltaUpdateDataViewItem(string owner, float timeStamp, dictionary<integer, string> fieldValues)
Add a new DataViewItem to the current DataView if it does not already exist, or update a SUBSET of the field values of an existing DataViewItem in the current DataView. Attempts to change the owner of an existing item will be rejected.
Parameters:
owner - The owner of this Data View Item
timeStamp
fieldValues - A dictionary of field ids to values to update
Returns:
A com.apama.dataview.DataViewResult event. Success will be set to false if the item cannot be added or updated, and message will identify the problem encountered. If added, itemId will be set to the new itemId, else the updated itemId.

addOrDeltaUpdateDataViewItemByFieldName

com.apama.dataview.DataViewResult addOrDeltaUpdateDataViewItemByFieldName(string owner, float timeStamp, dictionary<string, string> fieldValues)
Add a new DataViewItem to the current DataView if it does not already exist, or update a SUBSET of the field values of an existing DataViewItem in the current DataView by providing refrence by field name.

Attempts to change the owner of an existing item will be rejected.
Parameters:
owner - The owner of this Data View Item
timeStamp
fieldValues - A dictionary of field names to values to update
Returns:
A com.apama.dataview.DataViewResult event. Success will be set to false if the item cannot be added or updated, and message will identify the problem encountered. If added, itemId will be set to the new itemId, else the updated itemId.

addOrUpdateDataViewItem

com.apama.dataview.DataViewResult addOrUpdateDataViewItem(string owner, float timeStamp, sequence<string> fieldValues)
Add a new DataViewItem to the current DataView if it does not already exist, or update it if it does exist. This will ONLY work when keyFields are used. Attempts to change the owner of an existing item will be rejected.
Parameters:
owner - The owner of this Data View Item
timeStamp
fieldValues - The values for each field
Returns:
A com.apama.dataview.DataViewResult event. Success will be set to false if the item cannot be added or updated, and message will identify the problem encountered. If added, itemId will be set to the new itemId, else the updated itemId.

debug

void debug(string msg)
Parameters:
msg

define

com.apama.dataview.DataViewResult define(string dvName, string dvDisplayName, string dvDescription, sequence<string> fieldNames, sequence<string> fieldTypes, sequence<string> keyFields, context mainCtx)
The define action that checks all the parameters are valid and creates the Scenario for the Data View.

This should only ever be called once to setup the manager/data view. It can be called from any context. You can spawn copies of an initialised DataView into the same or different context, but you MUST call onSpawn(). To delete the DataView and Scenario, undefine() should be called only once from the same context that initialised the DataView.
Parameters:
dvName - The name for the dataview
dvDisplayName - The display name for the dataview
dvDescription - A description of the dataview's purpose
fieldNames - The names of the columns in the dataview
fieldTypes - The types of the columns in the dataview
keyFields - [OPTIONAL] The key fields of the columns in the dataview which can be used to determine a unique item
mainCtx - The main context
Returns:
A DataViewResult event signifying success or failure
See Also:
com.apama.dataview.DataViewManager#onSpawn() - 
com.apama.dataview.DataViewManager#undefine() - 

deleteAllDataViewItems

void deleteAllDataViewItems()
Delete all existing DataViewItems from the current DataView.

deleteDataViewItem

com.apama.dataview.DataViewResult deleteDataViewItem(integer itemId)
Delete an existing DataViewItem from the current DataView.
Parameters:
itemId - The id for this item within this Manager/Data View
Returns:
A DataViewResult event. Success will be set to false if the item cannot be deleted

deleteDataViewItemByKeyFields

com.apama.dataview.DataViewResult deleteDataViewItemByKeyFields(sequence<string> keyFields)
Delete an existing DataViewItem from the current DataView by matching the supplied key fields.
Parameters:
keyFields - The key fields used to identify a unique item within this Manager/Data View
Returns:
A DataViewResult event. Success will be set to false if the item cannot be deleted

emitAcknowledgement

void emitAcknowledgement(integer messageId, com.apama.dataview._Item item)
Parameters:
messageId
item

emitNack

void emitNack(integer messageId, integer scenarioInstanceId)
Parameters:
messageId
scenarioInstanceId

error

void error(string msg)
Parameters:
msg

getDataViewItem

sequence<string> getDataViewItem(integer itemId)
Retrieve the field values for a DataView item by id.
Parameters:
itemId - The id for this item within this Manager/Data View
Returns:
The sequence of fields in the row requested (blank if retrieval fails)

getDataViewItemByKeyFields

sequence<string> getDataViewItemByKeyFields(sequence<string> keyFields)
Retrieve the field values for a DataView with these key fields.
Parameters:
keyFields - The key fields used to identify a unique item within this Manager/Data View
Returns:
The sequence of fields in the row requested (blank if retrieval fails)

getFieldNameToIndex

dictionary<string, integer> getFieldNameToIndex()
Retrieve the helper dictionary to facilitate sequence position lookup by field name.
Returns:
The dictionary of field name to index in sequence.

hasDataViewItem

boolean hasDataViewItem(integer itemId)
Does a DataView item already exist with this id.
Parameters:
itemId - The id for this item within this Manager/Data View
Returns:
Boolean Whether the item exists

hasDataViewItemByKeyFields

com.apama.dataview.DataViewResult hasDataViewItemByKeyFields(sequence<string> keyFields)
Does a DataView item already exist with these key fields.
Parameters:
keyFields - The key fields used to identify a unique item within this Manager/Data View
Returns:
DataViewResult

info

void info(string msg)
Parameters:
msg

initialise

com.apama.dataview.DataViewResult initialise(string dvName, string dvDisplayName, string dvDescription, sequence<string> fieldNames, sequence<string> fieldTypes, sequence<string> keyFields, context mainCtx)
The initialisation action that checks all the parameters are valid but DOES NOT create the Scenario for the Data View.

This can be used if the Scenario for this DataView has been created elsewhere (using the define action).
Parameters:
dvName - The name for the dataview
dvDisplayName - The display name for the dataview
dvDescription - A description of the dataview's purpose
fieldNames - The names of the columns in the dataview
fieldTypes - The types of the columns in the dataview
keyFields - [OPTIONAL] The key fields of the columns in the dataview which can be used to determine a unique item
mainCtx - The main context
Returns:
A DataViewResult event signifying success or failure
See Also:
com.apama.dataview.DataViewManager#define() - 
com.apama.dataview.DataViewManager#onSpawn() - 

onSpawn

void onSpawn()
MUST be called when a DataViewManager is spawned to clear out its instance state and register the context with the ScenarioService.

setLogLevel

void setLogLevel(string level)
Change the log level.
Parameters:
level - The log level. Can be "ERROR", "WARN", "INFO" or "DEBUG"

undefine

void undefine()
Deletes an existing DataView and unloads the Scenario. This should be called once per DataView and from the same context which defined the DataView.
See Also:
com.apama.dataview.DataViewManager#define() - 

uninitialise

void uninitialise()
Deletes and cleans up the manager WITHOUT unloading the Scenario. This should be called if initialise() was used..
See Also:
com.apama.dataview.DataViewManager#initialise() - 

updateDeltaDataViewItem

com.apama.dataview.DataViewResult updateDeltaDataViewItem(integer itemId, float timeStamp, dictionary<integer, string> fieldValues)
Update a SUBSET of the field values of an existing DataViewItem in the current DataView.
Parameters:
itemId - The id for this item within this Manager/Data View. If -1, key fields are used.
timeStamp
fieldValues - A dictionary of field ids to values to update
Returns:
A DataViewResult event. Success will be set to false if the item cannot be updated

updateDeltaDataViewItemByFieldName

com.apama.dataview.DataViewResult updateDeltaDataViewItemByFieldName(integer itemId, float timeStamp, dictionary<string, string> fieldValues)
Update a SUBSET of the field values of an existing DataViewItem in the current DataView.
Parameters:
itemId - The id for this item within this Manager/Data View. If -1, key fields are used.
timeStamp
fieldValues - A dictionary of field names to values to update
Returns:
A DataViewResult event. Success will be set to false if the item cannot be updated

updateFullDataViewItem

com.apama.dataview.DataViewResult updateFullDataViewItem(integer itemId, float timeStamp, sequence<string> fieldValues)
Update ALL the field values of an existing DataViewItem in the current DataView.
Parameters:
itemId - The id for this item within this Manager/Data View. If -1, key fields are used.
timeStamp
fieldValues - The values for each field
Returns:
A DataViewResult event. Success will be set to false if the item cannot be updated or added

warn

void warn(string msg)
Parameters:
msg