Class A_CmsReportThread

java.lang.Object
java.lang.Thread
org.opencms.report.A_CmsReportThread
All Implemented Interfaces:
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 Thread implements I_CmsReportThread
Provides a common Thread class for the reports.

Since:
6.0.0
  • Field Details

  • Constructor Details

    • A_CmsReportThread

      protected A_CmsReportThread(CmsObject cms, 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 Details

    • addError

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

      Parameters:
      obj - the error object
    • getError

      public 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 List<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

      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 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

      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 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(Locale locale)
      Initialize a HTML report for this Thread.

      Parameters:
      locale - the locale for the report output messages
    • initOldHtmlReport

      @Deprecated protected void initOldHtmlReport(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