com.xpn.xwiki.plugin.scheduler
Class SchedulerPlugin

java.lang.Object
  extended by com.xpn.xwiki.plugin.XWikiDefaultPlugin
      extended by com.xpn.xwiki.plugin.scheduler.SchedulerPlugin
All Implemented Interfaces:
com.xpn.xwiki.plugin.XWikiPluginInterface

public class SchedulerPlugin
extends com.xpn.xwiki.plugin.XWikiDefaultPlugin

See SchedulerPluginApi for documentation.

Version:
$Id: SchedulerPlugin.java 12095 2008-08-27 15:45:57Z jvdrean $

Field Summary
static java.lang.String XWIKI_JOB_CLASS
          Fullname of the XWiki Scheduler Job Class representing a job that can be scheduled by this plugin.
 
Constructor Summary
SchedulerPlugin(java.lang.String name, java.lang.String className, com.xpn.xwiki.XWikiContext context)
          Default plugin constructor.
 
Method Summary
 JobState getJobStatus(com.xpn.xwiki.objects.BaseObject object, com.xpn.xwiki.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.
 java.lang.String getName()
          
 java.util.Date getNextFireTime(com.xpn.xwiki.objects.BaseObject object, com.xpn.xwiki.XWikiContext context)
          Get the next fire time for the given job name SchedulerJob
 com.xpn.xwiki.api.Api getPluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface plugin, com.xpn.xwiki.XWikiContext context)
          
 org.quartz.Scheduler getScheduler()
           
 void init(com.xpn.xwiki.XWikiContext context)
          
 void pauseJob(com.xpn.xwiki.objects.BaseObject object, com.xpn.xwiki.XWikiContext context)
          Pause the job with the given name by pausing all of its current triggers.
 void resumeJob(com.xpn.xwiki.objects.BaseObject object, com.xpn.xwiki.XWikiContext context)
          Resume the job with the given name (un-pause)
 boolean scheduleJob(com.xpn.xwiki.objects.BaseObject object, com.xpn.xwiki.XWikiContext context)
           
 void setScheduler(org.quartz.Scheduler scheduler)
           
 void unscheduleJob(com.xpn.xwiki.objects.BaseObject object, com.xpn.xwiki.XWikiContext context)
          Unschedule the given job
 void virtualInit(com.xpn.xwiki.XWikiContext context)
          
 
Methods inherited from class com.xpn.xwiki.plugin.XWikiDefaultPlugin
beginParsing, beginRendering, commonTagsHandler, downloadAttachment, endParsing, endRendering, endRenderingHandler, flushCache, flushCache, getClassName, insidePREHandler, outsidePREHandler, setClassName, setName, startRenderingHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XWIKI_JOB_CLASS

public static final java.lang.String XWIKI_JOB_CLASS
Fullname of the XWiki Scheduler Job Class representing a job that can be scheduled by this plugin.

See Also:
Constant Field Values
Constructor Detail

SchedulerPlugin

public SchedulerPlugin(java.lang.String name,
                       java.lang.String className,
                       com.xpn.xwiki.XWikiContext context)
Default plugin constructor.

See Also:
XWikiDefaultPlugin.XWikiDefaultPlugin(String,String,com.xpn.xwiki.XWikiContext)
Method Detail

init

public void init(com.xpn.xwiki.XWikiContext context)

Specified by:
init in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
init in class com.xpn.xwiki.plugin.XWikiDefaultPlugin
See Also:
XWikiPluginInterface.init(com.xpn.xwiki.XWikiContext)

virtualInit

public void virtualInit(com.xpn.xwiki.XWikiContext context)

Specified by:
virtualInit in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
virtualInit in class com.xpn.xwiki.plugin.XWikiDefaultPlugin
See Also:
XWikiPluginInterface.virtualInit(com.xpn.xwiki.XWikiContext)

getJobStatus

public JobState getJobStatus(com.xpn.xwiki.objects.BaseObject object,
                             com.xpn.xwiki.XWikiContext context)
                      throws org.quartz.SchedulerException
Retrieve the job's status of a given 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.

Parameters:
object - the XObject to give the status of
Returns:
the status of the Job inside the quartz scheduler, as JobState instance
Throws:
org.quartz.SchedulerException

scheduleJob

public boolean scheduleJob(com.xpn.xwiki.objects.BaseObject object,
                           com.xpn.xwiki.XWikiContext context)
                    throws SchedulerPluginException
Throws:
SchedulerPluginException

pauseJob

public void pauseJob(com.xpn.xwiki.objects.BaseObject object,
                     com.xpn.xwiki.XWikiContext context)
              throws SchedulerPluginException
Pause the job with the given name by pausing all of its current triggers.

Parameters:
object - the non-wrapped XObject Job to be paused
Throws:
SchedulerPluginException

resumeJob

public void resumeJob(com.xpn.xwiki.objects.BaseObject object,
                      com.xpn.xwiki.XWikiContext context)
               throws SchedulerPluginException
Resume the job with the given name (un-pause)

Parameters:
object - the non-wrapped XObject Job to be resumed
Throws:
SchedulerPluginException

unscheduleJob

public void unscheduleJob(com.xpn.xwiki.objects.BaseObject object,
                          com.xpn.xwiki.XWikiContext context)
                   throws SchedulerPluginException
Unschedule the given job

Parameters:
object - the unwrapped XObject job to be unscheduled
Throws:
SchedulerPluginException

getNextFireTime

public java.util.Date getNextFireTime(com.xpn.xwiki.objects.BaseObject object,
                                      com.xpn.xwiki.XWikiContext context)
                               throws SchedulerPluginException
Get the next fire time for the given job name SchedulerJob

Parameters:
object - unwrapped XObject job for which the next fire time will be given
Returns:
the next Date the job will be fired at
Throws:
SchedulerPluginException

getPluginApi

public com.xpn.xwiki.api.Api getPluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface plugin,
                                          com.xpn.xwiki.XWikiContext context)

Specified by:
getPluginApi in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
getPluginApi in class com.xpn.xwiki.plugin.XWikiDefaultPlugin

getName

public java.lang.String getName()

Specified by:
getName in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
getName in class com.xpn.xwiki.plugin.XWikiDefaultPlugin

setScheduler

public void setScheduler(org.quartz.Scheduler scheduler)
Parameters:
scheduler - the scheduler to use

getScheduler

public org.quartz.Scheduler getScheduler()
Returns:
the scheduler in use


Copyright © 2004-2009 XWiki. All Rights Reserved.