Class 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.
    • 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
    • Constructor Detail

      • JobImpl

        public JobImpl​(String topic,
                       String jobId,
                       Map<String,​Object> properties)
        Create a new job instance
        Parameters:
        topic - The job topic
        jobId - The unique (internal) job id
        properties - Non-null map of properties, at least containing PROPERTY_RESOURCE_PATH
    • Method Detail

      • getResourcePath

        public String getResourcePath()
        Get the full resource path.
      • hasReadErrors

        public boolean hasReadErrors()
        Did we have read errors?
      • isReadErrorRecoverable

        public boolean isReadErrorRecoverable()
        Is the error recoverable?
      • getProperties

        public Map<String,​Object> getProperties()
        Get all properties
      • retry

        public void retry()
        Update the information for a retry
      • getTopic

        public String getTopic()
        Specified by:
        getTopic in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getTopic()
      • getId

        public String getId()
        Specified by:
        getId in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getId()
      • getProperty

        public Object getProperty​(String name)
        Specified by:
        getProperty in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getProperty(java.lang.String)
      • getProperty

        public <T> T getProperty​(String name,
                                 Class<T> type)
        Specified by:
        getProperty in interface org.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:
        getProperty in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getProperty(java.lang.String, java.lang.Object)
      • getPropertyNames

        public Set<String> getPropertyNames()
        Specified by:
        getPropertyNames in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getPropertyNames()
      • getRetryCount

        public int getRetryCount()
        Specified by:
        getRetryCount in interface org.apache.sling.event.jobs.Job
      • getNumberOfRetries

        public int getNumberOfRetries()
        Specified by:
        getNumberOfRetries in interface org.apache.sling.event.jobs.Job
      • getQueueName

        public String getQueueName()
        Specified by:
        getQueueName in interface org.apache.sling.event.jobs.Job
      • getTargetInstance

        public String getTargetInstance()
        Specified by:
        getTargetInstance in interface org.apache.sling.event.jobs.Job
      • getProcessingStarted

        public Calendar getProcessingStarted()
        Specified by:
        getProcessingStarted in interface org.apache.sling.event.jobs.Job
      • getCreated

        public Calendar getCreated()
        Specified by:
        getCreated in interface org.apache.sling.event.jobs.Job
      • getCreatedInstance

        public String getCreatedInstance()
        Specified by:
        getCreatedInstance in interface org.apache.sling.event.jobs.Job
      • updateQueueInfo

        public void updateQueueInfo​(org.apache.sling.event.jobs.Queue queue)
        Update information about the queue.
      • setProperty

        public void setProperty​(String name,
                                Object value)
      • 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:
        getJobState in interface org.apache.sling.event.jobs.Job
      • getFinishedDate

        public Calendar getFinishedDate()
        Specified by:
        getFinishedDate in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getFinishedDate()
      • getResultMessage

        public String getResultMessage()
        Specified by:
        getResultMessage in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getResultMessage()
      • getProgressLog

        public String[] getProgressLog()
        Specified by:
        getProgressLog in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getProgressLog()
      • getProgressStepCount

        public int getProgressStepCount()
        Specified by:
        getProgressStepCount in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getProgressStepCount()
      • getFinishedProgressStep

        public int getFinishedProgressStep()
        Specified by:
        getFinishedProgressStep in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getFinishedProgressStep()
      • getProgressETA

        public Calendar getProgressETA()
        Specified by:
        getProgressETA in interface org.apache.sling.event.jobs.Job
        See Also:
        Job.getProgressETA()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object