com.ibm.websphere.fabric.da.plugin
Interface EndpointFilter


public interface EndpointFilter

An EndpointFilter plug-in is invoked after the Dynamic Assembler has performed all its policy matching and has given a policy matching score to all the endpoints, but before an endpoint is selected. It is invoked with the entire list of all candidates that have been considered. For each such endpoint, the following items are also provided:

The plug-in is then free to take the following actions:

If an endpoint is rejected, then it will no longer be considered as a potential handler for the request. Otherwise, if the plug-in assigns tiers, then all other scoring, etc., is ignored. Every endpoint in the same tier will be considered equivalent for the purposes of finding an endpoint to handle the request.

For example, if the following shows the resulting tiers after calling an Endpoint Filter plug-in:

Endpoint name Tier
A2
B3
C2
D4

Then endpoints A and C will be chosen from first for handling the request, with the requests being routed in a round-robin fashion. If neither A nor C are available (e.g. they are both inoperative due to limitations on the hours of operation), then endpoint B will be tried next. Endpoint D will only be chosen if all the others are unavailable.

A sample implementation

 public CandidateList filterCandidates(CandidateList cl) {
   for (int i=0; i<cl.getCandidateCount(); i++) {
     CandidateItem item = cl.getCandidate(i);
     if (item.isRejected()) {
       continue;
     }
     if (item.getAddress().contains("UseMe")) {
       item.setTier(1);
     }
     else if (item.getCost().getCostPerMinute() < 1.0) {
       item.setTier(2);
     }
     else if (item.getCost().getCostPerMinute() > 100.0) {
       item.reject("Too expensive");
     }
     else {
       item.setTier(3);
     }
   }
   // Return updates to DA
   return cl;
 }
 


Method Summary
 CandidateList filterCandidates(CandidateList candidates)
          Called after the DA has performed all its policy matching and has given a policy matching score to all the endpoints, in order to allow the candidate list of endpoints to be modified.
 

Method Detail

filterCandidates

CandidateList filterCandidates(CandidateList candidates)
Called after the DA has performed all its policy matching and has given a policy matching score to all the endpoints, in order to allow the candidate list of endpoints to be modified.

Parameters:
candidates - A CandidateList that contains the following data items for each candidate endpoint:
  • The cost (a configuration item)
  • The policy matching score (calculated)
  • An integer “tier,” i.e. a numeric “bucket” into which this endpoint falls (set by the plug-in)
  • Whether or not the endpoint has been rejected (set by the plug-in)
Returns:
a possibly-modified CandidateList where the tiers and/or the rejection states have been updated, or null if there is no change.


Copyright © 2002-2009 IBM. All Rights Reserved.