org.apache.sling.event.jobs
Class JobUtil

java.lang.Object
  extended by org.apache.sling.event.jobs.JobUtil

public abstract class JobUtil
extends Object

The Job class is an utility class for creating and processing jobs.

Since:
3.0

Nested Class Summary
static class JobUtil.JobPriority
          The priority for jobs.
 
Field Summary
static String JOB_ID
          Deprecated. - Use the new Job interface instead.
static String NOTIFICATION_PROPERTY_JOB_ID
          Property containing the unique job ID.
static String NOTIFICATION_PROPERTY_JOB_NAME
          Property containing the optional job name.
static String NOTIFICATION_PROPERTY_JOB_TOPIC
          Property containing the job topic.
static String PROPERTY_JOB_APPLICATION
          Deprecated. - Use the new Job interface instead.
static String PROPERTY_JOB_CREATED
          Deprecated. - Use the new Job interface instead.
static String PROPERTY_JOB_CREATED_APPLICATION
          Deprecated. - Use the new Job interface instead.
static String PROPERTY_JOB_NAME
          Deprecated. - Jobs should be started via JobManager.addJob(String, String, java.util.Map)
static String PROPERTY_JOB_PARALLEL
          Deprecated.  
static String PROPERTY_JOB_PRIORITY
          Deprecated. - Use the new Job interface instead.
static String PROPERTY_JOB_QUEUE_NAME
          Deprecated. - Use the new Job interface instead.
static String PROPERTY_JOB_QUEUE_ORDERED
          Deprecated.  
static String PROPERTY_JOB_RETRIES
          Deprecated. - Use the new Job interface instead.
static String PROPERTY_JOB_RETRY_COUNT
          Deprecated. - Use the new Job interface instead.
static String PROPERTY_JOB_RETRY_DELAY
          Deprecated. - Use the new Job interface instead.
static String PROPERTY_JOB_RUN_LOCAL
          Deprecated.  
static String PROPERTY_JOB_TOPIC
          Deprecated. - Jobs should be started via JobManager.addJob(String, String, java.util.Map)
static String PROPERTY_NOTIFICATION_JOB
          Deprecated.  
static String TOPIC_JOB
          Deprecated. - Use the new JobManager.addJob(String, String, java.util.Map) method instead.
static String TOPIC_JOB_CANCELLED
          A synchronous notification event when a job is cancelled.
static String TOPIC_JOB_FAILED
          Asynchronous notification event when a job failed.
static String TOPIC_JOB_FINISHED
          Asynchronous notification event when a job is finished.
static String TOPIC_JOB_STARTED
          Asynchronous notification event when a job is started.
 
Method Summary
static boolean acknowledgeJob(org.osgi.service.event.Event job)
          Deprecated. - Use the new JobConsumer interface instead.
static void finishedJob(org.osgi.service.event.Event job)
          Deprecated. - Use the new JobConsumer interface instead.
static Calendar getJobCreated(org.osgi.service.event.Event job)
          Deprecated. - Use the new Job interface instead.
static boolean isJobEvent(org.osgi.service.event.Event event)
          Deprecated. - Use the new Job interface instead.
static void processJob(org.osgi.service.event.Event job, JobProcessor processor)
          Deprecated. - Use the new JobConsumer interface instead.
static boolean rescheduleJob(org.osgi.service.event.Event job)
          Deprecated. - Use the new JobConsumer interface instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_JOB_TOPIC

@Deprecated
public static final String PROPERTY_JOB_TOPIC
Deprecated. - Jobs should be started via JobManager.addJob(String, String, java.util.Map)
The job topic property.

See Also:
Constant Field Values

PROPERTY_JOB_NAME

@Deprecated
public static final String PROPERTY_JOB_NAME
Deprecated. - Jobs should be started via JobManager.addJob(String, String, java.util.Map)
The property for the unique event name. Value is of type String. This property should only be used if it can happen that the exact same job is started on different cluster nodes. By specifying the same id for this job on all cluster nodes, the job handling can detect the duplicates and process the job only once. This is optional - and should only be used for the case mentioned.

See Also:
Constant Field Values

PROPERTY_JOB_PARALLEL

@Deprecated
public static final String PROPERTY_JOB_PARALLEL
Deprecated. 
This property is not supported anymore

See Also:
Constant Field Values

PROPERTY_JOB_RUN_LOCAL

@Deprecated
public static final String PROPERTY_JOB_RUN_LOCAL
Deprecated. 
This property is not supported anymore

See Also:
Constant Field Values

PROPERTY_JOB_RETRY_COUNT

@Deprecated
public static final String PROPERTY_JOB_RETRY_COUNT
Deprecated. - Use the new Job interface instead.
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

@Deprecated
public static final String PROPERTY_JOB_RETRIES
Deprecated. - Use the new Job interface instead.
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_RETRY_DELAY

@Deprecated
public static final String PROPERTY_JOB_RETRY_DELAY
Deprecated. - Use the new Job interface instead.
The property to set a retry delay. Value is of type Long and specifies milliseconds.

See Also:
Constant Field Values

PROPERTY_JOB_QUEUE_NAME

@Deprecated
public static final String PROPERTY_JOB_QUEUE_NAME
Deprecated. - Use the new Job interface instead.
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_QUEUE_ORDERED

@Deprecated
public static final String PROPERTY_JOB_QUEUE_ORDERED
Deprecated. 
This property is not supported anymore

See Also:
Constant Field Values

PROPERTY_JOB_PRIORITY

@Deprecated
public static final String PROPERTY_JOB_PRIORITY
Deprecated. - Use the new Job interface instead.
This property is set by the job handling to define the priority of this job execution. The property is evaluated by the processJob(Event, JobProcessor) method. If another way of executing the job is used, it is up to the processor to ensure the job priority is taken into account. 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_CREATED

@Deprecated
public static final String PROPERTY_JOB_CREATED
Deprecated. - Use the new Job interface instead.
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_APPLICATION

@Deprecated
public static final String PROPERTY_JOB_CREATED_APPLICATION
Deprecated. - Use the new Job interface instead.
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_APPLICATION

@Deprecated
public static final String PROPERTY_JOB_APPLICATION
Deprecated. - Use the new Job interface instead.
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

TOPIC_JOB

@Deprecated
public static final String TOPIC_JOB
Deprecated. - Use the new JobManager.addJob(String, String, java.util.Map) method instead.
The topic for jobs.

See Also:
Constant Field Values

JOB_ID

@Deprecated
public static final String JOB_ID
Deprecated. - Use the new Job interface instead.
This is a unique identifier which can be used to cancel the job.

See Also:
Constant Field Values

TOPIC_JOB_STARTED

public static final String TOPIC_JOB_STARTED
Asynchronous notification event when a job is started. The property NOTIFICATION_PROPERTY_JOB_TOPIC contains the job topic, the property NOTIFICATION_PROPERTY_JOB_NAME might contain the job name, and the property NOTIFICATION_PROPERTY_JOB_ID contains the unique job id. The time stamp of the event (as a Long) is available from the property EventConstants.TIMESTAMP. The payload of the job is available as additional job specific properties.

See Also:
Constant Field Values

TOPIC_JOB_FINISHED

public static final String TOPIC_JOB_FINISHED
Asynchronous notification event when a job is finished. The property NOTIFICATION_PROPERTY_JOB_TOPIC contains the job topic, the property NOTIFICATION_PROPERTY_JOB_NAME might contain the job name, and the property NOTIFICATION_PROPERTY_JOB_ID contains the unique job id. The time stamp of the event (as a Long) is available from the property EventConstants.TIMESTAMP. The payload of the job is available as additional job specific properties.

See Also:
Constant Field Values

TOPIC_JOB_FAILED

public static final String TOPIC_JOB_FAILED
Asynchronous notification event when a job failed. If a job execution fails, it is rescheduled for another try. The property NOTIFICATION_PROPERTY_JOB_TOPIC contains the job topic, the property NOTIFICATION_PROPERTY_JOB_NAME might contain the job name, and the property NOTIFICATION_PROPERTY_JOB_ID contains the unique job id. The time stamp of the event (as a Long) is available from the property EventConstants.TIMESTAMP. The payload of the job is available as additional job specific properties.

See Also:
Constant Field Values

TOPIC_JOB_CANCELLED

public static final String TOPIC_JOB_CANCELLED
A synchronous notification event when a job is cancelled. If a job execution is cancelled it is not rescheduled. The property NOTIFICATION_PROPERTY_JOB_TOPIC contains the job topic, the property NOTIFICATION_PROPERTY_JOB_NAME might contain the job name, and the property NOTIFICATION_PROPERTY_JOB_ID contains the unique job id. The time stamp of the event (as a Long) is available from the property EventConstants.TIMESTAMP. The payload of the job is available as additional job specific properties.

See Also:
Constant Field Values

PROPERTY_NOTIFICATION_JOB

@Deprecated
public static final String PROPERTY_NOTIFICATION_JOB
Deprecated. 
Property containing the job event. The value is of type org.osgi.service.event.Event.

See Also:
Constant Field Values

NOTIFICATION_PROPERTY_JOB_TOPIC

public static final String NOTIFICATION_PROPERTY_JOB_TOPIC
Property containing the job topic. Value is of type String.

See Also:
Job.getTopic(), Constant Field Values

NOTIFICATION_PROPERTY_JOB_NAME

public static final String NOTIFICATION_PROPERTY_JOB_NAME
Property containing the optional job name. Value is of type String.

See Also:
Job.getName(), Constant Field Values

NOTIFICATION_PROPERTY_JOB_ID

public static final String NOTIFICATION_PROPERTY_JOB_ID
Property containing the unique job ID. Value is of type String.

See Also:
Job.getId(), Constant Field Values
Method Detail

isJobEvent

@Deprecated
public static boolean isJobEvent(org.osgi.service.event.Event event)
Deprecated. - Use the new Job interface instead.

Is this a job event? This method checks if the event contains the PROPERTY_JOB_TOPIC property.

Parameters:
event - The event to check.
Returns:
true> if this is a job event.

acknowledgeJob

@Deprecated
public static boolean acknowledgeJob(org.osgi.service.event.Event job)
Deprecated. - Use the new JobConsumer interface instead.

Send an acknowledge. This signals the job handler that someone is starting to process the job. This method should be invoked as a first command during job processing. If this method returns false this means someone else is already processing this job, and the caller should not process the event anymore.

Returns:
Returns true if the acknowledge could be sent
Throws:
IllegalArgumentException - If the event is a job event but does not have a notifier context.

finishedJob

@Deprecated
public static void finishedJob(org.osgi.service.event.Event job)
Deprecated. - Use the new JobConsumer interface instead.

Notify a finished job.

Throws:
IllegalArgumentException - If the event is a job event but does not have a notifier context.

rescheduleJob

@Deprecated
public static boolean rescheduleJob(org.osgi.service.event.Event job)
Deprecated. - Use the new JobConsumer interface instead.

Notify a failed job.

Returns:
true if the job has been rescheduled, false otherwise.
Throws:
IllegalArgumentException - If the event is a job event but does not have a notifier context.

processJob

@Deprecated
public static void processJob(org.osgi.service.event.Event job,
                                         JobProcessor processor)
Deprecated. - Use the new JobConsumer interface instead.

Process a job in the background and notify its success. This method also sends an acknowledge message to the job event handler.

Throws:
IllegalArgumentException - If the event is a job event but does not have a notifier context.

getJobCreated

@Deprecated
public static Calendar getJobCreated(org.osgi.service.event.Event job)
Deprecated. - Use the new Job interface instead.

Get the created calendar object.

Parameters:
job - The job event
Returns:
The created info or null if this is not a job event.


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