|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectunsw.cse.mica.agent.XMLOverTCPAgentTransport
public class XMLOverTCPAgentTransport
This class encapsulates an XML protocol running over a TCP connection. At present this is the only available protocol and connection; this class provides a simple way of creating and using this transport setup. All of the methods simply delegate to an internal transport objects.
| Constructor Summary | |
|---|---|
XMLOverTCPAgentTransport(Agent agent,
java.lang.String host,
int port)
Create a new XML over TCP transport which will connect to a blackboard on the given host and port. |
|
| 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. |
java.lang.String |
getHost()
|
int |
getPort()
|
TypeManager |
getTypeManager()
Request a Mob TypeManager. |
boolean |
isConnected()
Check whether the transport is connected to the blackboard or not. |
java.util.List |
mobSearch(java.lang.String micaQuery)
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 XMLOverTCPAgentTransport(Agent agent,
java.lang.String host,
int port)
agent - the agent that this transport is forhost - the machine on which the blackboard is runningport - the TCP port number on which the blackboard is listening.| Method Detail |
|---|
public java.lang.String getAgentName()
AgentTransport
getAgentName in interface AgentTransportpublic java.lang.String getHost()
public int getPort()
public boolean isConnected()
AgentTransport
isConnected in interface AgentTransport
public java.lang.String connect(java.lang.String agentName)
throws TransportException
AgentActions
connect in interface AgentActionsagentName - The agent name proposed by the agent.
TransportException
public void deleteMob(java.lang.String mobName)
throws TransportException,
ActionException
AgentActions
deleteMob in interface AgentActionsmobName - the name of the mob to remove.
TransportException - if the agent was not connected
ActionException - if the requested mob doesn't exist
public void disconnect()
throws TransportException
AgentActions
disconnect in interface AgentActionsTransportException
public TypeManager getTypeManager()
throws TransportException
AgentActions
getTypeManager in interface AgentActionsTransportException - if the agent was not connected
public java.util.List mobSearch(java.lang.String micaQuery)
throws TransportException,
ActionException
AgentActions
mobSearch in interface AgentActionsmicaQuery - A query in the MicaQL query language.
TransportException - if the agent was not connected
ActionException - if the query was invalid
public Mob readMob(java.lang.String mobName)
throws TransportException,
ActionException
AgentActions
readMob in interface AgentActionsmobName - the name of the Mob to retrieve.
TransportException - if the agent was not connected
ActionException - if the requested mob doesn't exist
public void register(java.lang.String mobType)
throws TransportException,
ActionException
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 AgentActionsmobType - The type we are interested in
TransportException - if the agent was not connected
ActionException - if the requested type is not known.
public void unregister(java.lang.String mobType)
throws TransportException,
ActionException
AgentActions
unregister in interface AgentActionsmobType - The type that the agent is no longer interested in hearing about.
TransportException - if the agent was not connected
ActionException - if the agent was not connected or if the requested type is not known.
public java.lang.String writeMob(Mob mob)
throws TransportException
AgentActions
writeMob in interface AgentActionsTransportException - if the agent was not connected
public void replaceMob(Mob mob)
throws TransportException,
ActionException
AgentActions
replaceMob in interface AgentActionsmob - 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.
TransportException - if the agent was not connected
ActionException - if no mob existed with the given namepublic void setMessageHandler(MessageHandler handler)
AgentTransport
setMessageHandler in interface AgentTransporthandler - the new message handler for the transport
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||