com.ibm.sensorevent.model.payload
Class IBMSensorEventPayload

java.lang.Object
  extended by com.ibm.sensorevent.model.generic.GenericGroup
      extended by com.ibm.sensorevent.model.Group
          extended by com.ibm.sensorevent.model.Payload
              extended by com.ibm.sensorevent.model.payload.IBMSensorEventPayload
All Implemented Interfaces:
IGenericGroup, IGroup, IPayload, ISensorEventPayload, java.io.Serializable
Direct Known Subclasses:
CommandPayload, ReportPayload, TagReadReportPayload

public class IBMSensorEventPayload
extends Payload
implements ISensorEventPayload

IBMSensorEventPayload is the superclass of all payloads within the IBM sensor event model.

Each IBMSensorEventPayload has

The interface associated with this class is ISensorEventPayload.

See Also:
Serialized Form

Field Summary
static java.lang.String ATTR_TAG_KEY_INOUT
           
static java.lang.String ATTR_TAGLIST_KEY_INOUT
           
static java.lang.String ATTR_VALUE
           
static java.lang.String COPYRIGHT
           
protected  IGroup eventGroup
          The group within the IBMSensorEventPayload containing all attributes and subgroups
 
Fields inherited from class com.ibm.sensorevent.model.Payload
payloadClassName
 
Fields inherited from class com.ibm.sensorevent.model.generic.GenericGroup
attributes, groups, name
 
Constructor Summary
protected IBMSensorEventPayload()
          Constructs an IBMSensorEventPayload
protected IBMSensorEventPayload(IGroup eventGroup)
          Constructs an IBMSensorEventPayload with the given event group
protected IBMSensorEventPayload(java.lang.String eventType)
          Constructs an IBMSensorEventPayload with an event group whose name is the specified event type
 
Method Summary
 void copyFields(ISensorEventPayload sourcePayload)
          Copies the fields unique to this class (such as event group) and to its super class from the source payload into this payload.
static IGenericGroup fromMap(java.util.Map map)
          Converts the specified java.util.Map into a IGenericGroup.
static IGenericGroup fromMap(java.util.Map map, java.lang.String eventType)
          Converts the specified java.util.Map into an IBMSensorEventPayload whose name is eventType.
static IGenericGroup fromMap(java.lang.String eventType, java.util.Map map)
          Converts the specified java.util.Map into an IBMSensorEventPayload whose name is eventType.
static IGenericGroup fromTypedMap(java.util.Map map)
          Converts the specified java.util.Map into a IGenericGroup.
static IGenericGroup fromTypedMap(java.util.Map map, java.lang.String eventType)
          Converts the specified java.util.Map into an IBMSensorEventPayload whose name is eventType.
static IGenericGroup fromTypedMap(java.lang.String eventType, java.util.Map map)
          Converts the specified java.util.Map into an IBMSensorEventPayload whose name is eventType.
 java.util.List getAllGenericTagIDs()
          Return a list of all tag IDs from the event group.
 IGroup getEventGroup()
          Returns this payload's event group
 java.lang.String getGenericTagID()
          Return a the tag ID from the event group in string attribute "com.ibm.premises.reusable.tag".
 java.lang.String getGenericTagIDFromAttribute(java.lang.String attrName)
          Return a the tag ID from the event group in string attribute attrName.
 java.util.List getGenericTagIDs()
          Return a list of all tag IDs from the event group in string array attribute "com.ibm.premises.reusable.taglist".
 java.util.List getGenericTagIDsFromAttribute(java.lang.String attrName)
          Return a list of all tag IDs from the event group in string array attribute attrName.
static IGenericGroup getInstance()
          Factory method to create an IBMSensorEventPayload without an event group.
static IGenericGroup getInstance(IGroup eventGroup)
          Factory method to create an IBMSensorEventPayload with the given event group
static IGenericGroup getInstance(IPayload sourcePayload)
          Factory method to create a IBMSensorEventPayload from the specified payload
static IGenericGroup getInstance(java.lang.String eventType)
          Factory method to create an IBMSensorEventPayload with an event group whose name is the specified event type
 void setEventGroup(IGroup group)
          Sets this payload's event group
 java.util.Map toMap()
          Converts this payload to a java.util.Map of strings
 java.util.Map toTypedMap()
          Converts this payload to a java.util.Map; the values' data types are preserved
 
Methods inherited from class com.ibm.sensorevent.model.Payload
copyFields, copyGroup, getPayloadClassName, setPayloadClassName, toString
 
Methods inherited from class com.ibm.sensorevent.model.Group
processGroup, processMap, processTypedGroup, processTypedMap
 
Methods inherited from class com.ibm.sensorevent.model.generic.GenericGroup
addAttribute, addAttributeArray, addBooleanArrayAttribute, addBooleanAttribute, addByteArrayAttribute, addByteAttribute, addDateArrayAttribute, addDateArrayAttributeAsLong, addDateAttribute, addDateAttributeAsLong, addDoubleArrayAttribute, addDoubleAttribute, addFloatArrayAttribute, addFloatAttribute, addGroup, addHexAttribute, addHexAttribute, addIntArrayAttribute, addIntAttribute, addLongArrayAttribute, addLongAttribute, addShortArrayAttribute, addShortAttribute, addStringArrayAttribute, addStringAttribute, createGroupPath, getAttribute, getAttributes, getAttributesAsList, getBooleanAttributeArrayValue, getBooleanAttributeValue, getByteAttributeArrayValue, getByteAttributeValue, getDateAttributeArrayValue, getDateAttributeArrayValueAsLong, getDateAttributeValue, getDateAttributeValueAsLong, getDoubleAttributeArrayValue, getDoubleAttributeValue, getFloatAttributeArrayValue, getFloatAttributeValue, getGroup, getGroups, getGroupsAsList, getHexAttributeValue, getHexAttributeValueAsString, getIntAttributeArrayValue, getIntAttributeValue, getLongAttributeArrayValue, getLongAttributeValue, getName, getShortAttributeArrayValue, getShortAttributeValue, getStringAttributeArrayValue, getStringAttributeValue, removeAttributes, removeGroups, setAttributes, setGroups, setName, traverseGroupPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.sensorevent.model.IPayload
copyFields, getPayloadClassName, setPayloadClassName
 
Methods inherited from interface com.ibm.sensorevent.model.generic.IGenericGroup
addAttribute, addAttributeArray, addBooleanArrayAttribute, addBooleanAttribute, addByteArrayAttribute, addByteAttribute, addDateArrayAttribute, addDateArrayAttributeAsLong, addDateAttribute, addDateAttributeAsLong, addDoubleArrayAttribute, addDoubleAttribute, addFloatArrayAttribute, addFloatAttribute, addGroup, addHexAttribute, addHexAttribute, addIntArrayAttribute, addIntAttribute, addLongArrayAttribute, addLongAttribute, addShortArrayAttribute, addShortAttribute, addStringArrayAttribute, addStringAttribute, createGroupPath, getAttribute, getAttributes, getAttributesAsList, getBooleanAttributeArrayValue, getBooleanAttributeValue, getByteAttributeArrayValue, getByteAttributeValue, getDateAttributeArrayValue, getDateAttributeArrayValueAsLong, getDateAttributeValue, getDateAttributeValueAsLong, getDoubleAttributeArrayValue, getDoubleAttributeValue, getFloatAttributeArrayValue, getFloatAttributeValue, getGroup, getGroups, getGroupsAsList, getHexAttributeValue, getHexAttributeValueAsString, getIntAttributeArrayValue, getIntAttributeValue, getLongAttributeArrayValue, getLongAttributeValue, getName, getShortAttributeArrayValue, getShortAttributeValue, getStringAttributeArrayValue, getStringAttributeValue, removeAttributes, removeGroups, setAttributes, setGroups, setName, traverseGroupPath
 

Field Detail

COPYRIGHT

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

ATTR_VALUE

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

ATTR_TAG_KEY_INOUT

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

ATTR_TAGLIST_KEY_INOUT

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

eventGroup

protected volatile IGroup eventGroup
The group within the IBMSensorEventPayload containing all attributes and subgroups

Constructor Detail

IBMSensorEventPayload

protected IBMSensorEventPayload()
                         throws SensorEventException
Constructs an IBMSensorEventPayload

Throws:
SensorEventException

IBMSensorEventPayload

protected IBMSensorEventPayload(java.lang.String eventType)
                         throws SensorEventException
Constructs an IBMSensorEventPayload with an event group whose name is the specified event type

Parameters:
eventType - the name of the event group
Throws:
SensorEventException

IBMSensorEventPayload

protected IBMSensorEventPayload(IGroup eventGroup)
                         throws SensorEventException
Constructs an IBMSensorEventPayload with the given event group

Parameters:
eventGroup - the event group
Throws:
SensorEventException
Method Detail

getInstance

public static IGenericGroup getInstance()
                                 throws SensorEventException
Factory method to create an IBMSensorEventPayload without an event group. Since event groups are required, this method always throws an exception.

Throws:
SensorEventException

getInstance

public static IGenericGroup getInstance(java.lang.String eventType)
                                 throws SensorEventException
Factory method to create an IBMSensorEventPayload with an event group whose name is the specified event type

Parameters:
eventType - the name of the event group
Throws:
SensorEventException

getInstance

public static IGenericGroup getInstance(IGroup eventGroup)
                                 throws SensorEventException
Factory method to create an IBMSensorEventPayload with the given event group

Parameters:
eventGroup - the event group
Throws:
SensorEventException

getInstance

public static IGenericGroup getInstance(IPayload sourcePayload)
                                 throws SensorEventException
Factory method to create a IBMSensorEventPayload from the specified payload

Parameters:
sourcePayload - the payload to copy from
Throws:
SensorEventException

getEventGroup

public IGroup getEventGroup()
                     throws SensorEventException
Returns this payload's event group

Specified by:
getEventGroup in interface ISensorEventPayload
Throws:
SensorEventException

setEventGroup

public void setEventGroup(IGroup group)
                   throws SensorEventException
Sets this payload's event group

Specified by:
setEventGroup in interface ISensorEventPayload
Throws:
SensorEventException

copyFields

public void copyFields(ISensorEventPayload sourcePayload)
                throws SensorEventException
Copies the fields unique to this class (such as event group) and to its super class from the source payload into this payload.

Parameters:
sourcePayload - the source payload
Throws:
SensorEventException

getAllGenericTagIDs

public java.util.List getAllGenericTagIDs()
                                   throws SensorEventException
Return a list of all tag IDs from the event group. Search first for string array attribute "com.ibm.premises.reusable.taglist". If none exist, search for string attribute "com.ibm.premises.reusable.tag". If neither exist, return an empty list.

Throws:
SensorEventException

getGenericTagIDs

public java.util.List getGenericTagIDs()
                                throws SensorEventException
Return a list of all tag IDs from the event group in string array attribute "com.ibm.premises.reusable.taglist". If none exist, return an empty list.

Returns:
Throws:
SensorEventException

getGenericTagIDsFromAttribute

public java.util.List getGenericTagIDsFromAttribute(java.lang.String attrName)
                                             throws SensorEventException
Return a list of all tag IDs from the event group in string array attribute attrName. If none exist, return an empty list.

Returns:
Throws:
SensorEventException

getGenericTagID

public java.lang.String getGenericTagID()
                                 throws SensorEventException
Return a the tag ID from the event group in string attribute "com.ibm.premises.reusable.tag". Return null if it does not exist.

Returns:
Throws:
SensorEventException

getGenericTagIDFromAttribute

public java.lang.String getGenericTagIDFromAttribute(java.lang.String attrName)
                                              throws SensorEventException
Return a the tag ID from the event group in string attribute attrName. Return null if it does not exist.

Returns:
Throws:
SensorEventException

toMap

public java.util.Map toMap()
                    throws SensorEventException
Converts this payload to a java.util.Map of strings

Specified by:
toMap in interface IGroup
Overrides:
toMap in class Group
Throws:
SensorEventException

toTypedMap

public java.util.Map toTypedMap()
                         throws SensorEventException
Converts this payload to a java.util.Map; the values' data types are preserved

Specified by:
toTypedMap in interface IGroup
Overrides:
toTypedMap in class Group
Throws:
SensorEventException

fromMap

public static IGenericGroup fromMap(java.util.Map map)
                             throws SensorEventException
Converts the specified java.util.Map into a IGenericGroup. This method always throws an exception to prevent calling a superclass method.

Parameters:
map - the map
Throws:
SensorEventException

fromTypedMap

public static IGenericGroup fromTypedMap(java.util.Map map)
                                  throws SensorEventException
Converts the specified java.util.Map into a IGenericGroup. This method always throws an exception to prevent calling a superclass method.

Parameters:
map - the map
Throws:
SensorEventException

fromMap

public static IGenericGroup fromMap(java.lang.String eventType,
                                    java.util.Map map)
                             throws SensorEventException
Converts the specified java.util.Map into an IBMSensorEventPayload whose name is eventType. In this method, the map contains name/value pairs only.

Parameters:
eventType - the group name
map - the map
Throws:
SensorEventException

fromTypedMap

public static IGenericGroup fromTypedMap(java.lang.String eventType,
                                         java.util.Map map)
                                  throws SensorEventException
Converts the specified java.util.Map into an IBMSensorEventPayload whose name is eventType. In this method, the map contains name/value pairs only. The values' data types are preserved.

Parameters:
eventType - the group name
map - the map
Throws:
SensorEventException

fromMap

public static IGenericGroup fromMap(java.util.Map map,
                                    java.lang.String eventType)
                             throws SensorEventException
Converts the specified java.util.Map into an IBMSensorEventPayload whose name is eventType. In this method, the map contains one key named "value" whose value is another map of key/value pairs.

Parameters:
eventType - the group name
map - the map
Throws:
SensorEventException

fromTypedMap

public static IGenericGroup fromTypedMap(java.util.Map map,
                                         java.lang.String eventType)
                                  throws SensorEventException
Converts the specified java.util.Map into an IBMSensorEventPayload whose name is eventType. In this method, the map contains one key named "value" whose value is another map of key/value pairs. The values' data types are preserved.

Parameters:
eventType - the group name
map - the map
Throws:
SensorEventException


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