Java Doc for SDPlaceOrderPlugin.java in  » Science » Cougaar12_4 » org » cougaar » pizza » 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.pizza.plugin 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.cougaar.pizza.plugin.PlaceOrderPlugin
   org.cougaar.pizza.plugin.SDPlaceOrderPlugin

SDPlaceOrderPlugin
public class SDPlaceOrderPlugin extends PlaceOrderPlugin (Code)
The SDPlaceOrderPlugin extends the PlaceOrderPlugin to use Service Discovery to find pizza providers dynamically. Once the plugin receives the PizzaPreferences object, it publishes a org.cougaar.pizza.Constants.Verbs.FIND_PROVIDERS task with a Role of org.cougaar.pizza.Constants.Roles.PIZZAPROVIDER . This task will be handled by Service Discovery. The plugin then creates and expands the org.cougaar.pizza.Constants.Verbs.ORDER Task as done in the super class. However, unlike the super class, this plugin waits until Service Discovery has finished finding a pizza provider and has added a Disposition on the FindProviders task before it can allocate the pizza subtasks.

ServiceDiscovery will find a provider, creating a PizzaProvider relationship. Then the plugin continues as in the PlaceOrderPlugin.

If the Expansion on the order task fails, i.e., the provider could not complete the pizza order, then the plugin will remove the Allocations on the subtasks of the Expansion and request a new provider from Service Discovery. To exclude the provider that previously failed, the plugin adds a prepositional phrase of org.cougaar.pizza.Constants.Prepositions.NOT with the name of the provider as the indirect object on the FindProviders task. Once a new provider is found the tasks will be reallocated -- hopefully more succesfully!





Method Summary
protected  voidexecute()
     When we get the PizzaPreferences object (that subscription is changed), ask ServiceDiscovery to find a provider. Meanwhile, create the root order Task and its expansions - but not yet allocated.

When the FindProviders task is Disposed (a different subscription change), we have a provider.

protected  EntitygetProvider(Disposition disposition)
     Find a PizzaProvider to try using, avoiding the provider on the given Disposition if any. First, retrieve the excluded provider from the FindProviders task of the Disposition.
protected  voidsetupSubscriptions()
     Overrides the super class method.



Method Detail
execute
protected void execute()(Code)
When we get the PizzaPreferences object (that subscription is changed), ask ServiceDiscovery to find a provider. Meanwhile, create the root order Task and its expansions - but not yet allocated.

When the FindProviders task is Disposed (a different subscription change), we have a provider. Allocate the Order sub-tasks to that provider.

As in the base class, update the AllocationResults as they come in from our provider.

Finally, when the Expansion of the root Order Task changes, see if we got all our pizza. If not, remove the old Allocations to the old provider, and ask ServiceDiscovery to find another (different) provider. When that FindProviders is disposed, we'll try again...




getProvider
protected Entity getProvider(Disposition disposition)(Code)
Find a PizzaProvider to try using, avoiding the provider on the given Disposition if any. First, retrieve the excluded provider from the FindProviders task of the Disposition. Get all relationships that match the Role of PizzaProvider from the RelationshipSchedule. Return the first provider found that is not the excluded provider. Returns null if a provider is not found.

Note that only one failed provider can be avoided with this implementation.
Parameters:
  disposition - whose previous Provider to avoid a pizza provider Entity to try




setupSubscriptions
protected void setupSubscriptions()(Code)
Overrides the super class method. Adds additional subscriptions to Dispositions of the FindProviders Task and our original Order Tasks.



Fields inherited from org.cougaar.pizza.plugin.PlaceOrderPlugin
final protected static UnaryPredicate ALLOCATION_PRED(Code)(Java Doc)
final protected static UnaryPredicate EXPANSION_PRED(Code)(Java Doc)
final protected static UnaryPredicate PIZZA_PREF_PRED(Code)(Java Doc)
final protected static UnaryPredicate SELF_PRED(Code)(Java Doc)
protected IncrementalSubscription allocationSub(Code)(Java Doc)
protected DomainService domainService(Code)(Java Doc)
protected IncrementalSubscription expansionSub(Code)(Java Doc)
protected LoggingService logger(Code)(Java Doc)
protected IncrementalSubscription pizzaPrefSub(Code)(Java Doc)
protected PlanningFactory planningFactory(Code)(Java Doc)
protected IncrementalSubscription selfSub(Code)(Java Doc)

Methods inherited from org.cougaar.pizza.plugin.PlaceOrderPlugin
protected void allocateSubtasks(Collection subtasks, Entity provider)(Code)(Java Doc)
protected Task createOrderTask()(Code)(Java Doc)
protected Collection createPizzaSubtasks(PizzaPreferences pizzaPrefs, Task parentTask)(Code)(Java Doc)
protected void execute()(Code)(Java Doc)
protected Expansion getChangedExpansion()(Code)(Java Doc)
protected PizzaPreferences getPizzaPreferences()(Code)(Java Doc)
protected Entity getProvider()(Code)(Java Doc)
protected Entity getSelfEntity()(Code)(Java Doc)
public void load()(Code)(Java Doc)
protected void logExpansionResults(Expansion exp)(Code)(Java Doc)
protected void makeExpansion(Task parentTask, Collection subtasks)(Code)(Java Doc)
protected PizzaAsset makePizzaAsset(String assetType)(Code)(Java Doc)
protected Preference makeQuantityPreference(int value)(Code)(Java Doc)
protected NewTask makeTask(Verb verb, Asset directObject)(Code)(Java Doc)
protected String printAllocationResults(PlanElement pe)(Code)(Java Doc)
protected String printExpansionResults(Expansion exp)(Code)(Java Doc)
public void setDomainService(DomainService aDomainService)(Code)(Java Doc)
protected void setupSubscriptions()(Code)(Java Doc)
protected void updateOrderAllocationResults()(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.