org.cougaar.pizza.plugin.util
Class RoleWithBlacklistScorer

java.lang.Object
  extended byorg.cougaar.pizza.plugin.util.RoleWithBlacklistScorer
All Implemented Interfaces:
java.io.Serializable, org.cougaar.servicediscovery.description.ServiceInfoScorer

public class RoleWithBlacklistScorer
extends java.lang.Object
implements org.cougaar.servicediscovery.description.ServiceInfoScorer, java.io.Serializable

ServiceDiscovery Service scoring function using Role name and an exclusion list.

 Uses 2 criteria -  
   service role must match scorer role (in Commercial Service Scheme)
   service provider name must not match one of the names on the blacklist.

All passing descriptions get a score of 1, all failing descriptions get a score of -1.

SDClientPlugin creates the RoleWithBlacklistScorer and attaches it to the MMQueryRequest. MatchmakerPlugin uses the RoleWithBlacklistScorer to evaluate service descriptions returned from the yellow pages. All passing service descriptions are added to the MMQueryRequest results field.

This Scorer is a simple variation on the RoleScorer in the ServiceDiscovery module, as an example of how to modify this.

See Also:
RoleScorer, Serialized Form

Constructor Summary
RoleWithBlacklistScorer(org.cougaar.planning.ldm.plan.Role role, java.util.Collection blacklist)
           
 
Method Summary
 java.util.Collection getBlacklist()
          Which providers are not acceptable?
 org.cougaar.planning.ldm.plan.Role getRole()
          What Role is being requested?
 int scoreServiceInfo(org.cougaar.servicediscovery.description.ServiceInfo serviceInfo)
          Will be called by MatchmakerPlugin for each ServiceInfo.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoleWithBlacklistScorer

public RoleWithBlacklistScorer(org.cougaar.planning.ldm.plan.Role role,
                               java.util.Collection blacklist)
Method Detail

getRole

public org.cougaar.planning.ldm.plan.Role getRole()
What Role is being requested?

Returns:
the Role required for this request

getBlacklist

public java.util.Collection getBlacklist()
Which providers are not acceptable?

Returns:
the Collection of excluded provider names (Strings)

scoreServiceInfo

public int scoreServiceInfo(org.cougaar.servicediscovery.description.ServiceInfo serviceInfo)
Will be called by MatchmakerPlugin for each ServiceInfo. Returned score will be added to the ScoredServiceDescription associated with the Service.

Specified by:
scoreServiceInfo in interface org.cougaar.servicediscovery.description.ServiceInfoScorer
Parameters:
serviceInfo - The ServiceInfo returned by the YP for which we want a score
Returns:
int representing score. Client responsible for understanding the precise value. Current usage assumes lowest value >= 0 is the best. Values less than 0 indicate the provider is not suitable.

toString

public java.lang.String toString()