|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.lifl.magique.platform.Platform
A platform is used to gather and manage all the agents on a given host. Communications between remote agents is achieved using a communication layer between platform through RMI. When 2 remote agents try to communicate, the "connection" between their platform is automatically performed. Registry is automatically launched and port 4444 is the default registry port. Agent must be added to the platform using addAgent
| Field Summary | |
static int |
DEFAULT_PORT
|
static java.lang.String |
PLATFORMMAGIQUEAGENTNAME
|
| Constructor Summary | |
Platform()
default port (4444) is used |
|
Platform(int port)
|
|
Platform(java.lang.Integer port)
|
|
| Method Summary | |
void |
addAgent(AtomicAgent agent)
the given agent is added to the platform |
void |
connect(java.lang.String platformName)
perform a connection (via rmi) to the given platform |
Agent |
createAgent(java.lang.String agentName)
dynamically creates a magique agent (class fr.lifl.magique.Agent). |
AtomicAgent |
createAgent(java.lang.String agentClassName,
java.lang.String agentName)
dynamically creates an agent from its class an name. |
AtomicAgent |
createAgent(java.lang.String agentClassName,
java.lang.String agentName,
java.lang.Object[] args)
dynamically creates an agent from its class an name. |
void |
disconnectFrom(java.lang.String platformName)
disconnects from a given plaform |
void |
disconnectFromAll()
disconnect from all otherplatfroms this platform is connected to |
MessageList |
getMessages()
returns my message list |
java.util.Hashtable |
getMyAgents()
returns the hashtable of the agents active in the platform, it associates an agent name with the corresponding Agent object |
java.lang.String |
getName()
returns the name of the platform (of the form hostIpAddredd:port) |
java.util.Hashtable |
getPlatformAgenda()
returns the agenda of the platform, agenda associates a platform name name with the corresponding Communicate rmi interface implementation |
int |
getPort()
returns the port of the server of the platform |
PlatformServer |
getServer()
returns the RMI server asociated with this platform |
void |
haveAMessage(Message msg)
used when a message is sent by anther platform |
java.lang.Boolean |
ping(java.lang.String platformName)
test if the platform hostname is alive |
void |
removeAgent(java.lang.String agentName)
given agent is removed from platform |
void |
sendMessage(java.lang.String to,
Message msg)
|
void |
stop()
stops the platform by killing all agents located on it and stopping it. |
void |
treatMessage(PlatformMessage msg)
given message is treated : send to the recipient agent if he belongs to this platform, or send (after connection if required) to the platform who contains the recipient |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String PLATFORMMAGIQUEAGENTNAME
public static final int DEFAULT_PORT
| Constructor Detail |
public Platform()
public Platform(int port)
port - the port for the server associated with this platformpublic Platform(java.lang.Integer port)
port - the port for the server associated with this platform| Method Detail |
public java.util.Hashtable getPlatformAgenda()
Communicatepublic java.lang.String getName()
public int getPort()
public PlatformServer getServer()
public java.util.Hashtable getMyAgents()
Agentpublic MessageList getMessages()
public void addAgent(AtomicAgent agent)
throws AlreadyExistingAgentException
agent - the agent to be added
AlreadyExistingAgentException
public Agent createAgent(java.lang.String agentName)
throws AlreadyExistingAgentException
agentName - the name of the created agent
AlreadyExistingAgentException
public AtomicAgent createAgent(java.lang.String agentClassName,
java.lang.String agentName)
throws AlreadyExistingAgentException
agentClassName - the class of the to be created agentagentName - the name of the crated agent
AlreadyExistingAgentException
public AtomicAgent createAgent(java.lang.String agentClassName,
java.lang.String agentName,
java.lang.Object[] args)
throws AlreadyExistingAgentException
agentClassName - the class of the to be created agentagentName - the name of the crated agentargs - the arguments for the constructor of the agent
AlreadyExistingAgentExceptionpublic void removeAgent(java.lang.String agentName)
agentName - the name of the agent to be removedpublic void treatMessage(PlatformMessage msg)
msg - the msg to be treatedpublic void haveAMessage(Message msg)
msg - the sent message
public void sendMessage(java.lang.String to,
Message msg)
public void connect(java.lang.String platformName)
platformName - the platform to connect topublic void disconnectFromAll()
public void disconnectFrom(java.lang.String platformName)
platformName - the platform to disconnect frompublic void stop()
public java.lang.Boolean ping(java.lang.String platformName)
platformName - the platform to test
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||