info.magnolia.module.scheduler
Class SchedulerModule

java.lang.Object
  extended by info.magnolia.module.scheduler.SchedulerModule
All Implemented Interfaces:
info.magnolia.module.ModuleLifecycle

public class SchedulerModule
extends Object
implements info.magnolia.module.ModuleLifecycle

Scheduler module. Under the node jobs one can create jobs by defining the command to use. The scheduling is done based on a cron syntax scheduling expression. The job definition can contain a params node which can hold values passed to the command in the execution-context.


Field Summary
protected  org.quartz.Scheduler scheduler
          The quartz scheduler.
 
Constructor Summary
SchedulerModule()
           
 
Method Summary
 void addJob(JobDefinition job)
           
protected  String cronToQuarzCron(String cron)
           
static SchedulerModule getInstance()
          Deprecated. since 2.0.1. Please, use IoC instead.
 List<JobDefinition> getJobs()
           
 org.quartz.Scheduler getScheduler()
          If you need to get the scheduler handled by the module.
protected  void initJob(JobDefinition job)
          Initialize a single job.
protected  void initJobs()
          Add all the jobs defined in the jobs node.
protected  void initScheduler()
          Start the scheduler.
 void setJobs(List<JobDefinition> jobs)
           
 void start(info.magnolia.module.ModuleLifecycleContext moduleLifecycleContext)
          Start scheduler and add jobs.
protected  void startJob(JobDefinition job)
           
 void stop(info.magnolia.module.ModuleLifecycleContext moduleLifecycleContext)
          Stops the scheduler.
 void stopJob(String name)
          Deletes the job safely.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scheduler

protected org.quartz.Scheduler scheduler
The quartz scheduler.

Constructor Detail

SchedulerModule

public SchedulerModule()
Method Detail

getJobs

public List<JobDefinition> getJobs()

setJobs

public void setJobs(List<JobDefinition> jobs)
             throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

addJob

public void addJob(JobDefinition job)
            throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

stop

public void stop(info.magnolia.module.ModuleLifecycleContext moduleLifecycleContext)
Stops the scheduler.

Specified by:
stop in interface info.magnolia.module.ModuleLifecycle

start

public void start(info.magnolia.module.ModuleLifecycleContext moduleLifecycleContext)
Start scheduler and add jobs.

Specified by:
start in interface info.magnolia.module.ModuleLifecycle

initJobs

protected void initJobs()
Add all the jobs defined in the jobs node.


initJob

protected void initJob(JobDefinition job)
                throws org.quartz.SchedulerException
Initialize a single job.

Throws:
org.quartz.SchedulerException

startJob

protected void startJob(JobDefinition job)
                 throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

cronToQuarzCron

protected String cronToQuarzCron(String cron)

stopJob

public void stopJob(String name)
             throws org.quartz.SchedulerException
Deletes the job safely. If the job is not defined, the method does NOT throw an exception.

Throws:
org.quartz.SchedulerException

initScheduler

protected void initScheduler()
                      throws org.quartz.SchedulerException
Start the scheduler. No special configuration done yet.

Throws:
org.quartz.SchedulerException

getScheduler

public org.quartz.Scheduler getScheduler()
If you need to get the scheduler handled by the module.


getInstance

public static SchedulerModule getInstance()
Deprecated. since 2.0.1. Please, use IoC instead.

Singleton instance of the module.



Copyright © 2014 Magnolia International Ltd.. All Rights Reserved.