com.tivoli.zce.persistence
Class PHandler

java.lang.Object
  |
  +--com.tivoli.zce.persistence.PHandler

public class PHandler
extends java.lang.Object

Class with static methods, used to manage persistence of events. It uses a combination of event flags:

Event.counter, Event.isPersisted and com.tivoli.zce.engine.Event#currentEvent Event.currentEvent to figure out when to persist an event or to remove it from the persistent store.


Constructor Summary
PHandler()
           
 
Method Summary
static void addEvent(Event e)
          Method to add an event to the persistent store if it is enabled.
static void clean()
          If persistence is enabled, remove all elements in the persistent store.
static void init(com.tivoli.zce.persistence.IPersistentStore ps)
          initialize the persistence using the persistence store plugin
static void removeEvent_termAction(Event e)
          This method uses PHandler.removeEvent call and should be called from the terminalAction or an action that discard some events.
static void removeEvent_termAction(EventList elist)
          This method uses PHandler.removeEvent call and should be called from the terminalAction or an action that discards some events.
static void removeEvent_termRule(Event e)
          Method called in the terminal rule, the last operation during a processEvent call.
static void removeEvent(Event e)
          Method to mark an event as no longer in use and to remove it from the persistent store if persistence is enabled.
static void setOff()
          Set the persistence mechanism as disabled if it was enabled, do nothing otherwise.
static void setOn()
          Set the persistence mechanism as enabled if it was disabled, do nothing otherwise.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PHandler

public PHandler()
Method Detail

addEvent

public static void addEvent(Event e)
                     throws java.lang.Exception
Method to add an event to the persistent store if it is enabled. It checks if the event is already in the persistent store. If it is not, looks for e.counter transition from 0 -> 1 and persists the event

removeEvent_termRule

public static void removeEvent_termRule(Event e)
                                 throws java.lang.Exception
Method called in the terminal rule, the last operation during a processEvent call. If persistence is enabled, the event is persisted and the event is not in use (counter == 0), event is removed. We always set currentEvent == false to indicate the end of the processEvent cycle.
Parameters:
e - the event to eventually remove
Throws:
java.lang.Exception - an exception can be thrown in case of persistence error ( IO operation error ).

removeEvent_termAction

public static void removeEvent_termAction(EventList elist)
                                   throws java.lang.Exception
This method uses PHandler.removeEvent call and should be called from the terminalAction or an action that discards some events.
Parameters:
elist - the list of events to discard from the persistence
Throws:
java.lang.Exception - @see com.tivoli.zce.persistence.PHandler#removeEvent_termRule(Event e)

removeEvent_termAction

public static void removeEvent_termAction(Event e)
                                   throws java.lang.Exception
This method uses PHandler.removeEvent call and should be called from the terminalAction or an action that discard some events. This method is exactly the same as @see com.tivoli.zce.persistence.PHandler#removeEvent_termAction(EventList elist) except that it received only one Event.
Parameters:
e -  
Throws:
java.lang.Exception -  

removeEvent

public static void removeEvent(Event e)
                        throws java.lang.Exception
Method to mark an event as no longer in use and to remove it from the persistent store if persistence is enabled. It checks if persistence is enabled, if the event is persisted and if it is NOT the current event, i.e., an event going through the processEvent cycle. This method should be called in rules and actions when an event is no longer needed, i.e., not forwarded to the next stage of processing.

setOn

public static void setOn()
Set the persistence mechanism as enabled if it was disabled, do nothing otherwise.

setOff

public static void setOff()
Set the persistence mechanism as disabled if it was enabled, do nothing otherwise.

init

public static void init(com.tivoli.zce.persistence.IPersistentStore ps)
initialize the persistence using the persistence store plugin
Parameters:
ps - the persistence store plugin to used for storing persistence data.

clean

public static void clean()
If persistence is enabled, remove all elements in the persistent store.