org.apache.cocoon.components.cron
Interface JobScheduler

All Known Implementing Classes:
QuartzJobScheduler

public interface JobScheduler

This component schedules jobs.

Since:
2.1.1
Version:
CVS $Id: JobScheduler.java 56043 2004-10-30 16:15:17Z giacomo $
Author:
Giacomo Pati

Field Summary
static String ROLE
          The role of a JobScheduler
 
Method Summary
 void addJob(String name, Object job, String schedulingExpression, boolean canRunConcurrently)
          Schedule a time based job.
 void addJob(String name, Object job, String schedulingExpression, boolean canRunConcurrently, Parameters params, Map objects)
          Schedule a job.
 void addJob(String name, String jobrole, String schedulingExpression, boolean canRunConcurrently)
          Schedule a time based job.
 void addJob(String name, String jobrole, String schedulingExpression, boolean canRunConcurrently, Parameters params, Map objects)
          Schedule a time based job.
 void addPeriodicJob(String name, Object job, long period, boolean canRunConcurrently, Parameters params, Map objects)
          Schedule a periodic job.
 void addPeriodicJob(String name, String jobrole, long period, boolean canRunConcurrently, Parameters params, Map objects)
          Schedule a periodic job.
 boolean fireJob(Object job)
          Fire a CronJob once immediately
 boolean fireJob(Object job, Parameters params, Map objects)
          Fire a job once immediately
 boolean fireJob(String jobrole)
          Fire a job once immediately
 boolean fireJob(String jobrole, Parameters params, Map objects)
          Fire a job once immediately
 void fireJobAt(Date date, String name, Object job)
          Fire a job once at a specific date Note that if a job with the same name has already beed added it is overwritten.
 void fireJobAt(Date date, String name, Object job, Parameters params, Map objects)
          Fire a job once at a specific date Note that if a job with the same name has already beed added it is overwritten.
 void fireJobAt(Date date, String name, String jobrole)
          Fire a job once at a specific date Note that if a job with the same name has already beed added it is overwritten.
 void fireJobAt(Date date, String name, String jobrole, Parameters params, Map objects)
          Fire a job once at a specific date Note that if a job with the same name has already beed added it is overwritten.
 String[] getJobNames()
          Get the names of all scheduled jobs.
 JobSchedulerEntry getJobSchedulerEntry(String jobname)
          Get the JobSchedulerEntry for a scheduled job
 void removeJob(String name)
          Remove a scheduled job by name.
 

Field Detail

ROLE

public static final String ROLE
The role of a JobScheduler

Method Detail

getJobNames

public String[] getJobNames()
Get the names of all scheduled jobs.

Returns:
state of execution successfullness

getJobSchedulerEntry

public JobSchedulerEntry getJobSchedulerEntry(String jobname)
Get the JobSchedulerEntry for a scheduled job

Returns:
the entry

addJob

public void addJob(String name,
                   String jobrole,
                   String schedulingExpression,
                   boolean canRunConcurrently)
            throws CascadingException
Schedule a time based job. Note that if a job with the same name has already beed added it is overwritten.

Parameters:
name - the name of the job
jobrole - The Avalon components role name of the job itself
schedulingExpression - the time specification using a scheduling expression
canRunConcurrently - whether this job can run even previous scheduled runs are still running
Throws:
CascadingException

addJob

public void addJob(String name,
                   String jobrole,
                   String schedulingExpression,
                   boolean canRunConcurrently,
                   Parameters params,
                   Map objects)
            throws CascadingException
Schedule a time based job. Note that if a job with the same name has already beed added it is overwritten.

Parameters:
name - the name of the job
jobrole - The Avalon components role name of the job itself
schedulingExpression - the time specification using a scheduling expression
canRunConcurrently - whether this job can run even previous scheduled runs are still running
params - Additional Parameters to setup CronJob
objects - A Map with additional object to setup CronJob
Throws:
CascadingException

addJob

public void addJob(String name,
                   Object job,
                   String schedulingExpression,
                   boolean canRunConcurrently)
            throws CascadingException
Schedule a time based job. Note that if a job with the same name has already beed added it is overwritten.

Parameters:
name - the name of the job
job - The job object itself. It must implement either CronJob, Runnable or might also be an implementation specific class (i.e. org.quartz.Job)
schedulingExpression - the time specification using a scheduling expression
canRunConcurrently - whether this job can run even previous scheduled runs are still running
Throws:
CascadingException

addJob

public void addJob(String name,
                   Object job,
                   String schedulingExpression,
                   boolean canRunConcurrently,
                   Parameters params,
                   Map objects)
            throws CascadingException
Schedule a job. Note that if a job with the same name has already beed added it is overwritten.

Parameters:
name - the name of the job
job - The job object itself. It must implement either CronJob, Runnable or might also be an implementation specific class (i.e. org.quartz.Job)
schedulingExpression - the time specification using a scheduling expression
canRunConcurrently - whether this job can run even previous scheduled runs are still running
params - Additional Parameters to setup CronJob
objects - A Map with additional object to setup CronJob
Throws:
CascadingException

addPeriodicJob

public void addPeriodicJob(String name,
                           String jobrole,
                           long period,
                           boolean canRunConcurrently,
                           Parameters params,
                           Map objects)
                    throws CascadingException
Schedule a periodic job. The job is started the first time when the period has passed. Note that if a job with the same name has already beed added it is overwritten.

Parameters:
name - the name of the job
jobrole - The Avalon components role name of the job itself
period - Every period seconds this job is started
canRunConcurrently - whether this job can run even previous scheduled runs are still running
params - Additional Parameters to setup CronJob
objects - A Map with additional object to setup CronJob
Throws:
CascadingException

addPeriodicJob

public void addPeriodicJob(String name,
                           Object job,
                           long period,
                           boolean canRunConcurrently,
                           Parameters params,
                           Map objects)
                    throws CascadingException
Schedule a periodic job. The job is started the first time when the period has passed. Note that if a job with the same name has already beed added it is overwritten.

Parameters:
name - the name of the job
job - The job object itself. It must implement either CronJob, Runnable or might also be an implementation specific class (i.e. org.quartz.Job)
period - Every period seconds this job is started
canRunConcurrently - whether this job can run even previous scheduled runs are still running
params - Additional Parameters to setup CronJob
objects - A Map with additional object to setup CronJob
Throws:
CascadingException

fireJob

public boolean fireJob(String jobrole)
Fire a job once immediately

Parameters:
jobrole - The Avalon components role name of the job itself
Returns:
success state adding the job

fireJob

public boolean fireJob(Object job)
Fire a CronJob once immediately

Parameters:
job - The job object itself. It must implement either CronJob, Runnable or might also be an implementation specific class (i.e. org.quartz.Job)
Returns:
whether the job has been successfully started

fireJob

public boolean fireJob(String jobrole,
                       Parameters params,
                       Map objects)
                throws CascadingException
Fire a job once immediately

Parameters:
jobrole - The Avalon components role name of the job itself
params - Additional Parameters to setup CronJob
objects - A Map with additional object to setup CronJob
Returns:
whether the job has been successfully started
Throws:
CascadingException

fireJob

public boolean fireJob(Object job,
                       Parameters params,
                       Map objects)
                throws CascadingException
Fire a job once immediately

Parameters:
job - The job object itself. It must implement either CronJob, Runnable or might also be an implementation specific class (i.e. org.quartz.Job)
params - Additional Parameters to setup CronJob
objects - A Map with additional object to setup CronJob
Returns:
whether the job has been successfully started
Throws:
CascadingException

fireJobAt

public void fireJobAt(Date date,
                      String name,
                      String jobrole)
               throws CascadingException
Fire a job once at a specific date Note that if a job with the same name has already beed added it is overwritten.

Parameters:
date - The date this job should be scheduled
name - the name of the job
jobrole - The Avalon components role name of the job itself
Throws:
CascadingException

fireJobAt

public void fireJobAt(Date date,
                      String name,
                      String jobrole,
                      Parameters params,
                      Map objects)
               throws CascadingException
Fire a job once at a specific date Note that if a job with the same name has already beed added it is overwritten.

Parameters:
date - The date this job should be scheduled
name - the name of the job
jobrole - The Avalon components role name of the job itself
params - Additional Parameters to setup CronJob
objects - A Map with additional object to setup CronJob
Throws:
CascadingException

fireJobAt

public void fireJobAt(Date date,
                      String name,
                      Object job)
               throws CascadingException
Fire a job once at a specific date Note that if a job with the same name has already beed added it is overwritten.

Parameters:
date - The date this job should be scheduled
name - the name of the job
job - The job object itself. It must implement either CronJob, Runnable or might also be an implementation specific class (i.e. org.quartz.Job)
Throws:
CascadingException

fireJobAt

public void fireJobAt(Date date,
                      String name,
                      Object job,
                      Parameters params,
                      Map objects)
               throws CascadingException
Fire a job once at a specific date Note that if a job with the same name has already beed added it is overwritten.

Parameters:
date - The date this job should be scheduled
name - the name of the job
job - The job object itself. It must implement either CronJob, Runnable or might also be an implementation specific class (i.e. org.quartz.Job)
params - Additional Parameters to setup CronJob
objects - A Map with additional object to setup CronJob
Throws:
CascadingException

removeJob

public void removeJob(String name)
               throws NoSuchElementException
Remove a scheduled job by name.

Parameters:
name - the name of the job
Throws:
NoSuchElementException


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.