com.sag.osami.api.context
Class ContextEvent

java.lang.Object
  extended by com.sag.osami.api.context.ContextEvent

public final class ContextEvent
extends java.lang.Object

Instances of the ContextEvent class represent a single context event and its constituents, since a context is a container for the context data + context management data (ID, timestamp, origin, type, origin context store).

This class is immutable: once a context event was produced, there is no possibility to corrupt its data (e.g. within a handler).


Constructor Summary
ContextEvent(java.lang.Long id, java.lang.Object data, java.lang.String originID, java.util.Date timestamp, java.lang.String type, java.lang.String contextStoreOriginID)
          Constructor (mainly) for internal use, using the parameters as the values for the context event.
ContextEvent(java.lang.Object data, java.lang.String originID, java.util.Date timestamp, java.lang.String type)
          Constructor (mainly) for public use, taking the parameters as the values for the context event, but null as ID and contextStoreOriginID (both determined internally by context store)
 
Method Summary
 java.lang.String getContextStoreOriginID()
          Gets the origin ContextStore of the context, i.e. the (unique) name of the ContextStore where the context was created originally.
 java.lang.Object getData()
          Gets the payload data of the context.
 java.lang.Long getID()
          Gets the numeric, unique ID of the context.
 java.lang.String getOriginID()
          Gets the origin of the context.
 java.util.Date getTimestamp()
          Gets the time of creation of the context.
 java.lang.String getType()
          Gets the type of the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextEvent

public ContextEvent(java.lang.Object data,
                    java.lang.String originID,
                    java.util.Date timestamp,
                    java.lang.String type)
Constructor (mainly) for public use, taking the parameters as the values for the context event, but null as ID and contextStoreOriginID (both determined internally by context store)

Parameters:
data - payload data of the context event, may be null
originID - origin ID of the context event
timestamp - creation date of the context event
type - type of the context event

ContextEvent

public ContextEvent(java.lang.Long id,
                    java.lang.Object data,
                    java.lang.String originID,
                    java.util.Date timestamp,
                    java.lang.String type,
                    java.lang.String contextStoreOriginID)
Constructor (mainly) for internal use, using the parameters as the values for the context event.

Parameters:
id - unique numeric ID of the context event
data - payload data of the context event, may be null
originID - origin ID of the context event
timestamp - creation date of the context event
type - type of the context event
contextStoreOriginID - name of the context store where the context event was originally created
Method Detail

getID

public java.lang.Long getID()
Gets the numeric, unique ID of the context.

Returns:
the numeric, unique ID of the context

getType

public java.lang.String getType()
Gets the type of the context. It is represented by a plain string, which meaning should be unique for the application. If possible, standardized class names/ontological information should be used.

Example: "TEMP_C" (for temperature in Celsius)

Returns:
the type of the context

getData

public java.lang.Object getData()
Gets the payload data of the context.

Returns:
the payload data of the context (probably needs type cast)

getOriginID

public java.lang.String getOriginID()
Gets the origin of the context. The origin ID should identify the component or sub-system where the context was created (may denote hardware or software).

Example: "COM/SAG/OSAMI/SENSORS/VITAL" for some sensor system

Returns:
the origin of the context

getTimestamp

public java.util.Date getTimestamp()
Gets the time of creation of the context.

Returns:
the time of "creation" of the context

getContextStoreOriginID

public java.lang.String getContextStoreOriginID()
Gets the origin ContextStore of the context, i.e. the (unique) name of the ContextStore where the context was created originally.

Returns:
the origin ContextStore of the context