Source Code Cross Referenced for PizzaPrototypePlugin.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 Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * <copyright>
03:         *  Copyright 1997-2004 BBNT Solutions, LLC
04:         *  under sponsorship of the Defense Advanced Research Projects Agency (DARPA).
05:         *
06:         *  This program is free software; you can redistribute it and/or modify
07:         *  it under the terms of the Cougaar Open Source License as published by
08:         *  DARPA on the Cougaar Open Source Website (www.cougaar.org).
09:         *
10:         *  THE COUGAAR SOFTWARE AND ANY DERIVATIVE SUPPLIED BY LICENSOR IS
11:         *  PROVIDED 'AS IS' WITHOUT WARRANTIES OF ANY KIND, WHETHER EXPRESS OR
12:         *  IMPLIED, INCLUDING (BUT NOT LIMITED TO) ALL IMPLIED WARRANTIES OF
13:         *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND WITHOUT
14:         *  ANY WARRANTIES AS TO NON-INFRINGEMENT.  IN NO EVENT SHALL COPYRIGHT
15:         *  HOLDER BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT OR CONSEQUENTIAL
16:         *  DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE OF DATA OR PROFITS,
17:         *  TORTIOUS CONDUCT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18:         *  PERFORMANCE OF THE COUGAAR SOFTWARE.
19:         * </copyright>
20:         */
21:        package org.cougaar.pizza.plugin;
22:
23:        import org.cougaar.core.plugin.ComponentPlugin;
24:        import org.cougaar.core.service.DomainService;
25:        import org.cougaar.pizza.Constants;
26:        import org.cougaar.pizza.asset.PizzaAsset;
27:        import org.cougaar.planning.ldm.PlanningFactory;
28:        import org.cougaar.planning.service.PrototypeRegistryService;
29:
30:        /**
31:         * This Plugin creates and registers the Pizza Prototype asset.  Other plugins will create
32:         * instances of Pizza Assets as needed based on this prototype. This plugin does not require any inputs,
33:         * it simply creates and registers the prototype. Note that this plugin will only run once since there
34:         * are no inputs(subscriptions) that will cause it to run.
35:         */
36:        public class PizzaPrototypePlugin extends ComponentPlugin {
37:
38:            // The domainService provides domain factory services
39:            private DomainService domainService = null;
40:
41:            // The prototypeRegistryService provides prototype registration services
42:            private PrototypeRegistryService prototypeRegistryService = null;
43:
44:            // The planning factory we use to create planning objects.
45:            private PlanningFactory planningFactory;
46:
47:            /**
48:             * Used by the binding utility through introspection to set my DomainService
49:             * Services that are required for plugin usage should be set through reflection instead of explicitly
50:             * getting each service from your ServiceBroker in the load method. The setter methods are called after
51:             * the component is constructed but before the state methods such as initialize, load, setupSubscriptions, etc.
52:             * If the service is not available at that time the component will be unloaded.
53:             */
54:            public void setDomainService(DomainService aDomainService) {
55:                domainService = aDomainService;
56:            }
57:
58:            /**
59:             * Used by the binding utility through introspection to set my PrototypeRegistryService
60:             */
61:            public void setPrototypeRegistryService(
62:                    PrototypeRegistryService aPrototypeRegistryService) {
63:                prototypeRegistryService = aPrototypeRegistryService;
64:            }
65:
66:            /**
67:             * Generally used to initalize plugin subscriptions. But in this case, we will just use it to
68:             * call our method that will create the prototype.
69:             */
70:            protected void setupSubscriptions() {
71:                planningFactory = (PlanningFactory) domainService
72:                        .getFactory("planning");
73:                // unload the domain service since we only need it to get the planning factory
74:                getServiceBroker().releaseService(this , DomainService.class,
75:                        domainService);
76:
77:                // Create our prototype
78:                createPizzaPrototype();
79:            }
80:
81:            /**
82:             * Create and register the pizza prototype.
83:             */
84:            private void createPizzaPrototype() {
85:                PizzaAsset new_prototype = (PizzaAsset) planningFactory
86:                        .createPrototype(PizzaAsset.class, Constants.PIZZA);
87:                // Cache the prototype in the LDM so that other plugins can create Pizza instances using the new prototype.
88:                prototypeRegistryService.cachePrototype(Constants.PIZZA,
89:                        new_prototype);
90:            }
91:
92:            /**
93:             * No subscriptions to process so this method does nothing.
94:             */
95:            protected void execute() {
96:            }
97:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.