Package org.opencms.report
Class A_CmsReportThread
- java.lang.Object
-
- java.lang.Thread
-
- org.opencms.report.A_CmsReportThread
-
- All Implemented Interfaces:
java.lang.Runnable
,I_CmsReportThread
- Direct Known Subclasses:
CmsCreateSiteThread
,CmsDatabaseImportThread
,CmsExportThread
,CmsExternalLinksValidatorThread
,CmsExternalLinksValidatorThread
,CmsHistoryClearThread
,CmsImportUserThread
,CmsIndexingReportThread
,CmsModuleDeleteThread
,CmsModuleImportThread
,CmsModuleReplaceThread
,CmsProjectDeleteThread
,CmsRelationsValidatorThread
,CmsRemovePropertyFromResourcesThread
,CmsRemovePubLocksThread
,CmsSearchReplaceThread
,CmsShellScriptThread
,CmsSitesWebserverThread
,CmsStaticExportThread
,CmsSynchronizeThread
,CmsSynchronizeThread
,CmsTemplateMappingContentRewriter
,CmsUserDataReportThread
,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
-
-
Field Summary
Fields Modifier and Type Field Description protected I_CmsReport
m_report
The report that belongs to the thread.
-
Constructor Summary
Constructors Modifier Constructor Description protected
A_CmsReportThread(CmsObject cms, java.lang.String name)
Constructs a new report Thread with the given name.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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<java.lang.Object>
getErrors()
Returns a list of all errors that occurred during the report.long
getLastEntryTime()
Returns the time of last report entry.java.lang.Object
getLogChannel()
Returns the logger to which the report output should also be directed.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.java.lang.String
getReportUpdate(I_CmsReportUpdateFormatter formatter)
Gets the report update content using the specified report update formatter.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)
Deprecated.boolean
isDoomed()
Returns true if this thread is already "doomed" to be deleted.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opencms.report.I_CmsReportThread
start
-
-
-
-
Field Detail
-
m_report
protected I_CmsReport m_report
The report that belongs to the thread.
-
-
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 objectname
- 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<java.lang.Object> getErrors()
Returns a list of all errors that occurred during the report.- Returns:
- an error list that occurred during the report
-
getLastEntryTime
public long getLastEntryTime()
Returns the time of last report entry.Will return zero if no entry has been written.
- Returns:
- time of last report entry
-
getLogChannel
public java.lang.Object getLogChannel()
Returns the logger to which the report output should also be directed.If this returns null, report output is not sent to a logger.
- Returns:
- the logger to which report output should be sent.
-
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
-
getReportUpdate
public java.lang.String getReportUpdate(I_CmsReportUpdateFormatter formatter)
Gets the report update content using the specified report update formatter.- Parameters:
formatter
- the report update formatter- Returns:
- the report 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 interfaceI_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
@Deprecated protected void initOldHtmlReport(java.util.Locale locale)
Deprecated.Initialize a HTML report for this Thread.This method is reserved for older report threads that still use XML templates to generate their output.
This report type will not work correctly with the new workplace, so don't use it anymore.
- Parameters:
locale
- the locale for the report output messages
-
-