com.sun.mdm.index.survivor.impl
Class WeightedSurvivorStrategy

java.lang.Object
  extended bycom.sun.mdm.index.survivor.impl.WeightedSurvivorStrategy
All Implemented Interfaces:
SurvivorStrategyInterface

public class WeightedSurvivorStrategy
extends java.lang.Object
implements SurvivorStrategyInterface

Strategy for determing survivor. Calculates utility based on preference and quality.


Field Summary
static java.lang.String FLD_LAST_MODIFIED
          last modified constant
 
Constructor Summary
WeightedSurvivorStrategy()
          Creates new MySurvivalStrategy
 
Method Summary
 java.lang.Object clone()
          returns a clone of the object
 void init(java.util.Collection parameters)
          Initializes the survivor strategy object. Call this method after creating the object.

protected  void processMostRecentModified(SurvivorQuality q, java.util.Map scores, java.lang.String candidateId, SystemFieldListMap fields)
           
protected  void processSourceSystem(SurvivorQuality q, java.util.Map scores, java.lang.String candidateId, SystemFieldListMap fields)
          determine the utility for the SourceSystem quality
protected  void processSystemAgreement(SurvivorQuality q, java.util.Map scores, java.lang.String candidateId, SystemFieldListMap fields)
          Given m source systems and n aggrements.
 SystemField selectField(java.lang.String candidateId, SystemFieldListMap fields)
          Calculates the survivor value by using a MaxHeap to accrue utility scores.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLD_LAST_MODIFIED

public static final java.lang.String FLD_LAST_MODIFIED
last modified constant

See Also:
Constant Field Values
Constructor Detail

WeightedSurvivorStrategy

public WeightedSurvivorStrategy()
Creates new MySurvivalStrategy

Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
returns a clone of the object

Specified by:
clone in interface SurvivorStrategyInterface
Returns:
cloned object
Throws:
java.lang.CloneNotSupportedException - cloning not supported

init

public void init(java.util.Collection parameters)
          throws StrategyCreationException
Initializes the survivor strategy object. Call this method after creating the object.

Specified by:
init in interface SurvivorStrategyInterface
Parameters:
parameters - list of parameters used to initialize the strategy
Throws:
StrategyCreationException - missing required parameter

processMostRecentModified

protected void processMostRecentModified(SurvivorQuality q,
                                         java.util.Map scores,
                                         java.lang.String candidateId,
                                         SystemFieldListMap fields)
                                  throws SurvivorCalculationException
Parameters:
q - quality configuration from user defined XML
scores - reference to the scores MaxHeap
candidateId - field name of the set of values to be compared. Ignored for this quality
fields - set of fields for each system
Throws:
SurvivorCalculationException - if a expect value is not present

processSourceSystem

protected void processSourceSystem(SurvivorQuality q,
                                   java.util.Map scores,
                                   java.lang.String candidateId,
                                   SystemFieldListMap fields)
                            throws SurvivorCalculationException
determine the utility for the SourceSystem quality

Parameters:
q - quality configuration from user defined XML
scores - reference to the scores MaxHeap
candidateId - field name of the set of values to be compared. Ignored for this quality
fields - set of fields for each system
Throws:
SurvivorCalculationException - preferred system id does not exist in actual field list map parameter

processSystemAgreement

protected void processSystemAgreement(SurvivorQuality q,
                                      java.util.Map scores,
                                      java.lang.String candidateId,
                                      SystemFieldListMap fields)
                               throws SurvivorCalculationException
Given m source systems and n aggrements. The resulting score is n/m of the utility score specified in the configuration file

Parameters:
q - quality configuration from user defined XML
scores - reference to the scores MaxHeap
candidateId - field name of the set of values to be compared. Ignored for this quality
fields - set of fields for each system
Throws:
SurvivorCalculationException - unexpected values

selectField

public SystemField selectField(java.lang.String candidateId,
                               SystemFieldListMap fields)
                        throws SurvivorCalculationException
Calculates the survivor value by using a MaxHeap to accrue utility scores. User defines qualities, preferences and utility scores for each quality. Based on the user defined values, return the SystemField that has the highest utility after processing all of the qualities.

Specified by:
selectField in interface SurvivorStrategyInterface
Parameters:
candidateId - current candidate field to work with
fields - set of fields associated with each system
Returns:
SystemField object holding the surviving value.
Throws:
SurvivorCalculationException - no rule has been defined for this candidate field value not found for this candidate field


Sun Microsystems, Inc.