public final class ScheduledHarvestManager
extends java.lang.Object
Constructor and Description |
---|
ScheduledHarvestManager(SimpleDataStore dataStore,
java.io.File initialHarvestDir,
SimpleLuceneIndex harvestLogIndex,
int timeOutMilliseconds)
Constructor for the ScheduledHarvestManager
|
Modifier and Type | Method and Description |
---|---|
void |
addScheduledHarvest(ScheduledHarvest sh)
Adds a ScheduledHarvest to this manager or replaces an existing one with the same ID.
|
boolean |
containsScheduledHarvest(java.lang.Long shUid)
Determines whether the given ScheduledHarvest ID is in this manager.
|
boolean |
containsValue(ScheduledHarvest sh)
Determine whether the given ScheduledHarvest value is in this manager.
|
static java.lang.String |
getDateStamp()
Return a string for the current time and date, sutiable for display in log files and output to standout:
|
java.io.File |
getHarvestDir()
Gets the harvestDir attribute of the ScheduledHarvestManager object
|
static java.util.Date |
getHarvestStartDate(java.lang.String startTimeString)
Gets the date and time to begin the harvest by parsing a String in 24 hour time format such as 12:24 or
23:15.
|
ScheduledHarvest |
getScheduledHarvest(java.lang.Long shUid)
Gets the scheduledHarvest, or null if none exists.
|
java.util.Hashtable |
getScheduledHarvests()
Gets all scheduledHarvests in this this manager.
|
void |
harvestNow(java.lang.Long shUid,
boolean harvestAll,
boolean harvestAllIfNoDeletedRecord)
Harvests the given ScheduledHarvest immediately, if not already running.
|
boolean |
isRunning(java.lang.Long shUid)
Determines wheter the given ScheduledHarvest is currently running.
|
boolean |
isRunningOneTimeHarvest(ScheduledHarvest sh)
Determines whether a given ScheduledHarvest is already running.
|
void |
oneTimeHarvest(ScheduledHarvest sh,
java.util.Date from,
java.util.Date until,
java.io.File harvestDir,
boolean harvestAllIfNoDeletedRecord)
Performs a one-time only harvest in the background.
|
void |
removeInProgresstLogEntries()
Removes log entries showing entrytype status inprogress and replaces them with an error message
indicateing that the given harvest was terminated by a server shut-down or crash.
|
void |
removeScheduledHarvest(java.lang.Long shUid,
boolean deletefiles)
Removes the given ScheduledHarvest.
|
static void |
setDebug(boolean db)
Sets the debug attribute object
|
void |
setHarvestDir(java.io.File harvestDir)
Sets the harvestDir attribute of the ScheduledHarvestManager object
|
void |
stopAllHarvests()
Stops all running harvests gracefully.
|
void |
stopTimerThread(java.lang.Long shUid)
Stops the timer
|
public ScheduledHarvestManager(SimpleDataStore dataStore, java.io.File initialHarvestDir, SimpleLuceneIndex harvestLogIndex, int timeOutMilliseconds)
dataStore
- The data store that will hold persistent data for this manager.initialHarvestDir
- The initial directory where harvested files will be saved.harvestLogIndex
- The harvest log index used to log harvests.timeOutMilliseconds
- Number of milliseconds the harvester will wait for a response from the data
provider before timing outpublic void removeInProgresstLogEntries()
public void setHarvestDir(java.io.File harvestDir)
harvestDir
- The new harvestDir valuepublic java.io.File getHarvestDir()
public boolean isRunning(java.lang.Long shUid)
shUid
- ScheduledHarvest ID.public java.util.Hashtable getScheduledHarvests()
public ScheduledHarvest getScheduledHarvest(java.lang.Long shUid)
shUid
- The ID of the item to retrieve.public void addScheduledHarvest(ScheduledHarvest sh)
sh
- The ScheduledHarvest to add.public void removeScheduledHarvest(java.lang.Long shUid, boolean deletefiles)
shUid
- ScheduledHarvest ID to removedeletefiles
- Description of the Parameterpublic boolean containsScheduledHarvest(java.lang.Long shUid)
shUid
- ScheduledHarvest IDpublic boolean containsValue(ScheduledHarvest sh)
sh
- ScheduledHarvestpublic void harvestNow(java.lang.Long shUid, boolean harvestAll, boolean harvestAllIfNoDeletedRecord)
shUid
- Uid of the ScheduledHarvest.harvestAll
- True to havest all records, false to havest only records changed
since the previous harvest.harvestAllIfNoDeletedRecord
- True to harvest all records from scratch if deleted records are not
supportedpublic boolean isRunningOneTimeHarvest(ScheduledHarvest sh)
sh
- The ScheduledHarvestpublic void oneTimeHarvest(ScheduledHarvest sh, java.util.Date from, java.util.Date until, java.io.File harvestDir, boolean harvestAllIfNoDeletedRecord)
sh
- A ScheduledHarvest with appropriate settings.from
- From Dateuntil
- Until DateharvestDir
- Directory where harvested records will be saved.harvestAllIfNoDeletedRecord
- True to harvest all records from scratch if deleted records are not
supportedpublic void stopAllHarvests()
public void stopTimerThread(java.lang.Long shUid)
shUid
- The uid of the ScheduledHarvest.public static java.util.Date getHarvestStartDate(java.lang.String startTimeString) throws java.text.ParseException
startTimeString
- The hour and minute in 24 hour time, for example 23:15java.text.ParseException
- If unable to parsepublic static java.lang.String getDateStamp()
public static void setDebug(boolean db)
db
- The new debug value