org.pentaho.platform.scheduler
Class QuartzSubscriptionScheduler

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

public class QuartzSubscriptionScheduler
extends java.lang.Object
implements ISubscriptionScheduler

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

Author:
dmoran

Field Summary
static java.lang.String GROUP_NAME
           
 
Constructor Summary
QuartzSubscriptionScheduler()
           
 
Method Summary
static org.quartz.Trigger createTriggerFromSchedule(ISchedule sched)
           
 IScheduledJob deleteJob(java.lang.String triggerName)
          Delete the job.
 IScheduledJob executeJob(java.lang.String jobName)
          Execute the job.
 java.lang.String getCronSummary(java.lang.String cron)
           
 IScheduledJob getScheduledJob(java.lang.String schedRef)
          Returns the IScheduledJob for the passed in schedule reference from the scheduling system
 java.util.Map<java.lang.String,IScheduledJob> getScheduledJobMap()
          NOTE: doesn't actually throw any checked exceptions
 java.util.List<QuartzScheduledJob> getScheduledJobs()
          Returns a List of all IScheduledJobs that are currently in the subscription scheduling system
 int getSchedulerState()
           
 IScheduledJob pauseJob(java.lang.String jobName)
          Pause the job.
 void pauseScheduler()
           
 IScheduledJob resumeJob(java.lang.String jobName)
          Resume the job.
 void resumeScheduler()
           
 IScheduledJob scheduleJob(ISchedule schedule)
           
 java.util.List syncSchedule(java.util.List newSchedules)
          Returns a list of exception messages
 IScheduledJob syncSchedule(java.lang.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 java.lang.String GROUP_NAME
Constructor Detail

QuartzSubscriptionScheduler

public QuartzSubscriptionScheduler()
Method Detail

syncSchedule

public IScheduledJob syncSchedule(java.lang.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 java.util.List syncSchedule(java.util.List newSchedules)
                            throws java.lang.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:
java.lang.Exception

getScheduledJobMap

public java.util.Map<java.lang.String,IScheduledJob> getScheduledJobMap()
                                                                 throws org.quartz.SchedulerException,
                                                                        SubscriptionSchedulerException
NOTE: doesn't actually throw any checked exceptions

Specified by:
getScheduledJobMap in interface ISubscriptionScheduler
Throws:
SchedulerException
SubscriptionSchedulerException
org.quartz.SchedulerException

getScheduledJob

public IScheduledJob getScheduledJob(java.lang.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 java.util.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(java.lang.String jobName)
                       throws java.lang.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:
java.lang.Exception

resumeJob

public IScheduledJob resumeJob(java.lang.String jobName)
                        throws java.lang.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:
java.lang.Exception

executeJob

public IScheduledJob executeJob(java.lang.String jobName)
                         throws java.lang.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:
java.lang.Exception

deleteJob

public IScheduledJob deleteJob(java.lang.String triggerName)
                        throws java.lang.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:
java.lang.Exception

scheduleJob

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

getSchedulerState

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

pauseScheduler

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

resumeScheduler

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

getCronSummary

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

createTriggerFromSchedule

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