This project has retired. For details please refer to its Attic page.

org.apache.lenya.cms.scheduler
Class SchedulerStore

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

public class SchedulerStore
extends java.lang.Object

Store for scheduler jobs.


Field Summary
static java.lang.String ELEMENT_JOB
           
static java.lang.String ELEMENT_JOB_GROUP
           
static java.lang.String NAMESPACE
          The namespace for the jobs.xml file.
static java.lang.String SNAPSHOT_FILE
           
static java.lang.String TITLE_ELEMENT
           
 
Constructor Summary
SchedulerStore()
          Ctor.
 
Method Summary
protected  org.w3c.dom.Element createSnapshot(NamespaceHelper helper, Publication publication, JobWrapper[] jobs)
          Creates an XML element containting a snapshot of a job group.
protected  org.w3c.dom.Element[] getJobElements(Publication publication)
          Returns the job elements of a publication.
protected  java.io.File getJobsFile(Publication publication)
          Returns the job snapshot file for a publication..
static NamespaceHelper getNamespaceHelper()
          Returns a new scheduler namespace helper with an document containing a <sch:scheduler> element.
static NamespaceHelper getNamespaceHelper(org.w3c.dom.Document document)
          Returns a scheduler namespace helper for a document.
 org.w3c.dom.Document getSnapshot(Publication publication, JobWrapper[] jobs)
          Return an xml description of all scheduled jobs for the given publication.
protected  JobWrapper restoreJob(NamespaceHelper helper, org.w3c.dom.Element jobElement, Publication publication)
          Restores the jobs from a certain XML element.
 JobWrapper[] restoreJobs(Publication publication)
          Restores the jobs of a certain job group from the snapshot file.
protected  void writeSnapshot(Publication publication, JobWrapper[] jobs)
          Writes a job snapshot.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT_JOB_GROUP

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

ELEMENT_JOB

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

TITLE_ELEMENT

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

SNAPSHOT_FILE

public static final java.lang.String SNAPSHOT_FILE

NAMESPACE

public static final java.lang.String NAMESPACE
The namespace for the jobs.xml file.

See Also:
Constant Field Values
Constructor Detail

SchedulerStore

public SchedulerStore()
Ctor.

Parameters:
publication - The publication.
Method Detail

getJobsFile

protected java.io.File getJobsFile(Publication publication)
                            throws org.quartz.SchedulerException
Returns the job snapshot file for a publication..

Parameters:
Publication - The publication.
Returns:
A file.
Throws:
org.quartz.SchedulerException - when the publication could not be built.

writeSnapshot

protected void writeSnapshot(Publication publication,
                             JobWrapper[] jobs)
                      throws org.quartz.SchedulerException
Writes a job snapshot.

Parameters:
publication - The publication.
Throws:
org.quartz.SchedulerException - when something went wrong.

getSnapshot

public org.w3c.dom.Document getSnapshot(Publication publication,
                                        JobWrapper[] jobs)
                                 throws org.quartz.SchedulerException
Return an xml description of all scheduled jobs for the given publication.

Parameters:
publication - The publication.
Returns:
An XML document.
Throws:
org.quartz.SchedulerException - if an error occurs

getNamespaceHelper

public static NamespaceHelper getNamespaceHelper(org.w3c.dom.Document document)
Returns a scheduler namespace helper for a document.

Parameters:
document - The XML document.
Returns:
a namespace helper.

getNamespaceHelper

public static NamespaceHelper getNamespaceHelper()
Returns a new scheduler namespace helper with an document containing a <sch:scheduler> element.

Returns:
a namespace helper.

createSnapshot

protected org.w3c.dom.Element createSnapshot(NamespaceHelper helper,
                                             Publication publication,
                                             JobWrapper[] jobs)
                                      throws org.quartz.SchedulerException
Creates an XML element containting a snapshot of a job group.

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

restoreJobs

public JobWrapper[] restoreJobs(Publication publication)
                         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.

restoreJob

protected JobWrapper restoreJob(NamespaceHelper helper,
                                org.w3c.dom.Element jobElement,
                                Publication publication)
                         throws org.quartz.SchedulerException
Restores the jobs from a certain XML element.

Parameters:
jobElement - The XML element.
jobGroup - The job group the job belongs to.
Throws:
org.quartz.SchedulerException

getJobElements

protected org.w3c.dom.Element[] getJobElements(Publication publication)
                                        throws org.quartz.SchedulerException
Returns the job elements of a publication.

Parameters:
publication -
Returns:
Throws:
org.quartz.SchedulerException - when something went wrong.


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