Java Doc for SpawnAgents.java in  » Science » Cougaar12_4 » org » cougaar » core » mobility » plugin » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Cougaar12_4 » org.cougaar.core.mobility.plugin 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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

Field Summary
final protected static  booleanDEFAULT_LOOPBACK
    
final protected static  booleanDEFAULT_PARALLEL
    
protected  booleanaddInProgress
    
protected  Mapagents
    
protected  StringlocalNode
    
protected  LoggingServicelog
    
protected  booleanloopback
    
protected  booleanparallel
    
protected  UIDpluginId
    
protected  IncrementalSubscriptionsub
    
protected  UIDServiceuidService
    


Method Summary
protected  voidaddAgent(Object o)
    
protected  voidaddAgent(String agent, Object options, String node)
    
protected  voidaddAllAgents()
     Submit all adds in parallel.
protected  booleanaddLocalAgent(String agent, Object options)
    
protected  voidaddRemoteAgent(String agent, Object options, String node)
    
protected  voidcompletedAdd(String agent, Throwable ex)
    
public  voidexecute()
    
protected  AgentContainergetAgentContainer()
    
protected  MobilityFactorygetMobilityFactory()
    
protected  ObjectgetNextAgent()
     Get the next add-agent command.
protected  ThreadServicegetThreadService()
    
protected  ObjectparseAgent(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  voidparseAgents(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  voidparseParameter(String key, String value)
     Parse a non-agent parameter.
protected  voidparseParameters(Collection parameters)
     Parse the plugin parameters.
public  voidsetLoggingService(LoggingService log)
    
public  voidsetNodeIdentificationService(NodeIdentificationService nis)
    
public  voidsetUIDService(UIDService uidService)
    
public  voidsetupSubscriptions()
    
protected  ListtakeCompletedLocalAdds()
    

Field Detail
DEFAULT_LOOPBACK
final protected static boolean DEFAULT_LOOPBACK(Code)



DEFAULT_PARALLEL
final protected static boolean DEFAULT_PARALLEL(Code)



addInProgress
protected boolean addInProgress(Code)



agents
protected Map agents(Code)



localNode
protected String localNode(Code)



log
protected LoggingService log(Code)



loopback
protected boolean loopback(Code)



parallel
protected boolean parallel(Code)



pluginId
protected UID pluginId(Code)



sub
protected IncrementalSubscription sub(Code)



uidService
protected UIDService uidService(Code)





Method Detail
addAgent
protected void addAgent(Object o)(Code)
Request a non-blocking agent add



addAgent
protected void addAgent(String agent, Object options, String node)(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



completedAdd
protected void completedAdd(String agent, Throwable ex)(Code)



execute
public void execute()(Code)



getAgentContainer
protected AgentContainer getAgentContainer()(Code)



getMobilityFactory
protected MobilityFactory getMobilityFactory()(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




getThreadService
protected ThreadService getThreadService()(Code)



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.



setLoggingService
public void setLoggingService(LoggingService log)(Code)



setNodeIdentificationService
public void setNodeIdentificationService(NodeIdentificationService nis)(Code)



setUIDService
public void setUIDService(UIDService uidService)(Code)



setupSubscriptions
public void setupSubscriptions()(Code)



takeCompletedLocalAdds
protected List takeCompletedLocalAdds()(Code)



Methods inherited from org.cougaar.core.plugin.ComponentPlugin
abstract protected void execute()(Code)(Java Doc)
protected ConfigFinder getConfigFinder()(Code)(Java Doc)
abstract protected void setupSubscriptions()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.