org.pentaho.platform.scheduler
Class QuartzSubscriptionScheduler

java.lang.Object
  extended by org.pentaho.platform.scheduler.QuartzSubscriptionScheduler
All Implemented Interfaces:
ISubscriptionScheduler

public class QuartzSubscriptionScheduler
extends Object
implements ISubscriptionScheduler

Provides the interface between the Quartz Scheduling component and the Subscription Subsystem

Author:
dmoran

Field Summary
static String GROUP_NAME
           
 
Constructor Summary
QuartzSubscriptionScheduler()
           
 
Method Summary
static Trigger createTriggerFromSchedule(ISchedule sched)
           
 IScheduledJob deleteJob(String triggerName)
          Delete the job.
 IScheduledJob executeJob(String jobName)
          Execute the job.
 String getCronSummary(String cron)
           
 IScheduledJob getScheduledJob(String schedRef)
          Returns the IScheduledJob for the passed in schedule reference from the scheduling system
 Map<String,IScheduledJob> getScheduledJobMap()
          NOTE: doesn't actually throw any checked exceptions
 List<QuartzScheduledJob> getScheduledJobs()
          Returns a List of all IScheduledJobs that are currently in the subscription scheduling system
 int getSchedulerState()
           
 IScheduledJob pauseJob(String jobName)
          Pause the job.
 void pauseScheduler()
           
 IScheduledJob resumeJob(String jobName)
          Resume the job.
 void resumeScheduler()
           
 IScheduledJob scheduleJob(ISchedule schedule)
           
 List syncSchedule(List newSchedules)
          Returns a list of exception messages
 IScheduledJob syncSchedule(String oldScheduleReference, ISchedule newSchedule)
          Synchronizes The Scheduler schedule with the subscription schedule.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_NAME

public static final String GROUP_NAME
Constructor Detail

QuartzSubscriptionScheduler

public QuartzSubscriptionScheduler()
Method Detail

syncSchedule

public IScheduledJob syncSchedule(String oldScheduleReference,
                                  ISchedule newSchedule)
                           throws SubscriptionSchedulerException
Synchronizes The Scheduler schedule with the subscription schedule. Returns the scheduled job or null if the job was deleted

Specified by:
syncSchedule in interface ISubscriptionScheduler
newSchedule - The schedule to modify or add. If null, then the operation is treated as an delete.
Returns:
true if successfull
Throws:
SubscriptionSchedulerException

syncSchedule

public List syncSchedule(List newSchedules)
                  throws Exception
Returns a list of exception messages

Specified by:
syncSchedule in interface ISubscriptionScheduler
Parameters:
newSchedules - The list of schedules that should exist. Any schedules not in the list should be deleted
Returns:
list of exception messages
Throws:
Exception

getScheduledJobMap

public Map<String,IScheduledJob> getScheduledJobMap()
                                             throws SchedulerException,
                                                    SubscriptionSchedulerException
NOTE: doesn't actually throw any checked exceptions

Specified by:
getScheduledJobMap in interface ISubscriptionScheduler
Throws:
SchedulerException
SubscriptionSchedulerException

getScheduledJob

public IScheduledJob getScheduledJob(String schedRef)
                              throws SubscriptionSchedulerException
Description copied from interface: ISubscriptionScheduler
Returns the IScheduledJob for the passed in schedule reference from the scheduling system

Specified by:
getScheduledJob in interface ISubscriptionScheduler
Throws:
SubscriptionSchedulerException

getScheduledJobs

public List<QuartzScheduledJob> getScheduledJobs()
Description copied from interface: ISubscriptionScheduler
Returns a List of all IScheduledJobs that are currently in the subscription scheduling system

Specified by:
getScheduledJobs in interface ISubscriptionScheduler

pauseJob

public IScheduledJob pauseJob(String jobName)
                       throws Exception
Description copied from interface: ISubscriptionScheduler
Pause the job. NOTE: in the quartz implementation, the value of the jobName parameter should be the trigger name associated with the job to be paused.

Specified by:
pauseJob in interface ISubscriptionScheduler
Returns:
Throws:
Exception

resumeJob

public IScheduledJob resumeJob(String jobName)
                        throws Exception
Description copied from interface: ISubscriptionScheduler
Resume the job. NOTE: in the quartz implementation, the value of the jobName parameter should be the trigger name associated with the job to be resumed.

Specified by:
resumeJob in interface ISubscriptionScheduler
Returns:
Throws:
Exception

executeJob

public IScheduledJob executeJob(String jobName)
                         throws Exception
Description copied from interface: ISubscriptionScheduler
Execute the job. NOTE: in the quartz implementation, the value of the jobName parameter should be the trigger name associated with the job to be executed.

Specified by:
executeJob in interface ISubscriptionScheduler
Returns:
Throws:
Exception

deleteJob

public IScheduledJob deleteJob(String triggerName)
                        throws Exception
Description copied from interface: ISubscriptionScheduler
Delete the job. NOTE: in the quartz implementation, the value of the jobName parameter should be the trigger name associated with the job to be deleted.

Specified by:
deleteJob in interface ISubscriptionScheduler
Returns:
Throws:
Exception

scheduleJob

public IScheduledJob scheduleJob(ISchedule schedule)
                          throws Exception
Specified by:
scheduleJob in interface ISubscriptionScheduler
Throws:
Exception

getSchedulerState

public int getSchedulerState()
                      throws Exception
Specified by:
getSchedulerState in interface ISubscriptionScheduler
Throws:
Exception

pauseScheduler

public void pauseScheduler()
                    throws Exception
Specified by:
pauseScheduler in interface ISubscriptionScheduler
Throws:
Exception

resumeScheduler

public void resumeScheduler()
                     throws Exception
Specified by:
resumeScheduler in interface ISubscriptionScheduler
Throws:
Exception

getCronSummary

public String getCronSummary(String cron)
                      throws Exception
Specified by:
getCronSummary in interface ISubscriptionScheduler
Throws:
Exception

createTriggerFromSchedule

public static Trigger createTriggerFromSchedule(ISchedule sched)
                                         throws ParseException
Throws:
ParseException - if the schedule is a cron schedule, and the cron string is invalid