Class ThreadedService

java.lang.Object
org.dlese.dpc.schemedit.threadedservices.MonitoredTask
org.dlese.dpc.schemedit.threadedservices.ThreadedService
Direct Known Subclasses:
ExportingService, ValidatingService

public abstract class ThreadedService extends MonitoredTask
Provides services over collections, such as Validation and Export, that run in their own thread. Also manages reports generated by the services.
Author:
ostwald
  • Field Details

    • debug

      protected static boolean debug
    • NUM_STATUS_MESSAGES

      protected static final int NUM_STATUS_MESSAGES
      See Also:
    • dcsSetInfo

      protected DcsSetInfo dcsSetInfo
    • sessionBean

      protected SessionBean sessionBean
    • dataStore

      protected SimpleDataStore dataStore
    • servletContext

      protected ServletContext servletContext
    • index

      protected SimpleLuceneIndex index
    • dcsDataManager

      protected DcsDataManager dcsDataManager
    • validateFiles

      protected boolean validateFiles
    • indexOnValidation

      protected boolean indexOnValidation
    • statuses

      protected String[] statuses
    • isProcessing

      protected boolean isProcessing
    • stopProcessing

      protected boolean stopProcessing
  • Constructor Details

    • ThreadedService

      public ThreadedService(ServletContext servletContext, String threadedServiceDataDir)
      Constructor for the ThreadedService object
      Parameters:
      servletContext - NOT YET DOCUMENTED
      threadedServiceDataDir - NOT YET DOCUMENTED
  • Method Details

    • getIsProcessing

      public boolean getIsProcessing()
      Gets the isProcessing attribute of the ThreadedService object
      Specified by:
      getIsProcessing in class MonitoredTask
      Returns:
      The isProcessing value
    • getIndexOnValidation

      public boolean getIndexOnValidation()
      Gets the indexOnValidation attribute of the ThreadedService object
      Returns:
      The indexOnValidation value
    • validate

      protected void validate(XMLDocReader docReader, DcsDataRecord dcsDataRecord)
      NOT YET DOCUMENTED
      Parameters:
      docReader - NOT YET DOCUMENTED
      dcsDataRecord - NOT YET DOCUMENTED
    • getDocReader

      protected XMLDocReader getDocReader(String id)
      convience method to retrieve the docReader given a record id
      Parameters:
      id - NOT YET DOCUMENTED
      Returns:
      The docReader value
    • validationIsStale

      protected boolean validationIsStale(File sourceFile, XMLDocReader docReader)
      Test to see if record has been modified outside of DCS.
      Parameters:
      sourceFile - file on disk
      docReader - the docReader
      Returns:
      true if file has changed on disk
    • getIdList

      protected List getIdList(String collection, String[] statuses)
      Build a list of record ids from the results of a query for specified collection and statuses. This list is used by validate and export to iterate over items to process. The reason we don't use the resultDocs obtained by querying the index is that, for long result lists, the index may change out from under the resultDocs, causing the resultDocs to be unreliable.
      Parameters:
      collection - NOT YET DOCUMENTED
      statuses - NOT YET DOCUMENTED
      Returns:
      The idList value
    • list2delimitedString

      protected String list2delimitedString(List list, String delimiter)
      Creates a delimited string from the provided list
      Parameters:
      list - a list to be coverted
      delimiter - delimiter used to separate items
      Returns:
      delmited string of list items
    • getSessionId

      public String getSessionId()
      Gets the sessionId attribute of the ThreadedService object
      Returns:
      The sessionId value
    • stopProcessing

      public void stopProcessing()
      Halts a threaded service.
    • buildQuery

      protected String buildQuery(String collection, String[] statuses)
      Return a query string that will find records for the specified collection.
      Parameters:
      collection - collectionKey
      statuses - statuses to be included in query
      Returns:
      a query string to find items in collection with specified statuses
    • clearStatusMessages

      protected void clearStatusMessages()
      Clear status messages
    • addStatusMessage

      protected void addStatusMessage(String msg)
      Adds a feature to the ValidatingMessage attribute of the ThreadedService object
      Parameters:
      msg - The feature to be added to the ValidatingMessage attribute
    • getStatusMessages

      public ArrayList getStatusMessages()
      Gets the statusMessages attribute of the ThreadedService object
      Returns:
      The statusMessages value
    • getServiceReport

      public Report getServiceReport()
      Gets the serviceReport attribute of the ThreadedService object
      Returns:
      The serviceReport value
    • setServiceReport

      public void setServiceReport(Report report)
      Sets the serviceReport attribute of the ThreadedService object
      Parameters:
      report - The new serviceReport value
    • setDcsSetInfo

      protected void setDcsSetInfo(DcsSetInfo setInfo) throws Exception
      Sets the dcsSetInfo attribute of the ThreadedService object
      Parameters:
      setInfo - The new dcsSetInfo value
      Throws:
      Exception - NOT YET DOCUMENTED
    • setStatuses

      protected void setStatuses(String[] statuses) throws Exception
      Sets the statuses attribute of the ThreadedService object
      Parameters:
      statuses - The new statuses value
      Throws:
      Exception - NOT YET DOCUMENTED
    • clearServiceReport

      public void clearServiceReport()
      NOT YET DOCUMENTED
    • archiveServiceReport

      protected void archiveServiceReport(Report report)
      NOT YET DOCUMENTED
      Parameters:
      report - NOT YET DOCUMENTED
    • getArchivedReport

      public Report getArchivedReport(String collection)
      Gets the archivedReport attribute of the ThreadedService object
      Parameters:
      collection - NOT YET DOCUMENTED
      Returns:
      The archivedReport value
    • getArchivedReports

      public List getArchivedReports()
      Gets the archivedReports attribute of the ThreadedService object
      Returns:
      The archivedReports value
    • setValidationEnabled

      public void setValidationEnabled(boolean validateFiles)
      Sets whether or not to validate the files being indexed. If set to true, the files will be validated, otherwise they will not. Default is true.
      Parameters:
      validateFiles - True to validate, else false.
      See Also:
    • setIndexOnValidation

      public void setIndexOnValidation(boolean indexOnValidation)
      Sets the indexOnValidation attribute of the ThreadedService object
      Parameters:
      indexOnValidation - The new indexOnValidation value
    • getSimpleDateStamp

      public static String getSimpleDateStamp()
      Return a string for the current time and date, sutiable for display in log files and output to standout:
      Returns:
      The dateStamp value
    • getDateStamp

      public static String getDateStamp()
      Return a string for the current time and date, sutiable for display in log files and output to standout:
      Returns:
      The dateStamp value