|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.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 |
addPendingDecisionEvent(com.ibm.able.conversation.AbleConversation.DecisionLogicEvent newOutput)
Adds the given decision data to the queue of pending decision data outputs. |
protected void |
addPendingMessage(MessageHandle newMh)
Adds the given message to the queue of pending messages. |
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 |
deliverDecisionData()
Flushes the queue of pending decision data outputs by giving them, one by one, to this Conversation's DecisionLogicAdapter . |
void |
deliverMessages()
Flushes the queue of pending outbound messages by giving them, one by one, to this Conversation's MessageSystemAdapter . |
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. |
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 Conversation
com.ibm.conversation.Conversation
public void setMetaData(ConversationMetaData data)
Conversation
Does 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 Conversation
com.ibm.conversation.Conversation
The
- new meta-data object.public ConversationMetaData getMetaData()
Conversation
Does 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 Conversation
com.ibm.conversation.Conversation
public ConversationContext getContext()
Conversation
getContext
in interface Conversation
com.ibm.conversation.Conversation
public void setRootPolicy(java.lang.String newName, java.lang.String newRole)
Conversation
The root policy name and role must be set before the conversation is started, and should not be changed thereafter.
setRootPolicy
in interface Conversation
com.ibm.conversation.Conversation
newName
- 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 Conversation
com.ibm.conversation.Conversation
public 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 Conversation
com.ibm.conversation.Conversation
public java.lang.String getActivePolicyName()
Conversation
getActivePolicyName
in interface Conversation
com.ibm.conversation.Conversation
null
if there is none.public java.lang.String getActivePolicyRole()
Conversation
getActivePolicyRole
in interface Conversation
com.ibm.conversation.Conversation
null
if there is none.public ConversationPolicyHandler getConversationPolicyHandlerAt(int level)
Conversation
getConversationPolicyHandlerAt
in interface Conversation
com.ibm.conversation.Conversation
level
- The level of the desired policy handler.public ConversationPolicyHandler getActivePolicyHandler()
Conversation
getActivePolicyHandler
in interface Conversation
com.ibm.conversation.Conversation
public void setMessageTransformFactory(MessageTransformFactory newFactory)
Conversation
The ConverstionManager assigns a default MessageTransformFactory at the time the Conversation is created. It can safely be replaced anytime.
setMessageTransformFactory
in interface Conversation
com.ibm.conversation.Conversation
fac
- The new MessageTransformFactory to use.public void setConversationPolicyHandlerFactory(ConversationPolicyHandlerFactory newFactory)
Conversation
The ConverstionManager assigns a default ConversationPolicyHandlerFactory at the time the Conversation is created. It can safely be replaced anytime.
setConversationPolicyHandlerFactory
in interface Conversation
com.ibm.conversation.Conversation
fac
- The new ConversationPolicyHandlerFactory to use.public DecisionLogicAdapter getDecisionLogicAdapter()
Conversation
The ConversationManager assigns a default DecisionLogicAdapter at the time the Conversation is created. It can safely be replaced anytime.
getDecisionLogicAdapter
in interface Conversation
com.ibm.conversation.Conversation
public void setDecisionLogicAdapter(DecisionLogicAdapter newDLA)
Conversation
The ConversationManager assigns a default DecisionLogicAdapter at the time the Conversation is created. It can safely be replaced anytime.
setDecisionLogicAdapter
in interface Conversation
com.ibm.conversation.Conversation
newDLA
- The new DecisionLogicAdapter to use.public MessageSystemAdapter getMessageSystemAdapter()
Conversation
The ConversationManager assigns a default MessageSystemAdapter at the time the Conversation is created. It can safely be replaced anytime.
getMessageSystemAdapter
in interface Conversation
com.ibm.conversation.Conversation
public void setMessageSystemAdapter(MessageSystemAdapter newMSA)
Conversation
The ConversationManager assigns a default MessageSystemAdapter at the time the Conversation is created. It can safely be replaced anytime.
setMessageSystemAdapter
in interface Conversation
com.ibm.conversation.Conversation
newMSA
- The new MessageSystemAdapter to use.public void start()
Conversation
This 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.public void processMessage(MessageHandle mh)
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 via
deliverMessages()
,
processMessage
in interface Conversation
mh
- The message.deliverMessages()
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 via
deliverDecisionData()
.
processDecision
in interface Conversation
ddh
- The decision data.deliverDecisionData()
public void deliverMessages()
MessageSystemAdapter
.
A message is given to the MessageSystemAdapter via a call to
MessageSystemAdapter.sendMessage()
.
public void deliverDecisionData()
DecisionLogicAdapter
.
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 addPendingDecisionEvent(com.ibm.able.conversation.AbleConversation.DecisionLogicEvent newOutput)
newOutput
- The decision-data to add.protected final void addPendingMessage(MessageHandle newMh)
newMh
- The message 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.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |