org.apache.manifoldcf.crawler.jobs
Class Jobs

java.lang.Object
  extended by org.apache.manifoldcf.core.database.BaseTable
      extended by org.apache.manifoldcf.crawler.jobs.Jobs

public class Jobs
extends BaseTable

This class manages the jobs table.


Nested Class Summary
protected static class Jobs.JobObjectDescription
          Job object description class.
protected static class Jobs.JobObjectExecutor
          This is the executor object for locating job objects.
 
Field Summary
static java.lang.String _rcsid
           
protected  ICacheManager cacheManager
           
protected  IRepositoryConnectionManager connectionMgr
           
static java.lang.String connectionNameField
           
static java.lang.String descriptionField
           
static java.lang.String documentSpecField
           
static java.lang.String endTimeField
          If inactive, the end time of the LAST session, if any.
static java.lang.String errorField
          If non-null, this is the last error that occurred (which aborted the last task, either running the job or doing the delete cleanup).
static java.lang.String expirationField
          This is the expiration time of documents for a given job (in ms.)
static int HOPCOUNT_ACCURATE
           
static int HOPCOUNT_NEVERDELETE
           
static int HOPCOUNT_NODELETE
           
static java.lang.String hopcountModeField
          For a job whose connector supports hopcounts, this describes how those hopcounts are handled.
protected  HopFilterManager hopFilterManager
           
protected static java.util.Map hopmodeMap
           
static java.lang.String idField
           
static java.lang.String intervalField
          This is the minimum reschedule interval for a document being crawled adaptively (in ms.)
static java.lang.String lastCheckTimeField
          The time of the LAST session, if any.
static java.lang.String lastTimeField
          The last time this job was assessed, in ms.
protected  IOutputConnectionManager outputMgr
           
static java.lang.String outputNameField
           
static java.lang.String outputSpecField
           
static java.lang.String priorityField
          This is the job's priority vs.
static java.lang.String reseedIntervalField
          If this is an adaptive job, what should the reseed interval be (in milliseconds)
static java.lang.String reseedTimeField
          For an adaptive job, this is the next time to reseed the job.
protected  ScheduleManager scheduleManager
           
static int START_DISABLE
           
static int START_WINDOWBEGIN
           
static int START_WINDOWINSIDE
           
protected static java.util.Map startMap
           
static java.lang.String startMethodField
          How/when to start the job
static java.lang.String startTimeField
          If active, paused, activewait, or pausedwait, the start time of the current session, else null.
static int STATUS_ABORTING
           
static int STATUS_ABORTINGFORRESTART
           
static int STATUS_ABORTINGFORRESTARTSEEDING
           
static int STATUS_ABORTINGSEEDING
           
static int STATUS_ABORTINGSTARTINGUP
           
static int STATUS_ABORTINGSTARTINGUPFORRESTART
           
static int STATUS_ACTIVE
           
static int STATUS_ACTIVE_NEITHER
           
static int STATUS_ACTIVE_NOOUTPUT
           
static int STATUS_ACTIVE_UNINSTALLED
           
static int STATUS_ACTIVESEEDING
           
static int STATUS_ACTIVESEEDING_NEITHER
           
static int STATUS_ACTIVESEEDING_NOOUTPUT
           
static int STATUS_ACTIVESEEDING_UNINSTALLED
           
static int STATUS_ACTIVEWAIT
           
static int STATUS_ACTIVEWAITSEEDING
           
static int STATUS_DELETESTARTINGUP
           
static int STATUS_DELETING
           
static int STATUS_DELETING_NOOUTPUT
           
static int STATUS_INACTIVE
           
static int STATUS_NOTIFYINGOFCOMPLETION
           
static int STATUS_PAUSED
           
static int STATUS_PAUSEDSEEDING
           
static int STATUS_PAUSEDWAIT
           
static int STATUS_PAUSEDWAITSEEDING
           
static int STATUS_READYFORDELETE
           
static int STATUS_READYFORNOTIFY
           
static int STATUS_READYFORSTARTUP
           
static int STATUS_SHUTTINGDOWN
           
static int STATUS_STARTINGUP
           
static java.lang.String statusField
          Status of this job.
protected static java.util.Map statusMap
           
protected  IThreadContext threadContext
           
static int TYPE_CONTINUOUS
           
static int TYPE_SPECIFIED
           
static java.lang.String typeField
           
protected static java.util.Map typeMap
           
static java.lang.String windowEndField
          If non-null, this is the time that the current execution window closes, in ms since epoch.
 
Fields inherited from class org.apache.manifoldcf.core.database.BaseTable
dbInterface, tableName
 
Constructor Summary
Jobs(IThreadContext threadContext, IDBInterface database)
          Constructor.
 
Method Summary
 boolean abortJob(java.lang.Long jobID, java.lang.String errorText)
          Abort a job.
 void abortRestartJob(java.lang.Long jobID)
          Restart a job.
 boolean activeJobsPresent()
          Return true if there is a job in either the ACTIVE or the ACTIVESEEDING state.
 void analyzeTables()
          Analyze job tables that need analysis.
 boolean checkIfOutputReference(java.lang.String connectionName)
          See if there's a reference to an output connection name.
 boolean checkIfReference(java.lang.String connectionName)
          See if there's a reference to a connection name.
 boolean checkJobActive(java.lang.Long jobID)
          Check whether a job's status indicates that it is in ACTIVE or ACTIVESEEDING state.
 boolean cleaningJobsPresent()
          Return true if there is a job in the SHUTTINGDOWN state.
 IJobDescription create()
          Create a job.
 void deinstall()
          Uninstall.
 void delete(java.lang.Long id)
          Delete a job.
 boolean deletingJobsPresent()
          Return true if there is a job in the DELETING state.
static java.lang.String enumeratedValueToString(EnumeratedValues values)
          Go from enumerated value to string.
 IJobDescription[] findJobsForConnection(java.lang.String connectionName)
          Get the job IDs associated with a given connection name.
 void finishAbortJob(java.lang.Long jobID, long abortTime)
          Finish a job (abort).
 void finishJob(java.lang.Long jobID, long finishTime)
          Finish a job.
 java.lang.String[] getActiveConnectionNames()
          Get unique connection names for all active jobs.
 IResultSet getActiveJobConnections()
          Get a list of active job identifiers and their associated connection names.
 IJobDescription[] getAll()
          Get a list of all jobs which are not in the process of being deleted already.
 int getAnalyzeTime()
          Come up with a maximum time (in minutes) for re-analyzing tables.
protected static java.lang.String getJobIDKey(java.lang.Long jobID)
           
protected  void getJobsChunk(java.util.Map returnValues, java.lang.String idList, java.util.ArrayList params)
          Read a chunk of repository connections.
protected static java.lang.String getJobsKey()
           
protected  JobDescription[] getJobsMultiple(java.lang.Long[] ids)
          Get multiple jobs (without caching)
protected static java.lang.String getJobStatusKey()
           
 boolean hasPriorityJobs(int priority)
          Are there any jobs that have a specified priority level
static java.lang.String hopcountModeToString(int value)
          Go from hopcount mode to string.
 void install(java.lang.String outputTableName, java.lang.String outputNameField, java.lang.String connectionTableName, java.lang.String connectionNameField)
          Install or upgrade this table.
 IJobDescription load(java.lang.Long id, boolean readOnly)
          Load a job for editing.
 IJobDescription[] loadMultiple(java.lang.Long[] ids, boolean[] readOnlies)
          Load multiple jobs for editing.
 void noteConnectionChange(java.lang.String connectionName)
          Note a change in connection configuration.
 void noteConnectorDeregistration(java.lang.Long jobID, int oldStatusValue)
          Signal to a job that its underlying connector has gone away.
 void noteConnectorRegistration(java.lang.Long jobID, int oldStatusValue)
          Signal to a job that its underlying connector has returned.
 void noteJobDeleteStarted(java.lang.Long jobID, long startTime)
          Put job into "deleting" state, and set the start time field.
 void noteJobSeeded(java.lang.Long jobID, long seedTime)
          Note job seeded.
 void noteJobStarted(java.lang.Long jobID, long startTime)
          Make job active, and set the start time field.
 void noteOutputConnectionChange(java.lang.String connectionName)
          Note a change in output connection configuration.
 void noteOutputConnectorDeregistration(java.lang.Long jobID, int oldStatusValue)
          Signal to a job that its underlying output connector has gone away.
 void noteOutputConnectorRegistration(java.lang.Long jobID, int oldStatusValue)
          Signal to a job that its underlying output connector has returned.
 void notificationComplete(java.lang.Long jobID)
          Mark job as having properly notified the output connector of completion.
 void pauseJob(java.lang.Long jobID)
          Pause a job.
 ScheduleRecord[][] readScheduleRecords(java.lang.Long[] jobIDs)
          Read schedule records for a specified set of jobs.
 void resetDeleteStartupWorkerStatus()
          Reset delete startup worker thread status.
 void resetNotificationWorkerStatus()
          Reset notification worker thread status.
 void resetSeedingWorkerStatus()
          Reset as part of restoring seeding worker threads.
 void resetStartupWorkerStatus()
          Reset startup worker thread status.
 void restart()
          This method is called on a restart.
 void restartJob(java.lang.Long jobID)
          Restart a job.
 void returnJobToActive(java.lang.Long jobID)
          Put job back into active state, from the shutting-down state.
 void save(IJobDescription jobDescription)
          Save a job description.
 void startJob(java.lang.Long jobID, java.lang.Long windowEnd)
          Write job status and window end, and clear the endtime field.
static java.lang.String startMethodToString(int startMethod)
          Get from start method to string.
static java.lang.String statusToString(int status)
          Go from status to string.
static EnumeratedValues stringToEnumeratedValue(java.lang.String value)
          Go from string to enumerated value.
static int stringToHopcountMode(java.lang.String value)
          Go from string to hopcount mode.
static int stringToStartMethod(java.lang.String value)
          Go from string to start method.
static int stringToStatus(java.lang.String value)
          Go from string to status.
static int stringToType(java.lang.String value)
          Go from string to type.
static java.lang.String typeToString(int type)
          Go from type to string.
 void unwaitJob(java.lang.Long jobID, int newStatus, java.lang.Long windowEnd)
          Cause job that is in "wait" state to become un-waited.
 void updateLastTime(java.lang.Long jobID, long currentTime)
          Update a job's last-time field.
 void waitJob(java.lang.Long jobID, int newStatus)
          Cause job that is in active or paused state to become waited.
 void writeStatus(java.lang.Long jobID, int status)
          Update a job's status.
 void writeStatus(java.lang.Long jobID, int status, java.lang.Long reseedTime)
          Update a job's status, and its reseed time.
 
Methods inherited from class org.apache.manifoldcf.core.database.BaseTable
addTableIndex, analyzeTable, beginTransaction, constructDistinctOnClause, constructOffsetLimitClause, constructRegexpClause, constructSubstringClause, endTransaction, getDatabaseCacheKey, getDBInterface, getMaxInClause, getMaxOrClause, getTableIndexes, getTableName, getTableSchema, getTransactionID, makeTableKey, noteModifications, performAddIndex, performAlter, performCreate, performDelete, performDrop, performInsert, performLock, performModification, performQuery, performQuery, performRemoveIndex, performUpdate, prepareRowForSave, readRow, reindexTable, signalRollback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rcsid

public static final java.lang.String _rcsid
See Also:
Constant Field Values

STATUS_INACTIVE

public static final int STATUS_INACTIVE
See Also:
Constant Field Values

STATUS_ACTIVE

public static final int STATUS_ACTIVE
See Also:
Constant Field Values

STATUS_PAUSED

public static final int STATUS_PAUSED
See Also:
Constant Field Values

STATUS_SHUTTINGDOWN

public static final int STATUS_SHUTTINGDOWN
See Also:
Constant Field Values

STATUS_ACTIVEWAIT

public static final int STATUS_ACTIVEWAIT
See Also:
Constant Field Values

STATUS_PAUSEDWAIT

public static final int STATUS_PAUSEDWAIT
See Also:
Constant Field Values

STATUS_ABORTING

public static final int STATUS_ABORTING
See Also:
Constant Field Values

STATUS_STARTINGUP

public static final int STATUS_STARTINGUP
See Also:
Constant Field Values

STATUS_ABORTINGSTARTINGUP

public static final int STATUS_ABORTINGSTARTINGUP
See Also:
Constant Field Values

STATUS_READYFORSTARTUP

public static final int STATUS_READYFORSTARTUP
See Also:
Constant Field Values

STATUS_READYFORDELETE

public static final int STATUS_READYFORDELETE
See Also:
Constant Field Values

STATUS_ACTIVESEEDING

public static final int STATUS_ACTIVESEEDING
See Also:
Constant Field Values

STATUS_ABORTINGSEEDING

public static final int STATUS_ABORTINGSEEDING
See Also:
Constant Field Values

STATUS_PAUSEDSEEDING

public static final int STATUS_PAUSEDSEEDING
See Also:
Constant Field Values

STATUS_ACTIVEWAITSEEDING

public static final int STATUS_ACTIVEWAITSEEDING
See Also:
Constant Field Values

STATUS_PAUSEDWAITSEEDING

public static final int STATUS_PAUSEDWAITSEEDING
See Also:
Constant Field Values

STATUS_ABORTINGFORRESTART

public static final int STATUS_ABORTINGFORRESTART
See Also:
Constant Field Values

STATUS_ABORTINGFORRESTARTSEEDING

public static final int STATUS_ABORTINGFORRESTARTSEEDING
See Also:
Constant Field Values

STATUS_ABORTINGSTARTINGUPFORRESTART

public static final int STATUS_ABORTINGSTARTINGUPFORRESTART
See Also:
Constant Field Values

STATUS_READYFORNOTIFY

public static final int STATUS_READYFORNOTIFY
See Also:
Constant Field Values

STATUS_NOTIFYINGOFCOMPLETION

public static final int STATUS_NOTIFYINGOFCOMPLETION
See Also:
Constant Field Values

STATUS_DELETING

public static final int STATUS_DELETING
See Also:
Constant Field Values

STATUS_DELETESTARTINGUP

public static final int STATUS_DELETESTARTINGUP
See Also:
Constant Field Values

STATUS_ACTIVE_UNINSTALLED

public static final int STATUS_ACTIVE_UNINSTALLED
See Also:
Constant Field Values

STATUS_ACTIVESEEDING_UNINSTALLED

public static final int STATUS_ACTIVESEEDING_UNINSTALLED
See Also:
Constant Field Values

STATUS_ACTIVE_NOOUTPUT

public static final int STATUS_ACTIVE_NOOUTPUT
See Also:
Constant Field Values

STATUS_ACTIVESEEDING_NOOUTPUT

public static final int STATUS_ACTIVESEEDING_NOOUTPUT
See Also:
Constant Field Values

STATUS_ACTIVE_NEITHER

public static final int STATUS_ACTIVE_NEITHER
See Also:
Constant Field Values

STATUS_ACTIVESEEDING_NEITHER

public static final int STATUS_ACTIVESEEDING_NEITHER
See Also:
Constant Field Values

STATUS_DELETING_NOOUTPUT

public static final int STATUS_DELETING_NOOUTPUT
See Also:
Constant Field Values

TYPE_CONTINUOUS

public static final int TYPE_CONTINUOUS
See Also:
Constant Field Values

TYPE_SPECIFIED

public static final int TYPE_SPECIFIED
See Also:
Constant Field Values

START_WINDOWBEGIN

public static final int START_WINDOWBEGIN
See Also:
Constant Field Values

START_WINDOWINSIDE

public static final int START_WINDOWINSIDE
See Also:
Constant Field Values

START_DISABLE

public static final int START_DISABLE
See Also:
Constant Field Values

HOPCOUNT_ACCURATE

public static final int HOPCOUNT_ACCURATE
See Also:
Constant Field Values

HOPCOUNT_NODELETE

public static final int HOPCOUNT_NODELETE
See Also:
Constant Field Values

HOPCOUNT_NEVERDELETE

public static final int HOPCOUNT_NEVERDELETE
See Also:
Constant Field Values

idField

public static final java.lang.String idField
See Also:
Constant Field Values

descriptionField

public static final java.lang.String descriptionField
See Also:
Constant Field Values

documentSpecField

public static final java.lang.String documentSpecField
See Also:
Constant Field Values

connectionNameField

public static final java.lang.String connectionNameField
See Also:
Constant Field Values

outputSpecField

public static final java.lang.String outputSpecField
See Also:
Constant Field Values

outputNameField

public static final java.lang.String outputNameField
See Also:
Constant Field Values

typeField

public static final java.lang.String typeField
See Also:
Constant Field Values

intervalField

public static final java.lang.String intervalField
This is the minimum reschedule interval for a document being crawled adaptively (in ms.)

See Also:
Constant Field Values

expirationField

public static final java.lang.String expirationField
This is the expiration time of documents for a given job (in ms.)

See Also:
Constant Field Values

priorityField

public static final java.lang.String priorityField
This is the job's priority vs. other jobs.

See Also:
Constant Field Values

startMethodField

public static final java.lang.String startMethodField
How/when to start the job

See Also:
Constant Field Values

reseedIntervalField

public static final java.lang.String reseedIntervalField
If this is an adaptive job, what should the reseed interval be (in milliseconds)

See Also:
Constant Field Values

statusField

public static final java.lang.String statusField
Status of this job.

See Also:
Constant Field Values

lastTimeField

public static final java.lang.String lastTimeField
The last time this job was assessed, in ms. since epoch.

See Also:
Constant Field Values

startTimeField

public static final java.lang.String startTimeField
If active, paused, activewait, or pausedwait, the start time of the current session, else null.

See Also:
Constant Field Values

lastCheckTimeField

public static final java.lang.String lastCheckTimeField
The time of the LAST session, if any. This is the place where the "last repository change check time" is gotten from.

See Also:
Constant Field Values

endTimeField

public static final java.lang.String endTimeField
If inactive, the end time of the LAST session, if any.

See Also:
Constant Field Values

windowEndField

public static final java.lang.String windowEndField
If non-null, this is the time that the current execution window closes, in ms since epoch.

See Also:
Constant Field Values

errorField

public static final java.lang.String errorField
If non-null, this is the last error that occurred (which aborted the last task, either running the job or doing the delete cleanup).

See Also:
Constant Field Values

reseedTimeField

public static final java.lang.String reseedTimeField
For an adaptive job, this is the next time to reseed the job.

See Also:
Constant Field Values

hopcountModeField

public static final java.lang.String hopcountModeField
For a job whose connector supports hopcounts, this describes how those hopcounts are handled.

See Also:
Constant Field Values

statusMap

protected static java.util.Map statusMap

typeMap

protected static java.util.Map typeMap

startMap

protected static java.util.Map startMap

hopmodeMap

protected static java.util.Map hopmodeMap

cacheManager

protected ICacheManager cacheManager

scheduleManager

protected ScheduleManager scheduleManager

hopFilterManager

protected HopFilterManager hopFilterManager

outputMgr

protected IOutputConnectionManager outputMgr

connectionMgr

protected IRepositoryConnectionManager connectionMgr

threadContext

protected IThreadContext threadContext
Constructor Detail

Jobs

public Jobs(IThreadContext threadContext,
            IDBInterface database)
     throws ManifoldCFException
Constructor.

Parameters:
database - is the database handle.
Throws:
ManifoldCFException
Method Detail

install

public void install(java.lang.String outputTableName,
                    java.lang.String outputNameField,
                    java.lang.String connectionTableName,
                    java.lang.String connectionNameField)
             throws ManifoldCFException
Install or upgrade this table.

Throws:
ManifoldCFException

deinstall

public void deinstall()
               throws ManifoldCFException
Uninstall.

Throws:
ManifoldCFException

getAnalyzeTime

public int getAnalyzeTime()
                   throws ManifoldCFException
Come up with a maximum time (in minutes) for re-analyzing tables.

Returns:
the time, in minutes.
Throws:
ManifoldCFException

analyzeTables

public void analyzeTables()
                   throws ManifoldCFException
Analyze job tables that need analysis.

Throws:
ManifoldCFException

readScheduleRecords

public ScheduleRecord[][] readScheduleRecords(java.lang.Long[] jobIDs)
                                       throws ManifoldCFException
Read schedule records for a specified set of jobs. Cannot use caching!

Throws:
ManifoldCFException

getAll

public IJobDescription[] getAll()
                         throws ManifoldCFException
Get a list of all jobs which are not in the process of being deleted already.

Returns:
the array of all jobs.
Throws:
ManifoldCFException

getActiveJobConnections

public IResultSet getActiveJobConnections()
                                   throws ManifoldCFException
Get a list of active job identifiers and their associated connection names.

Returns:
a resultset with "jobid" and "connectionname" fields.
Throws:
ManifoldCFException

getActiveConnectionNames

public java.lang.String[] getActiveConnectionNames()
                                            throws ManifoldCFException
Get unique connection names for all active jobs.

Returns:
the array of connection names corresponding to active jobs.
Throws:
ManifoldCFException

hasPriorityJobs

public boolean hasPriorityJobs(int priority)
                        throws ManifoldCFException
Are there any jobs that have a specified priority level

Throws:
ManifoldCFException

create

public IJobDescription create()
                       throws ManifoldCFException
Create a job.

Throws:
ManifoldCFException

delete

public void delete(java.lang.Long id)
            throws ManifoldCFException
Delete a job. This is not enough by itself; the queue entries also need to be deleted.

Parameters:
id - is the job id.
Throws:
ManifoldCFException

load

public IJobDescription load(java.lang.Long id,
                            boolean readOnly)
                     throws ManifoldCFException
Load a job for editing.

Parameters:
id - is the job id.
Returns:
the editable job description.
Throws:
ManifoldCFException

loadMultiple

public IJobDescription[] loadMultiple(java.lang.Long[] ids,
                                      boolean[] readOnlies)
                               throws ManifoldCFException
Load multiple jobs for editing.

Parameters:
ids - is the set of id's to load
readOnlies - are boolean values, set to true if the job description to be read is to be designated "read only".
Returns:
the array of objects, in order.
Throws:
ManifoldCFException

save

public void save(IJobDescription jobDescription)
          throws ManifoldCFException
Save a job description.

Parameters:
jobDescription - is the job description.
Throws:
ManifoldCFException

restart

public void restart()
             throws ManifoldCFException
This method is called on a restart.

Throws:
ManifoldCFException

noteOutputConnectorDeregistration

public void noteOutputConnectorDeregistration(java.lang.Long jobID,
                                              int oldStatusValue)
                                       throws ManifoldCFException
Signal to a job that its underlying output connector has gone away.

Parameters:
jobID - is the identifier of the job.
oldStatusValue - is the current status value for the job.
Throws:
ManifoldCFException

noteOutputConnectorRegistration

public void noteOutputConnectorRegistration(java.lang.Long jobID,
                                            int oldStatusValue)
                                     throws ManifoldCFException
Signal to a job that its underlying output connector has returned.

Parameters:
jobID - is the identifier of the job.
oldStatusValue - is the current status value for the job.
Throws:
ManifoldCFException

noteConnectorDeregistration

public void noteConnectorDeregistration(java.lang.Long jobID,
                                        int oldStatusValue)
                                 throws ManifoldCFException
Signal to a job that its underlying connector has gone away.

Parameters:
jobID - is the identifier of the job.
oldStatusValue - is the current status value for the job.
Throws:
ManifoldCFException

noteConnectorRegistration

public void noteConnectorRegistration(java.lang.Long jobID,
                                      int oldStatusValue)
                               throws ManifoldCFException
Signal to a job that its underlying connector has returned.

Parameters:
jobID - is the identifier of the job.
oldStatusValue - is the current status value for the job.
Throws:
ManifoldCFException

noteConnectionChange

public void noteConnectionChange(java.lang.String connectionName)
                          throws ManifoldCFException
Note a change in connection configuration. This method will be called whenever a connection's configuration is modified, or when an external repository change is signalled.

Throws:
ManifoldCFException

noteOutputConnectionChange

public void noteOutputConnectionChange(java.lang.String connectionName)
                                throws ManifoldCFException
Note a change in output connection configuration. This method will be called whenever a connection's configuration is modified, or when an external target config change is signalled.

Throws:
ManifoldCFException

checkJobActive

public boolean checkJobActive(java.lang.Long jobID)
                       throws ManifoldCFException
Check whether a job's status indicates that it is in ACTIVE or ACTIVESEEDING state.

Throws:
ManifoldCFException

resetDeleteStartupWorkerStatus

public void resetDeleteStartupWorkerStatus()
                                    throws ManifoldCFException
Reset delete startup worker thread status.

Throws:
ManifoldCFException

resetNotificationWorkerStatus

public void resetNotificationWorkerStatus()
                                   throws ManifoldCFException
Reset notification worker thread status.

Throws:
ManifoldCFException

resetStartupWorkerStatus

public void resetStartupWorkerStatus()
                              throws ManifoldCFException
Reset startup worker thread status.

Throws:
ManifoldCFException

resetSeedingWorkerStatus

public void resetSeedingWorkerStatus()
                              throws ManifoldCFException
Reset as part of restoring seeding worker threads.

Throws:
ManifoldCFException

startJob

public void startJob(java.lang.Long jobID,
                     java.lang.Long windowEnd)
              throws ManifoldCFException
Write job status and window end, and clear the endtime field. (The start time will be written when the job enters the "active" state.)

Parameters:
jobID - is the job identifier.
windowEnd - is the window end time, if any
Throws:
ManifoldCFException

returnJobToActive

public void returnJobToActive(java.lang.Long jobID)
                       throws ManifoldCFException
Put job back into active state, from the shutting-down state.

Parameters:
jobID - is the job identifier.
Throws:
ManifoldCFException

noteJobDeleteStarted

public void noteJobDeleteStarted(java.lang.Long jobID,
                                 long startTime)
                          throws ManifoldCFException
Put job into "deleting" state, and set the start time field.

Parameters:
jobID - is the job identifier.
startTime - is the current time in milliseconds from start of epoch.
Throws:
ManifoldCFException

noteJobStarted

public void noteJobStarted(java.lang.Long jobID,
                           long startTime)
                    throws ManifoldCFException
Make job active, and set the start time field.

Parameters:
jobID - is the job identifier.
startTime - is the current time in milliseconds from start of epoch.
Throws:
ManifoldCFException

noteJobSeeded

public void noteJobSeeded(java.lang.Long jobID,
                          long seedTime)
                   throws ManifoldCFException
Note job seeded.

Parameters:
jobID - is the job id.
seedTime - is the job seed time.
Throws:
ManifoldCFException

unwaitJob

public void unwaitJob(java.lang.Long jobID,
                      int newStatus,
                      java.lang.Long windowEnd)
               throws ManifoldCFException
Cause job that is in "wait" state to become un-waited.

Parameters:
jobID - is the job identifier.
newStatus - is the new status (either STATUS_ACTIVE or STATUS_PAUSED or STATUS_ACTIVESEEDING or STATUS_PAUSEDSEEDING)
windowEnd - is the window end time, if any.
Throws:
ManifoldCFException

waitJob

public void waitJob(java.lang.Long jobID,
                    int newStatus)
             throws ManifoldCFException
Cause job that is in active or paused state to become waited.

Parameters:
jobID - is the job identifier.
newStatus - is the new status (either STATUS_ACTIVEWAIT or STATUS_PAUSEDWAIT or STATUS_ACTIVEWAITSEEDING or STATUS_PAUSEDWAITSEEDING)
Throws:
ManifoldCFException

abortJob

public boolean abortJob(java.lang.Long jobID,
                        java.lang.String errorText)
                 throws ManifoldCFException
Abort a job.

Parameters:
jobID - is the job id.
errorText - is the error, or null if none.
Returns:
true if there wasn't an abort already logged for this job.
Throws:
ManifoldCFException

abortRestartJob

public void abortRestartJob(java.lang.Long jobID)
                     throws ManifoldCFException
Restart a job. Finish off what's currently happening, and then start the job up again.

Parameters:
jobID - is the job id.
Throws:
ManifoldCFException

pauseJob

public void pauseJob(java.lang.Long jobID)
              throws ManifoldCFException
Pause a job.

Parameters:
jobID - is the job id.
Throws:
ManifoldCFException

restartJob

public void restartJob(java.lang.Long jobID)
                throws ManifoldCFException
Restart a job.

Parameters:
jobID - is the job id.
Throws:
ManifoldCFException

writeStatus

public void writeStatus(java.lang.Long jobID,
                        int status,
                        java.lang.Long reseedTime)
                 throws ManifoldCFException
Update a job's status, and its reseed time.

Parameters:
jobID - is the job id.
status - is the desired status.
reseedTime - is the reseed time.
Throws:
ManifoldCFException

writeStatus

public void writeStatus(java.lang.Long jobID,
                        int status)
                 throws ManifoldCFException
Update a job's status.

Parameters:
jobID - is the job id.
status - is the desired status.
Throws:
ManifoldCFException

updateLastTime

public void updateLastTime(java.lang.Long jobID,
                           long currentTime)
                    throws ManifoldCFException
Update a job's last-time field.

Parameters:
jobID - is the job id.
currentTime - is the current time.
Throws:
ManifoldCFException

finishJob

public void finishJob(java.lang.Long jobID,
                      long finishTime)
               throws ManifoldCFException
Finish a job. Write completion and the current time.

Parameters:
jobID - is the job id.
finishTime - is the finish time.
Throws:
ManifoldCFException

finishAbortJob

public void finishAbortJob(java.lang.Long jobID,
                           long abortTime)
                    throws ManifoldCFException
Finish a job (abort). Write completion and the current time.

Parameters:
jobID - is the job id.
Throws:
ManifoldCFException

notificationComplete

public void notificationComplete(java.lang.Long jobID)
                          throws ManifoldCFException
Mark job as having properly notified the output connector of completion.

Parameters:
jobID - is the job id.
Throws:
ManifoldCFException

checkIfReference

public boolean checkIfReference(java.lang.String connectionName)
                         throws ManifoldCFException
See if there's a reference to a connection name.

Parameters:
connectionName - is the name of the connection.
Returns:
true if there is a reference, false otherwise.
Throws:
ManifoldCFException

checkIfOutputReference

public boolean checkIfOutputReference(java.lang.String connectionName)
                               throws ManifoldCFException
See if there's a reference to an output connection name.

Parameters:
connectionName - is the name of the connection.
Returns:
true if there is a reference, false otherwise.
Throws:
ManifoldCFException

findJobsForConnection

public IJobDescription[] findJobsForConnection(java.lang.String connectionName)
                                        throws ManifoldCFException
Get the job IDs associated with a given connection name.

Parameters:
connectionName - is the name of the connection.
Returns:
the set of job id's associated with that connection.
Throws:
ManifoldCFException

deletingJobsPresent

public boolean deletingJobsPresent()
                            throws ManifoldCFException
Return true if there is a job in the DELETING state. (This matches the conditions for values to be returned from getNextDeletableDocuments).

Returns:
true if such jobs exist.
Throws:
ManifoldCFException

cleaningJobsPresent

public boolean cleaningJobsPresent()
                            throws ManifoldCFException
Return true if there is a job in the SHUTTINGDOWN state. (This matches the conditions for values to be returned from getNextCleanableDocuments).

Returns:
true if such jobs exist.
Throws:
ManifoldCFException

activeJobsPresent

public boolean activeJobsPresent()
                          throws ManifoldCFException
Return true if there is a job in either the ACTIVE or the ACTIVESEEDING state. (This matches the conditions for values to be returned from getNextDocuments).

Returns:
true if such jobs exist.
Throws:
ManifoldCFException

stringToStatus

public static int stringToStatus(java.lang.String value)
                          throws ManifoldCFException
Go from string to status.

Parameters:
value - is the string.
Returns:
the status value.
Throws:
ManifoldCFException

statusToString

public static java.lang.String statusToString(int status)
                                       throws ManifoldCFException
Go from status to string.

Parameters:
status - is the status.
Returns:
the string.
Throws:
ManifoldCFException

stringToType

public static int stringToType(java.lang.String value)
                        throws ManifoldCFException
Go from string to type.

Parameters:
value - is the string.
Returns:
the type value.
Throws:
ManifoldCFException

typeToString

public static java.lang.String typeToString(int type)
                                     throws ManifoldCFException
Go from type to string.

Parameters:
type - is the type.
Returns:
the string.
Throws:
ManifoldCFException

stringToHopcountMode

public static int stringToHopcountMode(java.lang.String value)
                                throws ManifoldCFException
Go from string to hopcount mode.

Throws:
ManifoldCFException

hopcountModeToString

public static java.lang.String hopcountModeToString(int value)
                                             throws ManifoldCFException
Go from hopcount mode to string.

Throws:
ManifoldCFException

stringToStartMethod

public static int stringToStartMethod(java.lang.String value)
                               throws ManifoldCFException
Go from string to start method.

Parameters:
value - is the string.
Returns:
the start method value.
Throws:
ManifoldCFException

startMethodToString

public static java.lang.String startMethodToString(int startMethod)
                                            throws ManifoldCFException
Get from start method to string.

Parameters:
startMethod - is the start method.
Returns:
a string.
Throws:
ManifoldCFException

stringToEnumeratedValue

public static EnumeratedValues stringToEnumeratedValue(java.lang.String value)
                                                throws ManifoldCFException
Go from string to enumerated value.

Parameters:
value - is the input.
Returns:
the enumerated value.
Throws:
ManifoldCFException

enumeratedValueToString

public static java.lang.String enumeratedValueToString(EnumeratedValues values)
Go from enumerated value to string.

Parameters:
values - is the enumerated value.
Returns:
the string value.

getJobsKey

protected static java.lang.String getJobsKey()

getJobIDKey

protected static java.lang.String getJobIDKey(java.lang.Long jobID)

getJobStatusKey

protected static java.lang.String getJobStatusKey()

getJobsMultiple

protected JobDescription[] getJobsMultiple(java.lang.Long[] ids)
                                    throws ManifoldCFException
Get multiple jobs (without caching)

Parameters:
ids - is the set of ids to get jobs for.
Returns:
the corresponding job descriptions.
Throws:
ManifoldCFException

getJobsChunk

protected void getJobsChunk(java.util.Map returnValues,
                            java.lang.String idList,
                            java.util.ArrayList params)
                     throws ManifoldCFException
Read a chunk of repository connections.

Parameters:
returnValues - is keyed by id and contains a JobDescription value.
idList - is the list of id's.
params - is the set of parameters.
Throws:
ManifoldCFException