org.ceryle.xnode.classifier
Class BackgroundClassifier

java.lang.Object
  extended by java.lang.Thread
      extended by org.ceryle.xnode.classifier.BackgroundClassifier
All Implemented Interfaces:
Runnable

public class BackgroundClassifier
extends Thread

Extends Thread to validate an XML Document, provided with a Swing document. If verbose is true, indicates with progress bar and error messages. If not, is silent (not even error messages). This makes a first pass in validating mode if the Document has a DOCTYPE declaration, then a second pass if that fails. If there is no DOCTYPE, just a WF parse.

This writes directly to the supplied MessageWriter since using the MessageHandler would signal activity and halt the process. Only errors are flagged, which will stop the process.

Author:
Murray Altheim

Nested Class Summary
 class BackgroundClassifier.ClassificationScheduler
          Extends Thread as a scheduler for classifying a list of XNodes.
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static boolean failOnError
          If true, upon an error on any single document kills all further processing of all documents.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BackgroundClassifier(Idler idler, MessageWriter messagewriter)
          Constructor provided with the Document to check.
 
Method Summary
protected  void classified(XNodeID xid)
          Called by an XNodeClassifier upon successful classification of the XNode identified by the XNodeID xid.
protected  void finished()
          Called at the end of the classification process, disabling further use of this instance.
protected  void halt()
          Called at the end of each ClassificationScheduler (there may be many).
 void kill()
          Interrupt any existing process, close the classifier and disable all further processes.
 void listErrors()
          List the documents with errors to the MessageHandler.
 void listNotFound()
          List the documents not found to the MessageHandler.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

failOnError

public static boolean failOnError
If true, upon an error on any single document kills all further processing of all documents. The default is false.

Constructor Detail

BackgroundClassifier

public BackgroundClassifier(Idler idler,
                            MessageWriter messagewriter)
                     throws ProcessException
Constructor provided with the Document to check.

Parameters:
idler - adds a IdlerListener to the Idler to trigger the beginning and ending of background processing.
messagewriter - the MessageWriter to receive messages and warnings.
Throws:
ProcessException
Method Detail

classified

protected void classified(XNodeID xid)
Called by an XNodeClassifier upon successful classification of the XNode identified by the XNodeID xid.


kill

public void kill()
Interrupt any existing process, close the classifier and disable all further processes.

Once killed the BackgroundClassifier stays dead. You never have to worry about it crawling across your bedroom floor at night, if that's the kind of thing you worry about.


finished

protected void finished()
Called at the end of the classification process, disabling further use of this instance.


halt

protected void halt()
Called at the end of each ClassificationScheduler (there may be many).


listNotFound

public void listNotFound()
List the documents not found to the MessageHandler.


listErrors

public void listErrors()
List the documents with errors to the MessageHandler.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.