com.ibm.premises.reusable
Class AbstractRUCAgent

java.lang.Object
  extended by com.ibm.sensorevent.engine.baseagent.AbstractTaskAgent
      extended by com.ibm.sensorevent.engine.baseagent.IBMSEAbstractTaskAgent
          extended by com.ibm.premises.reusable.AbstractRUCAgent
All Implemented Interfaces:
com.ibm.sensorevent.engine.baseagent.ITaskAgent

public abstract class AbstractRUCAgent
extends com.ibm.sensorevent.engine.baseagent.IBMSEAbstractTaskAgent

Parent class of all ReusableComponent Agent classes. The RUC Agent is where the logic for the RUC should be put. RUCs with only a void command method should put that logic code into onIBMSensorEvent. RUCs that require non-void methods should define them for all necessary logic.

Author:
palmerja

Method Summary
static java.util.List<java.lang.String> getAllEPCsFromPayload(com.ibm.sensorevent.model.ISensorEvent event)
          For a TagRead or AggregatedTagRead payload, get the tags from the payload For generic map payloads, find tagList keys defined in constants and return its value.
static java.lang.String getSingleEPCFromPayload(com.ibm.sensorevent.model.ISensorEvent event)
          For a TagRead payload, get the tag from the payload For an AggregatedTagRead payload, get only the first tag For generic map payloads, find the tag key defined in constants and return its value.
 void publishFailureReply(java.util.Map map, java.lang.String rucActionName)
          Publish message to SIBus to reply to RUC signal/query Should be called by each RUC MDB to push results asynchronously This allows for async chaining among RUCs
 void publishSuccessReply(java.util.Map map, java.lang.String rucActionName)
          Publish message to SIBus to reply to RUC signal/query Should be called by each RUC MDB to push results asynchronously This allows for async chaining among RUCs
 
Methods inherited from class com.ibm.sensorevent.engine.baseagent.AbstractTaskAgent
broadCast, broadCast, getOriginalMsg, onEvent, publish, publish, publishOutbound, publishToCEP, setOriginalMsg
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

publishSuccessReply

public void publishSuccessReply(java.util.Map map,
                                java.lang.String rucActionName)
Publish message to SIBus to reply to RUC signal/query Should be called by each RUC MDB to push results asynchronously This allows for async chaining among RUCs

Parameters:
map - The map of payload attributes. If null, payload will have no attributes.
rucActionName - Used to query the Task Agent props for the .output.success value as topic

publishFailureReply

public void publishFailureReply(java.util.Map map,
                                java.lang.String rucActionName)
Publish message to SIBus to reply to RUC signal/query Should be called by each RUC MDB to push results asynchronously This allows for async chaining among RUCs

Parameters:
map - The map of payload attributes. If null, payload will have no attributes.
rucActionName - Used to query the Task Agent props for the .output.failure value as topic

getAllEPCsFromPayload

public static java.util.List<java.lang.String> getAllEPCsFromPayload(com.ibm.sensorevent.model.ISensorEvent event)
                                                              throws com.ibm.sensorevent.model.generic.SensorEventException
For a TagRead or AggregatedTagRead payload, get the tags from the payload For generic map payloads, find tagList keys defined in constants and return its value. If tagList key not set, find tag key defined in constants and return its value. Note that this gives priority to tagList over tag in the generic payload.

Parameters:
event -
Returns:
a List of all tags/EPCs as Strings
Throws:
com.ibm.sensorevent.model.generic.SensorEventException

getSingleEPCFromPayload

public static java.lang.String getSingleEPCFromPayload(com.ibm.sensorevent.model.ISensorEvent event)
                                                throws com.ibm.sensorevent.model.generic.SensorEventException
For a TagRead payload, get the tag from the payload For an AggregatedTagRead payload, get only the first tag For generic map payloads, find the tag key defined in constants and return its value. If tag key not set, find tagList key defined in constants and return only the first tag from its value. Note that this gives priority to tag over tagList in the generic payload.

Parameters:
event -
Returns:
A single tag/EPC from the payload as a String. For payloads with multiple tags, cannot guarantee which one will be returned, so this usage is not recommended.
Throws:
com.ibm.sensorevent.model.generic.SensorEventException