|
ABLE 2.3.0 07/13/2005 14:21:00 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectcom.ibm.able.conversation.AbleConversation
The AbleConversation class executes one side of a single conversation, managing all ConversationPolicyHandlers, etc., as needed. It's owned by, and has a reference to, an AbleConversationManager.
An AbleConversation immediately processes any message or decision-data given to it as
input, and stores any outputs generated by the currently active ConversationPolicyHandler
in two queues: one for output messages to be given to the MessageSystemAdapter, and the
other for decision-data to be given to the DecisionLogicAdapter. To do this, it uses
an internal, private ConversationPolicyListener that it
attaches to all ConversationPolicyHandlers. The output queues are flushed
periodically by the AbleConversationManager that owns this Conversation.
This is not an AbleBean, but it may become one in the future. For this reason, some of the methods are copied from the AbleBean interface. It will only be used as a transient object in ABLE, so it does not implement the Serializable interface.
| Field Summary | |
|---|---|
static java.lang.String |
CHILD_CP_DONE_PROPERTY
Property name of the PropertyChangeEvent fired when a child conversation policy has just terminated. |
static java.lang.String |
CHILD_CP_LOADED_PROPERTY
Property name of the PropertyChangeEvent fired when a child conversation policy has just been loaded. |
| Constructor Summary | |
|---|---|
AbleConversation(AbleConversationManager mgr,
java.lang.String newConvId)
Constructs an AbleConversation object. |
|
| Method Summary | |
|---|---|
protected void |
addPendingOutputEvent(com.ibm.able.conversation.AbleConversation.OutputEvent newOutput)
Adds the given output event to the queue of pending output events. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener newListener)
Adds the given PropertyChangeListener to this object's property-change support. |
void |
addPropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener newListener)
Adds the given PropertyChangeListener to this object's property-change support, under the given property name. |
void |
dispatchOutputs()
Flushes the queue of pending ConversationPolicyHandler outputs one by one. |
protected void |
firePropertyChange(java.beans.PropertyChangeEvent event)
Fires the given PropertyChangeEvent to registered PropertyChangeListeners. |
ConversationPolicyHandler |
getActivePolicyHandler()
Returns the currently active conversation policy handler. |
java.lang.String |
getActivePolicyName()
Returns the name of the conversation policy currently active in this conversation. |
java.lang.String |
getActivePolicyRole()
Returns the role this agent is playing in the currently active conversation policy. |
ConversationContext |
getContext()
Returns the current conversational context for this conversation. |
java.lang.String |
getConversationId()
Returns the conversation ID for this conversation. |
ConversationPolicyHandler |
getConversationPolicyHandlerAt(int level)
Returns the conversation policy handler at the given level of the stack. |
DecisionLogicAdapter |
getDecisionLogicAdapter()
Returns the DecisionLogicAdapter currently in use for this Conversation. |
MessageSystemAdapter |
getMessageSystemAdapter()
Returns the MessageSystemAdapter currently in use for this Conversation. |
ConversationMetaData |
getMetaData()
Returns the conversation meta-data for this conversation. |
java.lang.String |
getRootPolicyName()
Returns the name of the root conversation policy for this conversation. |
java.lang.String |
getRootPolicyRole()
Returns the role this agent plays when it executes the root conversation policy. |
protected void |
loadPolicy(java.lang.String name,
java.lang.String role)
Creates, initializes, and installs a new ConversationPolicyHandler with the given policy and role. |
protected void |
popPolicy(java.lang.String returnCode)
Pops the currently active ConversationPolicyHandler from the stack and sends the return code to its parent. |
void |
processDecision(DecisionDataHandle ddh)
Processes the given decision. |
void |
processMessage(MessageHandle mh)
Processes the given message. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener oldListener)
Removes the given PropertyChangeListener from this object's property-change support. |
void |
removePropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener oldListener)
Removes the given PropertyChangeListener from this object's property-change support for the given property name. |
void |
setConversationPolicyHandlerFactory(ConversationPolicyHandlerFactory newFactory)
Sets the ConversationPolicyHandlerFactory to use in creating ConversationPolicyHandlers for this conversation. |
void |
setDecisionLogicAdapter(DecisionLogicAdapter newDLA)
Sets the DecisionLogicAdapter to use for this Conversation. |
void |
setMessageSystemAdapter(MessageSystemAdapter newMSA)
Sets the MessageSystemAdapter to use for this Conversation. |
void |
setMessageTransformFactory(MessageTransformFactory newFactory)
Sets the MessageTransformFactory to use in creating MessageTransforms for translating messages into decision data, and vice-versa. |
void |
setMetaData(ConversationMetaData data)
Sets the conversation meta-data for this conversation. |
void |
setRootPolicy(java.lang.String newName,
java.lang.String newRole)
Sets the name and role of the root conversation policy. |
void |
start()
Begins execution of the conversation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String CHILD_CP_DONE_PROPERTY
public static final java.lang.String CHILD_CP_LOADED_PROPERTY
| Constructor Detail |
public AbleConversation(AbleConversationManager mgr,
java.lang.String newConvId)
mgr - The ConverstionManager that owns this Converstion.newConvId - The conversation ID of this Conversation.| Method Detail |
public java.lang.String getConversationId()
Conversation
The conversation ID is assigned by the ConversationManager at the time
this Conversation is created. Its value is equal to that of
getMetaData().getSelfConversationId();
getConversationId in interface Conversationpublic void setMetaData(ConversationMetaData data)
ConversationDoes not copy the new meta-data's contents; just replaces the old meta-data object with the new one. This should not be called once the conversation has been set up.
setMetaData in interface Conversationdata - The new meta-data object.public ConversationMetaData getMetaData()
ConversationDoes not return a copy, but the actual meta-data object in use. After the conversation has been set up, the properties of this meta-data object should not be changed.
getMetaData in interface Conversationpublic ConversationContext getContext()
Conversation
getContext in interface Conversation
public void setRootPolicy(java.lang.String newName,
java.lang.String newRole)
ConversationThe root policy name and role must be set before the conversation is started, and should not be changed thereafter.
setRootPolicy in interface ConversationnewName - The new root policy's name.newRole - The role to play in the new root policy.public java.lang.String getRootPolicyName()
Conversation
The root policy name must be set (via setRootPolicy()) before
the conversation is started, and should not be changed thereafter.
getRootPolicyName in interface Conversationpublic java.lang.String getRootPolicyRole()
Conversation
The root policy role must be set (via setRootPolicy()) before
the conversation is started, and should not be changed thereafter.
getRootPolicyRole in interface Conversationpublic java.lang.String getActivePolicyName()
Conversation
getActivePolicyName in interface Conversationnull if there is none.public java.lang.String getActivePolicyRole()
Conversation
getActivePolicyRole in interface Conversationnull if there is none.public ConversationPolicyHandler getConversationPolicyHandlerAt(int level)
Conversation
getConversationPolicyHandlerAt in interface Conversationlevel - The level of the desired policy handler.
public ConversationPolicyHandler getActivePolicyHandler()
Conversation
getActivePolicyHandler in interface Conversationpublic void setMessageTransformFactory(MessageTransformFactory newFactory)
ConversationThe ConverstionManager assigns a default MessageTransformFactory at the time the Conversation is created. It can safely be replaced anytime.
setMessageTransformFactory in interface ConversationnewFactory - The new MessageTransformFactory to use.public void setConversationPolicyHandlerFactory(ConversationPolicyHandlerFactory newFactory)
ConversationThe ConverstionManager assigns a default ConversationPolicyHandlerFactory at the time the Conversation is created. It can safely be replaced anytime.
setConversationPolicyHandlerFactory in interface ConversationnewFactory - The new ConversationPolicyHandlerFactory to use.public DecisionLogicAdapter getDecisionLogicAdapter()
ConversationThe ConversationManager assigns a default DecisionLogicAdapter at the time the Conversation is created. It can safely be replaced anytime.
getDecisionLogicAdapter in interface Conversationpublic void setDecisionLogicAdapter(DecisionLogicAdapter newDLA)
ConversationThe ConversationManager assigns a default DecisionLogicAdapter at the time the Conversation is created. It can safely be replaced anytime.
setDecisionLogicAdapter in interface ConversationnewDLA - The new DecisionLogicAdapter to use.public MessageSystemAdapter getMessageSystemAdapter()
ConversationThe ConversationManager assigns a default MessageSystemAdapter at the time the Conversation is created. It can safely be replaced anytime.
getMessageSystemAdapter in interface Conversationpublic void setMessageSystemAdapter(MessageSystemAdapter newMSA)
ConversationThe ConversationManager assigns a default MessageSystemAdapter at the time the Conversation is created. It can safely be replaced anytime.
setMessageSystemAdapter in interface ConversationnewMSA - The new MessageSystemAdapter to use.public void start()
ConversationThis should be called only once. It clears the policy-handler stack, then creates a new policy-handler running the root policy in the root policy role and adds the new policy-handler to the stack.
If the start state is a decision state for this agent,
calling start() will cause DecisionLogicAdapter.decisionPoint()
to be called on the decision logic adapter. This is the signal to the decision logic
that it is supposed to start the conversation in earnest, by making its first decision.
start in interface Conversation
protected void loadPolicy(java.lang.String name,
java.lang.String role)
name - The policy name.role - The role.protected void popPolicy(java.lang.String returnCode)
returnCode - The return code to send to the parent.
public void processMessage(MessageHandle mh)
throws ConversationException
This gives the message to the active policy handler for processing, then stores the
policy handler's outputs until they are dispatched. Dispatching is done asynchronously
via dispatchOutputs(),
processMessage in interface Conversationmh - The message.
ConversationException - If there is no currently active policy.dispatchOutputs()
public void processDecision(DecisionDataHandle ddh)
throws ConversationException
This gives the decision data to the active policy handler for processing, then stores the
policy handler's outputs until they are dispathed. Dispatching is done asynchronously
via dispatchOutputs().
processDecision in interface Conversationddh - The decision data.
ConversationException - If there is no currently active policy, or if the decision is illegal, as determined by the
conversational context.dispatchOutputs()public void dispatchOutputs()
Messages are given to the MessageSystemAdapter. Conversation-management outputs
(e.g., load child policy & child policy done) are processed by this
AbleConversation object.
Decision data is given to the DecisionLogicAdapter via a call to the appropriate
method: e.g., DecisionLogicAdapter.decisionPoint() if the conversation
is at a decision point for this agent.
protected final void addPendingOutputEvent(com.ibm.able.conversation.AbleConversation.OutputEvent newOutput)
newOutput - The decision-data to add.public void addPropertyChangeListener(java.beans.PropertyChangeListener newListener)
newListener - The new PropertyChangeListener.
public void addPropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener newListener)
property - The property name.newListener - The new PropertyChangeListener.public void removePropertyChangeListener(java.beans.PropertyChangeListener oldListener)
oldListener - The PropertyChangeListener to remove.
public void removePropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener oldListener)
property - The property name.oldListener - The PropertyChangeListener to remove.protected void firePropertyChange(java.beans.PropertyChangeEvent event)
event - The PropertyChangeEvent.
|
ABLE 2.3.0 07/13/2005 14:21:00 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||