org.apache.sling.event.impl.jobs.deprecated
Class EventAdminBridge

java.lang.Object
  extended by org.apache.sling.event.impl.jobs.deprecated.EventAdminBridge
All Implemented Interfaces:
JobConsumer, org.osgi.service.event.EventHandler

@Service(value={org.osgi.service.event.EventHandler.class,JobConsumer.class})
@Properties(value={@Property(name="event.topics",value="org/apache/sling/event/job"),@Property(name="job.topics",value="/")})
public class EventAdminBridge
extends Object
implements org.osgi.service.event.EventHandler, JobConsumer

Event admin bridge for compatibility. This event handler receives jobs from the event admin and adds them to the job manager. It uses an async queue for adding. This handler is enabled by default, to disable it provide a configuration which removes both topic properties (or sets them to null)


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.sling.event.jobs.consumer.JobConsumer
JobConsumer.AsyncHandler, JobConsumer.JobResult
 
Field Summary
 
Fields inherited from interface org.apache.sling.event.jobs.consumer.JobConsumer
PROPERTY_JOB_ASYNC_HANDLER, PROPERTY_TOPICS
 
Constructor Summary
EventAdminBridge()
           
 
Method Summary
protected  void activate()
          Activate this component and start background thread
protected  void deactivate()
          Deactivate this component.
 void handleEvent(org.osgi.service.event.Event event)
           
 JobConsumer.JobResult process(Job job)
          Execute the job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventAdminBridge

public EventAdminBridge()
Method Detail

activate

@Activate
protected void activate()
Activate this component and start background thread


deactivate

@Deactivate
protected void deactivate()
Deactivate this component.


handleEvent

public void handleEvent(org.osgi.service.event.Event event)
Specified by:
handleEvent in interface org.osgi.service.event.EventHandler
See Also:
EventHandler.handleEvent(org.osgi.service.event.Event)

process

public JobConsumer.JobResult process(Job job)
Description copied from interface: JobConsumer
Execute the job. If the job has been processed successfully, JobResult.OK should be returned. If the job has not been processed completely, but might be rescheduled JobResult.FAILED should be returned. If the job processing failed and should not be rescheduled, JobResult.CANCEL should be returned. If the consumer decides to process the job asynchronously it should return JobResult.ASYNC and notify the job manager by using the JobConsumer.AsyncHandler interface. If the processing fails with throwing an exception/throwable, the process will not be rescheduled and treated like the method would have returned JobResult.CANCEL.

Specified by:
process in interface JobConsumer
Parameters:
job - The job
Returns:
The job result


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