|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunsw.cse.mica.agent.DefaultAgent
public abstract class DefaultAgent
The Default Agent is a utility class that inherits from the Agent class. It has implementations of the setTransport() and getTransport() methods, which are a reasonable default.
Generally, it is better to subclass DefaultAgent for most applications than to implement Agent. In future, more utility features are likely to be added to DefaultAgent.
Constructor Summary | |
---|---|
DefaultAgent()
|
Method Summary | |
---|---|
AgentTransport |
getTransport()
Get the current agent transport. |
void |
handleDeletedMob(Mob m)
The default implementation of handleDeletedMob() does nothing. |
abstract void |
handleNewMob(Mob m)
This method is called when a new MICA object has arrived. |
void |
handleReplacedMob(Mob oldMob,
Mob newMob)
The default implementation of handleReplacedMob() does nothing. |
void |
handleTypeManagerChanged()
The default implementation of handleTypeManagerChanged() does nothing. |
abstract void |
init(MicaProperties args)
Start the agent. |
void |
setTransport(AgentTransport at)
Set the agent transport. |
void |
terminate()
The default implementation of terminate() does nothing. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultAgent()
Method Detail |
---|
public void setTransport(AgentTransport at)
setTransport
in interface Agent
at
- The agent transport.public AgentTransport getTransport()
getTransport
in interface Agent
public abstract void init(MicaProperties args) throws MicaException
Agent
This signals to the agent that it should start.
Note: This function should not block -- it should return in a relatively short period of time, so that other parts of the Agent startup program can continue. If necessary, start your own thread to do your bidding.
It is safe to assume that by the time init()
is called,
setTransport()
has been called.
The usual contents of an
init()
method would be:
at.connect("ThisAgent")
)
at.register("text")
)
args
- Additional arguments provided to the agent. If the agent is started from with
the 'Runner' tool, the args array contains the values provided from within the runner's
XML configuration file. Otherwise, the exact contents will depend on the calling method.
MicaException
public void terminate() throws MicaException
terminate()
does nothing.
terminate
in interface Agent
MicaException
public abstract void handleNewMob(Mob m)
MessageHandler
Whenever a mob is written to the blackboard that the agent has registered
an interest in the handleNewMob
is called. It is passed the new Mob (MICA object)
as a parameter so it can decide any further actions.
Note: The handleNewMob is called asynchronously. You should not make any assumptions about its synchronizations.
handleNewMob
in interface MessageHandler
m
- the mob that has been written to the blackboardpublic void handleDeletedMob(Mob m)
handleDeletedMob()
does nothing.
handleDeletedMob
in interface MessageHandler
m
- the mob that has been deletedpublic void handleReplacedMob(Mob oldMob, Mob newMob)
handleReplacedMob()
does nothing.
handleReplacedMob
in interface MessageHandler
oldMob
- the old value of the mob (where the name is cleared)newMob
- the new value of the mobpublic void handleTypeManagerChanged()
handleTypeManagerChanged()
does nothing.
handleTypeManagerChanged
in interface MessageHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |