org.cougaar.pizza.plugin
Class SDClientPlugin

java.lang.Object
  extended byorg.cougaar.util.GenericStateModelAdapter
      extended byorg.cougaar.core.blackboard.BlackboardClientComponent
          extended byorg.cougaar.core.plugin.ComponentPlugin
              extended byorg.cougaar.servicediscovery.plugin.SimpleSDClientPlugin
                  extended byorg.cougaar.pizza.plugin.SDClientPlugin
All Implemented Interfaces:
org.cougaar.core.blackboard.BlackboardClient, org.cougaar.core.component.Component, org.cougaar.util.GenericStateModel, org.cougaar.core.plugin.PluginBase

public class SDClientPlugin
extends org.cougaar.servicediscovery.plugin.SimpleSDClientPlugin

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, possibly excluding the Providers listed in the NOT Prepositional Phrase. Sends a Disposition on the FindProviders Task when it gets a Relationship with a provider for the service.

This is an extension of the SimpleSDClientPlugin that uses the pizza Domain constants and specically forbids using providers listed in the Find Providers Task. Use this as an example of how you can extend the SimpleSDClientPlugin for your own application.

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.


Nested Class Summary
 
Nested classes inherited from class org.cougaar.core.blackboard.BlackboardClient
org.cougaar.core.blackboard.BlackboardClient.Local
 
Field Summary
protected static org.cougaar.util.UnaryPredicate MYFINDPROVIDERSTASKPREDICATE
          Extenders will probably over-ride this to point to their own Verb Constant
 
Fields inherited from class org.cougaar.servicediscovery.plugin.SimpleSDClientPlugin
myLoggingService
 
Fields inherited from class org.cougaar.core.blackboard.BlackboardClientComponent
agentId, agentIdentificationService, alarmService, blackboard, blackboardClientName
 
Fields inherited from interface org.cougaar.core.plugin.PluginBase
INSERTION_POINT
 
Fields inherited from interface org.cougaar.util.GenericStateModel
ACTIVE, IDLE, LOADED, UNINITIALIZED, UNLOADED
 
Fields inherited from interface org.cougaar.core.blackboard.BlackboardClient
current
 
Constructor Summary
SDClientPlugin()
           
 
Method Summary
protected  org.cougaar.planning.ldm.plan.Role getRole(org.cougaar.servicediscovery.description.ServiceDescription serviceDescription)
          Retrieve the Role that the Provider is offering out of the ServiceDescription.
protected  org.cougaar.servicediscovery.description.ServiceInfoScorer getServiceInfoScorer(org.cougaar.planning.ldm.plan.Role role, org.cougaar.planning.ldm.plan.Task fpTask)
          Create a scoring function to weigh different services registered in the YP, for use by the Matchmaker.
 
Methods inherited from class org.cougaar.servicediscovery.plugin.SimpleSDClientPlugin
execute, getDomainService, getLocalEntity, getRole, load, queryServices, requestServiceContract, setDomainService, setupSubscriptions, unload, updateFindProvidersTaskDispositions
 
Methods inherited from class org.cougaar.core.plugin.ComponentPlugin
getConfigFinder
 
Methods inherited from class org.cougaar.core.blackboard.BlackboardClientComponent
currentTimeMillis, cycle, getAgentIdentifier, getAlarmService, getBindingSite, getBlackboardClientName, getBlackboardService, getMessageAddress, getParameter, getParameters, getServiceBroker, halt, precycle, requestCycle, resume, setAgentIdentificationService, setAlarmService, setBindingSite, setBlackboardService, setParameter, setSchedulerService, setServiceBroker, setSuicideService, shouldExecute, start, stop, suspend, toString, wasAwakened
 
Methods inherited from class org.cougaar.util.GenericStateModelAdapter
getModelState, initialize, transitState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.cougaar.util.GenericStateModel
getModelState, halt, initialize, resume, start, stop, suspend
 

Field Detail

MYFINDPROVIDERSTASKPREDICATE

protected static final org.cougaar.util.UnaryPredicate MYFINDPROVIDERSTASKPREDICATE
Extenders will probably over-ride this to point to their own Verb Constant

Constructor Detail

SDClientPlugin

public SDClientPlugin()
Method Detail

getServiceInfoScorer

protected org.cougaar.servicediscovery.description.ServiceInfoScorer getServiceInfoScorer(org.cougaar.planning.ldm.plan.Role role,
                                                                                          org.cougaar.planning.ldm.plan.Task fpTask)
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 role, and forbids any providers named by the given Task.

Extenders of this plugin may over-ride this method to use a different function.

Parameters:
role - the Role to look for
fpTask - The FindProviders task this will satisfy
Returns:
the scoring function to hand the Matchmaker

getRole

protected org.cougaar.planning.ldm.plan.Role getRole(org.cougaar.servicediscovery.description.ServiceDescription serviceDescription)
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.
Returns:
the Role advertised by the Provider, or null if none found.