org.opencms.report
Class A_CmsReportThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.opencms.report.A_CmsReportThread
All Implemented Interfaces:
java.lang.Runnable, I_CmsReportThread
Direct Known Subclasses:
CmsDatabaseImportThread, CmsExportThread, CmsExternalLinksValidatorThread, CmsModuleDeleteThread, CmsModuleReplaceThread, CmsProjectDeleteThread, CmsRelationsValidatorThread, CmsSynchronizeThread, CmsXmlContentRepairThread

public abstract class A_CmsReportThread
extends java.lang.Thread
implements I_CmsReportThread

Provides a common Thread class for the reports.

Since:
6.0.0
Version:
$Revision: 1.28 $
Author:
Alexander Kandzior

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected A_CmsReportThread(CmsObject cms, java.lang.String name)
          Constructs a new report Thread with the given name.
 
Method Summary
 void addError(java.lang.Object obj)
          Adds an error object to the list of errors that occurred during the report.
protected  CmsObject getCms()
          Returns the OpenCms context object this Thread is initialized with.
 java.lang.Throwable getError()
          Returns the error exception in case there was an error during the execution of this Thread, null otherwise.
 java.util.List getErrors()
          Returns a list of all errors that occurred during the report.
protected  I_CmsReport getReport()
          Returns the report where the output of this Thread is written to.
abstract  java.lang.String getReportUpdate()
          Returns the part of the report that is ready for output.
 long getRuntime()
          Returns the time this report has been running.
 CmsUUID getUUID()
          Returns the OpenCms UUID of this report thread.
 boolean hasError()
          Returns if the report generated an error output.
protected  void initHtmlReport(java.util.Locale locale)
          Initialize a HTML report for this Thread.
protected  void initOldHtmlReport(java.util.Locale locale)
          Initialize a HTML report for this Thread.
 boolean isDoomed()
          Returns true if this thread is already "doomed" to be deleted.
 
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
 
Methods inherited from interface org.opencms.report.I_CmsReportThread
start
 

Constructor Detail

A_CmsReportThread

protected A_CmsReportThread(CmsObject cms,
                            java.lang.String name)
Constructs a new report Thread with the given name.

Parameters:
cms - the current OpenCms context object
name - the name of the Thread
Method Detail

addError

public void addError(java.lang.Object obj)
Adds an error object to the list of errors that occurred during the report.

Parameters:
obj - the error object

getError

public java.lang.Throwable getError()
Returns the error exception in case there was an error during the execution of this Thread, null otherwise.

Returns:
the error exception in case there was an error, null otherwise

getErrors

public java.util.List getErrors()
Returns a list of all errors that occurred during the report.

Returns:
an error list that occurred during the report

getReportUpdate

public abstract java.lang.String getReportUpdate()
Returns the part of the report that is ready for output.

Returns:
the part of the report that is ready for output

getRuntime

public long getRuntime()
Returns the time this report has been running.

Returns:
the time this report has been running

getUUID

public CmsUUID getUUID()
Returns the OpenCms UUID of this report thread.

Specified by:
getUUID in interface I_CmsReportThread
Returns:
the OpenCms UUID of this report thread

hasError

public boolean hasError()
Returns if the report generated an error output.

Returns:
true if the report generated an error, otherwise false

isDoomed

public boolean isDoomed()
Returns true if this thread is already "doomed" to be deleted.

A OpenCms deamon Thread (the "Grim Reaper") will collect all doomed Threads, i.e. threads that are not longer active for some time.

Returns:
true if this thread is already "doomed" to be deleted

getCms

protected CmsObject getCms()
Returns the OpenCms context object this Thread is initialized with.

Returns:
the OpenCms context object this Thread is initialized with

getReport

protected I_CmsReport getReport()
Returns the report where the output of this Thread is written to.

Returns:
the report where the output of this Thread is written to

initHtmlReport

protected void initHtmlReport(java.util.Locale locale)
Initialize a HTML report for this Thread.

Parameters:
locale - the locale for the report output messages

initOldHtmlReport

protected void initOldHtmlReport(java.util.Locale locale)
Initialize a HTML report for this Thread.

This method is reserved for older report threads that still use XML templates to generate their output.

Parameters:
locale - the locale for the report output messages