public class JobImpl extends Object implements Job, Comparable<JobImpl>
Job.JobState
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_BRIDGED_EVENT
Internal job property if this is an bridged event (event admin).
|
static String |
PROPERTY_DELAY_OVERRIDE
Internal job property containing optional delay override.
|
static String |
PROPERTY_FINISHED_STATE
This property contains the finished state of a job once it's marked as finished.
|
static String |
PROPERTY_RESOURCE_PATH
Internal job property containing the resource path.
|
PROPERTY_FINISHED_DATE, PROPERTY_JOB_CREATED, PROPERTY_JOB_CREATED_INSTANCE, PROPERTY_JOB_DESCRIPTION, PROPERTY_JOB_PRIORITY, 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 and Description |
---|
JobImpl(String topic,
String name,
String jobId,
Map<String,Object> properties)
Create a new job instance
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(JobImpl o) |
boolean |
equals(Object obj) |
Calendar |
getCreated()
This property is set by the job handling and contains a calendar object
specifying the date and time when this job has been created.
|
String |
getCreatedInstance()
This property is set by the job handling and contains the Sling instance ID
of the instance where this job has been created.
|
Calendar |
getFinishedDate()
If the job is cancelled or succeeded, this method will return the finish date.
|
int |
getFinishedProgressStep()
If the job is in processing, return the optional information
about the finished steps.
|
String |
getId()
Unique job ID.
|
JobUtil.JobPriority |
getJobPriority()
This property is not supported anymore and always returns
JobUtil#JobPriority.NORM . |
Job.JobState |
getJobState()
Get the job state
|
String |
getName()
Optional job name
|
int |
getNumberOfRetries()
The property to track the retry maximum retry count for jobs.
|
Calendar |
getProcessingStarted()
This property is set by the job handling and contains a calendar object
specifying the date and time when this job has been started.
|
Calendar |
getProgressETA()
If the job is in processing, return the optional ETA for this job.
|
String[] |
getProgressLog()
This method returns the optional progress log from the last job
processing.
|
int |
getProgressStepCount()
If the job is in processing, return the optional progress step
count if available.
|
Map<String,Object> |
getProperties()
Get all properties
|
Object |
getProperty(String name)
Get the value of a property.
|
<T> T |
getProperty(String name,
Class<T> type)
Get a named property and convert it into the given type.
|
<T> T |
getProperty(String name,
T defaultValue)
Get a named property and convert it into the given type.
|
Set<String> |
getPropertyNames()
Get all property names.
|
String |
getQueueName()
The name of the job queue processing this job.
|
String |
getResourcePath()
Get the full resource path.
|
String |
getResultMessage()
This method returns the message from the last job processing, regardless
whether the processing failed, succeeded or was cancelled.
|
int |
getRetryCount()
On first execution the value of this property is zero.
|
String |
getTargetInstance()
This property is set by the job handling and contains the Sling instance ID
of the instance where this job should be processed.
|
String |
getTopic()
The job topic.
|
int |
hashCode() |
boolean |
hasReadErrors()
Did we have read errors?
|
boolean |
isBridgedEvent()
Is this a bridged event?
|
String |
log(String message,
Object... args) |
String[] |
prepare(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(Queue queue)
Update information about the queue.
|
public static final String PROPERTY_RESOURCE_PATH
public static final String PROPERTY_BRIDGED_EVENT
public static final String PROPERTY_DELAY_OVERRIDE
public static final String PROPERTY_FINISHED_STATE
public JobImpl(String topic, String name, String jobId, Map<String,Object> properties)
topic
- The job topicname
- The unique job name (optional)jobId
- The unique (internal) job idproperties
- Non-null map of properties, at least containing PROPERTY_RESOURCE_PATH
public String getResourcePath()
public boolean isBridgedEvent()
public boolean hasReadErrors()
public void retry()
public String getTopic()
Job
getTopic
in interface Job
Job.getTopic()
public String getName()
Job
getName
in interface Job
null
Job.getName()
public String getId()
Job
getId
in interface Job
Job.getId()
public Object getProperty(String name)
Job
getProperty
in interface Job
name
- The property namenull
Job.getProperty(java.lang.String)
public <T> T getProperty(String name, Class<T> type)
Job
null
in this
case.getProperty
in interface Job
name
- The name of the propertytype
- The class of the typenull
if
non existing or can't be converted.Job.getProperty(java.lang.String, java.lang.Class)
public <T> T getProperty(String name, T defaultValue)
Job
getProperty
in interface Job
name
- The name of the propertydefaultValue
- The default value to use if the named property does
not exist or cannot be converted to the requested type. The
default value is also used to define the type to convert the
value to. If this is null
any existing property is
not converted.Job.getProperty(java.lang.String, java.lang.Object)
public Set<String> getPropertyNames()
Job
getPropertyNames
in interface Job
Job.getPropertyNames()
public JobUtil.JobPriority getJobPriority()
Job
JobUtil#JobPriority.NORM
.getJobPriority
in interface Job
public int getRetryCount()
Job
getRetryCount
in interface Job
public int getNumberOfRetries()
Job
getNumberOfRetries
in interface Job
public String getQueueName()
Job
getQueueName
in interface Job
null
public String getTargetInstance()
Job
getTargetInstance
in interface Job
null
public Calendar getProcessingStarted()
Job
getProcessingStarted
in interface Job
public Calendar getCreated()
Job
getCreated
in interface Job
public String getCreatedInstance()
Job
getCreatedInstance
in interface Job
public void updateQueueInfo(Queue queue)
public String[] startProgress(int steps, long eta)
public String[] setProgress(int step)
public String update(long eta)
public Job.JobState getJobState()
Job
getJobState
in interface Job
public Calendar getFinishedDate()
Job
getFinishedDate
in interface Job
null
Job.getFinishedDate()
public String getResultMessage()
Job
getResultMessage
in interface Job
null
Job.getResultMessage()
public String[] getProgressLog()
Job
getProgressLog
in interface Job
null
Job.getProgressLog()
public int getProgressStepCount()
Job
getProgressStepCount
in interface Job
-1
.Job.getProgressStepCount()
public int getFinishedProgressStep()
Job
Job.getProgressStepCount()
this can
be used to calculate a progress bar.getFinishedProgressStep
in interface Job
0
org.apache.sling.event.jobs.Job#getCurrentProgressStep()
public Calendar getProgressETA()
Job
getProgressETA
in interface Job
null
Job.getProgressETA()
public int compareTo(JobImpl o)
compareTo
in interface Comparable<JobImpl>
Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.