unsw.cse.mica.agent
Interface MessageHandler

All Known Subinterfaces:
Agent
All Known Implementing Classes:
AbstractAgentProtocol, Debugger, DefaultAgent, DefaultAgent2, GUIAgent, LocalAgentTransport, LogDebugger, MobMaker, MobMaker2, MobSpawner, ProxyAgent, QueuedMessageHandler, SecureXMLAgentProtocol, SynchronizedTransport, TimerAgent, XMLAgentProtocol

public interface MessageHandler

A message handler is an object that can handle messages that are sent from the Blackboard to an Agent. This interface exists separately from the Agent interface as part of the infrastructure for Transports. In general, however, the only point where it is of interest is for the Agent interface which extends this interface.

Author:
jhw

Method Summary
 void handleDeletedMob(Mob mob)
          This method is called whenever a non-transient MICA object is deleted from the blackboard that the agent has registered interest it.
 void handleNewMob(Mob mob)
          This method is called when a new MICA object has arrived.
 void handleReplacedMob(Mob oldMob, Mob newMob)
          This method is called whenever a mob is replaced on the blackboard with a type for which the agent has registered interest.
 void handleTypeManagerChanged()
          Called by the AgentTransport whenever the blackboard's type manager has changed.
 

Method Detail

handleNewMob

void handleNewMob(Mob mob)
This method is called when a new MICA object has arrived.

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.

Parameters:
mob - the mob that has been written to the blackboard

handleDeletedMob

void handleDeletedMob(Mob mob)
This method is called whenever a non-transient MICA object is deleted from the blackboard that the agent has registered interest it.

Whenever a mob is deleted from the blackboard that the agent has registered an interest in the handleDeletedMob method is called.

Parameters:
mob - the mob that has been deleted

handleReplacedMob

void handleReplacedMob(Mob oldMob,
                       Mob newMob)
This method is called whenever a mob is replaced on the blackboard with a type for which the agent has registered interest.

Parameters:
oldMob - the old value of the mob (where the name is cleared)
newMob - the new value of the mob

handleTypeManagerChanged

void handleTypeManagerChanged()
Called by the AgentTransport whenever the blackboard's type manager has changed. If the agent does not need type information, this method can simply be implemented as an empty function. If the agent requires an up-to-date type manager, the use of a RemoteTypeManager is suggested.