org.exist.backup
Class ConsistencyCheck

java.lang.Object
  extended by org.exist.backup.ConsistencyCheck

public class ConsistencyCheck
extends Object


Nested Class Summary
static interface ConsistencyCheck.ProgressCallback
           
 
Constructor Summary
ConsistencyCheck(DBBroker broker)
           
 
Method Summary
 List checkAll(ConsistencyCheck.ProgressCallback callback)
          Combines checkCollectionTree(ConsistencyCheck.ProgressCallback) and checkDocuments(ConsistencyCheck.ProgressCallback).
 List checkCollectionTree(ConsistencyCheck.ProgressCallback callback)
          Run some tests on the collection hierarchy, starting at the root collection /db.
 List checkDocuments(ConsistencyCheck.ProgressCallback progress)
          Run some tests on all documents stored in the database.
 void checkDocuments(ConsistencyCheck.ProgressCallback progress, List errorList)
          Run some tests on all documents stored in the database.
 ErrorReport checkXMLTree(DocumentImpl doc)
          Check the persistent DOM of a document.
 int getDocumentCount()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsistencyCheck

public ConsistencyCheck(DBBroker broker)
Method Detail

checkAll

public List checkAll(ConsistencyCheck.ProgressCallback callback)
Combines checkCollectionTree(ConsistencyCheck.ProgressCallback) and checkDocuments(ConsistencyCheck.ProgressCallback).

Parameters:
callback - the callback object to report to
Returns:
a list of ErrorReport objects or an empty list if no errors were found

checkCollectionTree

public List checkCollectionTree(ConsistencyCheck.ProgressCallback callback)
Run some tests on the collection hierarchy, starting at the root collection /db.

Parameters:
callback - callback object
Returns:
a list of ErrorReport instances describing the errors found

getDocumentCount

public int getDocumentCount()

checkDocuments

public List checkDocuments(ConsistencyCheck.ProgressCallback progress)
Run some tests on all documents stored in the database. The method checks if a document is readable and if its DOM representation is consistent.

Parameters:
progress - progress callback
Returns:
a list of ErrorReport instances describing the errors found

checkDocuments

public void checkDocuments(ConsistencyCheck.ProgressCallback progress,
                           List errorList)
Run some tests on all documents stored in the database. The method checks if a document is readable and if its DOM representation is consistent.

Parameters:
progress - progress callback
errorList - error reports will be added to this list, using instances of class ErrorReport.

checkXMLTree

public ErrorReport checkXMLTree(DocumentImpl doc)
Check the persistent DOM of a document. The method traverses the entire node tree and checks it for consistency, including node relationships, child and attribute counts etc.

Parameters:
doc - the document to check
Returns:
null if the document is consistent, an error report otherwise.


Copyright (C) Wolfgang Meier. All rights reserved.