org.apache.shale.dialog.base
Class AbstractDialogContext

java.lang.Object
  extended by org.apache.shale.dialog.base.AbstractDialogContext
All Implemented Interfaces:
DialogContext

public abstract class AbstractDialogContext
extends Object
implements DialogContext

Convenience abstract DialogContext implementation. Provides listener registration and convenience event firing methods. Subclasses are expected to be serializable.

Since:
1.0.4

Constructor Summary
AbstractDialogContext()
           
 
Method Summary
 void addDialogContextListener(DialogContextListener listener)
          Register given DialogContextListener for this DialogContext.
protected  void fireOnActivate()
          Inform all registered DialogContextListeners that the dialog instance has been activated.
protected  void fireOnEntry(String stateId)
          Inform all registered DialogContextListeners that the dialog instance execution has entered a particular state.
protected  void fireOnException(Exception exception)
          Inform all registered DialogContextListeners that the dialog instance has encountered an unexpected error condition.
protected  void fireOnExit(String stateId)
          Inform all registered DialogContextListeners that the dialog instance execution has exited a particular state.
protected  void fireOnPassivate()
          Inform all registered DialogContextListeners that the dialog instance has been passivated.
protected  void fireOnStart()
          Inform all registered DialogContextListeners that the dialog instance has begun execution.
protected  void fireOnStop()
          Inform all registered DialogContextListeners that the dialog instance has finished execution normally.
protected  void fireOnTransition(String fromStateId, String toStateId)
          Inform all registered DialogContextListeners that the dialog instance execution has followed a particular transition.
 DialogContextListener[] getDialogContextListeners()
          Return the set of currently registered DialogContextListeners.
 void removeDialogContextListener(DialogContextListener listener)
          Remove this previously registered DialogContextListener for this DialogContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.shale.dialog.DialogContext
advance, getData, getId, getName, getOpaqueState, getParent, isActive, setData, setOpaqueState, start, stop
 

Constructor Detail

AbstractDialogContext

public AbstractDialogContext()
Method Detail

addDialogContextListener

public void addDialogContextListener(DialogContextListener listener)
Register given DialogContextListener for this DialogContext. Listener cannot be null.

Specified by:
addDialogContextListener in interface DialogContext
Parameters:
listener - The DialogContextListener instance.

getDialogContextListeners

public DialogContextListener[] getDialogContextListeners()
Return the set of currently registered DialogContextListeners.

Specified by:
getDialogContextListeners in interface DialogContext

removeDialogContextListener

public void removeDialogContextListener(DialogContextListener listener)
Remove this previously registered DialogContextListener for this DialogContext. The listener will no longer receive any associated callbacks.

Specified by:
removeDialogContextListener in interface DialogContext
Parameters:
listener - The DialogContextListener instance.

fireOnActivate

protected void fireOnActivate()

Inform all registered DialogContextListeners that the dialog instance has been activated.


fireOnPassivate

protected void fireOnPassivate()

Inform all registered DialogContextListeners that the dialog instance has been passivated.


fireOnStart

protected void fireOnStart()
Inform all registered DialogContextListeners that the dialog instance has begun execution.


fireOnStop

protected void fireOnStop()
Inform all registered DialogContextListeners that the dialog instance has finished execution normally.


fireOnException

protected void fireOnException(Exception exception)
Inform all registered DialogContextListeners that the dialog instance has encountered an unexpected error condition. The exception is first logged for archival.

Parameters:
exception - A potentially implementation specific exception during the execution of this dialog instance

fireOnEntry

protected void fireOnEntry(String stateId)
Inform all registered DialogContextListeners that the dialog instance execution has entered a particular state.

Parameters:
stateId - Implementation specific identifier of the state that has been entered

fireOnExit

protected void fireOnExit(String stateId)
Inform all registered DialogContextListeners that the dialog instance execution has exited a particular state.

Parameters:
stateId - Implementation specific identifier of the state that has been exited

fireOnTransition

protected void fireOnTransition(String fromStateId,
                                String toStateId)
Inform all registered DialogContextListeners that the dialog instance execution has followed a particular transition.

Parameters:
fromStateId - Implementation specific identifier of the source state for the transition that has been followed
toStateId - Implementation specific identifier of the target state for the transition that has been followed


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.