org.apache.sling.event.impl.jobs.timed
Class TimedEventSender

java.lang.Object
  extended by org.apache.sling.event.impl.jobs.timed.TimedEventSender
All Implemented Interfaces:
org.apache.sling.commons.scheduler.Job, org.apache.sling.discovery.TopologyEventListener, TimedEventStatusProvider, org.osgi.service.event.EventHandler

@Service(value={TimedEventStatusProvider.class,org.osgi.service.event.EventHandler.class,org.apache.sling.discovery.TopologyEventListener.class})
@Property(name="event.topics",
          value={"org/apache/sling/api/resource/Resource/ADDED","org/apache/sling/api/resource/Resource/REMOVED","org/apache/sling/api/resource/Resource/CHANGED","org/osgi/framework/BundleEvent/STARTED","org/osgi/framework/BundleEvent/UPDATED"})
public class TimedEventSender
extends Object
implements org.apache.sling.commons.scheduler.Job, TimedEventStatusProvider, org.osgi.service.event.EventHandler, org.apache.sling.discovery.TopologyEventListener

An event handler for timed events.


Field Summary
 
Fields inherited from interface org.apache.sling.event.TimedEventStatusProvider
PROPERTY_EVENT_ID
 
Constructor Summary
TimedEventSender()
           
 
Method Summary
protected  void activate()
          Activate this component.
 void cancelTimedEvent(String jobId)
          Cancel this timed event.
protected  void deactivate()
          Deactivate this component.
 void execute(org.apache.sling.commons.scheduler.JobContext context)
           
 org.osgi.service.event.Event getScheduledEvent(String topic, String eventId, String jobId)
          Return the scheduled event with the given id.
 Collection<org.osgi.service.event.Event> getScheduledEvents(String topic, Map<String,Object>... filterProps)
          Return a list of currently scheduled events.
 void handleEvent(org.osgi.service.event.Event event)
           
 void handleTopologyEvent(org.apache.sling.discovery.TopologyEvent event)
           
protected  boolean processEvent(org.osgi.service.event.Event event, org.apache.sling.event.impl.jobs.timed.ScheduleInfo scheduleInfo)
          Process the event.
protected  void runInBackground()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimedEventSender

public TimedEventSender()
Method Detail

activate

@Activate
protected void activate()
Activate this component.


deactivate

@Deactivate
protected void deactivate()
Deactivate this component.


runInBackground

protected void runInBackground()
See Also:
org.apache.sling.event.impl.AbstractRepositoryEventHandler#runInBackground()

processEvent

protected boolean processEvent(org.osgi.service.event.Event event,
                               org.apache.sling.event.impl.jobs.timed.ScheduleInfo scheduleInfo)
Process the event. If a scheduler is available, a job is scheduled or stopped.

Parameters:
event - The incoming event.
Returns:

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)

execute

public void execute(org.apache.sling.commons.scheduler.JobContext context)
Specified by:
execute in interface org.apache.sling.commons.scheduler.Job
See Also:
Job.execute(org.apache.sling.commons.scheduler.JobContext)

getScheduledEvent

public org.osgi.service.event.Event getScheduledEvent(String topic,
                                                      String eventId,
                                                      String jobId)
Description copied from interface: TimedEventStatusProvider
Return the scheduled event with the given id.

Specified by:
getScheduledEvent in interface TimedEventStatusProvider
Returns:
The scheduled event or null.
See Also:
TimedEventStatusProvider.getScheduledEvent(java.lang.String, java.lang.String, java.lang.String)

getScheduledEvents

public Collection<org.osgi.service.event.Event> getScheduledEvents(String topic,
                                                                   Map<String,Object>... filterProps)
Description copied from interface: TimedEventStatusProvider
Return a list of currently scheduled events.

Specified by:
getScheduledEvents in interface TimedEventStatusProvider
Parameters:
topic - Topic can be used as a filter, if it is non-null, only jobs with this topic will be returned.
filterProps - A list of filter property maps. Each map acts like a template. The searched event must match the template (AND query). By providing several maps, different filters are possible (OR query).
Returns:
A non null collection.
See Also:
TimedEventStatusProvider.getScheduledEvents(java.lang.String, java.util.Map...)

cancelTimedEvent

public void cancelTimedEvent(String jobId)
Description copied from interface: TimedEventStatusProvider
Cancel this timed event.

Specified by:
cancelTimedEvent in interface TimedEventStatusProvider
Parameters:
jobId - The unique identifier as found in the property TimedEventStatusProvider.PROPERTY_EVENT_ID.
See Also:
TimedEventStatusProvider.cancelTimedEvent(java.lang.String)

handleTopologyEvent

public void handleTopologyEvent(org.apache.sling.discovery.TopologyEvent event)
Specified by:
handleTopologyEvent in interface org.apache.sling.discovery.TopologyEventListener
See Also:
TopologyEventListener.handleTopologyEvent(org.apache.sling.discovery.TopologyEvent)


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