ABLE, Version 1.1b

com.ibm.able.platform.agents
Class FipaAgentDefaultAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.ibm.able.AbleObject
                          |
                          +--com.ibm.able.agents.AbleDefaultAgent
                                |
                                +--com.ibm.able.platform.agents.FipaAgentDefaultAgent
Direct Known Subclasses:
FipaAccAgentAppl, FipaAmsAgentAppl, FipaDfAgentAppl, SimpleFipaAgent

public class FipaAgentDefaultAgent
extends AbleDefaultAgent
implements FipaAgent, java.io.Serializable

This class provides a simple implementation of the FipaAgent interface. It is a convenience class that provides built-in FIPA AMS & DF Agent Descriptors that can be filled in by subclasses, and methods to register and deregister with the AMS & DF agents.

Additional methods are also provided to handle FIPA architected ACL messages, but the implementations of these methods do nothing and must be overridden by subclasses. The one exception is the quitAgent() method, which will unbind the agent from RMI and deregister the agent with the AMS and DF if registered at those places. In a nutshell, if an agent derived from this class does not care about a particular FIPA ACL message, CFP, for example, the agent need do nothing as by default the message will be ignored. However, if a certain action needs to be done in response to a particular message, then the derived class will need to override the method that handles that particular message.

Version:
$Revision: 1.2 $, $Date: 2000/02/21 20:01:03 $
See Also:
Serialized Form

Field Summary
protected  FipaAmsAgentDescription myAmsAd
          An AMS Agent Description of this agent.
protected  FipaDfAgentDescription myDfAd
          An DF Agent Description of this agent.
protected  java.util.Vector myDfServices
          A list of FipaServiceDescription objects.
 
Fields inherited from class com.ibm.able.agents.AbleDefaultAgent
activeDataSource, agentAddr, agentHost, agentName, beans, effectors, eventConnections, numEpochs, processList, processListOK, sensors
 
Fields inherited from class com.ibm.able.AbleObject
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
FipaAgentDefaultAgent()
          Create a new FipaAgentDefaultAgent.
FipaAgentDefaultAgent(java.lang.String theName)
          Create a new FipaAgent and specify it's name.
FipaAgentDefaultAgent(java.lang.String theName, java.lang.String theComment)
          Create a new FipaAgent, specify it's name, and give it a comment.
 
Method Summary
static java.lang.String Copyright()
          Determine the copyright of this class.
 void deregisterWithAms()
          Deregister this agent with this platform's AMS.
 void deregisterWithDf()
          Deregister this agent with this platform's DF.
 void destroyAgent()
           
 void executeAgent()
           
 void invokeAgent()
           
static void main(java.lang.String[] args)
           
 void moveAgent()
           
 void msgAcceptProposal(FipaAclMessage theAclMessage)
           
 void msgAgree(FipaAclMessage theAclMessage)
           
 void msgCancel(FipaAclMessage theAclMessage)
           
 void msgCfp(FipaAclMessage theAclMessage)
           
 void msgConfirm(FipaAclMessage theAclMessage)
           
 void msgDisconfirm(FipaAclMessage theAclMessage)
           
 void msgFailure(FipaAclMessage theAclMessage)
           
 void msgInform(FipaAclMessage theAclMessage)
           
 void msgInformIf(FipaAclMessage theAclMessage)
           
 void msgInformRef(FipaAclMessage theAclMessage)
           
 void msgNotUnderstood(FipaAclMessage theAclMessage)
           
 void msgPropose(FipaAclMessage theAclMessage)
           
 void msgQueryIf(FipaAclMessage theAclMessage)
           
 void msgQueryRef(FipaAclMessage theAclMessage)
           
 void msgRefuse(FipaAclMessage theAclMessage)
           
 void msgRejectProposal(FipaAclMessage theAclMessage)
           
 void msgRequest(FipaAclMessage theAclMessage)
           
 void msgRequestWhen(FipaAclMessage theAclMessage)
           
 void msgRequestWhenever(FipaAclMessage theAclMessage)
           
 void msgSubscribe(FipaAclMessage theAclMessage)
           
 void quitAgent()
          Terminate this agent.
 FipaAmsAgent registerWithAms()
          Register this agent with this platform's AMS.
 FipaDfAgent registerWithDf()
          Register this agent with this platform's DF.
 void resumeAgent()
           
 void suspendAgent()
           
 java.lang.String toString()
          Retrieve a string describing (the contents of) the object.
 void waitAgent()
           
 void wakeUpAgent()
           
 
Methods inherited from class com.ibm.able.agents.AbleDefaultAgent
addBean, addEffector, addEventConnection, addSensor, buildProcessList, clsNm, containsBean, containsBean, debugTrace, getAgentAddr, getAgentHost, getAgentName, getBean, getBeans, getDataSource, getEffectors, getNumEpochs, getProcessList, getSensors, handleAbleEvent, init, init, invokeEffector, invokeSensor, isActiveDataSource, process, propertyChange, quitAll, quitEnabledEventProcessing, removeAllBeans, removeBean, removeEffector, removeEventConnection, removeSensor, reset, resumeAll, rmiRebind, rmiUnbind, setActiveDataSource, setEffectors, setProcessList, setSensors, suspendAll
 
Methods inherited from class com.ibm.able.AbleObject
addAbleEventListener, addDestBufferConnection, addPropertyChangeListener, addPropertyConnection, addSourceBufferConnection, addStateChangeListener, dataChanged, firePropertyChange, flushAbleEventQueue, getAbleEventListeners, getAbleEventProcessingEnabled, getAbleEventQueueSize, getBuffer, getBufferContents, getComment, getDestBufferConnections, getFileName, getInputBuffer, getInputBuffer, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, hasInputBuffer, hasOutputBuffer, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, processAbleEvent, processBufferConnections, processNoEventProcessingEnabledSituation, processTimerEvent, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllPropertyConnections, removeDestBufferConnection, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setDataFlowEnabled, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setSleepTime, setState, setTimerEventProcessingEnabled, sourceConnectionsOK, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

myAmsAd

protected FipaAmsAgentDescription myAmsAd
An AMS Agent Description of this agent. The description is usually initialised by the constructor of an implementing subclass, and certainly must be filled in prior to calling registerWithAms().

myDfAd

protected FipaDfAgentDescription myDfAd
An DF Agent Description of this agent. The description is usually initialised by the constructor of an implementing subclass, and certainly must be filled in prior to calling registerWithDf().

myDfServices

protected java.util.Vector myDfServices
A list of FipaServiceDescription objects. The list of services is usually initialised and set into the DF agent description object above by the constructor of an implementing subclass, and certainly must be filled in prior to calling registerWithDf().
Constructor Detail

FipaAgentDefaultAgent

public FipaAgentDefaultAgent()
                      throws java.rmi.RemoteException
Create a new FipaAgentDefaultAgent. This method that takes no parameters allows this class to be used by BeanBox-like construction tools. It simply sets the name of the agent to a system generated name.
Throws:
java.rmi.RemoteException - On any error.

FipaAgentDefaultAgent

public FipaAgentDefaultAgent(java.lang.String theName)
                      throws java.rmi.RemoteException
Create a new FipaAgent and specify it's name.
Parameters:
theName - A string containing the name of this new agent.

Throws:
java.rmi.RemoteException - On any error.

FipaAgentDefaultAgent

public FipaAgentDefaultAgent(java.lang.String theName,
                             java.lang.String theComment)
                      throws java.rmi.RemoteException
Create a new FipaAgent, specify it's name, and give it a comment.
Parameters:
theName - A string containing the name of this new agent.

theComment - A string containing a comment for this new agent.

Throws:
java.rmi.RemoteException - On any error.
Method Detail

invokeAgent

public void invokeAgent()
                 throws java.rmi.RemoteException
Specified by:
invokeAgent in interface FipaAgent

destroyAgent

public void destroyAgent()
                  throws java.rmi.RemoteException
Specified by:
destroyAgent in interface FipaAgent

quitAgent

public void quitAgent()
               throws java.rmi.RemoteException
Terminate this agent.
Specified by:
quitAgent in interface FipaAgent
Throws:
java.rmi.RemoteException - On any error.

suspendAgent

public void suspendAgent()
                  throws java.rmi.RemoteException
Specified by:
suspendAgent in interface FipaAgent

resumeAgent

public void resumeAgent()
                 throws java.rmi.RemoteException
Specified by:
resumeAgent in interface FipaAgent

waitAgent

public void waitAgent()
               throws java.rmi.RemoteException
Specified by:
waitAgent in interface FipaAgent

wakeUpAgent

public void wakeUpAgent()
                 throws java.rmi.RemoteException
Specified by:
wakeUpAgent in interface FipaAgent

moveAgent

public void moveAgent()
               throws java.rmi.RemoteException
Specified by:
moveAgent in interface FipaAgent

executeAgent

public void executeAgent()
                  throws java.rmi.RemoteException
Specified by:
executeAgent in interface FipaAgent

msgAcceptProposal

public void msgAcceptProposal(FipaAclMessage theAclMessage)
                       throws java.rmi.RemoteException
Specified by:
msgAcceptProposal in interface FipaAgent

msgAgree

public void msgAgree(FipaAclMessage theAclMessage)
              throws java.rmi.RemoteException
Specified by:
msgAgree in interface FipaAgent

msgCancel

public void msgCancel(FipaAclMessage theAclMessage)
               throws java.rmi.RemoteException
Specified by:
msgCancel in interface FipaAgent

msgCfp

public void msgCfp(FipaAclMessage theAclMessage)
            throws java.rmi.RemoteException
Specified by:
msgCfp in interface FipaAgent

msgConfirm

public void msgConfirm(FipaAclMessage theAclMessage)
                throws java.rmi.RemoteException
Specified by:
msgConfirm in interface FipaAgent

msgDisconfirm

public void msgDisconfirm(FipaAclMessage theAclMessage)
                   throws java.rmi.RemoteException
Specified by:
msgDisconfirm in interface FipaAgent

msgFailure

public void msgFailure(FipaAclMessage theAclMessage)
                throws java.rmi.RemoteException
Specified by:
msgFailure in interface FipaAgent

msgInform

public void msgInform(FipaAclMessage theAclMessage)
               throws java.rmi.RemoteException
Specified by:
msgInform in interface FipaAgent

msgInformIf

public void msgInformIf(FipaAclMessage theAclMessage)
                 throws java.rmi.RemoteException
Specified by:
msgInformIf in interface FipaAgent

msgInformRef

public void msgInformRef(FipaAclMessage theAclMessage)
                  throws java.rmi.RemoteException
Specified by:
msgInformRef in interface FipaAgent

msgNotUnderstood

public void msgNotUnderstood(FipaAclMessage theAclMessage)
                      throws java.rmi.RemoteException
Specified by:
msgNotUnderstood in interface FipaAgent

msgPropose

public void msgPropose(FipaAclMessage theAclMessage)
                throws java.rmi.RemoteException
Specified by:
msgPropose in interface FipaAgent

msgQueryIf

public void msgQueryIf(FipaAclMessage theAclMessage)
                throws java.rmi.RemoteException
Specified by:
msgQueryIf in interface FipaAgent

msgQueryRef

public void msgQueryRef(FipaAclMessage theAclMessage)
                 throws java.rmi.RemoteException
Specified by:
msgQueryRef in interface FipaAgent

msgRefuse

public void msgRefuse(FipaAclMessage theAclMessage)
               throws java.rmi.RemoteException
Specified by:
msgRefuse in interface FipaAgent

msgRejectProposal

public void msgRejectProposal(FipaAclMessage theAclMessage)
                       throws java.rmi.RemoteException
Specified by:
msgRejectProposal in interface FipaAgent

msgRequest

public void msgRequest(FipaAclMessage theAclMessage)
                throws java.rmi.RemoteException
Specified by:
msgRequest in interface FipaAgent

msgRequestWhen

public void msgRequestWhen(FipaAclMessage theAclMessage)
                    throws java.rmi.RemoteException
Specified by:
msgRequestWhen in interface FipaAgent

msgRequestWhenever

public void msgRequestWhenever(FipaAclMessage theAclMessage)
                        throws java.rmi.RemoteException
Specified by:
msgRequestWhenever in interface FipaAgent

msgSubscribe

public void msgSubscribe(FipaAclMessage theAclMessage)
                  throws java.rmi.RemoteException
Specified by:
msgSubscribe in interface FipaAgent

registerWithAms

public FipaAmsAgent registerWithAms()
                             throws java.rmi.RemoteException
Register this agent with this platform's AMS.

Note that someone must fill in the AMS Agent Description before this method is called!


deregisterWithAms

public void deregisterWithAms()
                       throws java.rmi.RemoteException
Deregister this agent with this platform's AMS.

It is safe to call this method even if the agent has never registered with the AMS -- no action will be taken.


registerWithDf

public FipaDfAgent registerWithDf()
                           throws java.rmi.RemoteException
Register this agent with this platform's DF.

Note that someone must fill in the DF Agent Description before this method is called!


deregisterWithDf

public void deregisterWithDf()
                      throws java.rmi.RemoteException
Deregister this agent with this platform's DF.

It is safe to call this method even if the agent has never registered with the DF -- no action will be taken.


main

public static void main(java.lang.String[] args)
                 throws java.rmi.RemoteException

toString

public java.lang.String toString()
Retrieve a string describing (the contents of) the object.
Returns:
A String containing the current contents of the object.
Overrides:
toString in class AbleDefaultAgent

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright statement.

ABLE, Version 1.1b

ABLE: Produced by Joe, Don, and Jeff who say, 'Thanks for your support.'