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(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, setNamepublic SlaveContainer(Platform platform, java.lang.String hostname, int port)
platform - platform on which the container runs.hostname - hostname of the master container.port - port on which the master container's TCP server runs.public SlaveContainer(Platform platform, java.lang.String name, java.lang.String hostname, int port)
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.public SlaveContainer(Platform platform, java.lang.String devname, int baud, java.lang.String settings)
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).public SlaveContainer(Platform platform, java.lang.String name, java.lang.String devname, int baud, java.lang.String settings)
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).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)
ContainerisDuplicate in class Containeraid - the agent id to check.public boolean send(Message m)
Containerpublic boolean send(Message m, boolean relay)
Containerpublic AgentID[] getAgents()
Containerpublic java.lang.String[] getServices()
ContainergetServices in class Containerpublic AgentID agentForService(java.lang.String service)
ContaineragentForService in class Containerservice - name of the service.public AgentID[] agentsForService(java.lang.String service)
ContaineragentsForService in class Containerservice - name of the service.protected void initComplete()
ContainerinitComplete in class Containerpublic void shutdown()
Containerpublic java.lang.String getState()
Containerpublic java.lang.String toString()
Containerpublic void connectionClosed(ConnectionHandler handler)
handler - indicates the connection that is closed.public AgentID add(java.lang.String name, Agent agent)
ContainerAgent names should only contain alphanumeric characters and underscores. The first character should not be a digit. Names with special characters such as '-', '.', '@', etc are considered reserved and should be avoided.
While agent names inconsistent with this guideline may not be rejected today, they may not work well on all platforms. In future, we may enforce this guideline more strictly.
protected void start()
Containerpublic boolean subscribe(AgentID aid, AgentID topic)
Containerpublic boolean unsubscribe(AgentID aid, AgentID topic)
Containerunsubscribe in class Containeraid - id of agent to unsubscribe.topic - topic to unsubscribe from.public void unsubscribe(AgentID aid)
Containerunsubscribe in class Containeraid - id of agent to unsubscribe.