org.apache.sling.event.jobs
Interface Job

All Known Implementing Classes:
JobImpl

public interface Job

A job Property Types In general all scalar types and all serializable classes are supported as property types. However, in order for deseralizing classes these must be exported. Serializable classes are not searchable in the query either. Due to the above to potential problems, it is advisable to not use custom classes as job properties, but rather use out of the box supported types in combination with collections. A resource provider might convert numbers to a different type, JCR is well-known for this behavior as it only supports long but neither integer nor short. Therefore if you are dealing with numbers, use the getProperty(String, Class) method to get the correct type instead of directly casting it.

Since:
1.2

Field Summary
static String PROPERTY_JOB_CREATED
          This property is set by the job handling and contains a calendar object specifying the date and time when this job has been created.
static String PROPERTY_JOB_CREATED_INSTANCE
          This property is set by the job handling and contains the Sling instance ID of the instance where this job has been created.
static String PROPERTY_JOB_PRIORITY
          This property is set by the job handling to define the priority of this job execution.
static String PROPERTY_JOB_QUEUE_NAME
          The name of the job queue processing this job.
static String PROPERTY_JOB_RETRIES
          The property to track the retry maximum retry count for jobs.
static String PROPERTY_JOB_RETRY_COUNT
          The property to track the retry count for jobs.
static String PROPERTY_JOB_RETRY_DELAY
          The property to set a retry delay.
static String PROPERTY_JOB_STARTED_TIME
          This property is set by the job handling and contains a calendar object specifying the date and time when this job has been started.
static String PROPERTY_JOB_TARGET_INSTANCE
          This property is set by the job handling and contains the Sling instance ID of the instance where this job should be processed.
 
Method Summary
 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.
 String getId()
          Unique job ID.
 JobUtil.JobPriority getJobPriority()
          This property is set by the job handling to define the priority of this job execution.
 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.
 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.
 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.
 

Field Detail

PROPERTY_JOB_QUEUE_NAME

static final String PROPERTY_JOB_QUEUE_NAME
The name of the job queue processing this job. This property is set by the job handling when the job is processed. If this property is set by the client creating the job it's value is ignored

See Also:
Constant Field Values

PROPERTY_JOB_PRIORITY

static final String PROPERTY_JOB_PRIORITY
This property is set by the job handling to define the priority of this job execution. The property is evaluated by the job handling before starting the JobConsumer and sets the priority of the thread accordingly. For possible values see JobUtil.JobPriority. If this property is set by the client creating the job it's value is ignored

See Also:
Constant Field Values

PROPERTY_JOB_RETRY_COUNT

static final String PROPERTY_JOB_RETRY_COUNT
The property to track the retry count for jobs. Value is of type Integer. On first execution the value of this property is zero. This property is managed by the job handling. If this property is set by the client creating the job it's value is ignored

See Also:
Constant Field Values

PROPERTY_JOB_RETRIES

static final String PROPERTY_JOB_RETRIES
The property to track the retry maximum retry count for jobs. Value is of type Integer. This property is managed by the job handling. If this property is set by the client creating the job it's value is ignored

See Also:
Constant Field Values

PROPERTY_JOB_CREATED

static final String PROPERTY_JOB_CREATED
This property is set by the job handling and contains a calendar object specifying the date and time when this job has been created. If this property is set by the client creating the job it's value is ignored

See Also:
Constant Field Values

PROPERTY_JOB_CREATED_INSTANCE

static final String PROPERTY_JOB_CREATED_INSTANCE
This property is set by the job handling and contains the Sling instance ID of the instance where this job has been created.

See Also:
Constant Field Values

PROPERTY_JOB_TARGET_INSTANCE

static final String PROPERTY_JOB_TARGET_INSTANCE
This property is set by the job handling and contains the Sling instance ID of the instance where this job should be processed.

See Also:
Constant Field Values

PROPERTY_JOB_STARTED_TIME

static final String PROPERTY_JOB_STARTED_TIME
This property is set by the job handling and contains a calendar object specifying the date and time when this job has been started. This property is only set if the job is currently in processing If this property is set by the client creating the job it's value is ignored

See Also:
Constant Field Values

PROPERTY_JOB_RETRY_DELAY

static final String PROPERTY_JOB_RETRY_DELAY
The property to set a retry delay. Value is of type Long and specifies milliseconds. This property can be used to override the retry delay from the queue configuration. But it should only be used very rarely as the queue configuration should be the one in charge.

See Also:
Constant Field Values
Method Detail

getTopic

String getTopic()
The job topic.

Returns:
The job topic

getName

String getName()
Optional job name

Returns:
The job name or null

getId

String getId()
Unique job ID.

Returns:
The unique job ID.

getProperty

Object getProperty(String name)
Get the value of a property.

Parameters:
name - The property name
Returns:
The value of the property or null

getPropertyNames

Set<String> getPropertyNames()
Get all property names.

Returns:
A set of property names.

getProperty

<T> T getProperty(String name,
                  Class<T> type)
Get a named property and convert it into the given type. This method does not support conversion into a primitive type or an array of a primitive type. It should return null in this case.

Parameters:
name - The name of the property
type - The class of the type
Returns:
Return named value converted to type T or null if non existing or can't be converted.

getProperty

<T> T getProperty(String name,
                  T defaultValue)
Get a named property and convert it into the given type. This method does not support conversion into a primitive type or an array of a primitive type. It should return the default value in this case.

Parameters:
name - The name of the property
defaultValue - 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.
Returns:
Return named value converted to type T or the default value if non existing or can't be converted.

getJobPriority

JobUtil.JobPriority getJobPriority()
This property is set by the job handling to define the priority of this job execution. The property is evaluated by the job handling before starting the JobConsumer and sets the priority of the thread accordingly. For possible values see JobUtil.JobPriority.


getRetryCount

int getRetryCount()
On first execution the value of this property is zero. This property is managed by the job handling.


getNumberOfRetries

int getNumberOfRetries()
The property to track the retry maximum retry count for jobs. This property is managed by the job handling.


getQueueName

String getQueueName()
The name of the job queue processing this job. This property is set by the job handling when the job is processed.

Returns:
The queue name or null

getTargetInstance

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.

Returns:
The sling ID or null

getProcessingStarted

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. This property is only set if the job is currently in processing


getCreated

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.


getCreatedInstance

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.



Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.