public class SlaveContainer extends Container
Constructor and Description |
---|
SlaveContainer(Platform platform,
java.lang.String hostname,
int port)
Creates a slave container connecting over a TCP socket.
|
SlaveContainer(Platform platform,
java.lang.String devname,
int baud,
java.lang.String settings)
Creates a slave container connecting over a RS232 port.
|
SlaveContainer(Platform platform,
java.lang.String name,
java.lang.String hostname,
int port)
Creates a named slave container connecting over a TCP socket.
|
SlaveContainer(Platform platform,
java.lang.String name,
java.lang.String devname,
int baud,
java.lang.String settings)
Creates a named slave container connecting over a RS232 port.
|
Modifier and Type | Method and Description |
---|---|
AgentID |
add(java.lang.String name,
Agent agent)
Adds an agent to the container.
|
AgentID |
agentForService(java.lang.String service)
Finds an agent providing a named service.
|
AgentID[] |
agentsForService(java.lang.String service)
Finds all agents providing a named service.
|
boolean |
authenticate(java.lang.String creds)
Authenticate to master container.
|
void |
checkAuthFailure(java.lang.String id)
Checks for authentication failure on send.
|
void |
connectionClosed(org.arl.fjage.remote.ConnectionHandler handler)
Callback for closure of connection to remote container.
|
AgentID[] |
getAgents()
Gets all agent ids in the container.
|
java.lang.String[] |
getServices()
Gets a list of all services that agents in this container provide.
|
java.lang.String |
getState()
Gets human readble state information for container.
|
protected void |
initComplete()
Called when the container is initialized.
|
protected boolean |
isDuplicate(AgentID aid)
Checks if an agent id already exists in the container.
|
boolean |
kill(AgentID aid)
Terminates an agent.
|
boolean |
send(Message m)
Sends a message.
|
boolean |
send(Message m,
boolean relay)
Sends a message.
|
void |
shutdown()
Terminates the container and all agents in it.
|
protected void |
start()
Starts the container and all agents in it.
|
boolean |
subscribe(AgentID aid,
AgentID topic)
Subscribes an agent to messages sent to a topic.
|
java.lang.String |
toString()
Gets a string representation of the container.
|
void |
unsubscribe(AgentID aid)
Unsubscribes an agent from all topics.
|
boolean |
unsubscribe(AgentID aid,
AgentID topic)
Unsubscribes an agent from a topic.
|
add, addListener, canLocateAgent, clone, containsAgent, deregister, deregister, getAgent, getAutoClone, getName, getPlatform, isIdle, isRunning, kill, register, removeListener, setAutoClone, setCloner, setName
public SlaveContainer(Platform platform, java.lang.String hostname, int port) throws java.io.IOException
platform
- platform on which the container runs.hostname
- hostname of the master container.port
- port on which the master container's TCP server runs.java.io.IOException
public SlaveContainer(Platform platform, java.lang.String name, java.lang.String hostname, int port) throws java.io.IOException
platform
- platform on which the container runs.name
- name of the container.hostname
- hostname of the master container.port
- port on which the master container's TCP server runs.java.io.IOException
public SlaveContainer(Platform platform, java.lang.String devname, int baud, java.lang.String settings) throws java.io.IOException
platform
- platform on which the container runs.devname
- device name of the RS232 port.baud
- baud rate for the RS232 port.settings
- RS232 settings (null for defaults, or "N81" for no parity, 8 bits, 1 stop bit).java.io.IOException
public SlaveContainer(Platform platform, java.lang.String name, java.lang.String devname, int baud, java.lang.String settings) throws java.io.IOException
platform
- platform on which the container runs.name
- name of the container.devname
- device name of the RS232 port.baud
- baud rate for the RS232 port.settings
- RS232 settings (null for defaults, or "N81" for no parity, 8 bits, 1 stop bit).java.io.IOException
public boolean authenticate(java.lang.String creds)
creds
- credentials to authenticate with.public void checkAuthFailure(java.lang.String id)
INTERNAL USE ONLY.
protected boolean isDuplicate(AgentID aid)
Container
isDuplicate
in class Container
aid
- the agent id to check.public boolean send(Message m)
Container
public boolean send(Message m, boolean relay)
Container
public AgentID[] getAgents()
Container
public java.lang.String[] getServices()
Container
getServices
in class Container
public AgentID agentForService(java.lang.String service)
Container
agentForService
in class Container
service
- name of the service.public AgentID[] agentsForService(java.lang.String service)
Container
agentsForService
in class Container
service
- name of the service.protected void initComplete()
Container
initComplete
in class Container
public void shutdown()
Container
public java.lang.String getState()
Container
public java.lang.String toString()
Container
public void connectionClosed(org.arl.fjage.remote.ConnectionHandler handler)
handler
- indicates the connection that is closed.public AgentID add(java.lang.String name, Agent agent)
Container
protected void start()
Container
public boolean subscribe(AgentID aid, AgentID topic)
Container
public boolean unsubscribe(AgentID aid, AgentID topic)
Container
unsubscribe
in class Container
aid
- id of agent to unsubscribe.topic
- topic to unsubscribe from.public void unsubscribe(AgentID aid)
Container
unsubscribe
in class Container
aid
- id of agent to unsubscribe.