Class ThreadedService
java.lang.Object
org.dlese.dpc.schemedit.threadedservices.MonitoredTask
org.dlese.dpc.schemedit.threadedservices.ThreadedService
- Direct Known Subclasses:
ExportingService,ValidatingService
Provides services over collections, such as Validation and Export, that run
in their own thread. Also manages reports generated by the services.
- Author:
- ostwald
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SimpleDataStoreprotected DcsDataManagerprotected DcsSetInfoprotected static booleanprotected SimpleLuceneIndexprotected booleanprotected booleanprotected static final intprotected ServletContextprotected SessionBeanprotected String[]protected booleanprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionThreadedService(ServletContext servletContext, String threadedServiceDataDir) Constructor for the ThreadedService object -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddStatusMessage(String msg) Adds a feature to the ValidatingMessage attribute of the ThreadedService objectprotected voidarchiveServiceReport(Report report) NOT YET DOCUMENTEDprotected StringbuildQuery(String collection, String[] statuses) Return a query string that will find records for the specified collection.voidNOT YET DOCUMENTEDprotected voidClear status messagesgetArchivedReport(String collection) Gets the archivedReport attribute of the ThreadedService objectGets the archivedReports attribute of the ThreadedService objectstatic StringReturn a string for the current time and date, sutiable for display in log files and output to standout:protected XMLDocReadergetDocReader(String id) convience method to retrieve the docReader given a record idprotected ListBuild a list of record ids from the results of a query for specified collection and statuses.booleanGets the indexOnValidation attribute of the ThreadedService objectbooleanGets the isProcessing attribute of the ThreadedService objectGets the serviceReport attribute of the ThreadedService objectGets the sessionId attribute of the ThreadedService objectstatic StringReturn a string for the current time and date, sutiable for display in log files and output to standout:Gets the statusMessages attribute of the ThreadedService objectprotected Stringlist2delimitedString(List list, String delimiter) Creates a delimited string from the provided listprotected voidsetDcsSetInfo(DcsSetInfo setInfo) Sets the dcsSetInfo attribute of the ThreadedService objectvoidsetIndexOnValidation(boolean indexOnValidation) Sets the indexOnValidation attribute of the ThreadedService objectvoidsetServiceReport(Report report) Sets the serviceReport attribute of the ThreadedService objectprotected voidsetStatuses(String[] statuses) Sets the statuses attribute of the ThreadedService objectvoidsetValidationEnabled(boolean validateFiles) Sets whether or not to validate the files being indexed.voidHalts a threaded service.protected voidvalidate(XMLDocReader docReader, DcsDataRecord dcsDataRecord) NOT YET DOCUMENTEDprotected booleanvalidationIsStale(File sourceFile, XMLDocReader docReader) Test to see if record has been modified outside of DCS.Methods inherited from class org.dlese.dpc.schemedit.threadedservices.MonitoredTask
getTaskProgress, setTaskProgress
-
Field Details
-
debug
protected static boolean debug -
NUM_STATUS_MESSAGES
protected static final int NUM_STATUS_MESSAGES- See Also:
-
dcsSetInfo
-
sessionBean
-
dataStore
-
servletContext
-
index
-
dcsDataManager
-
validateFiles
protected boolean validateFiles -
indexOnValidation
protected boolean indexOnValidation -
statuses
-
isProcessing
protected boolean isProcessing -
stopProcessing
protected boolean stopProcessing
-
-
Constructor Details
-
ThreadedService
Constructor for the ThreadedService object- Parameters:
servletContext- NOT YET DOCUMENTEDthreadedServiceDataDir- NOT YET DOCUMENTED
-
-
Method Details
-
getIsProcessing
public boolean getIsProcessing()Gets the isProcessing attribute of the ThreadedService object- Specified by:
getIsProcessingin classMonitoredTask- Returns:
- The isProcessing value
-
getIndexOnValidation
public boolean getIndexOnValidation()Gets the indexOnValidation attribute of the ThreadedService object- Returns:
- The indexOnValidation value
-
validate
NOT YET DOCUMENTED- Parameters:
docReader- NOT YET DOCUMENTEDdcsDataRecord- NOT YET DOCUMENTED
-
getDocReader
convience method to retrieve the docReader given a record id- Parameters:
id- NOT YET DOCUMENTED- Returns:
- The docReader value
-
validationIsStale
Test to see if record has been modified outside of DCS.- Parameters:
sourceFile- file on diskdocReader- the docReader- Returns:
- true if file has changed on disk
-
getIdList
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 DOCUMENTEDstatuses- NOT YET DOCUMENTED- Returns:
- The idList value
-
list2delimitedString
Creates a delimited string from the provided list- Parameters:
list- a list to be coverteddelimiter- delimiter used to separate items- Returns:
- delmited string of list items
-
getSessionId
Gets the sessionId attribute of the ThreadedService object- Returns:
- The sessionId value
-
stopProcessing
public void stopProcessing()Halts a threaded service. -
buildQuery
Return a query string that will find records for the specified collection.- Parameters:
collection- collectionKeystatuses- 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
Adds a feature to the ValidatingMessage attribute of the ThreadedService object- Parameters:
msg- The feature to be added to the ValidatingMessage attribute
-
getStatusMessages
Gets the statusMessages attribute of the ThreadedService object- Returns:
- The statusMessages value
-
getServiceReport
Gets the serviceReport attribute of the ThreadedService object- Returns:
- The serviceReport value
-
setServiceReport
Sets the serviceReport attribute of the ThreadedService object- Parameters:
report- The new serviceReport value
-
setDcsSetInfo
Sets the dcsSetInfo attribute of the ThreadedService object- Parameters:
setInfo- The new dcsSetInfo value- Throws:
Exception- NOT YET DOCUMENTED
-
setStatuses
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
NOT YET DOCUMENTED- Parameters:
report- NOT YET DOCUMENTED
-
getArchivedReport
Gets the archivedReport attribute of the ThreadedService object- Parameters:
collection- NOT YET DOCUMENTED- Returns:
- The archivedReport value
-
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
Return a string for the current time and date, sutiable for display in log files and output to standout:- Returns:
- The dateStamp value
-
getDateStamp
Return a string for the current time and date, sutiable for display in log files and output to standout:- Returns:
- The dateStamp value
-