ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.conversation
Class AblePlatformConversationSetupLogic

java.lang.Object
  extended bycom.ibm.able.conversation.AbleOwned
      extended bycom.ibm.able.conversation.AblePlatformConversationSetupLogic

public class AblePlatformConversationSetupLogic
extends AbleOwned

Class AblePlatformConversationSetupLogic implements the decision logic functions required for the conversation setup handshake defined in the "ConversationSetup" CP.

This class accepts all requests. Subclasses may modify this behavior by overriding decideAcceptance.


Constructor Summary
AblePlatformConversationSetupLogic()
          Constructs an AblePlatformConversationSetupLogic object.
AblePlatformConversationSetupLogic(AbleBean newOwner)
          Constructs an AblePlatformConversationSetupLogic object.
AblePlatformConversationSetupLogic(AbleBean newOwner, ConversationManager mgr)
          Constructs an AblePlatformConversationSetupLogic object.
 
Method Summary
protected  void callerConversationAccepted(Conversation conv, DecisionDataHandle ddh)
           
 void conversationAccepted(Conversation conv, DecisionDataHandle ddh)
          Decision-logic callback for when the other agent has accepted this agent's request to start a conversation.
 void conversationOver(Conversation conv, DecisionDataHandle ddh)
          Decision-logic callback for when the conversation has ended.
 void conversationRequested(Conversation conv, DecisionDataHandle ddh)
          Decision-logic callback for the second pbase of conversation setup.
 boolean decideAcceptance(javax.agent.AgentName partnerName, javax.agent.Locator partnerLocator, java.lang.String proposedRootPolicy, java.lang.String proposedAcceptorRole)
          Indicates whether this agent accepts the given request for a conversation.
 ConversationManager getConversationManager()
          Returns the ConversationManager to which this object is bound.
 java.lang.String getRootPartnerRole(java.lang.String convId)
          Returns the partner agent's current role in the given conversation.
 java.lang.String getRootPolicyName(java.lang.String convId)
          Returns the name of the root conversation policy in the given conversation.
 java.lang.String getRootSelfRole(java.lang.String convId)
          Returns this agent's current role in the given conversation.
 boolean isPolicySupported(java.lang.String policyName, java.lang.String selfRole)
          Indicates whether this agent is able to load the given conversation policy and role.
 boolean isValidPartnerPolicy(java.lang.String convId, java.lang.String policyName, java.lang.String acceptorRole)
          Indicates whether the given conversation policy and partner's role are valid--i.e., are consistent with the current settings of the conversation.
protected  void responderConversationAccepted(Conversation conv, DecisionDataHandle ddh)
          Helper method called when the conversation-setup messages have been properly exchanged.
 void setConversationManager(ConversationManager manager)
          Sets the ConversationManager to which this object is bound.
 void setRootPolicy(java.lang.String convId, java.lang.String policyName, java.lang.String selfRole)
          Sets the root conversation policy name and this agent's role for the given conversation.
 void start(Conversation conv, DecisionDataHandle ddh)
          Decision-point callback for the start of the conversation.
 
Methods inherited from class com.ibm.able.conversation.AbleOwned
getAbleOwner, logException, logMessage, setAbleOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AblePlatformConversationSetupLogic

public AblePlatformConversationSetupLogic()
Constructs an AblePlatformConversationSetupLogic object.


AblePlatformConversationSetupLogic

public AblePlatformConversationSetupLogic(AbleBean newOwner)
Constructs an AblePlatformConversationSetupLogic object.

Parameters:
newOwner - The AbleBean that owns this object.

AblePlatformConversationSetupLogic

public AblePlatformConversationSetupLogic(AbleBean newOwner,
                                          ConversationManager mgr)
Constructs an AblePlatformConversationSetupLogic object.

Parameters:
newOwner - The AbleBean that owns this object.
mgr - The ConversationManager to which this object is bound.
Method Detail

getConversationManager

public ConversationManager getConversationManager()
Returns the ConversationManager to which this object is bound.

Returns:
The ConversationManager to which this object is bound.

setConversationManager

public void setConversationManager(ConversationManager manager)
Sets the ConversationManager to which this object is bound.

Parameters:
manager - The new ConversationManager to bind this object to.

getRootPartnerRole

public java.lang.String getRootPartnerRole(java.lang.String convId)
Returns the partner agent's current role in the given conversation.

Parameters:
convId - The ID of the conversation in question.
Returns:
The partner's current role in the given converstion, or null if there is no conversation with the given ID..

getRootSelfRole

public java.lang.String getRootSelfRole(java.lang.String convId)
Returns this agent's current role in the given conversation.

Parameters:
convId - The ID of the conversation in question.
Returns:
This agent's role in the given conversation, or null if there is no conversation with the given ID.

getRootPolicyName

public java.lang.String getRootPolicyName(java.lang.String convId)
Returns the name of the root conversation policy in the given conversation.

Parameters:
convId - The ID of the conversation in question.
Returns:
The name of the root conversation policy in the given conversation, or null if there is no conversation with the given ID.

setRootPolicy

public void setRootPolicy(java.lang.String convId,
                          java.lang.String policyName,
                          java.lang.String selfRole)
Sets the root conversation policy name and this agent's role for the given conversation.

Parameters:
convId - The ID of the conversation in question.
policyName - The new root conversation policy.
selfRole - The new role this agent plays in the root conversation policy.

isPolicySupported

public boolean isPolicySupported(java.lang.String policyName,
                                 java.lang.String selfRole)
Indicates whether this agent is able to load the given conversation policy and role.

Parameters:
policyName - The name of the conversation policy in question.
selfRole - The role this agent would play in the given conversation policy.
Returns:
true if the policy and role are supported, false if not.

isValidPartnerPolicy

public boolean isValidPartnerPolicy(java.lang.String convId,
                                    java.lang.String policyName,
                                    java.lang.String acceptorRole)
Indicates whether the given conversation policy and partner's role are valid--i.e., are consistent with the current settings of the conversation. Used during the second phase of a setup handshake initiated by this agent.

Parameters:
convId - The ID of the conversation in question.
policyName - The conversation policy name.
acceptorRole - The name the other agent will play in the conversation.
Returns:
true if the policy and partner-role are acceptible, false if not.

start

public void start(Conversation conv,
                  DecisionDataHandle ddh)
Decision-point callback for the start of the conversation. This is called when the conversation is first being set up--i.e., when it is in the start state of the ConversationSetup conversation policy--and this agent is playing the role of Caller.

Parameters:
conv - The Conversation to which this callback applies.
ddh - The DecisionDataHandle containing inbound decision data.

conversationRequested

public void conversationRequested(Conversation conv,
                                  DecisionDataHandle ddh)
Decision-logic callback for the second pbase of conversation setup. This is called when the other agent has initiated the conversation, and this agent has just received a "conversationRequested" message.

Parameters:
conv - The Conversation to which the callback applies.
ddh - The DecisionDataHandle containing the inbound decision-data.

conversationAccepted

public void conversationAccepted(Conversation conv,
                                 DecisionDataHandle ddh)
Decision-logic callback for when the other agent has accepted this agent's request to start a conversation.

Parameters:
conv - The Conversation to which this callback applies.
ddh - The DecisionDataHandle containing inbound decision-data.

callerConversationAccepted

protected void callerConversationAccepted(Conversation conv,
                                          DecisionDataHandle ddh)

responderConversationAccepted

protected void responderConversationAccepted(Conversation conv,
                                             DecisionDataHandle ddh)
Helper method called when the conversation-setup messages have been properly exchanged. This finalized the setup by loading the agreed-upon root conversation policy.

Parameters:
conv - The Conversation to be finalized.
ddh - The inbound decision-data received with the last message.

conversationOver

public void conversationOver(Conversation conv,
                             DecisionDataHandle ddh)
Decision-logic callback for when the conversation has ended. Writes a message to the agent's log.

Parameters:
conv - The Conversation that is ending.
ddh - Inbound decision-data received from the last inbound message.

decideAcceptance

public boolean decideAcceptance(javax.agent.AgentName partnerName,
                                javax.agent.Locator partnerLocator,
                                java.lang.String proposedRootPolicy,
                                java.lang.String proposedAcceptorRole)
Indicates whether this agent accepts the given request for a conversation. This is designed to be overridded. This version just returns true.

Parameters:
partnerName - The AgentName of the requestor agent.
partnerLocator - The Locator of the requestor agent.
proposedRootPolicy - The root conversation policy proposed by the requestor agent.
proposedAcceptorRole - The role this agent would be taking on in the root conversation policy.
Returns:
true if this agent accepts the request; false if not. Unless overridded, this just returns true.

ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005