Interface IScheduler
-
public interface IScheduler
An object that allows for the scheduling of IActions on the Pentaho platform- Author:
- arodriguez
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IScheduler.SchedulerStatus
-
Field Summary
Fields Modifier and Type Field Description static String
RESERVEDMAPKEY_ACTIONCLASS
static String
RESERVEDMAPKEY_ACTIONID
static String
RESERVEDMAPKEY_ACTIONUSER
static String
RESERVEDMAPKEY_APPEND_DATE_FORMAT
static String
RESERVEDMAPKEY_AUTO_CREATE_UNIQUE_FILENAME
static String
RESERVEDMAPKEY_LINEAGE_ID
static String
RESERVEDMAPKEY_RESTART_FLAG
static String
RESERVEDMAPKEY_STREAMPROVIDER
static String
RESERVEDMAPKEY_STREAMPROVIDER_INPUTFILE
static String
RESERVEDMAPKEY_UIPASSPARAM
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addListener(ISchedulerListener listener)
IComplexJobTrigger
createComplexJobTrigger()
IComplexJobTrigger
createComplexTrigger(Integer year, Integer month, Integer dayOfMonth, Integer dayOfWeek, Integer hourOfDay)
IComplexJobTrigger
createComplexTrigger(String cronString)
ICronJobTrigger
createCronJobTrigger()
IJob
createJob(String jobName, Class<? extends IAction> action, Map<String,Serializable> jobParams, IJobTrigger trigger)
Schedules a job to be run at one or more times in the future.IJob
createJob(String jobName, Class<? extends IAction> action, Map<String,Serializable> jobParams, IJobTrigger trigger, IBackgroundExecutionStreamProvider outputStreamProvider)
Schedules a job to be run at one or more times in the future.IJob
createJob(String jobName, String actionId, Map<String,Serializable> jobParams, IJobTrigger trigger)
Schedules a job to be run at one or more times in the future.IJob
createJob(String jobName, String actionId, Map<String,Serializable> jobParams, IJobTrigger trigger, IBackgroundExecutionStreamProvider outputStreamProvider)
Schedules a job to be run at one or more times in the future.IJobRequest
createJobRequest()
IJobScheduleParam
createJobScheduleParam()
IJobScheduleRequest
createJobScheduleRequest()
ISchedulerResource
createSchedulerResource()
ISimpleJobTrigger
createSimpleJobTrigger(Date startTime, Date endTime, int repeatCount, long repeatIntervalSeconds)
void
fireJobCompleted(IAction actionBean, String actionUser, Map<String,Serializable> params, IBackgroundExecutionStreamProvider streamProvider)
Not intended for public use.Map<IScheduleSubject,IComplexJobTrigger>
getAvailabilityWindows()
Gets the scheduler availability window for all subjects for whom a window has been setIJob
getJob(String jobId)
Fetches a Job by jobIdList<IJobResult>
getJobHistory(String jobId)
Returns a history of the runs for a particular job.ArrayList<IJobScheduleParam>
getJobParameters()
List<IJob>
getJobs(IJobFilter filter)
Lists currently scheduled jobs.Integer
getMinScheduleInterval(IScheduleSubject subject)
Get the minimum time that must elapse between job runs.IScheduler.SchedulerStatus
getStatus()
Returns the current scheduler status.IComplexJobTrigger
getSubjectAvailabilityWindow(IScheduleSubject subject)
Gets the scheduler availability window to the specified subjectvoid
pause()
Pauses the entire scheduler, which prevents all scheduled jobs from running.void
pauseJob(String jobId)
Prevents the specified job from running in the future.void
removeJob(String jobId)
Removes the specified job from the list of scheduled jobsvoid
resumeJob(String jobId)
Allows previously paused jobs to resume running in the future.void
setAvailabilityWindows(Map<IScheduleSubject,IComplexJobTrigger> windows)
Replaces the scheduler availability map with the provided availability map.void
setMinScheduleInterval(IScheduleSubject subject, int intervalInSeconds)
Sets the minimum time that must elapse between runs of any jobs.void
setSubjectAvailabilityWindow(IScheduleSubject subject, IComplexJobTrigger window)
Sets when a particular subject is allowed to schedule jobs.void
shutdown()
Shuts the scheduler down so it will process no more jobs.void
start()
Allows the scheduler to process scheduled jobs.void
triggerNow(String jobId)
Triggers the given quartz job by jobId to be executed immediatelyvoid
updateJob(String jobId, Map<String,Serializable> jobParams, IJobTrigger trigger)
Updates both the parameters and trigger to be used to execute an existing scheduled action.default void
validateJobParams(Map<String,Serializable> jobParams)
A default implementation which doesn't do anything and exists for the backward compatibility sake.
-
-
-
Field Detail
-
RESERVEDMAPKEY_ACTIONCLASS
static final String RESERVEDMAPKEY_ACTIONCLASS
- See Also:
- Constant Field Values
-
RESERVEDMAPKEY_ACTIONUSER
static final String RESERVEDMAPKEY_ACTIONUSER
- See Also:
- Constant Field Values
-
RESERVEDMAPKEY_ACTIONID
static final String RESERVEDMAPKEY_ACTIONID
- See Also:
- Constant Field Values
-
RESERVEDMAPKEY_STREAMPROVIDER
static final String RESERVEDMAPKEY_STREAMPROVIDER
- See Also:
- Constant Field Values
-
RESERVEDMAPKEY_STREAMPROVIDER_INPUTFILE
static final String RESERVEDMAPKEY_STREAMPROVIDER_INPUTFILE
- See Also:
- Constant Field Values
-
RESERVEDMAPKEY_UIPASSPARAM
static final String RESERVEDMAPKEY_UIPASSPARAM
- See Also:
- Constant Field Values
-
RESERVEDMAPKEY_LINEAGE_ID
static final String RESERVEDMAPKEY_LINEAGE_ID
- See Also:
- Constant Field Values
-
RESERVEDMAPKEY_RESTART_FLAG
static final String RESERVEDMAPKEY_RESTART_FLAG
- See Also:
- Constant Field Values
-
RESERVEDMAPKEY_AUTO_CREATE_UNIQUE_FILENAME
static final String RESERVEDMAPKEY_AUTO_CREATE_UNIQUE_FILENAME
- See Also:
- Constant Field Values
-
RESERVEDMAPKEY_APPEND_DATE_FORMAT
static final String RESERVEDMAPKEY_APPEND_DATE_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
createJob
IJob createJob(String jobName, Class<? extends IAction> action, Map<String,Serializable> jobParams, IJobTrigger trigger) throws SchedulerException
Schedules a job to be run at one or more times in the future.- Parameters:
jobName
- the user defined name for the jobaction
- the action to be run at the scheduled time(s)jobParams
- the parameters to be passed to the action when it runstrigger
- the time(s) at which to run the action- Returns:
- the scheduled job
- Throws:
SchedulerException
- If the job could not be scheduled
-
createJob
IJob createJob(String jobName, String actionId, Map<String,Serializable> jobParams, IJobTrigger trigger) throws SchedulerException
Schedules a job to be run at one or more times in the future.- Parameters:
jobName
- the user defined name for the jobactionId
- the bean Id of the action to be run as defined an a plugin's plugin.xmljobParams
- the parameters to be passed to the action when it runstrigger
- the time(s) at which to run the action- Returns:
- the scheduled job
- Throws:
SchedulerException
- If the job could not be scheduled
-
createJob
IJob createJob(String jobName, Class<? extends IAction> action, Map<String,Serializable> jobParams, IJobTrigger trigger, IBackgroundExecutionStreamProvider outputStreamProvider) throws SchedulerException
Schedules a job to be run at one or more times in the future.- Parameters:
jobName
- the user defined name for the jobaction
- the action to be run at the scheduled time(s)jobParams
- the parameters to be passed to the action when it runstrigger
- the time(s) at which to run the actionoutputStreamProvider
- if the action being scheduled expects to write to an output stream, at the time of action execution the this provider will be used to create the stream that passed to the action.- Returns:
- the scheduled job
- Throws:
SchedulerException
- If the job could not be scheduled
-
createJob
IJob createJob(String jobName, String actionId, Map<String,Serializable> jobParams, IJobTrigger trigger, IBackgroundExecutionStreamProvider outputStreamProvider) throws SchedulerException
Schedules a job to be run at one or more times in the future.- Parameters:
jobName
- the user defined name for the jobactionId
- the bean Id of the action to be run as defined an a plugin's plugin.xmljobParams
- the parameters to be passed to the action when it runstrigger
- the time(s) at which to run the actionoutputStreamProvider
- if the action being scheduled expects to write to an output stream, at the time of action execution the this provider will be used to create the stream that passed to the action.- Returns:
- the scheduled job
- Throws:
SchedulerException
- If the job could not be scheduled
-
updateJob
void updateJob(String jobId, Map<String,Serializable> jobParams, IJobTrigger trigger) throws SchedulerException
Updates both the parameters and trigger to be used to execute an existing scheduled action.- Parameters:
jobId
- the ID of an existing scheduled jobjobParams
- the parameters to be passed to the action when it runstrigger
- the time(s) at which to run the action- Throws:
SchedulerException
- If the job could not be updated
-
removeJob
void removeJob(String jobId) throws SchedulerException
Removes the specified job from the list of scheduled jobs- Parameters:
jobId
- the job to be removed- Throws:
SchedulerException
-
pauseJob
void pauseJob(String jobId) throws SchedulerException
Prevents the specified job from running in the future. The job remains in the list of scheduled jobs in a "paused" state. If the job is currently running, the currently running job is allowed to complete.- Parameters:
jobId
- the job to be paused- Throws:
SchedulerException
-
resumeJob
void resumeJob(String jobId) throws SchedulerException
Allows previously paused jobs to resume running in the future.- Parameters:
jobId
- the job to be resumed- Throws:
SchedulerException
-
getJob
IJob getJob(String jobId) throws SchedulerException
Fetches a Job by jobId- Parameters:
jobId
- the job to be returned- Throws:
SchedulerException
-
triggerNow
void triggerNow(String jobId) throws SchedulerException
Triggers the given quartz job by jobId to be executed immediately- Parameters:
jobId
- the job to be executed- Throws:
SchedulerException
-
setSubjectAvailabilityWindow
void setSubjectAvailabilityWindow(IScheduleSubject subject, IComplexJobTrigger window)
Sets when a particular subject is allowed to schedule jobs.- Parameters:
subject
- the subject to which the subject applieswindow
- the window of time at which the scheduler is available
-
setAvailabilityWindows
void setAvailabilityWindows(Map<IScheduleSubject,IComplexJobTrigger> windows)
Replaces the scheduler availability map with the provided availability map.- Parameters:
windows
- the new scheduler availability map
-
getSubjectAvailabilityWindow
IComplexJobTrigger getSubjectAvailabilityWindow(IScheduleSubject subject)
Gets the scheduler availability window to the specified subject- Parameters:
subject
- the subject whose window is being requested- Returns:
- the subject's availability window
-
getAvailabilityWindows
Map<IScheduleSubject,IComplexJobTrigger> getAvailabilityWindows()
Gets the scheduler availability window for all subjects for whom a window has been set- Returns:
- the scheduler availability map
-
pause
void pause() throws SchedulerException
Pauses the entire scheduler, which prevents all scheduled jobs from running. Any currently running jobs are allowed to complete. Note that the "paused" state of individual jobs is not changed by this call.- Throws:
SchedulerException
-
start
void start() throws SchedulerException
Allows the scheduler to process scheduled jobs. Note that the "paused" state of individual jobs is not changed by this call.- Throws:
SchedulerException
-
shutdown
void shutdown() throws SchedulerException
Shuts the scheduler down so it will process no more jobs. The implementation will decide if this means kill jobs in progress or let them finish.- Throws:
SchedulerException
-
setMinScheduleInterval
void setMinScheduleInterval(IScheduleSubject subject, int intervalInSeconds)
Sets the minimum time that must elapse between runs of any jobs. For example if set to "5" then a job may not be scheduled to run less than 5 seconds apart.- Parameters:
subject
- the subject to which the interval appliesintervalInSeconds
- the interval in seconds
-
getMinScheduleInterval
Integer getMinScheduleInterval(IScheduleSubject subject)
Get the minimum time that must elapse between job runs.- Parameters:
subject
- the subject whose min interval is being requested return the minimum interval or null if no interval has been set
-
getJobs
List<IJob> getJobs(IJobFilter filter) throws SchedulerException
Lists currently scheduled jobs.- Parameters:
filter
- the filter to use to determine which jobs to return. If null all scheduled jobs are return.- Returns:
- the scheduled jobs
- Throws:
SchedulerException
-
getJobHistory
List<IJobResult> getJobHistory(String jobId)
Returns a history of the runs for a particular job.- Parameters:
jobId
- the job for which to query it's execution history- Returns:
- the execution history for the given job
-
getStatus
IScheduler.SchedulerStatus getStatus() throws SchedulerException
Returns the current scheduler status.- Returns:
- the scheduler status
- Throws:
SchedulerException
-
addListener
void addListener(ISchedulerListener listener)
-
fireJobCompleted
void fireJobCompleted(IAction actionBean, String actionUser, Map<String,Serializable> params, IBackgroundExecutionStreamProvider streamProvider)
Not intended for public use.- Parameters:
actionBean
-actionUser
-params
-streamProvider
-
-
createJobScheduleRequest
IJobScheduleRequest createJobScheduleRequest()
-
createJobScheduleParam
IJobScheduleParam createJobScheduleParam()
-
createSimpleJobTrigger
ISimpleJobTrigger createSimpleJobTrigger(Date startTime, Date endTime, int repeatCount, long repeatIntervalSeconds)
-
createCronJobTrigger
ICronJobTrigger createCronJobTrigger()
-
createComplexTrigger
IComplexJobTrigger createComplexTrigger(String cronString)
-
createComplexJobTrigger
IComplexJobTrigger createComplexJobTrigger()
-
createComplexTrigger
IComplexJobTrigger createComplexTrigger(Integer year, Integer month, Integer dayOfMonth, Integer dayOfWeek, Integer hourOfDay)
-
getJobParameters
ArrayList<IJobScheduleParam> getJobParameters()
-
createSchedulerResource
ISchedulerResource createSchedulerResource()
-
createJobRequest
IJobRequest createJobRequest()
-
validateJobParams
default void validateJobParams(Map<String,Serializable> jobParams) throws SchedulerException
A default implementation which doesn't do anything and exists for the backward compatibility sake.- Parameters:
jobParams
- scheduling job parameters- Throws:
SchedulerException
-
-