edu.UCL.xmiddle.lib.reconciliation
Class LevelTreeReconcile

java.lang.Object
  |
  +--edu.UCL.xmiddle.lib.reconciliation.LevelTreeReconcile

public class LevelTreeReconcile
extends java.lang.Object

LevelTreeReconcile is used to reconcile differences between two trees. The two trees are passed to this class, and their differences found. These differences are then reconciled, either application-independently, or if no general case is possible, then application-specifically. This relies on the application's default reconciliation policy, or any reconciliation policy specified locally to the reconciled Node.

See Also:
LevelTreeDiff, LevelTreeMerge

Constructor Summary
LevelTreeReconcile()
           
 
Method Summary
static boolean areNodesEqual(org.w3c.dom.Node n1, org.w3c.dom.Node n2)
          This method compares two nodes (by means of a recursive procedure).
static boolean areNodesEqualNotStandard(org.w3c.dom.Node n1, org.w3c.dom.Node n2)
          This method compares two nodes (recursive style - alternative implementation).
static org.w3c.dom.Node findNode(org.w3c.dom.Node n, org.w3c.dom.Document dataSchema)
          Finds the node that can be duplicated using the given Schema Document.
static org.w3c.dom.Document reconcile(org.w3c.dom.Document treeA, org.w3c.dom.Document treeB, org.w3c.dom.Document latestCommonDocument, org.w3c.dom.Document schema)
          Apply reconciliation policies to the two trees.
static void resolveAttributes(org.w3c.dom.Node n1, org.w3c.dom.Node n2, org.w3c.dom.Node nOld)
          Solves attribute conflicts (in the case order not important).
static void resolveNode(org.w3c.dom.Node n1, org.w3c.dom.Node n2, org.w3c.dom.Node nOld)
          This method solve conflicts according to a non standard resolution policy (case of presence of attribute Resolutor with value different from null).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LevelTreeReconcile

public LevelTreeReconcile()
Method Detail

reconcile

public static org.w3c.dom.Document reconcile(org.w3c.dom.Document treeA,
                                             org.w3c.dom.Document treeB,
                                             org.w3c.dom.Document latestCommonDocument,
                                             org.w3c.dom.Document schema)
Apply reconciliation policies to the two trees. treeA is assumed to be the 'local' tree, for resolutors that require such information.

Parameters:
treeA - the first of a pair of trees to be reconciled.
treeB - the second of a pair of trees to be reconciled.
latestCommonDocument - The latest common document
Returns:
the reconciled Document

areNodesEqual

public static boolean areNodesEqual(org.w3c.dom.Node n1,
                                    org.w3c.dom.Node n2)
This method compares two nodes (by means of a recursive procedure). The result is true if the two nodes are equal, false if they are not equal.

Returns:
true if they are equal, false otherwise

areNodesEqualNotStandard

public static boolean areNodesEqualNotStandard(org.w3c.dom.Node n1,
                                               org.w3c.dom.Node n2)
This method compares two nodes (recursive style - alternative implementation). The result is true if the two nodes are equal, false if they are not equal.

Returns:
true if the node are equal, false otherwise

findNode

public static org.w3c.dom.Node findNode(org.w3c.dom.Node n,
                                        org.w3c.dom.Document dataSchema)
Finds the node that can be duplicated using the given Schema Document.

Parameters:
n - the node from which the retrieving process starts(a "leaf" node)
dataSchema - the associated Schema Document
Returns:
the node that can be duplicated ("root of the branch")

resolveNode

public static void resolveNode(org.w3c.dom.Node n1,
                               org.w3c.dom.Node n2,
                               org.w3c.dom.Node nOld)
This method solve conflicts according to a non standard resolution policy (case of presence of attribute Resolutor with value different from null).


resolveAttributes

public static void resolveAttributes(org.w3c.dom.Node n1,
                                     org.w3c.dom.Node n2,
                                     org.w3c.dom.Node nOld)
Solves attribute conflicts (in the case order not important).

Parameters:
n1 - node of the base document
n2 - node of the other document
nOld - node of the common latest edition document