| org.cougaar.core.plugin.ComponentPlugin org.cougaar.core.mobility.plugin.SpawnAgents
SpawnAgents | public class SpawnAgents extends ComponentPlugin (Code) | | This plugin adds agents to the local or remote nodes, as specified by
its plugin parameter list.
This is really just a souped-up version of the
AddAgentExamplePlugin .
Each plugin parameter is a "key=value" pair, where the default key
is "agent". The keys are:
- loopback=true
-
If the target is the local node and this plugin is loaded in the
node agent, then use the local node's "addAgent" method instead of
a mobility blackboard relay. This avoids the mobility domain if
all agents are local.
- parallel
-
Spawn agents in parallel, instead of waiting for each add to
complete before adding the next agent.
- agent
-
An add-agent command, see
SpawnAgents.parseAgent . This can
simply be a list of agent names, e.g.:
<argument>Foo</argument>
<argument>Bar</argument>
|
Inner Class :protected static class AddCommand | |
Inner Class :final protected static class AgentControlPredicate implements UnaryPredicate | |
Inner Class :protected static class CompletedLocalAdd | |
Method Summary | |
protected void | addAgent(Object o) | protected void | addAgent(String agent, Object options, String node) | protected void | addAllAgents() Submit all adds in parallel. | protected boolean | addLocalAgent(String agent, Object options) | protected void | addRemoteAgent(String agent, Object options, String node) | protected void | completedAdd(String agent, Throwable ex) | public void | execute() | protected AgentContainer | getAgentContainer() | protected MobilityFactory | getMobilityFactory() | protected Object | getNextAgent() Get the next add-agent command. | protected ThreadService | getThreadService() | protected Object | parseAgent(String s) Parse an "agent=STRING" command specified in the plugin
parameters.
An agent string is either an agent name, a name followed by an "@"
and a node name, or either of the prior options followed by an " if "
and a node name. | protected void | parseAgents(List l) A subclass can override this method to specify a dynamically generated
parameter list, e.g.:
protected void parseAgents(List dummy) {
List l = new ArrayList();
if (localNode.equals("A")) {
l.add("foo");
} else {
l.add("bar");
l.add("qux");
}
super.parseAgents(l);
}
Also see
SpawnAgents.getNextAgent , which accesses the "agents" table
created by this method. | protected void | parseParameter(String key, String value) Parse a non-agent parameter. | protected void | parseParameters(Collection parameters) Parse the plugin parameters. | public void | setLoggingService(LoggingService log) | public void | setNodeIdentificationService(NodeIdentificationService nis) | public void | setUIDService(UIDService uidService) | public void | setupSubscriptions() | protected List | takeCompletedLocalAdds() |
DEFAULT_LOOPBACK | final protected static boolean DEFAULT_LOOPBACK(Code) | | |
DEFAULT_PARALLEL | final protected static boolean DEFAULT_PARALLEL(Code) | | |
addInProgress | protected boolean addInProgress(Code) | | |
loopback | protected boolean loopback(Code) | | |
parallel | protected boolean parallel(Code) | | |
addAgent | protected void addAgent(Object o)(Code) | | Request a non-blocking agent add
|
addAllAgents | protected void addAllAgents()(Code) | | Submit all adds in parallel.
|
addLocalAgent | protected boolean addLocalAgent(String agent, Object options)(Code) | | false if the caller must use #addRemoteAgent |
addRemoteAgent | protected void addRemoteAgent(String agent, Object options, String node)(Code) | | Add an agent using a mobility relay
|
execute | public void execute()(Code) | | |
getNextAgent | protected Object getNextAgent()(Code) | | Get the next add-agent command.
Note that a subclass can override this method for greater control
over the iteration order and values.
See Also: SpawnAgents.parseAgents |
parseAgent | protected Object parseAgent(String s)(Code) | | Parse an "agent=STRING" command specified in the plugin
parameters.
An agent string is either an agent name, a name followed by an "@"
and a node name, or either of the prior options followed by an " if "
and a node name. This allows the client to specific all of the
following simple commands:
<!-- add agent A to the local node -->
<argument>A</argument>
<!-- add agent B to node X, which may be remote -->
<argument>B @ X</argument>
<!-- if this is node Y, then add agent C to the local node -->
<argument>C if Y</argument>
<!-- if this is node Z, then add agent D to node Q -->
<argument>D @ Q if Z</argument>
an agent name, an AddCommand, or null |
parseAgents | protected void parseAgents(List l)(Code) | | A subclass can override this method to specify a dynamically generated
parameter list, e.g.:
protected void parseAgents(List dummy) {
List l = new ArrayList();
if (localNode.equals("A")) {
l.add("foo");
} else {
l.add("bar");
l.add("qux");
}
super.parseAgents(l);
}
Also see
SpawnAgents.getNextAgent , which accesses the "agents" table
created by this method.
|
parseParameter | protected void parseParameter(String key, String value)(Code) | | Parse a non-agent parameter.
|
parseParameters | protected void parseParameters(Collection parameters)(Code) | | Parse the plugin parameters.
|
setupSubscriptions | public void setupSubscriptions()(Code) | | |
takeCompletedLocalAdds | protected List takeCompletedLocalAdds()(Code) | | |
|
|