Interface ScheduleService
-
- All Known Implementing Classes:
AbstractSchedulerService
,QuartzSchedulerService
,TorqueSchedulerService
,TurbineNonPersistentSchedulerService
public interface ScheduleService extends Service
ScheduleService interface.- Version:
- $Id$
- Author:
- Dave Bryson, Quinton McCombs
-
-
Field Summary
Fields Modifier and Type Field Description static String
INTIALLY_ACTIVE
TR.props key for initially activating the scheduler threadstatic String
LOGGER_NAME
TR.props key for the loggerstatic String
SERVICE_NAME
Name of service
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addJob(JobEntry je)
Add a new job to the queue.JobEntry
getJob(int oid)
Get a specific Job from Storage.boolean
isEnabled()
Determines if the scheduler service is currently active.List<? extends JobEntry>
listJobs()
List jobs in the queue.JobEntry
newJob(int sec, int min, int hour, int wd, int day_mo, String task)
Factory method for a new Job Schedule a job to run on a certain point of time.
Example 1: Run the DefaultScheduledJob at 8:00am every 15th of the month -
JobEntry je = newJob(0,0,8,-1,15,"DefaultScheduledJob");
Example 2: Run the DefaultScheduledJob at 8:00am every day -
JobEntry je = newJob(0,0,8,-1,-1,"DefaultScheduledJob");
Example 3: Run the DefaultScheduledJob every 2 hours. -
JobEntry je = newJob(0,120,-1,-1,-1,"DefaultScheduledJob");
Example 4: Run the DefaultScheduledJob every 30 seconds. -
JobEntry je = newJob(30,-1,-1,-1,-1,"DefaultScheduledJob");void
removeJob(JobEntry je)
Remove a job from the queue.void
startScheduler()
Starts the scheduler if not already running.void
stopScheduler()
Stops the scheduler if ti is currently running.void
updateJob(JobEntry je)
Modify a Job.-
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
-
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
-
-
-
-
Field Detail
-
SERVICE_NAME
static final String SERVICE_NAME
Name of service- See Also:
- Constant Field Values
-
INTIALLY_ACTIVE
static final String INTIALLY_ACTIVE
TR.props key for initially activating the scheduler thread- See Also:
- Constant Field Values
-
LOGGER_NAME
static final String LOGGER_NAME
TR.props key for the logger- See Also:
- Constant Field Values
-
-
Method Detail
-
newJob
JobEntry newJob(int sec, int min, int hour, int wd, int day_mo, String task) throws TurbineException
Factory method for a new Job Schedule a job to run on a certain point of time.
Example 1: Run the DefaultScheduledJob at 8:00am every 15th of the month -
JobEntry je = newJob(0,0,8,-1,15,"DefaultScheduledJob");
Example 2: Run the DefaultScheduledJob at 8:00am every day -
JobEntry je = newJob(0,0,8,-1,-1,"DefaultScheduledJob");
Example 3: Run the DefaultScheduledJob every 2 hours. -
JobEntry je = newJob(0,120,-1,-1,-1,"DefaultScheduledJob");
Example 4: Run the DefaultScheduledJob every 30 seconds. -
JobEntry je = newJob(30,-1,-1,-1,-1,"DefaultScheduledJob");- Parameters:
sec
- Value for entry "seconds".min
- Value for entry "minutes".hour
- Value for entry "hours".wd
- Value for entry "week days".day_mo
- Value for entry "month days".task
- Task to execute.- Returns:
- A JobEntry.
- Throws:
TurbineException
- could not create job
-
getJob
JobEntry getJob(int oid) throws TurbineException
Get a specific Job from Storage.- Parameters:
oid
- The int id for the job.- Returns:
- A JobEntry.
- Throws:
TurbineException
- could not retrieve job
-
addJob
void addJob(JobEntry je) throws TurbineException
Add a new job to the queue.- Parameters:
je
- A JobEntry with the job to add.- Throws:
TurbineException
- job could not be added
-
updateJob
void updateJob(JobEntry je) throws TurbineException
Modify a Job.- Parameters:
je
- A JobEntry with the job to modify- Throws:
TurbineException
- job could not be updated
-
removeJob
void removeJob(JobEntry je) throws TurbineException
Remove a job from the queue.- Parameters:
je
- A JobEntry with the job to remove.- Throws:
TurbineException
- job could not be removed
-
listJobs
List<? extends JobEntry> listJobs()
List jobs in the queue. This is used by the scheduler UI.- Returns:
- A List of jobs.
-
isEnabled
boolean isEnabled()
Determines if the scheduler service is currently active.- Returns:
- Status of the scheduler service.
-
startScheduler
void startScheduler()
Starts the scheduler if not already running.
-
stopScheduler
void stopScheduler()
Stops the scheduler if ti is currently running.
-
-