org.apache.lenya.cms.scheduler
Class SchedulerWrapper

java.lang.Object
  extended by org.apache.lenya.cms.scheduler.SchedulerWrapper

public class SchedulerWrapper
extends java.lang.Object


Field Summary
static java.lang.String CLASS_ATTRIBUTE
           
static java.lang.String ELEMENT_TRIGGER
           
static java.lang.String ELEMENT_TRIGGERS
           
static java.lang.String JOB_ID
           
static java.lang.String JOB_PREFIX
           
static java.lang.String TYPE_ATTRIBUTE
           
 
Constructor Summary
SchedulerWrapper(java.lang.String servletContextPath, java.lang.String schedulerConfigurationPath)
          Creates a new instance of SchedulerWrapper
 
Method Summary
protected  void addJob(org.quartz.JobDetail detail)
          Adds a job.
protected  void addJob(org.quartz.JobDetail detail, org.quartz.Trigger trigger)
          Adds a job.
protected  void addJob(java.lang.String jobGroup, java.util.Date startTime, java.lang.Class jobClass, org.quartz.JobDataMap map)
          Adds a job.
 void addJob(java.lang.String jobGroup, java.util.Date startTime, javax.servlet.http.HttpServletRequest request)
          Adds a job.
protected  void deleteJob(java.lang.String jobName, java.lang.String jobGroup)
          Deletes a job.
 void deleteJobs(Document document)
          Deletes the jobs for a certain document.
protected  JobWrapper[] getJobWrappers(java.lang.String jobGroupName)
          Returns the job wrappers for a certain job group.
protected static java.lang.String getNextJobId()
          Returns the next job ID to use (calculated using the current time).
protected  Publication getPublication(java.lang.String jobGroup)
          Returns the publication for a job group.
protected  org.apache.avalon.framework.configuration.Configuration getSchedulerConfiguration()
          Reads the scheduler configuration.
protected  java.lang.String getSchedulerConfigurationPath()
          Returns the scheduler configuration path.
protected  java.lang.String getServletContextPath()
          Returns the servlet context path.
 org.w3c.dom.Document getSnapshot()
          Return an xml description of all scheduled jobs.
protected  org.w3c.dom.Element getSnapshot(NamespaceHelper helper, java.lang.String group)
          Returns the snapshot of a certain job group.
 org.w3c.dom.Document getSnapshot(java.lang.String[] jobGroupNames)
          Return an XML description certain job groups.
protected  SchedulerStore getStore()
          Returns the store.
protected  org.quartz.Trigger getTrigger(java.lang.String jobName, java.lang.String jobGroup)
          Returns the trigger of a certain job.
protected  org.w3c.dom.Element getTriggerTypes(NamespaceHelper helper)
          Returns an XML element containing the trigger types.
 void modifyJob(java.lang.String jobId, java.lang.String jobGroup, java.util.Date startTime)
          Modifies the execution time of a job.
 void restoreJobs(java.lang.String jobGroup)
          Restores the jobs of a certain job group from the snapshot file.
 void shutdown()
          Shuts down the scheduler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JOB_PREFIX

public static final java.lang.String JOB_PREFIX
See Also:
Constant Field Values

JOB_ID

public static final java.lang.String JOB_ID
See Also:
Constant Field Values

ELEMENT_TRIGGERS

public static final java.lang.String ELEMENT_TRIGGERS
See Also:
Constant Field Values

ELEMENT_TRIGGER

public static final java.lang.String ELEMENT_TRIGGER
See Also:
Constant Field Values

TYPE_ATTRIBUTE

public static final java.lang.String TYPE_ATTRIBUTE
See Also:
Constant Field Values

CLASS_ATTRIBUTE

public static final java.lang.String CLASS_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

SchedulerWrapper

public SchedulerWrapper(java.lang.String servletContextPath,
                        java.lang.String schedulerConfigurationPath)
Creates a new instance of SchedulerWrapper

Parameters:
servletContextPath - The servlet context path.
schedulerConfigurationPath - The scheduler configuration path.
Method Detail

getStore

protected SchedulerStore getStore()
Returns the store.

Returns:
A scheduler store.

shutdown

public void shutdown()
Shuts down the scheduler.


getServletContextPath

protected java.lang.String getServletContextPath()
Returns the servlet context path.

Returns:
The servlet context path.

getSchedulerConfigurationPath

protected java.lang.String getSchedulerConfigurationPath()
Returns the scheduler configuration path.

Returns:
A string.

getNextJobId

protected static java.lang.String getNextJobId()
Returns the next job ID to use (calculated using the current time).

Returns:
A string.

addJob

protected void addJob(java.lang.String jobGroup,
                      java.util.Date startTime,
                      java.lang.Class jobClass,
                      org.quartz.JobDataMap map)
               throws org.quartz.SchedulerException,
                      PublicationException
Adds a job.

Parameters:
jobGroup - The job group.
startTime - The start time.
jobClass - The class of the job.
map - The job parameters.
Throws:
org.quartz.SchedulerException - if an error occurs.
PublicationException - if an error occurs.

addJob

public void addJob(java.lang.String jobGroup,
                   java.util.Date startTime,
                   javax.servlet.http.HttpServletRequest request)
            throws org.quartz.SchedulerException
Adds a job.

Parameters:
jobGroup - The job group.
startTime - The start time.
request - The request to obtain the parameters from.
Throws:
org.quartz.SchedulerException - when something went wrong.

getPublication

protected Publication getPublication(java.lang.String jobGroup)
                              throws PublicationException
Returns the publication for a job group.

Parameters:
jobGroup - A job group.
Returns:
A publication.
Throws:
PublicationException - when the publication does not exist.

addJob

protected void addJob(org.quartz.JobDetail detail,
                      org.quartz.Trigger trigger)
Adds a job.

Parameters:
detail - The job information.
trigger - The trigger to trigger the job.

addJob

protected void addJob(org.quartz.JobDetail detail)
Adds a job.

Parameters:
detail - The job information.

deleteJob

protected void deleteJob(java.lang.String jobName,
                         java.lang.String jobGroup)
Deletes a job.

Parameters:
jobName - The job name.
jobGroup - The job group.

getSchedulerConfiguration

protected org.apache.avalon.framework.configuration.Configuration getSchedulerConfiguration()
Reads the scheduler configuration.

Returns:
A configuration.

getTriggerTypes

protected org.w3c.dom.Element getTriggerTypes(NamespaceHelper helper)
Returns an XML element containing the trigger types.

Parameters:
helper - The namespace helper of the document that shall contain the element.
Returns:
An XML element.

getTrigger

protected org.quartz.Trigger getTrigger(java.lang.String jobName,
                                        java.lang.String jobGroup)
                                 throws org.quartz.SchedulerException
Returns the trigger of a certain job.

Parameters:
jobName - The job name.
jobGroup - The job group.
Returns:
A trigger.
Throws:
org.quartz.SchedulerException - when something went wrong.

getSnapshot

public org.w3c.dom.Document getSnapshot(java.lang.String[] jobGroupNames)
                                 throws org.quartz.SchedulerException
Return an XML description certain job groups.

Parameters:
jobGroupNames - The job group names.
Returns:
An XML document.
Throws:
org.quartz.SchedulerException - if an error occurs

getSnapshot

protected org.w3c.dom.Element getSnapshot(NamespaceHelper helper,
                                          java.lang.String group)
                                   throws org.quartz.SchedulerException
Returns the snapshot of a certain job group.

Parameters:
helper - The namespace helper.
group - The job group.
Returns:
An XML element.
Throws:
org.quartz.SchedulerException - when something went wrong.

getJobWrappers

protected JobWrapper[] getJobWrappers(java.lang.String jobGroupName)
                               throws org.quartz.SchedulerException
Returns the job wrappers for a certain job group.

Parameters:
jobGroupName - The job group.
Returns:
An array of job wrappers.
Throws:
org.quartz.SchedulerException - when something went wrong.

getSnapshot

public org.w3c.dom.Document getSnapshot()
                                 throws org.quartz.SchedulerException
Return an xml description of all scheduled jobs.

Returns:
DOCUMENT ME!
Throws:
org.quartz.SchedulerException - if an error occurs

restoreJobs

public void restoreJobs(java.lang.String jobGroup)
                 throws org.quartz.SchedulerException
Restores the jobs of a certain job group from the snapshot file.

Parameters:
jobGroup - The job group.
Throws:
org.quartz.SchedulerException - when something went wrong.

modifyJob

public void modifyJob(java.lang.String jobId,
                      java.lang.String jobGroup,
                      java.util.Date startTime)
               throws org.quartz.SchedulerException
Modifies the execution time of a job.

Parameters:
jobId - The job ID.
jobGroup - The job group.
startTime - The new start time.
Throws:
org.quartz.SchedulerException - when the job was not found.

deleteJobs

public void deleteJobs(Document document)
                throws org.quartz.SchedulerException,
                       PublicationException
Deletes the jobs for a certain document. This method is called when a document has been moved or deleted.

Parameters:
document - A document.
Throws:
org.quartz.SchedulerException - when something went wrong.
PublicationException - when something went wrong.


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.