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


org.cougaar.core.plugin.ComponentPlugin
   org.cougaar.servicediscovery.plugin.SimpleSDClientPlugin

All known Subclasses:   org.cougaar.pizza.plugin.SDClientPlugin,
SimpleSDClientPlugin
public class SimpleSDClientPlugin extends ComponentPlugin (Code)
Simple ServiceDiscovery ClientPlugin, responsible for initiating queries for services, taking the resulting service pointer, and sending a Relay to the Provider requesting service.

Service Discovery is initiated by receiving a Find Providers task, and looking for the single Role indicated on the AS Prepositional Phrase. Sends a Disposition on the FindProviders Task when it gets a Relationship with a provider for the service.

This Plugin is written to be extended (or copied). See the pizza module for an example of doing this.

Limitations: not quiescent aware, doesn't handle time-phased relationships, not guaranteed to work with persistence and restarts, and assumes that providers will not revoke relationships or otherwise change their mind.



Field Summary
protected  LoggingServicemyLoggingService
    


Method Summary
protected  voidexecute()
     Issue MMQueries for FindProviders Tasks, ServiceContractRelays for responses to MMQueries, and Dispositions on the FindProviders Tasks when those Relays are filled in with a Contract.
protected  DomainServicegetDomainService()
     Get the DomainService set by reflection, for getting pointers to Factories.
protected  UnaryPredicategetFindProvidersPredicate()
     Predicate to get the FindProviders Tasks.
protected  EntitygetLocalEntity()
     Get the local (self) Entity - from a local cache, or by querying the Blackboard.
protected  PlanningFactorygetPlanningFactory()
    
protected  RolegetRole(Task findProvidersTask)
     Return the Role (indirect object) on the Constants.Prepositions.AS Prep Phrase in the given FindProviders Task, if any -- this is the Provider Role we will look for.
protected  RolegetRole(ServiceDescription serviceDescription)
     Retrieve the Role that the Provider is offering out of the ServiceDescription.
protected  SDFactorygetSDFactory()
     Get the SDFactory.
protected  ServiceInfoScorergetServiceInfoScorer(Role role, Task fpTask)
     Create a scoring function to weigh different services registered in the YP, for use by the Matchmaker.
public  voidload()
     Load other services, particularly those not essential to operations.
protected  voidqueryServices(Role role, Task findProvidersTask)
     Send an MMQueryRequest to the Matchmaker, requesting a provider with the given Role , satisfying the given Task.
protected  voidrequestServiceContract(ServiceDescription serviceDescription)
     Create and publish a relay with a service request for the specified Role, to the Provider specified in the serviceDescription.
public  voidsetDomainService(DomainService domainService)
    
protected  voidsetupSubscriptions()
     Subscribe to MMRequests (requests to the Matchmaker), ServiceContractRelays (where we'll get responses from the Providers), and FindProviders Tasks (requests to us to do ServiceDiscovery).
public  voidunload()
    
protected  voidupdateFindProvidersTaskDispositions(Collection changedServiceContractRelays)
     For each ServiceContractRelay that changes and has a ServiceContract, find the un-disposed FindProviders Task that requested a Provider with the given Role, and dispose it as succesful.

Field Detail
myLoggingService
protected LoggingService myLoggingService(Code)





Method Detail
execute
protected void execute()(Code)
Issue MMQueries for FindProviders Tasks, ServiceContractRelays for responses to MMQueries, and Dispositions on the FindProviders Tasks when those Relays are filled in with a Contract.

For each new FindProviders Task, issue an MMQuery to the Matchmaker, looking for the specified Role. If an MMQuery changes, issue a new ServiceContractRelay to the first named Provider that was found. If a ServiceContractRelay changes, update the Disposition on the original FindProviders Task if we've now found a Provider for the needed Service.




getDomainService
protected DomainService getDomainService()(Code)
Get the DomainService set by reflection, for getting pointers to Factories.



getFindProvidersPredicate
protected UnaryPredicate getFindProvidersPredicate()(Code)
Predicate to get the FindProviders Tasks. In the off-chance that your verb is slightly different, you can over-ride this method to point to your domain-specific Verb Constant. Note that it is not a constant, just so it can be over-ridden.



getLocalEntity
protected Entity getLocalEntity()(Code)
Get the local (self) Entity - from a local cache, or by querying the Blackboard. the local (self) Entity



getPlanningFactory
protected PlanningFactory getPlanningFactory()(Code)
Get the PlanningFactory



getRole
protected Role getRole(Task findProvidersTask)(Code)
Return the Role (indirect object) on the Constants.Prepositions.AS Prep Phrase in the given FindProviders Task, if any -- this is the Provider Role we will look for.
Parameters:
  findProvidersTask - Task which should contain an AS Prepositional Phrase Role on AS Phrase, indicate Role desired from ServiceDiscovery -- may be null



getRole
protected Role getRole(ServiceDescription serviceDescription)(Code)
Retrieve the Role that the Provider is offering out of the ServiceDescription. Note that this assumes the role is under the CommercialServiceScheme, using the Domain's Constants file. Extenders will over-ride this method.
Parameters:
  serviceDescription - The Description of the Service as advertised in the YP. the Role advertised by the Provider, or null if none found.



getSDFactory
protected SDFactory getSDFactory()(Code)
Get the SDFactory. Factory for service discovery domain



getServiceInfoScorer
protected ServiceInfoScorer getServiceInfoScorer(Role role, Task fpTask)(Code)
Create a scoring function to weigh different services registered in the YP, for use by the Matchmaker. In this case, create a function that requires the given (Commercial) role.

Extenders of this plugin may over-ride this method to use a different function.
Parameters:
  role - the Role to look for
Parameters:
  fpTask - The FindProviders task this will satisfy the scoring function to hand the Matchmaker




load
public void load()(Code)
Load other services, particularly those not essential to operations. In this case, use the DomainService to get Factories and release it. Also get the Logging Service.



queryServices
protected void queryServices(Role role, Task findProvidersTask)(Code)
Send an MMQueryRequest to the Matchmaker, requesting a provider with the given Role , satisfying the given Task.

Extenders of this plugin might choose to over-ride this method, though it usually will not be necessary.
Parameters:
  role - The Role to request
Parameters:
  findProvidersTask - The Task whose request this will satisfy




requestServiceContract
protected void requestServiceContract(ServiceDescription serviceDescription)(Code)
Create and publish a relay with a service request for the specified Role, to the Provider specified in the serviceDescription.
Parameters:
  serviceDescription - the Matchmaker tells us about the possible service provider in this Service Description



setDomainService
public void setDomainService(DomainService domainService)(Code)
Used by the binding utility through reflection to set my DomainService



setupSubscriptions
protected void setupSubscriptions()(Code)
Subscribe to MMRequests (requests to the Matchmaker), ServiceContractRelays (where we'll get responses from the Providers), and FindProviders Tasks (requests to us to do ServiceDiscovery).



unload
public void unload()(Code)
Release any services retrieved during load() -- in this case, the LoggingService and DomainService



updateFindProvidersTaskDispositions
protected void updateFindProvidersTaskDispositions(Collection changedServiceContractRelays)(Code)
For each ServiceContractRelay that changes and has a ServiceContract, find the un-disposed FindProviders Task that requested a Provider with the given Role, and dispose it as succesful.

Assumes there will be one un-disposed FindProviders Task per Role.




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.