|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.sling.event.impl.AbstractRepositoryEventHandler
org.apache.sling.event.impl.TimedJobHandler
@Service(value=TimedEventStatusProvider.class) @Properties(value={@Property(name="event.topics",propertyPrivate=true,value={"org/osgi/framework/BundleEvent/UPDATED","org/osgi/framework/BundleEvent/STARTED","org/apache/sling/event/timed"}),@Property(name="repository.path",value="/var/eventing/timed-jobs",propertyPrivate=true)}) public class TimedJobHandler
An event handler for timed events.
Nested Class Summary | |
---|---|
protected static class |
TimedJobHandler.ScheduleInfo
|
Nested classes/interfaces inherited from class org.apache.sling.event.impl.AbstractRepositoryEventHandler |
---|
AbstractRepositoryEventHandler.EventInfo |
Field Summary |
---|
Fields inherited from class org.apache.sling.event.impl.AbstractRepositoryEventHandler |
---|
CONFIG_PROPERTY_REPO_PATH, environment, logger, queue, repositoryPath, running, writeLock, writeQueue, writerSession |
Fields inherited from interface org.apache.sling.event.TimedEventStatusProvider |
---|
PROPERTY_EVENT_ID |
Constructor Summary | |
---|---|
TimedJobHandler()
|
Method Summary | |
---|---|
protected void |
addNodeProperties(javax.jcr.Node eventNode,
org.osgi.service.event.Event event)
Add properties when storing event in repository. |
void |
cancelTimedEvent(String jobId)
Cancel this timed event. |
void |
execute(JobContext context)
Execute this job. |
protected String |
getEventNodeType()
Return the node type for the event. |
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 schedulded events. |
void |
handleEvent(org.osgi.service.event.Event event)
|
protected void |
loadEvents()
Load all active timed events from the repository. |
void |
onEvent(javax.jcr.observation.EventIterator iter)
|
protected String |
persistEvent(org.osgi.service.event.Event event,
TimedJobHandler.ScheduleInfo scheduleInfo)
|
protected boolean |
processEvent(org.osgi.service.event.Event event,
TimedJobHandler.ScheduleInfo scheduleInfo)
Process the event. |
protected void |
processWriteQueue()
|
protected void |
runInBackground()
|
protected void |
startWriterSession()
Start the repository session and add this handler as an observer for new events created on other nodes. |
Methods inherited from class org.apache.sling.event.impl.AbstractRepositoryEventHandler |
---|
activate, addEventProperties, deactivate, getWriterRootNode, ignoreException, readEvent, stopWriterSession, writeEvent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimedJobHandler()
Method Detail |
---|
protected void startWriterSession() throws javax.jcr.RepositoryException
AbstractRepositoryEventHandler
startWriterSession
in class AbstractRepositoryEventHandler
javax.jcr.RepositoryException
AbstractRepositoryEventHandler.startWriterSession()
protected void processWriteQueue()
processWriteQueue
in class AbstractRepositoryEventHandler
AbstractRepositoryEventHandler.processWriteQueue()
protected void runInBackground()
runInBackground
in class AbstractRepositoryEventHandler
AbstractRepositoryEventHandler.runInBackground()
protected String persistEvent(org.osgi.service.event.Event event, TimedJobHandler.ScheduleInfo scheduleInfo)
protected boolean processEvent(org.osgi.service.event.Event event, TimedJobHandler.ScheduleInfo scheduleInfo)
event
- The incomming event.
public void onEvent(javax.jcr.observation.EventIterator iter)
onEvent
in interface javax.jcr.observation.EventListener
EventListener.onEvent(javax.jcr.observation.EventIterator)
public void handleEvent(org.osgi.service.event.Event event)
handleEvent
in interface org.osgi.service.event.EventHandler
EventHandler.handleEvent(org.osgi.service.event.Event)
public void execute(JobContext context)
Job
execute
in interface Job
context
- The context of the job.Job.execute(org.apache.sling.commons.scheduler.JobContext)
protected void loadEvents()
javax.jcr.RepositoryException
protected void addNodeProperties(javax.jcr.Node eventNode, org.osgi.service.event.Event event) throws javax.jcr.RepositoryException
AbstractRepositoryEventHandler
addNodeProperties
in class AbstractRepositoryEventHandler
javax.jcr.RepositoryException
org.apache.sling.engine.event.impl.JobPersistenceHandler#addNodeProperties(javax.jcr.Node, org.osgi.service.event.Event)
protected String getEventNodeType()
AbstractRepositoryEventHandler
getEventNodeType
in class AbstractRepositoryEventHandler
AbstractRepositoryEventHandler.getEventNodeType()
public org.osgi.service.event.Event getScheduledEvent(String topic, String eventId, String jobId)
TimedEventStatusProvider
getScheduledEvent
in interface TimedEventStatusProvider
TimedEventStatusProvider.getScheduledEvent(java.lang.String, java.lang.String, java.lang.String)
public Collection<org.osgi.service.event.Event> getScheduledEvents(String topic, Map<String,Object>... filterProps)
TimedEventStatusProvider
getScheduledEvents
in interface TimedEventStatusProvider
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).
TimedEventStatusProvider.getScheduledEvents(java.lang.String, java.util.Map...)
public void cancelTimedEvent(String jobId)
TimedEventStatusProvider
cancelTimedEvent
in interface TimedEventStatusProvider
jobId
- The unique identifer as found in the property TimedEventStatusProvider.PROPERTY_EVENT_ID
.TimedEventStatusProvider.cancelTimedEvent(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |