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 enum`
`JobImpl.ReadErrorType`

## Nested classes/interfaces inherited from interface org.apache.sling.event.jobs.Job

`org.apache.sling.event.jobs.Job.JobState`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`PROPERTY_DELAY_OVERRIDE`
Internal job property containing optional delay override.
`static final String`
`PROPERTY_FINISHED_STATE`
This property contains the finished state of a job once it's marked as finished.
`static final String`
`PROPERTY_JOB_QUEUED`
Internal job property specifying when the job was put into the queue.
`static final String`
`PROPERTY_RESOURCE_PATH`
Internal 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`

## Constructor Summary

Constructors
Constructor
Description
`JobImpl(String topic, String jobId, Map<String,Object> properties)`
Create a new job instance

## Method Summary

Modifier and Type
Method
Description
`int`
`compareTo(JobImpl o)`
`boolean`
`equals(Object obj)`
`Calendar`
`getCreated()`
`String`
`getCreatedInstance()`
`Calendar`
`getFinishedDate()`
`int`
`getFinishedProgressStep()`
`String`
`getId()`
`org.apache.sling.event.jobs.Job.JobState`
`getJobState()`
`int`
`getNumberOfRetries()`
`Calendar`
`getProcessingStarted()`
`Calendar`
`getProgressETA()`
`String[]`
`getProgressLog()`
`int`
`getProgressStepCount()`
`Map<String,Object>`
`getProperties()`
Get all properties
`Object`
`getProperty(String name)`
`<T> T`
`getProperty(String name, Class<T> type)`
`<T> T`
`getProperty(String name, T defaultValue)`
`Set<String>`
`getPropertyNames()`
`String`
`getQueueName()`
`JobImpl.ReadErrorType`
`getReadErrorType()`
`String`
`getResourcePath()`
Get the full resource path.
`String`
`getResultMessage()`
`int`
`getRetryCount()`
`String`
`getTargetInstance()`
`String`
`getTopic()`
`int`
`hashCode()`
`boolean`
`hasReadErrors()`
Did we have read errors?
`boolean`
`isReadErrorRecoverable()`
Is the error recoverable?
`String`
`log(int logMaxCount, String message, Object... args)`
`String[]`
`prepare(org.apache.sling.event.jobs.Queue queue)`
Prepare a new job execution
`void`
`retry()`
Update the information for a retry
`String[]`
`setProgress(int step)`
`void`
`setProperty(String name, Object value)`
`String[]`
`startProgress(int steps, long eta)`
`String`
`toString()`
`String`
`update(long eta)`
`void`
`updateQueueInfo(org.apache.sling.event.jobs.Queue queue)`
Update information about the queue.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### 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 Details

### 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 Details

### 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?

### 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)

### log

public String log(int logMaxCount, String message, Object... args)

### 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()`

### compareTo

public int compareTo(JobImpl o)

Specified by:
  `compareTo` in interface `Comparable<JobImpl>`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

### toString

public String toString()

Overrides:
  `toString` in class `Object`