public class SchedulerPlugin extends XWikiDefaultPlugin implements org.xwiki.observation.EventListener
SchedulerPluginApi
for documentation.Modifier and Type | Field and Description |
---|---|
static String |
XWIKI_JOB_CLASS
Deprecated.
use
XWIKI_JOB_CLASSREFERENCE instead |
static org.xwiki.model.reference.EntityReference |
XWIKI_JOB_CLASSREFERENCE
Local reference of the XWiki Scheduler Job Class representing a job that can be scheduled by this plugin.
|
Constructor and Description |
---|
SchedulerPlugin(String name,
String className,
XWikiContext context)
Default plugin constructor.
|
Modifier and Type | Method and Description |
---|---|
List<org.xwiki.observation.event.Event> |
getEvents() |
JobState |
getJobStatus(BaseObject object,
XWikiContext context)
Retrieve the job's status of a given
XWIKI_JOB_CLASS job
XObject, by asking the actual job status to the quartz scheduler instance. |
String |
getName() |
Date |
getNextFireTime(BaseObject object,
XWikiContext context)
Get the next fire time for the given job name SchedulerJob
|
Api |
getPluginApi(XWikiPluginInterface plugin,
XWikiContext context) |
Date |
getPreviousFireTime(BaseObject object,
XWikiContext context)
Give, for a BaseObject job in a
JobState.STATE_NORMAL state, the previous date at which the job has been
executed. |
org.quartz.Scheduler |
getScheduler() |
void |
init(XWikiContext context) |
void |
onEvent(org.xwiki.observation.event.Event event,
Object source,
Object data) |
void |
pauseJob(BaseObject object,
XWikiContext context)
Pause the job with the given name by pausing all of its current triggers.
|
void |
resumeJob(BaseObject object,
XWikiContext context)
Resume the job with the given name (un-pause)
|
boolean |
scheduleJob(BaseObject object,
XWikiContext context) |
void |
setScheduler(org.quartz.Scheduler scheduler) |
void |
triggerJob(BaseObject object,
XWikiContext context)
Trigger a job (execute it now)
|
void |
unscheduleJob(BaseObject object,
XWikiContext context)
Unschedule the given job
|
beginParsing, beginRendering, commonTagsHandler, downloadAttachment, endParsing, endRendering, endRenderingHandler, flushCache, flushCache, getClassName, getLocalization, insidePREHandler, localizePlainOrKey, outsidePREHandler, setClassName, setName, startRenderingHandler, virtualInit
@Deprecated public static final String XWIKI_JOB_CLASS
XWIKI_JOB_CLASSREFERENCE
insteadpublic static final org.xwiki.model.reference.EntityReference XWIKI_JOB_CLASSREFERENCE
public SchedulerPlugin(String name, String className, XWikiContext context)
public void init(XWikiContext context)
init
in interface XWikiPluginInterface
init
in class XWikiDefaultPlugin
public JobState getJobStatus(BaseObject object, XWikiContext context) throws org.quartz.SchedulerException
XWIKI_JOB_CLASS
job
XObject, by asking the actual job status to the quartz scheduler instance. It's the actual status, as the one
stored in the XObject may be changed manually by users.object
- the XObject to give the status ofJobState
instanceorg.quartz.SchedulerException
public boolean scheduleJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
SchedulerPluginException
public void pauseJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
object
- the non-wrapped XObject Job to be pausedSchedulerPluginException
public void resumeJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
object
- the non-wrapped XObject Job to be resumedSchedulerPluginException
public void triggerJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
object
- the non-wrapped XObject Job to be triggeredcontext
- the XWiki contextSchedulerPluginException
public void unscheduleJob(BaseObject object, XWikiContext context) throws SchedulerPluginException
object
- the unwrapped XObject job to be unscheduledSchedulerPluginException
public Date getPreviousFireTime(BaseObject object, XWikiContext context) throws SchedulerPluginException
JobState.STATE_NORMAL
state, the previous date at which the job has been
executed. Note that this method does not compute a date from the CRON expression, it only returns a date value
which is set each time the job is executed. If the job has never been fired this method will return null.object
- unwrapped XObject job for which the next fire time will be givencontext
- the XWiki contextSchedulerPluginException
public Date getNextFireTime(BaseObject object, XWikiContext context) throws SchedulerPluginException
object
- unwrapped XObject job for which the next fire time will be givenSchedulerPluginException
public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context)
getPluginApi
in interface XWikiPluginInterface
getPluginApi
in class XWikiDefaultPlugin
public String getName()
getName
in interface XWikiPluginInterface
getName
in interface org.xwiki.observation.EventListener
getName
in class XWikiDefaultPlugin
public void setScheduler(org.quartz.Scheduler scheduler)
scheduler
- the scheduler to usepublic org.quartz.Scheduler getScheduler()
public List<org.xwiki.observation.event.Event> getEvents()
getEvents
in interface org.xwiki.observation.EventListener
Copyright © 2004–2021 XWiki. All rights reserved.