ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.conversation
Class SimpleCPH

java.lang.Object
  |
  +--com.ibm.able.conversation.AbstractCPH
        |
        +--com.ibm.able.conversation.SimpleCPH
All Implemented Interfaces:
ConversationPolicyHandler, java.io.Serializable

public class SimpleCPH
extends AbstractCPH
implements java.io.Serializable

An implementation of the ConversationPolicyHandler interface that uses a state machine to execute a conversation

OLD VERSION -- TO BE DELETED Replaced by com.ibm.able.conversation.AbleCpStateMachineHandler

See Also:
Serialized Form

Field Summary
protected static long serialVersionUID
          Serialized version identifier in form YYYYMMDDVerRelModxx
 
Fields inherited from class com.ibm.able.conversation.AbstractCPH
propertySupport
 
Constructor Summary
SimpleCPH()
          Default Constructor for SimpleCPH
SimpleCPH(ConversationParser parser)
          Constructor for SimpleCPH with a ConversationParser object
 
Method Summary
 java.util.Collection getDecisionPoints()
          Returns the set of all names that might be used in decision-requests, for any role.
 MessageForm getMessageForm(java.lang.String messageKey)
          Returns the MessageForm object associated with the given transition, as identified by message key.
 java.util.Hashtable getMessageForms(java.lang.String decisionPoint)
          Returns a hashtable of messageforms associated with the set of out-going transitions from the given decision point name
 java.util.Collection getMessageKeys()
          Returns the set of message-keys of the decision names for all decision points.
 java.util.Collection getMessageKeys(java.lang.String decisionPoint)
          Returns the set of all message-keys (names of send-message transitions) for outgoing transitions from the given decision point.
 java.lang.String getPolicyName()
          Identifies the policy we're handling.
 java.lang.String getRole()
          Returns the role we've assumed, or null if we haven't assumed one.
 java.util.Collection getRoleSet()
          Returns the set of possible roles, as defined by the policy we're handling.
 StateMachine getStateMachine()
          Returns the StateMachine object associated with the CPH
 java.lang.String getStateName()
          Identifies the current "state" of the CP.
 void process(ConversationEvent input, ConversationEventSequence outputs)
          Attempts to process the given input event.
 void reset()
          Puts the CP into a start state without changing the role.
 void reset(java.lang.String newRole)
          Puts the CP into a start state and sets the role.
 void setRole(java.lang.String newRole)
          Sets the current role.
 java.lang.String startAt()
           
 
Methods inherited from class com.ibm.able.conversation.AbstractCPH
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, process, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
Serialized version identifier in form YYYYMMDDVerRelModxx
Constructor Detail

SimpleCPH

public SimpleCPH()
Default Constructor for SimpleCPH

SimpleCPH

public SimpleCPH(ConversationParser parser)
Constructor for SimpleCPH with a ConversationParser object

Parameters:
parser - An instance of a conversation parser that represents a conversation
Method Detail

getPolicyName

public java.lang.String getPolicyName()
Description copied from interface: ConversationPolicyHandler
Identifies the policy we're handling.
See Also:
ConversationPolicyHandler.getPolicyName()

getStateName

public java.lang.String getStateName()
Description copied from interface: ConversationPolicyHandler
Identifies the current "state" of the CP. For CPHs that aren't based on state-machines (e.g., for rule-based CPHs), this may be a problem. This presumes that the "state" of a CP can be usefully represented by a string. True for state-machine CPs, less so for other architectures.
See Also:
ConversationPolicyHandler.getStateName()

getRoleSet

public java.util.Collection getRoleSet()
Description copied from interface: ConversationPolicyHandler
Returns the set of possible roles, as defined by the policy we're handling.
See Also:
ConversationPolicyHandler.getRoleSet()

getRole

public java.lang.String getRole()
Description copied from interface: ConversationPolicyHandler
Returns the role we've assumed, or null if we haven't assumed one.
See Also:
ConversationPolicyHandler.getRole()

setRole

public void setRole(java.lang.String newRole)
Description copied from interface: ConversationPolicyHandler
Sets the current role. Tests to see whether newRole is in the role set. If not, does nothing. reset() should always be called after changing the role. Do not use this. use reset(newRole) instead. TO DO: get rid of this.
See Also:
ConversationPolicyHandler.setRole(String)

getDecisionPoints

public java.util.Collection getDecisionPoints()
Description copied from interface: ConversationPolicyHandler
Returns the set of all names that might be used in decision-requests, for any role. In any CP, each decision-point is assumed to have a unique name. Usually the decision- point name is the same as the state name. Q: rename "decision point" --> "state name"?
See Also:
ConversationPolicyHandler.getDecisionPoints()

getMessageKeys

public java.util.Collection getMessageKeys()
Description copied from interface: ConversationPolicyHandler
Returns the set of message-keys of the decision names for all decision points. These usually correspond to the names of send-message transitions. In any CP, each send-message transition is assumed to have a unique message-key. Q: rename "message key" -> "decision name"? Q: return all possible decision names (even if not for send-message transitions)?
See Also:
ConversationPolicyHandler.getMessageKeys()

getMessageKeys

public java.util.Collection getMessageKeys(java.lang.String decisionPoint)
Description copied from interface: ConversationPolicyHandler
Returns the set of all message-keys (names of send-message transitions) for outgoing transitions from the given decision point.
See Also:
ConversationPolicyHandler.getMessageKeys(String)

getMessageForm

public MessageForm getMessageForm(java.lang.String messageKey)
Description copied from interface: ConversationPolicyHandler
Returns the MessageForm object associated with the given transition, as identified by message key.
See Also:

WARNING: Not implemented


reset

public void reset()
Description copied from interface: ConversationPolicyHandler
Puts the CP into a start state without changing the role. Role should be set before the first time this is called.
See Also:
ConversationPolicyHandler.reset()

reset

public void reset(java.lang.String newRole)
Description copied from interface: ConversationPolicyHandler
Puts the CP into a start state and sets the role.
See Also:
ConversationPolicyHandler.reset(String)

process

public void process(ConversationEvent input,
                    ConversationEventSequence outputs)
Description copied from interface: ConversationPolicyHandler
Attempts to process the given input event. Returns the output event, if there is one, or null if not. Only certain types of ConversationEvent make sense as inputs to a CPH: --MessageEvent, type=INBOUND only, from messaging system --DecisionEvent, type=DECISION only, from decision logic --CPDoneEvent, passed up from child CP, for child-return transitions --ProtocolErrorEvent passed up from child, for contextual error-handling --TimerEvent, type=TIMER_EXPIRED only, for timeout expiration Similarly, only certain types make sense as outputs: --MessageEvent, type=OUTBOUND only --DecisionEvent, type=DECISION_REQUEST --CPDoneEvent --ProtocolErrorEvent --LoadCPEvent --TimerEvent, type=SET_TIMER, for setting a timer --ContextEvent More than output may be triggered by a single input (e.g., a decision to say goodbye might trigger outbound message & CPDone). TO DO? We could return a newly created output sequence, rather than appending outputs to a sequence supplied by the user. This would be conceptually cleaner, though slower. There's a performance hit caused by allocating all whole new sequence object, just to put 1 event in it.
See Also:
ConversationPolicyHandler.process(ConversationEvent, ConversationEventSequence)

getStateMachine

public StateMachine getStateMachine()
Returns the StateMachine object associated with the CPH

Returns:
StateMachine object

getMessageForms

public java.util.Hashtable getMessageForms(java.lang.String decisionPoint)
Returns a hashtable of messageforms associated with the set of out-going transitions from the given decision point name

Parameters:
decisionPoint - name of the decision point (state)

Returns:
hashtable of messageforms indexed by the trasition id(name)

startAt

public java.lang.String startAt()
Returns:
name of the state if the underlying state-machine is active in the current state, null otherwise

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003