org.ceryle.wiki.plugin.assertion
Class AssertionCrawler

java.lang.Object
  extended by java.lang.Thread
      extended by org.ceryle.wiki.plugin.assertion.AssertionCrawler
All Implemented Interfaces:
Runnable

public class AssertionCrawler
extends Thread

This class extends Thread as a wiki site crawler, whose aim is to synchronize the AssertionHandler's cache with the wiki's set of pages. This populates the provided Map with the current set of wiki pages, the key being the page, the values either null or a List containing the Assertions for that page.

Author:
Murray Altheim

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AssertionCrawler(AssertionHandler handler, Set pagecache, ActionListener listener)
          Constructor with the AssertionHandler to service and its page cache.
 
Method Summary
protected  void fireEvent(String command)
          Fires an ActionEvent with the provided command name to the registered listener, if available.
 Set getCache()
           
 void run()
           
 
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, 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
 

Constructor Detail

AssertionCrawler

public AssertionCrawler(AssertionHandler handler,
                        Set pagecache,
                        ActionListener listener)
Constructor with the AssertionHandler to service and its page cache. The cache which can be obtained via getCache(), and will contain the names of pages. If an ActionListener is provided, it will receive an ActionEvent with an action command of AssertionHandler.SYNCHRONIZED upon successful completion, AssertionHandler.UNSYNCHRONIZED if any errors occurred. Once the thread has completed, the listener is removed from the WikiEventManager.

Parameters:
handler - the AssertionHandler to update.
pagecache - the optional page cache (as a Set)
listener - an optional listener that will receive an ActionEvent upon completion
Method Detail

getCache

public Set getCache()

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

fireEvent

protected final void fireEvent(String command)
Fires an ActionEvent with the provided command name to the registered listener, if available.

Parameters:
command - the name of the action fired.


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