com.ibm.able.examples.conversation
Class ChatterboxAgent
java.lang.Object
com.ibm.able.AbleObject
com.ibm.able.AbleDefaultAgent
com.ibm.able.AbleRemoteDefaultAgent
com.ibm.able.platform.AblePlatformDefaultAgent
com.ibm.able.conversation.AblePlatformConversationAgent
com.ibm.able.examples.conversation.ChatterboxAgent
- All Implemented Interfaces:
- AbleAgent, AbleBean, AbleBeanContainer, AbleBeanRemoteContainer, AbleDataBufferManager, AbleEventListener, AbleEventListenerManager, AbleEventListenerRemoteManager, AbleEventQueueManager, AbleEventQueueProcessor, AbleEventQueueRemoteManager, AblePlatformAgent, AblePropertyChangeManager, AbleRemoteAgent, AbleRemoteBean, AbleRemoteEventListener, AbleSerializable, AbleUserDefinedFunctionManager, AbleUserDefinedFunctionRemoteManager, java.util.EventListener, javax.agent.service.transport.MessageListener, java.beans.PropertyChangeListener, java.rmi.Remote, java.io.Serializable
- public class ChatterboxAgent
- extends AblePlatformConversationAgent
- See Also:
- Serialized Form
| Fields inherited from class com.ibm.able.platform.AblePlatformDefaultAgent |
agentLastUpdate, agentMovable, agentStatus, agentSummary, agentToAutoRegister, agentToBindToRmi, agentType, agentVendor, agentVersion, myAgentInboxes, myAgentLoggingService, myCapabilities, myCapabilityOrder, myCustomCapabilityAutonomyLevels, myHighCapabilityAutonomyLevels, myJasAbleLocator, myJasAgentAttributes, myJasAgentDescription, myJasAgentDirectoryService, myJasAgentName, myJasAgentNamingService, myJasDefaultLocator, myJasMessageTransportService, myJasServiceRoot, myJasTransportSystem, myJasVerifiableDirectoryService, myJasVerifiableNamingService, myKeyPair, myLowCapabilityAutonomyLevels, myMediumCapabilityAutonomyLevels, myPrincipal, myReceiveMessageMethod, myRequestKey, mySecSppt, myTrustLevel, myVerifiableAgentName |
| Fields inherited from class com.ibm.able.AbleObject |
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, properties, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace |
|
Constructor Summary |
ChatterboxAgent(java.lang.String instanceName)
Constructs a ChatterboxAgent instance, with the given display name. |
|
Method Summary |
protected boolean |
decideToSendTestMessage()
Indicates whether this agent should send a test message as part of its current
processing step. |
protected boolean |
decideToStartConversation()
Indicates whether this agent should initiate a conversation as part of its
current processing step. |
int |
getTotalConversations()
Returns the total number of conversations this agent is allowed to have. |
void |
init()
Initializes this agent. |
boolean |
isConversationEnabled()
Indicates whether this agent may initiate conversations. |
boolean |
isTestMessageEnabled()
Indicates whether this agent may send a test message. |
java.lang.String |
listKnownCpNames()
Returns a space-separated list of the names of all known conversation policies. |
void |
process()
Does one step of processing. |
protected javax.agent.service.directory.AgentDescription |
selectConversationPartner()
Selects, from the platform registry, an agent to communicate with. |
protected void |
sendTestMessage(javax.agent.service.directory.AgentDescription partnerDesc)
Sends a simple test message to the given agent. |
void |
setConversationEnabled(boolean b)
Toggles whether this agent may initiate conversations. |
void |
setTestMessageEnabled(boolean b)
Toggles whether this agent may send test messages. |
void |
setTotalConversations(int i)
Sets the total number of conversations this agent may have. |
| Methods inherited from class com.ibm.able.conversation.AblePlatformConversationAgent |
createMetaData, getConversationManager, getLocatorForInbox, getLocatorForType, getPartnerRole, installTargetForCp, logException, logMessage, onInboundDecision, onMessage, onTimeout, onUnexpectedMessage, startConversation, startConversation, startConversation, startConversation |
| Methods inherited from class com.ibm.able.platform.AblePlatformDefaultAgent |
_init, _init, _quitAll, _reset, _resumeAll, _suspendAll, addAgentInbox, addJasAgentAttribute, authenticateAndAuthorizeCaller, authorizeCapabilityChangeRequest, broadcastTransportMessage, createAgentSituationReport, createLocatorAndBindToMethod, getAboutDataBean, getAgentAutonomyLevel, getAgentDescription, getAgentInboxes, getAgentLastUpdate, getAgentLoggingService, getAgentStatus, getAgentSummary, getAgentType, getAgentVendor, getAgentVersion, getAndSetAgentDescription, getAndSetAgentNames, getAndSetTransportServices, getAndValidateServiceRoot, getCapabilities, getCapability, getCapabilityAutonomyLevels, getCapabilityOrder, getCapabilityPresets, getCapabilitySummaryByAgentAutonomyLevel, getCapabilitySummaryByCapabilityAutonomyLevels, getCustomizerDataBean, getCustomizerInfo, getJasAgentAttributes, getJasAgentName, getNewAgentDescription, getPlatformAgentName, getPrincipal, getTransportMessageContent, getTransportMessageContent2, handleAnsweredRequest, init, initAgentCapabilities, initCommonCode, initializeAgent, initializeAgent, isAgentMovable, isAgentToAutoRegister, isAgentToBindToRmi, loadAgentDescriptionWithAbleAttributes, loadAgentDescriptionWithAbleLocator, loadAgentDescriptionWithAgentName, loadAgentDescriptionWithBaseLocators, loadAgentDescriptionWithPublicKey, loadAgentDescriptionWithUserAttributes, logAgentSituationReport, logHistory, lookUpAgent, lookUpAgent, main, makeCapabilityAutonomyLevelsSummary, maybeDeregisterWithAgentDirectoryService, maybeRebindToRmi, maybeRegisterWithAgentDirectoryService, maybeUnbindFromRmi, preInit, preInit, process, processAnsweredRequest, quitAgent, quitAll, receiveMessage, removeAgentInbox, removeAgentInboxes, removeAgentSituationReports, removeJasAgentAttribute, reset, resetAgent, resumeAgent, resumeAll, sendTransportMessage, sendTransportMessage, setAgentAutonomyLevel, setAgentMovable, setAgentNameUniqueID, setAgentSummary, setAgentToAutoRegister, setAgentToBindToRmi, setAgentType, setAgentVendor, setAgentVersion, setCapabilityAutonomyLevel, setCapabilityAutonomyLevels, setCustomizerDataBean, setPrincipal, setRequestKey, setRestartedFromPersistence, suspendAgent, suspendAll, toString, updateAgentSituationReport, updateDescriptionWithAgentDirectoryService, validateAnsweredRequest, verifyCapabilities, verifyKey |
| Methods inherited from class com.ibm.able.AbleDefaultAgent |
addBean, addBeans, addEventConnection, addUserDefinedFunction, buildProcessList, clsNm, containsBean, containsBean, containsUserDefinedFunction, debugTrace, generateUniqueName, getBean, getBeans, getDataSource, getEventConnections, getNumEpochs, getProcessList, getUserDefinedFunction, getUserDefinedFunctions, handleAbleEvent, initAllBeans, invokeUserDefinedFunction, isActiveDataSource, propertyChange, quitEnabledEventProcessing, removeAllBeans, removeAllConnections, removeAllEventConnections, removeBean, removeBean, removeBeans, removeEventConnection, removeUserDefinedFunction, resetAllBeans, setActiveDataSource, setDataFlowEnabled, setProcessList, setUserDefinedFunctions |
| Methods inherited from class com.ibm.able.AbleObject |
addAbleEventListener, addDestBufferConnection, addPropertyChangeListener, addPropertyConnection, addSourceBufferConnection, addStateChangeListener, dataChanged, firePropertyChange, flushAbleEventQueue, getAbleEventListeners, getAbleEventProcessingEnabled, getAbleEventQueueSize, getComment, getDestBufferConnections, getFileName, getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getProperties, getProperty, getPropertyChangeListeners, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, getTraceLogger, hasInputBuffer, hasOutputBuffer, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, processAbleEvent, processBufferConnections, processNoEventProcessingEnabledSituation, processTimerEvent, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllPropertyConnections, removeDestBufferConnection, removeProperty, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setProperties, setProperty, setSleepTime, setState, setTimerEventProcessingEnabled, setTraceLogger, sourceConnectionsOK, startEnabledEventProcessing, suspendEnabledEventProcessing |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.ibm.able.AbleEventQueueRemoteManager |
flushAbleEventQueue, getAbleEventProcessingEnabled, getAbleEventQueueSize, getSleepTime, isTimerEventProcessingEnabled, quitEnabledEventProcessing, restartEnabledEventProcessing, resumeEnabledEventProcessing, setAbleEventProcessingEnabled, setSleepTime, setTimerEventProcessingEnabled, startEnabledEventProcessing, suspendEnabledEventProcessing |
| Methods inherited from interface javax.agent.service.transport.MessageListener |
equals, hashCode |
| Methods inherited from interface com.ibm.able.AbleBean |
getComment, getLogger, getName, getParent, getProperties, getProperty, getState, getTraceLogger, isChanged, removeProperty, setChanged, setComment, setLogger, setName, setParent, setProperties, setProperty, setState, setTraceLogger |
| Methods inherited from interface com.ibm.able.AbleDataBufferManager |
addDestBufferConnection, addSourceBufferConnection, getDestBufferConnections, getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getSourceBufferConnections, hasInputBuffer, hasOutputBuffer, isConnectable, isDataFlowEnabled, processBufferConnections, removeAllBufferConnections, removeDestBufferConnection, removeSourceBufferConnection, setInputBuffer, setInputBuffer, setOutputBuffer, setOutputBuffer |
| Methods inherited from interface com.ibm.able.AbleEventQueueManager |
flushAbleEventQueue, getAbleEventProcessingEnabled, getAbleEventQueueSize, getSleepTime, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isTimerEventProcessingEnabled, restartEnabledEventProcessing, resumeEnabledEventProcessing, setAbleEventProcessingEnabled, setSleepTime, setTimerEventProcessingEnabled, startEnabledEventProcessing, suspendEnabledEventProcessing |
ABLE_AGENT_TYPE
public static final java.lang.String ABLE_AGENT_TYPE
- See Also:
- Constant Field Values
ChatterboxAgent
public ChatterboxAgent(java.lang.String instanceName)
throws java.rmi.RemoteException,
AbleException
- Constructs a ChatterboxAgent instance, with the given display name.
- Parameters:
instanceName - The displayName of the agent.
- Throws:
java.rmi.RemoteException - If the superclass constructor throws one.
AbleException - If the superclass constructor throws one.
getTotalConversations
public int getTotalConversations()
- Returns the total number of conversations this agent is allowed to have.
- Returns:
- The total number of conversations this agent may have.
setTotalConversations
public void setTotalConversations(int i)
- Sets the total number of conversations this agent may have.
- Parameters:
i - The new total.
isConversationEnabled
public boolean isConversationEnabled()
- Indicates whether this agent may initiate conversations.
- Returns:
- true if this agent may initiate converstions, false if not.
isTestMessageEnabled
public boolean isTestMessageEnabled()
- Indicates whether this agent may send a test message.
- Returns:
- true if this agent may send a test message, false if not.
setConversationEnabled
public void setConversationEnabled(boolean b)
- Toggles whether this agent may initiate conversations.
- Parameters:
b - New indicator for whether this agent may initiate conversations.
setTestMessageEnabled
public void setTestMessageEnabled(boolean b)
- Toggles whether this agent may send test messages.
- Parameters:
b - New indicator for whether this agent may send messages.
init
public void init()
throws AbleException
- Description copied from class:
AblePlatformConversationAgent
- Initializes this agent.
Sets up a default message inbox;
calls super.init();
installs the MessageTransportService (created in super.init()) in its
MessageSystemAdapter;
initializes its ConversationManager.
- Specified by:
init in interface AbleRemoteBean- Overrides:
init in class AblePlatformConversationAgent
- Throws:
AbleException
process
public void process()
throws AbleException
- Description copied from class:
AblePlatformConversationAgent
- Does one step of processing.
Calls
super.process(), then calls process() on its
ConversationManager.
- Specified by:
process in interface AbleRemoteBean- Overrides:
process in class AblePlatformConversationAgent
- Throws:
AbleException - If the superclass or the conversationManager throws one.
decideToSendTestMessage
protected boolean decideToSendTestMessage()
- Indicates whether this agent should send a test message as part of its current
processing step.
- Returns:
- true if it should, false if not.
decideToStartConversation
protected boolean decideToStartConversation()
- Indicates whether this agent should initiate a conversation as part of its
current processing step.
- Returns:
- true if it should, false if not.
selectConversationPartner
protected javax.agent.service.directory.AgentDescription selectConversationPartner()
- Selects, from the platform registry, an agent to communicate with.
It first obtains from the registry the AgentDescriptions of all agents
that have registered themselves as being Chatterbox agents. Then it selects
and returns one at random from the list.
- Returns:
- The description of the selected agent.
sendTestMessage
protected void sendTestMessage(javax.agent.service.directory.AgentDescription partnerDesc)
- Sends a simple test message to the given agent.
- Parameters:
partnerDesc - The AgentDescription of the agent to send the message to.
listKnownCpNames
public java.lang.String listKnownCpNames()
- Returns a space-separated list of the names of all known conversation policies.
- Returns:
- The list.
(C) Copyright IBM Corporation 1999, 2005