|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunsw.cse.mica.agent.LocalAgentTransport
public class LocalAgentTransport
The local agent transport is used to communicate between agents that run within the same JVM. For now, it should be considered a little under-tested; the XMLNetAgentTransport is far more thoroughly tested.
Constructor Summary | |
---|---|
LocalAgentTransport(Agent agent,
LocalBBTransport trans)
This creates an Agent transport. |
Method Summary | |
---|---|
java.lang.String |
connect(java.lang.String agentName)
Connect to the blackboard. |
void |
deleteMob(java.lang.String mobName)
Delete a mob from the blackboard. |
void |
disconnect()
Disconnect from the Blackboard |
java.lang.String |
getAgentName()
Get the name that was provided for this agent at connection. |
TypeManager |
getTypeManager()
Request a Mob TypeManager. |
void |
handleDeletedMob(Mob m)
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 m)
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. |
boolean |
isConnected()
Check whether the transport is connected to the blackboard or not. |
java.util.List |
mobSearch(java.lang.String prologQuery)
Finds all mobs meeting the criteria. |
Mob |
readMob(java.lang.String mobName)
Retrieve a mob by its name. |
void |
register(java.lang.String mobType)
Allows the agent to register for events of a particular mobType. |
void |
replaceMob(Mob mob)
Replace a mob on the blackboard. |
void |
setMessageHandler(MessageHandler handler)
Tell the transport to use a new message handler. |
void |
unregister(java.lang.String mobType)
Inform the blackboard that we are no longer interested in a particular type. |
java.lang.String |
writeMob(Mob mob)
Write a mob to the blackboard. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocalAgentTransport(Agent agent, LocalBBTransport trans)
Method Detail |
---|
public void setMessageHandler(MessageHandler handler)
AgentTransport
setMessageHandler
in interface AgentTransport
handler
- the new message handler for the transportpublic TypeManager getTypeManager()
AgentActions
getTypeManager
in interface AgentActions
public 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)
MessageHandler
Whenever a mob is deleted from the blackboard that the agent has registered an interest in
the handleDeletedMob
method is called.
handleDeletedMob
in interface MessageHandler
m
- the mob that has been deletedpublic void handleReplacedMob(Mob oldMob, Mob newMob)
MessageHandler
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()
MessageHandler
handleTypeManagerChanged
in interface MessageHandler
public void deleteMob(java.lang.String mobName)
AgentActions
deleteMob
in interface AgentActions
mobName
- the name of the mob to deletepublic Mob readMob(java.lang.String mobName)
AgentActions
readMob
in interface AgentActions
mobName
- the nae of the mob to be read
public java.lang.String writeMob(Mob mob)
AgentActions
writeMob
in interface AgentActions
mob
- the mob to be written
public void replaceMob(Mob mob)
AgentActions
replaceMob
in interface AgentActions
mob
- the mob to be written. The mob's name must be specified and indicates the name
of the mob that will be replaced. The mob's type is ignored as the previous type will be carried over.public java.util.List mobSearch(java.lang.String prologQuery)
AgentActions
mobSearch
in interface AgentActions
prologQuery
-
public java.lang.String connect(java.lang.String agentName)
AgentActions
connect
in interface AgentActions
agentName
- The agent name proposed by the agent.
AgentActions.connect(java.lang.String)
public boolean isConnected()
AgentTransport
isConnected
in interface AgentTransport
public java.lang.String getAgentName()
AgentTransport
getAgentName
in interface AgentTransport
public void disconnect()
AgentActions
disconnect
in interface AgentActions
AgentActions.disconnect()
public void register(java.lang.String mobType)
AgentActions
Registration tells the blackboard that the agent is interested in mobs of a particular type.
If the securirty policy allows, the agent will be informed when mobs of this type are written
to the blackboard (via its handleNewMob
method) or when mobs of this type are
deleted from the blackboard (via its handleDeletedMob
method).
register
in interface AgentActions
mobType
- The type we are interested inAgentActions.register(java.lang.String)
public void unregister(java.lang.String mobType)
AgentActions
unregister
in interface AgentActions
mobType
- The type that the agent is no longer interested in hearing about.AgentActions.unregister(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |