com.ibm.adt.topology.provider.impl
Class TopologyComparatorImpl

java.lang.Object
  extended by com.ibm.adt.topology.provider.impl.TopologyComparatorImpl
All Implemented Interfaces:
TopologyComparator

public abstract class TopologyComparatorImpl
extends java.lang.Object
implements TopologyComparator

TopologyComparatorImpl provides a default implementation of TopologyComparator with full support of all architected features such as recursive compare and filtering. A Provider implementation extends this class, and may choose to customize the behavior of the comparator by adding filters in its' constructor, or providing custom code for post-filtering and result formatting.


Constructor Summary
TopologyComparatorImpl()
           
 
Method Summary
 void applyFilter(ComparatorFilter filter)
          Allows specification of filters to be applied to the compare() function.
protected  void clearFilters()
           
 void clearResults()
          Clears the result set so that the comparator instance may be reused.
 java.util.Collection compare(TopologyObject o1, TopologyObject o2, boolean recurse)
          Compares the topology starting at the specified TopologyObject objects.
protected  java.util.Collection filterResults()
          Post-filter the compare results to filter out irrelevant differences.
 AdditionalInfo getAdditionalInfo(java.lang.Object po)
          Gather additional information about a given PropertyObject so that it may be reflected in the comparator output.
 ComparatorFilter[] getFilters()
          Returns an array containing all of the currently applied filters.
 java.util.Collection getResults()
          Returns the result set of the previous compare opertain in the form of a collection of Object[2] arrays.
 java.io.OutputStream resultsToXml(org.w3c.dom.Element compareInputXml)
          Formats the result to an xml file in the form as defined by TopologyComparator.xsd.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopologyComparatorImpl

public TopologyComparatorImpl()
Method Detail

compare

public java.util.Collection compare(TopologyObject o1,
                                    TopologyObject o2,
                                    boolean recurse)
                             throws TopologyComparatorException,
                                    TopologyException
Description copied from interface: TopologyComparator
Compares the topology starting at the specified TopologyObject objects. TopologyObject must of the same type.

Specified by:
compare in interface TopologyComparator
Parameters:
o1 - reference TopologyObject
o2 - delta TopologyObject
recurse - specifes whether to recurse the topology
Returns:
result set in the form of a collection of Object[2] objects
Throws:
TopologyComparatorException
TopologyException

getResults

public java.util.Collection getResults()
Description copied from interface: TopologyComparator
Returns the result set of the previous compare opertain in the form of a collection of Object[2] arrays.

Specified by:
getResults in interface TopologyComparator
Returns:
the result set of the last compare

clearResults

public void clearResults()
Description copied from interface: TopologyComparator
Clears the result set so that the comparator instance may be reused.

Specified by:
clearResults in interface TopologyComparator

applyFilter

public void applyFilter(ComparatorFilter filter)
Description copied from interface: TopologyComparator
Allows specification of filters to be applied to the compare() function.

Specified by:
applyFilter in interface TopologyComparator

clearFilters

protected void clearFilters()

getFilters

public ComparatorFilter[] getFilters()
Description copied from interface: TopologyComparator
Returns an array containing all of the currently applied filters.

Specified by:
getFilters in interface TopologyComparator
Returns:
an array of ComparatorFilter objects

resultsToXml

public java.io.OutputStream resultsToXml(org.w3c.dom.Element compareInputXml)
                                  throws TopologyComparatorException
Description copied from interface: TopologyComparator
Formats the result to an xml file in the form as defined by TopologyComparator.xsd.

Specified by:
resultsToXml in interface TopologyComparator
Parameters:
compareInputXml - if specified, the element is copied into the reulting output xml.
Returns:
an OutputStream with the resulting xml
Throws:
TopologyComparatorException

filterResults

protected java.util.Collection filterResults()
                                      throws TopologyException,
                                             TopologyComparatorException
Post-filter the compare results to filter out irrelevant differences. A TopologyProvider implementation may choose to override this method to provide customization of post-filter function.

Throws:
TopologyComparatorException
TopologyException

getAdditionalInfo

public AdditionalInfo getAdditionalInfo(java.lang.Object po)
Gather additional information about a given PropertyObject so that it may be reflected in the comparator output. A TopologyProvider implementation may choose to override this method to provide customization of this output.

Specified by:
getAdditionalInfo in interface TopologyComparator
Parameters:
po - specifies the PropertyObject


© Copyright 2006 IBM Corp. 2006 All Rights Reserved