|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectunsw.cse.mica.agent.DefaultAgent
unsw.cse.mica.tools.proxy.ProxyAgent
public class ProxyAgent
A ProxyAgent handles the reading and writing of Proxy objects to and from a server.
| Constructor Summary | |
|---|---|
ProxyAgent()
|
|
| Method Summary | |
|---|---|
void |
add(ProxySet set)
Add a new proxy set for this ProxyAgent to manage communications for. |
boolean |
delete(Proxy proxy)
Remove the Mob corresponding to the given Proxy object from the Swarm server. |
java.util.List |
getMobs(java.lang.String type)
Return a List of Mobs on te server with the given type. |
void |
handleDeletedMob(Mob m)
Deleted Mobs are turned into Proxy objects and removed from the ProxySet associated with the Mob's type. |
void |
handleNewMob(Mob m)
A ProxyAgent handles new mobs by testing their type and adding a new Proxy object for that Mob to the ProxySet corresponding to the type. |
void |
handleTypeManagerChanged()
The default implementation of handleTypeManagerChanged() does nothing. |
void |
init(MicaProperties args)
Start the agent. |
boolean |
write(Proxy proxy)
Writes the given Proxy object to the server as a Mob, updating the Proxy object's MobId field accordingly. |
| Methods inherited from class unsw.cse.mica.agent.DefaultAgent |
|---|
getTransport, handleReplacedMob, setTransport, terminate |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProxyAgent()
| Method Detail |
|---|
public void init(MicaProperties args)
AgentThis 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"))
init in interface Agentinit in class DefaultAgent
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.
public void add(ProxySet set)
throws MicaException
set - A new ProxySet that this ProxyAgent will handle.
MicaException
public boolean write(Proxy proxy)
throws MicaException
proxy - The proxy whose Mob should be written to the server
true iff the Proxy was successfully written.
MicaExceptionpublic boolean delete(Proxy proxy)
proxy - The Proxy object whose Mob representation on the server is to
be deleted.
true if the Mob was successfully removed.
public java.util.List getMobs(java.lang.String type)
throws MicaException
type - The type of mobs to return
MicaExceptionpublic void handleNewMob(Mob m)
handleNewMob in interface MessageHandlerhandleNewMob in class DefaultAgentm - the mob that has been written to the blackboardDefaultAgent.handleNewMob(unsw.cse.mica.data.Mob)public void handleDeletedMob(Mob m)
handleDeletedMob in interface MessageHandlerhandleDeletedMob in class DefaultAgentm - the mob that has been deletedpublic void handleTypeManagerChanged()
DefaultAgenthandleTypeManagerChanged() does nothing.
handleTypeManagerChanged in interface MessageHandlerhandleTypeManagerChanged in class DefaultAgent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||