com.tivoli.zce.engine
Class Event

java.lang.Object
  |
  +--com.tivoli.zce.engine.Event
All Implemented Interfaces:
java.io.Serializable

public class Event
extends java.lang.Object
implements java.io.Serializable

Internal representation of an event. An Event in ZCE is a hash table of label name, label value pairs, where values for each is a String. Event contains no type information on the labels, this is provided in the rule specification, and compiled into the appropriate method calls during run-time. For example, ZCE calls the appropriate translation method, e.g., getInt("numberOfHosts") to retrive the value of an integer label named "numberOfHosts".

See Also:
Serialized Form

Field Summary
 int counter
          Field used for the persistence mechanism.
 boolean currentEvent
          This flag is set to true when this event is the current event processed by ZCE.
 boolean isCorrelated
          This flag is set to true if this event was already correlated (triggered) by one of the processed rules.
 boolean isPersisted
          This flag is set to true if this event was already registered in the persistence storage.
 IRule lastRule
          The lastRule attribute is set to the last Rule (as IRule) that triggered this event This is used for the correct continuation of the path of this event.
 java.lang.Object original
          field used optionaly to keep a reference to the original event:
 long timestamp
          This attribute is calculated during the creation of the Event using the currentTimeMillis() method.
 java.lang.String type
          This attribute represents the type of the event and is used to find the applicable set of rules to process using this event.
 
Constructor Summary
Event()
          Create empty Event to be filled in with putItem() or copyInto()
Event(Event event)
          Create a new Event by cloning items from a given Event
Event(java.util.Vector items)
          Create a new Event with a given Vector of items in it.
 
Method Summary
protected  void copyInto(java.util.Vector items)
          Method used to add a @see java.util.Vector of EventItem
 java.util.Enumeration getAllLabels()
          Returns the complete list of labels included in this event
 java.lang.Boolean getBoolean(java.lang.String label)
          Return the Boolean value of attribute specified by label
 java.lang.Float getFloat(java.lang.String label)
          Return the Float value of attribute specified by label
 java.lang.Long getInt(java.lang.String label)
          Return the Integer value of attribute specified by label
 com.tivoli.zce.predicates.zce.IntSet getIntSet(java.lang.String label)
          Return the IntSet value of attribute specified by label
 com.tivoli.zce.predicates.zce.IPAddress getIPAddress(java.lang.String label)
          Return generic set value of attribute specified by label
 com.tivoli.zce.predicates.zce.IPAddressSet getIPAddressSet(java.lang.String label)
          Return the IPAddressSet value of attribute specified by label
 java.lang.Object getItem(java.lang.String key)
          Extract an "item" of class Object from the list of items
 java.lang.String getString(java.lang.String label)
          Return the String value of attribute specified by label
 com.tivoli.zce.engine.StringSet getStringSet(java.lang.String label)
          Return the StringSet value of attribute specified by label
 java.util.Vector getTypes()
          Return class hierarchy.
 boolean hasAttribute(java.lang.String label)
          Test if event has the attribute named specified by label
protected  void putItem(com.tivoli.zce.engine.EventItem item)
          Method for inheriting classes to add item to list of (cached) items at runtime.
 void putItem(java.lang.String key, java.lang.Object value)
          Add an "item" of class Object into the list of items
 void setOriginal(java.lang.Object orig)
          Method to set the original field.
 java.lang.String toString()
          Convert event to String by concatenating all items
 void updateItem(java.lang.String label, long value)
          Update the value of an EXISTING item e.g.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timestamp

public long timestamp
This attribute is calculated during the creation of the Event using the currentTimeMillis() method. It can also be set manually, for example to ensure that the internal ZCE Event has the same value as the external, "translated" event.
See Also:
java.lang.System#currentTimeMillis()

type

public java.lang.String type
This attribute represents the type of the event and is used to find the applicable set of rules to process using this event.

lastRule

public IRule lastRule
The lastRule attribute is set to the last Rule (as IRule) that triggered this event This is used for the correct continuation of the path of this event. When an event reaches a shared action, the lastRule attribute is used to enable continuation to the correct, next in the sequence non-shared action.

counter

public int counter
Field used for the persistence mechanism. This variable counts the number of state-based rules that are keeping this event. When this counter returns to 0, we can remove this event from the persistence store.

isCorrelated

public boolean isCorrelated
This flag is set to true if this event was already correlated (triggered) by one of the processed rules. It can be used by the external event source to determine if this event was correlated at all by any of the rules.

isPersisted

public boolean isPersisted
This flag is set to true if this event was already registered in the persistence storage.

currentEvent

public boolean currentEvent
This flag is set to true when this event is the current event processed by ZCE. It will be set to false at the end of the processing cycle, even if this event is kept by a state machine or an action.

original

public java.lang.Object original
field used optionaly to keep a reference to the original event:

the event object before the conversion to an Event.
See Also:
Event
Constructor Detail

Event

public Event()
Create empty Event to be filled in with putItem() or copyInto()

Event

public Event(java.util.Vector items)
Create a new Event with a given Vector of items in it.
Parameters:
items - The array of EventItems

Event

public Event(Event event)
Create a new Event by cloning items from a given Event
Parameters:
event - Event to clone items from
Method Detail

setOriginal

public void setOriginal(java.lang.Object orig)
Method to set the original field. This field is provided for convenience and is used in persistence, if persistence is enabled. Recommendation is to use a value that will make it simple to regenerate the original event and forward it.
Parameters:
orig - Value to set

hasAttribute

public boolean hasAttribute(java.lang.String label)
Test if event has the attribute named specified by label
Parameters:
label - Label to check for
Returns:
Boolean if event contains given label

putItem

public void putItem(java.lang.String key,
                    java.lang.Object value)
Add an "item" of class Object into the list of items
Parameters:
key - the field name
value - the field value

getItem

public java.lang.Object getItem(java.lang.String key)
Extract an "item" of class Object from the list of items
Parameters:
key - the field name
Returns:
the object value

putItem

protected void putItem(com.tivoli.zce.engine.EventItem item)
Method for inheriting classes to add item to list of (cached) items at runtime.
Parameters:
item - Item to add to list of (cached) items

copyInto

protected void copyInto(java.util.Vector items)
Method used to add a @see java.util.Vector of EventItem
Parameters:
items -  

getString

public java.lang.String getString(java.lang.String label)
Return the String value of attribute specified by label
Parameters:
label - Label to get String value for
Returns:
String value of given label

getInt

public java.lang.Long getInt(java.lang.String label)
Return the Integer value of attribute specified by label
Parameters:
label - Label to get integer value for
Returns:
Integer value for given label

getFloat

public java.lang.Float getFloat(java.lang.String label)
Return the Float value of attribute specified by label
Parameters:
label - Label to get float value for
Returns:
Float value for given label

getStringSet

public com.tivoli.zce.engine.StringSet getStringSet(java.lang.String label)
Return the StringSet value of attribute specified by label
Parameters:
label - Label to get string set value for
Returns:
String set value for given label

getIntSet

public com.tivoli.zce.predicates.zce.IntSet getIntSet(java.lang.String label)
Return the IntSet value of attribute specified by label
Parameters:
label - Label to get integer set value for
Returns:
IntSet value for given label

getIPAddressSet

public com.tivoli.zce.predicates.zce.IPAddressSet getIPAddressSet(java.lang.String label)
Return the IPAddressSet value of attribute specified by label
Parameters:
label - Label to get IPAddress set value for
Returns:
IPAddressSet value for given label

getBoolean

public java.lang.Boolean getBoolean(java.lang.String label)
Return the Boolean value of attribute specified by label
Parameters:
label - Label to get boolean value for
Returns:
Boolean value for given label

getIPAddress

public com.tivoli.zce.predicates.zce.IPAddress getIPAddress(java.lang.String label)
Return generic set value of attribute specified by label
Parameters:
label - Label to get generic set value for
Returns:
Set value for given label

updateItem

public final void updateItem(java.lang.String label,
                             long value)
Update the value of an EXISTING item e.g. timestamp
Parameters:
label - Label to be updated
value - New value for given label

toString

public java.lang.String toString()
Convert event to String by concatenating all items
Overrides:
toString in class java.lang.Object
Returns:
String representation of event

getAllLabels

public java.util.Enumeration getAllLabels()
Returns the complete list of labels included in this event
Returns:
Enumeration list of labels

getTypes

public final java.util.Vector getTypes()
Return class hierarchy. Since we do not support hierarchies, we simply return null
Returns:
Vector of all parent classes. Always null here.