Package org.apache.sling.event.impl.jobs
Class JobImpl
- java.lang.Object
-
- org.apache.sling.event.impl.jobs.JobImpl
-
- All Implemented Interfaces:
Comparable<JobImpl>,org.apache.sling.event.jobs.Job
public class JobImpl extends Object implements org.apache.sling.event.jobs.Job, Comparable<JobImpl>
This object encapsulates all information about a job.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJobImpl.ReadErrorType
-
Field Summary
Fields Modifier and Type Field Description static StringPROPERTY_DELAY_OVERRIDEInternal job property containing optional delay override.static StringPROPERTY_FINISHED_STATEThis property contains the finished state of a job once it's marked as finished.static StringPROPERTY_JOB_QUEUEDInternal job property specifying when the job was put into the queue.static StringPROPERTY_RESOURCE_PATHInternal job property containing the resource path.-
Fields inherited from interface org.apache.sling.event.jobs.Job
PROPERTY_FINISHED_DATE, PROPERTY_JOB_CREATED, PROPERTY_JOB_CREATED_INSTANCE, PROPERTY_JOB_DESCRIPTION, PROPERTY_JOB_PROGRESS_ETA, PROPERTY_JOB_PROGRESS_LOG, PROPERTY_JOB_PROGRESS_STEP, PROPERTY_JOB_PROGRESS_STEPS, PROPERTY_JOB_QUEUE_NAME, PROPERTY_JOB_RETRIES, PROPERTY_JOB_RETRY_COUNT, PROPERTY_JOB_RETRY_DELAY, PROPERTY_JOB_STARTED_TIME, PROPERTY_JOB_TARGET_INSTANCE, PROPERTY_JOB_TITLE, PROPERTY_RESULT_MESSAGE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JobImpl o)booleanequals(Object obj)CalendargetCreated()StringgetCreatedInstance()CalendargetFinishedDate()intgetFinishedProgressStep()StringgetId()org.apache.sling.event.jobs.Job.JobStategetJobState()intgetNumberOfRetries()CalendargetProcessingStarted()CalendargetProgressETA()String[]getProgressLog()intgetProgressStepCount()Map<String,Object>getProperties()Get all propertiesObjectgetProperty(String name)<T> TgetProperty(String name, Class<T> type)<T> TgetProperty(String name, T defaultValue)Set<String>getPropertyNames()StringgetQueueName()JobImpl.ReadErrorTypegetReadErrorType()StringgetResourcePath()Get the full resource path.StringgetResultMessage()intgetRetryCount()StringgetTargetInstance()StringgetTopic()inthashCode()booleanhasReadErrors()Did we have read errors?booleanisReadErrorRecoverable()Is the error recoverable?Stringlog(int logMaxCount, String message, Object... args)String[]prepare(org.apache.sling.event.jobs.Queue queue)Prepare a new job executionvoidretry()Update the information for a retryString[]setProgress(int step)voidsetProperty(String name, Object value)String[]startProgress(int steps, long eta)StringtoString()Stringupdate(long eta)voidupdateQueueInfo(org.apache.sling.event.jobs.Queue queue)Update information about the queue.
-
-
-
Field Detail
-
PROPERTY_RESOURCE_PATH
public static final String PROPERTY_RESOURCE_PATH
Internal job property containing the resource path.- See Also:
- Constant Field Values
-
PROPERTY_DELAY_OVERRIDE
public static final String PROPERTY_DELAY_OVERRIDE
Internal job property containing optional delay override.- See Also:
- Constant Field Values
-
PROPERTY_JOB_QUEUED
public static final String PROPERTY_JOB_QUEUED
Internal job property specifying when the job was put into the queue.- See Also:
- Constant Field Values
-
PROPERTY_FINISHED_STATE
public static final String PROPERTY_FINISHED_STATE
This property contains the finished state of a job once it's marked as finished. The value is either "CANCELLED" or "SUCCEEDED". This property is read-only and can't be specified when the job is created.- See Also:
- Constant Field Values
-
-
Method Detail
-
getResourcePath
public String getResourcePath()
Get the full resource path.
-
hasReadErrors
public boolean hasReadErrors()
Did we have read errors?
-
getReadErrorType
public JobImpl.ReadErrorType getReadErrorType()
-
isReadErrorRecoverable
public boolean isReadErrorRecoverable()
Is the error recoverable?
-
retry
public void retry()
Update the information for a retry
-
getTopic
public String getTopic()
- Specified by:
getTopicin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getTopic()
-
getId
public String getId()
- Specified by:
getIdin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getId()
-
getProperty
public Object getProperty(String name)
- Specified by:
getPropertyin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getProperty(java.lang.String)
-
getProperty
public <T> T getProperty(String name, Class<T> type)
- Specified by:
getPropertyin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getProperty(java.lang.String, java.lang.Class)
-
getProperty
public <T> T getProperty(String name, T defaultValue)
- Specified by:
getPropertyin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getProperty(java.lang.String, java.lang.Object)
-
getPropertyNames
public Set<String> getPropertyNames()
- Specified by:
getPropertyNamesin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getPropertyNames()
-
getRetryCount
public int getRetryCount()
- Specified by:
getRetryCountin interfaceorg.apache.sling.event.jobs.Job
-
getNumberOfRetries
public int getNumberOfRetries()
- Specified by:
getNumberOfRetriesin interfaceorg.apache.sling.event.jobs.Job
-
getQueueName
public String getQueueName()
- Specified by:
getQueueNamein interfaceorg.apache.sling.event.jobs.Job
-
getTargetInstance
public String getTargetInstance()
- Specified by:
getTargetInstancein interfaceorg.apache.sling.event.jobs.Job
-
getProcessingStarted
public Calendar getProcessingStarted()
- Specified by:
getProcessingStartedin interfaceorg.apache.sling.event.jobs.Job
-
getCreated
public Calendar getCreated()
- Specified by:
getCreatedin interfaceorg.apache.sling.event.jobs.Job
-
getCreatedInstance
public String getCreatedInstance()
- Specified by:
getCreatedInstancein interfaceorg.apache.sling.event.jobs.Job
-
updateQueueInfo
public void updateQueueInfo(org.apache.sling.event.jobs.Queue queue)
Update information about the queue.
-
prepare
public String[] prepare(org.apache.sling.event.jobs.Queue queue)
Prepare a new job execution
-
startProgress
public String[] startProgress(int steps, long eta)
-
setProgress
public String[] setProgress(int step)
-
update
public String update(long eta)
-
getJobState
public org.apache.sling.event.jobs.Job.JobState getJobState()
- Specified by:
getJobStatein interfaceorg.apache.sling.event.jobs.Job
-
getFinishedDate
public Calendar getFinishedDate()
- Specified by:
getFinishedDatein interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getFinishedDate()
-
getResultMessage
public String getResultMessage()
- Specified by:
getResultMessagein interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getResultMessage()
-
getProgressLog
public String[] getProgressLog()
- Specified by:
getProgressLogin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getProgressLog()
-
getProgressStepCount
public int getProgressStepCount()
- Specified by:
getProgressStepCountin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getProgressStepCount()
-
getFinishedProgressStep
public int getFinishedProgressStep()
- Specified by:
getFinishedProgressStepin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getFinishedProgressStep()
-
getProgressETA
public Calendar getProgressETA()
- Specified by:
getProgressETAin interfaceorg.apache.sling.event.jobs.Job- See Also:
Job.getProgressETA()
-
compareTo
public int compareTo(JobImpl o)
- Specified by:
compareToin interfaceComparable<JobImpl>
-
-