com.ibm.premises.reusable
Class AbstractRUCAgent

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

public abstract class AbstractRUCAgent
extends AbstractTaskAgent

Parent class of all ReusableComponent Agent classes. The RUC Agent is where the logic for the RUC should be put. RUCs should define methods for all necessary logic.


Field Summary
static java.lang.String COPYRIGHT
           
protected static java.lang.String EJBREF_DBBACKEND
           
protected static java.lang.String EJBREF_EPCISBACKEND
           
protected static java.lang.String EJBREF_PREMBACKEND
           
protected static java.lang.String EJBREF_RFIDICBACKEND
           
protected  Utils utils
           
 
Fields inherited from class com.ibm.sensorevent.engine.baseagent.AbstractTaskAgent
agentclassname, AMITBUS, AMITQ, ANY, COLON, EVENT_PREFIX, EVENT_PREFIX_SHORT, ise, originalMsg, OUTBOUND, registeredTopics, SLASH
 
Constructor Summary
protected AbstractRUCAgent(java.lang.String agentName)
           
 
Method Summary
protected  java.lang.String getAgentProp(java.lang.String id)
           
static java.util.List<java.lang.String> getAllEPCsFromPayload(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 getEndpointFromProperties(java.util.Map systemProperties, java.util.Map agentProperties, java.lang.String endpointKey, java.lang.String hostKey, java.lang.String portKey, java.lang.String extensionKey, java.lang.String defaultHost, java.lang.String defaultPort, java.lang.String defaultExtension)
          Looks in properties to determine the EPCIS Web Service endpoint First, looks in Agent properties, first looking for complete endpoint then either host/port/extension Then, performs same check in System properties After this, populate the rest of the endpoint
static int getIntValueFromProperties(java.util.Map systemProperties, java.util.Map agentProperties, java.lang.String key, int defaultValue)
           
protected  java.util.HashMap<java.lang.String,java.lang.String> getJMSHeaderProperties(IPayloadMetaData pMD, java.lang.String locationId)
          Read JMS header properties (given by a specific jmsheader prefix in the key) from event metadata Always looks for JMS header properties in the payload metadata Only looks for JMS header properties in the location metadata if include.location.context is true
protected  java.util.HashMap<java.lang.String,java.lang.String> getJMSHeaderProperties(ISensorEvent ise)
          Read JMS header properties (given by a specific jmsheader prefix in the key) from event metadata Always looks for JMS header properties in the payload metadata Only looks for JMS header properties in the location metadata if include.location.context is true.
static long getLongValueFromProperties(java.util.Map systemProperties, java.util.Map agentProperties, java.lang.String key, long defaultValue)
           
static java.lang.String getSingleEPCFromPayload(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.
protected  AggregationBackendInterface getTargetAggregationBackend()
           
protected  AggregationInferenceBackendInterface getTargetAggregationInferenceBackend()
           
protected  AssetMgmtBackendInterface getTargetAssetMgmtBackend()
           
protected  AssetTypeMgmtBackendInterface getTargetAssetTypeMgmtBackend()
           
protected  EJBObject getTargetBackendBean()
          The real work-horse in getting backend beans, including custom beans by JNDI name and reflection
protected  CommissioningBackendInterface getTargetCommissioningBackend()
           
protected  EPCDetailedQueryBackendInterface getTargetEPCDetailedQueryBackend()
           
protected  EPCMgmtBackendInterface getTargetEPCMgmtBackend()
           
protected  EPCPrintBackendInterface getTargetEPCPrintBackend()
           
protected  MasterDataBackendInterface getTargetMasterDataBackend()
           
protected  ObservationBackendInterface getTargetObservationBackend()
           
protected  PedigreeBackendInterface getTargetPedigreeBackend()
           
protected  java.lang.String getValueFromAgentOrSystemProperties(java.lang.String key, java.lang.String defaultValue)
           
static java.lang.String getValueFromProperties(java.util.Map systemProperties, java.util.Map agentProperties, java.lang.String key, java.lang.String defaultValue)
           
protected  void publishEvent(java.lang.String eventType, java.lang.String topic, ISensorEvent event)
           
 void publishFailureReply(java.util.Map map, java.lang.String rucActionName, java.lang.String origEventId)
          Publish response 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
protected  void publishOutboundUsingTopicFromProps(java.lang.String messageXML, IPayloadMetaData pMD, java.lang.String locationId)
           
protected  void publishOutboundUsingTopicFromProps(java.lang.String messageXML, ISensorEvent ise)
           
 void publishSuccessReply(java.util.Map map, java.lang.String rucActionName, java.lang.String origEventId)
          Publish response 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
addHeader, broadCast, broadCast, getAgentname, getAgentProperty, getAgentStore, getAgentStoreForGroup, getAgentStoreForSystem, getAllAgentProperties, getEventConverter, getJNDIObject, getMsgProperty, getOriginalMsg, getPremisesContext, getPremisesHome, getProfileid, getSourceid, getSystemProperties, getValidId, getXML, isIBMSE, isIBMSE, isWBEPacket, log, publish, publish, publish, publishOutbound, publishOutbound, publishOutbound, publishToCEP, resetAgentStore, resetAgentStoreForGroup, resetAgentStoreForSystem, setAgentname, setOriginalMsg, setProfileid, setSourceid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

utils

protected Utils utils

EJBREF_DBBACKEND

protected static final java.lang.String EJBREF_DBBACKEND
See Also:
Constant Field Values

EJBREF_EPCISBACKEND

protected static final java.lang.String EJBREF_EPCISBACKEND
See Also:
Constant Field Values

EJBREF_RFIDICBACKEND

protected static final java.lang.String EJBREF_RFIDICBACKEND
See Also:
Constant Field Values

EJBREF_PREMBACKEND

protected static final java.lang.String EJBREF_PREMBACKEND
See Also:
Constant Field Values
Constructor Detail

AbstractRUCAgent

protected AbstractRUCAgent(java.lang.String agentName)
Method Detail

publishEvent

protected void publishEvent(java.lang.String eventType,
                            java.lang.String topic,
                            ISensorEvent event)

publishSuccessReply

public void publishSuccessReply(java.util.Map map,
                                java.lang.String rucActionName,
                                java.lang.String origEventId)
Publish response 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,
                                java.lang.String origEventId)
Publish response 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

publishOutboundUsingTopicFromProps

protected void publishOutboundUsingTopicFromProps(java.lang.String messageXML,
                                                  ISensorEvent ise)

publishOutboundUsingTopicFromProps

protected void publishOutboundUsingTopicFromProps(java.lang.String messageXML,
                                                  IPayloadMetaData pMD,
                                                  java.lang.String locationId)

getJMSHeaderProperties

protected java.util.HashMap<java.lang.String,java.lang.String> getJMSHeaderProperties(ISensorEvent ise)
Read JMS header properties (given by a specific jmsheader prefix in the key) from event metadata Always looks for JMS header properties in the payload metadata Only looks for JMS header properties in the location metadata if include.location.context is true. The implementation of this method calls getJMSHeaderProperties(IPayloadMetaData pMD, String locationId) passing pMD and locationId from the ISensorEvent ise

Parameters:
ise -
Returns:
HashMap map of name-value pairs to add to JMS header

getJMSHeaderProperties

protected java.util.HashMap<java.lang.String,java.lang.String> getJMSHeaderProperties(IPayloadMetaData pMD,
                                                                                      java.lang.String locationId)
Read JMS header properties (given by a specific jmsheader prefix in the key) from event metadata Always looks for JMS header properties in the payload metadata Only looks for JMS header properties in the location metadata if include.location.context is true

Parameters:
pMD -
locationId -
Returns:
HashMap map of name-value pairs to add to JMS header

getAgentProp

protected java.lang.String getAgentProp(java.lang.String id)

getTargetAggregationBackend

protected AggregationBackendInterface getTargetAggregationBackend()
                                                           throws ReusableComponentException
Throws:
ReusableComponentException

getTargetAggregationInferenceBackend

protected AggregationInferenceBackendInterface getTargetAggregationInferenceBackend()
                                                                             throws ReusableComponentException
Throws:
ReusableComponentException

getTargetCommissioningBackend

protected CommissioningBackendInterface getTargetCommissioningBackend()
                                                               throws ReusableComponentException
Throws:
ReusableComponentException

getTargetEPCMgmtBackend

protected EPCMgmtBackendInterface getTargetEPCMgmtBackend()
                                                   throws ReusableComponentException
Throws:
ReusableComponentException

getTargetEPCPrintBackend

protected EPCPrintBackendInterface getTargetEPCPrintBackend()
                                                     throws ReusableComponentException
Throws:
ReusableComponentException

getTargetEPCDetailedQueryBackend

protected EPCDetailedQueryBackendInterface getTargetEPCDetailedQueryBackend()
                                                                     throws ReusableComponentException
Throws:
ReusableComponentException

getTargetMasterDataBackend

protected MasterDataBackendInterface getTargetMasterDataBackend()
                                                         throws ReusableComponentException
Throws:
ReusableComponentException

getTargetObservationBackend

protected ObservationBackendInterface getTargetObservationBackend()
                                                           throws ReusableComponentException
Throws:
ReusableComponentException

getTargetAssetMgmtBackend

protected AssetMgmtBackendInterface getTargetAssetMgmtBackend()
                                                       throws ReusableComponentException
Throws:
ReusableComponentException

getTargetAssetTypeMgmtBackend

protected AssetTypeMgmtBackendInterface getTargetAssetTypeMgmtBackend()
                                                               throws ReusableComponentException
Throws:
ReusableComponentException

getTargetPedigreeBackend

protected PedigreeBackendInterface getTargetPedigreeBackend()
                                                     throws ReusableComponentException
Throws:
ReusableComponentException

getTargetBackendBean

protected EJBObject getTargetBackendBean()
                                  throws ReusableComponentException
The real work-horse in getting backend beans, including custom beans by JNDI name and reflection

Returns:
The actual Bean as an EJBObject, which must be cast by the caller to its real remote interface
Throws:
ReusableComponentException - Based on ResourceLocator throwing NamingException during lookup, or a custom RUC exception

getValueFromAgentOrSystemProperties

protected java.lang.String getValueFromAgentOrSystemProperties(java.lang.String key,
                                                               java.lang.String defaultValue)

getValueFromProperties

public static java.lang.String getValueFromProperties(java.util.Map systemProperties,
                                                      java.util.Map agentProperties,
                                                      java.lang.String key,
                                                      java.lang.String defaultValue)

getLongValueFromProperties

public static long getLongValueFromProperties(java.util.Map systemProperties,
                                              java.util.Map agentProperties,
                                              java.lang.String key,
                                              long defaultValue)

getIntValueFromProperties

public static int getIntValueFromProperties(java.util.Map systemProperties,
                                            java.util.Map agentProperties,
                                            java.lang.String key,
                                            int defaultValue)

getEndpointFromProperties

public static java.lang.String getEndpointFromProperties(java.util.Map systemProperties,
                                                         java.util.Map agentProperties,
                                                         java.lang.String endpointKey,
                                                         java.lang.String hostKey,
                                                         java.lang.String portKey,
                                                         java.lang.String extensionKey,
                                                         java.lang.String defaultHost,
                                                         java.lang.String defaultPort,
                                                         java.lang.String defaultExtension)
Looks in properties to determine the EPCIS Web Service endpoint First, looks in Agent properties, first looking for complete endpoint then either host/port/extension Then, performs same check in System properties After this, populate the rest of the endpoint

Returns:

getAllEPCsFromPayload

public static java.util.List<java.lang.String> getAllEPCsFromPayload(ISensorEvent event)
                                                              throws 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. Will return null if the event param is null
Throws:
SensorEventException

getSingleEPCFromPayload

public static java.lang.String getSingleEPCFromPayload(ISensorEvent event)
                                                throws 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. Will return null if the event param is null
Throws:
SensorEventException


Copyright © 2005 - 2009 IBM Corp. All Rights Reserved.