org.vmguys.vmtools.utils
Class VMJdomDiff

java.lang.Object
  |
  +--org.vmguys.vmtools.utils.VMJdomDiff

public class VMJdomDiff
extends java.lang.Object

This class generates and applies difference documents. If given two XML documents, it will generate an difference document that will show the differences between the data. If given an XML document and a difference document, it will apply the differences and return the updated data.

This class operates on JDOM trees, rather than XML documents. An application using this class should parse the input XML files to create the trees, or use the result tree to generate an XML document.

This is similar to OtaUpdate except that the result is not OTA compliant.


Field Summary
static java.lang.String schemaLocation
          The default schemaLocation value for VMXML documents.
static java.lang.String tagname
          The element tag name for a difference document.
static java.lang.String xmlns
          The default namespace for VMXML documents.
 
Constructor Summary
VMJdomDiff()
          No-args constructor.
 
Method Summary
 org.jdom.Element applyDiffs(org.jdom.Element original, org.jdom.Element differences)
          Applies the difference tree to the original tree to recreate the modified tree.
 org.jdom.Element generateDiffs(org.jdom.Element original, org.jdom.Element modified)
          Returns the differences between the original tree and the modified tree as a VMXMLDiff tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tagname

public static final java.lang.String tagname
The element tag name for a difference document.

xmlns

public static final java.lang.String xmlns
The default namespace for VMXML documents.

schemaLocation

public static final java.lang.String schemaLocation
The default schemaLocation value for VMXML documents.
Constructor Detail

VMJdomDiff

public VMJdomDiff()
No-args constructor.
Method Detail

generateDiffs

public org.jdom.Element generateDiffs(org.jdom.Element original,
                                      org.jdom.Element modified)
                               throws org.jdom.JDOMException

Returns the differences between the original tree and the modified tree as a VMXMLDiff tree. The result tree can then be converted to an XML document.

When the difference tree is applied against the original tree by applyDiffs, the result will be the modified tree.

See Also:
applyDiffs(Element, Element)

applyDiffs

public org.jdom.Element applyDiffs(org.jdom.Element original,
                                   org.jdom.Element differences)
                            throws org.jdom.JDOMException
Applies the difference tree to the original tree to recreate the modified tree. The tree rooted at the original element is cloned, then the updates specified in the update request are applied. The result is returned to the caller.
See Also:
generateDiffs(Element, Element)


Copyright © 2001 VM Systems, Inc. All Rights Reserved.