Package jade.tools
Class ToolAgent
- java.lang.Object
-
- jade.core.Agent
-
- jade.tools.ToolAgent
-
- All Implemented Interfaces:
TimerListener,Serializable,Serializable,Runnable
- Direct Known Subclasses:
Introspector,rma,Sniffer,ToolNotifier
public abstract class ToolAgent extends Agent
This abstract class is the common ancestor of all JADE tools (RMA, Sniffer, Introspector, etc.). It provides suitable behaviours to interact with the AMS, registering for interesting events and requesting actions when needed.- Version:
- $Date$ $Revision$
- Author:
- Giovanni Rimassa - Universita' di Parma
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classToolAgent.AMSListenerBehaviourThis abstract behaviour is used to receive notifications from the AMS.static interfaceToolAgent.EventHandler-
Nested classes/interfaces inherited from class jade.core.Agent
Agent.Interrupted
-
-
Field Summary
Fields Modifier and Type Field Description protected Loggerlogger-
Fields inherited from class jade.core.Agent
AP_ACTIVE, AP_DELETED, AP_IDLE, AP_INITIATED, AP_MAX, AP_MIN, AP_SUSPENDED, AP_WAITING, D_ACTIVE, D_MAX, D_MIN, D_RETIRED, D_SUSPENDED, D_UNKNOWN, MSG_QUEUE_CLASS
-
-
Constructor Summary
Constructors Constructor Description ToolAgent()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterClone()Actions to perform after cloning.protected voidafterLoad()protected voidafterMove()Actions to perform after moving.protected voidafterReload()protected voidafterThaw()protected voidbeforeFreeze()protected voidbeforeMove()This empty placeholder shall be overridden by user defined agents to execute some actions before the original agent instance on the source container is stopped (e.g.protected voidbeforeReload()protected voidbeforeSave()protected ACLMessagegetCancel()Retrieve thecancelACL message with which this tool agent removes its subscription with the AMS.protected ACLMessagegetRequest()Retrieve therequestACL message with which this tool agent requests the AMS tool-specific actions.protected ACLMessagegetSubscribe()Retrieve thesubscribeACL message with which this tool agent subscribed with the AMS.voidsetup()This protected method is an empty placeholder for application specific startup code.protected voidtakeDown()This protected method is an empty placeholder for application specific cleanup code.protected voidtoolSetup()This method is invoked just after the generic agent setup.protected voidtoolTakeDown()This method is invoked just before the generic agent takedown.-
Methods inherited from class jade.core.Agent
addBehaviour, beforeClone, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, createMessageQueue, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAID, getAMS, getArguments, getBehavioursCnt, getBootProperties, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getExecutedBehavioursCnt, getGenerateBehaviourEvents, getGenerateMessageEvents, getHap, getHelper, getLocalName, getName, getO2AInterface, getO2AObject, getPostedMessagesCnt, getProperty, getQueueSize, getReceivedMessagesCnt, getSentMessagesCnt, getState, here, isAlive, isRestarting, join, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, receive, registerO2AInterface, removeBehaviour, removeTimer, restartLater, restoreBufferedState, restoreFields, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setGenerateMessageEvents, setO2AManager, setQueueSize, waitUntilStarted, write
-
-
-
-
Field Detail
-
logger
protected transient Logger logger
-
-
Method Detail
-
toolSetup
protected void toolSetup()
This method is invoked just after the generic agent setup. Subclasses must use this method the same way ordinary agents use theirsetup()method.
-
toolTakeDown
protected void toolTakeDown()
This method is invoked just before the generic agent takedown. Subclasses must use this method the same way ordinary agents use theirtakeDown()method.
-
getSubscribe
protected ACLMessage getSubscribe()
Retrieve thesubscribeACL message with which this tool agent subscribed with the AMS.- Returns:
- The subscription ACL message.
-
getCancel
protected ACLMessage getCancel()
Retrieve thecancelACL message with which this tool agent removes its subscription with the AMS.- Returns:
- The cancellation ACL message.
-
getRequest
protected ACLMessage getRequest()
Retrieve therequestACL message with which this tool agent requests the AMS tool-specific actions.- Returns:
- The request ACL message.
-
setup
public final void setup()
Description copied from class:AgentThis protected method is an empty placeholder for application specific startup code. Agent developers can override it to provide necessary behaviour. When this method is called the agent has been already registered with the Agent Platform AMS and is able to send and receive messages. However, the agent execution model is still sequential and no behaviour scheduling is active yet. This method can be used for ordinary startup tasks such as DF registration, but is essential to add at least aBehaviourobject to the agent, in order for it to be able to do anything.- Overrides:
setupin classAgent- See Also:
Agent.addBehaviour(Behaviour b),Behaviour
-
takeDown
protected final void takeDown()
Description copied from class:AgentThis protected method is an empty placeholder for application specific cleanup code. Agent developers can override it to provide necessary behaviour. When this method is called the agent has not deregistered itself with the Agent Platform AMS and is still able to exchange messages with other agents. However, no behaviour scheduling is active anymore and the Agent Platform Life Cycle state is already set to deleted. This method can be used for ordinary cleanup tasks such as DF deregistration, but explicit removal of all agent behaviours is not needed.
-
afterClone
protected void afterClone()
Description copied from class:AgentActions to perform after cloning. This empty placeholder method can be overridden by user defined agents to execute some actions just after creating an agent copy to the destination agent container.
NOT available in MIDP- Overrides:
afterClonein classAgent
-
beforeMove
protected void beforeMove()
Description copied from class:AgentThis empty placeholder shall be overridden by user defined agents to execute some actions before the original agent instance on the source container is stopped (e.g. releasing local resources such as a GUI).
IMPORTANT: At this point, it is ensured that the move process is successful and that a moved agent instance has been created on the destination container Therefore setting the value of a class field in this method will have no impact on the moved agent instance. Such parameters must indeed be set before thedoMove()method is called.
NOT available in MIDP- Overrides:
beforeMovein classAgent
-
afterMove
protected void afterMove()
Description copied from class:AgentActions to perform after moving. This empty placeholder method can be overridden by user defined agents to execute some actions just after arriving to the destination agent container for a migration.
NOT available in MIDP
-
afterLoad
protected void afterLoad()
-
afterThaw
protected void afterThaw()
-
afterReload
protected void afterReload()
-
beforeSave
protected void beforeSave()
-
beforeFreeze
protected void beforeFreeze()
-
beforeReload
protected void beforeReload()
-
-