|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.extra.util.Cron
public class Cron
Cron job handling tools
Nested Class Summary | |
---|---|
class |
Cron.CronJob
CronJob class |
static class |
Cron.When
This class determines when a cronjob should be triggered |
Constructor Summary | |
---|---|
Cron()
Cron scheduler default constructor (with no defined 'crontab' file loaded) |
|
Cron(java.io.File xmlFile)
Cron scheduler default constructor |
Method Summary | |
---|---|
void |
cleanJobList()
Clears the current CronJob list |
static void |
exec(java.lang.String[] cmdArgs)
Executes the specified command in a separate process |
protected boolean |
getAttributeBoolean(org.w3c.dom.Element elem,
java.lang.String key,
boolean dft)
Returns the boolean value of the named attribute from the specified element |
protected long |
getAttributeLong(org.w3c.dom.Element elem,
java.lang.String key,
long dft)
Returns the long value of the named attribute from the specified element |
protected java.lang.String |
getAttributeString(org.w3c.dom.Element elem,
java.lang.String key,
java.lang.String dft)
Gets a named attribute from the specified element. |
long |
getCronIntervalSec()
Gets the current cron wakeup interval (in seconds). |
java.io.File |
getCrontabXMLFile()
Returns the current crontab xml file |
protected org.w3c.dom.Document |
getDocument(java.io.File xmlFile)
Creates/returns an XML Document for the specific xml file |
int |
getJobCount()
Returns the current number of CronJobs |
java.lang.String |
getJobDescription(java.lang.String jobName)
Gets the description of the specified job name (case sensitive match) |
protected java.util.List<Cron.CronJob> |
getJobList()
Gets the current CronJob list |
java.lang.String[] |
getJobNames()
Gets the current CronJob names |
protected java.lang.String |
getNodeText(org.w3c.dom.Node root)
Returns the String text for the specified node |
protected ThreadPool |
getThreadPool()
Gets the ThreadPool used to run threaded jobs |
java.util.TimeZone |
getTimeZone()
Gets the current TimZone |
boolean |
hasJobs()
Returns true if "getJobCount()" is greater than 0 |
boolean |
hasLoadError()
Returns true if a "load" error has occurred |
boolean |
load(java.io.File xmlFile)
Loads the specified crontab xml file |
boolean |
load(java.io.File xmlFile,
boolean checkStopOnError)
Loads the specified crontab xml file |
static void |
main(java.lang.String[] argv)
Main entry point |
void |
runCron()
Start the Cron process. |
void |
setCronIntervalSec(long intervSec)
Sets the cron wakeup interval (in seconds). |
void |
setCrontabXMLFile(java.io.File xmlFile)
Sets the crontab xml file to load |
void |
setTimeZone(java.lang.String tmzStr)
Sets the current TimeZone |
void |
setTimeZone(java.util.TimeZone tmz)
Sets the current TimeZone |
static boolean |
TestRange(java.lang.String range,
int value,
int type)
Tests to see if the specified value is within the specified range |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Cron()
public Cron(java.io.File xmlFile) throws java.io.FileNotFoundException
xmlFile
- The crontab xml file to load
java.io.FileNotFoundException
Method Detail |
---|
public void setCrontabXMLFile(java.io.File xmlFile) throws java.io.FileNotFoundException
xmlFile
- The crontab file to load
java.io.FileNotFoundException
public java.io.File getCrontabXMLFile() throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void setCronIntervalSec(long intervSec)
intervSec
- The cron wakeup interval (in seconds).public long getCronIntervalSec()
public void setTimeZone(java.lang.String tmzStr)
tmzStr
- The TimeZone (String representation)public void setTimeZone(java.util.TimeZone tmz)
tmz
- The TimeZonepublic java.util.TimeZone getTimeZone()
protected ThreadPool getThreadPool()
protected java.util.List<Cron.CronJob> getJobList()
public void cleanJobList()
public int getJobCount()
public boolean hasJobs()
public java.lang.String[] getJobNames()
public java.lang.String getJobDescription(java.lang.String jobName)
public void runCron() throws java.io.IOException
java.io.IOException
public boolean hasLoadError()
public boolean load(java.io.File xmlFile) throws java.io.IOException
xmlFile
- The crontab xml file to load
java.io.IOException
public boolean load(java.io.File xmlFile, boolean checkStopOnError) throws java.io.IOException
xmlFile
- The crontab xml file to load
java.io.IOException
protected org.w3c.dom.Document getDocument(java.io.File xmlFile)
xmlFile
- The XML fileprotected java.lang.String getNodeText(org.w3c.dom.Node root)
root
- The node for which the node text will be returnedprotected java.lang.String getAttributeString(org.w3c.dom.Element elem, java.lang.String key, java.lang.String dft)
elem
- The element from which the attribute value will be returnedkey
- The name of the attributedft
- The default value to return if the named attribute doesn't exist
protected boolean getAttributeBoolean(org.w3c.dom.Element elem, java.lang.String key, boolean dft)
elem
- The element from which the attribute value will be returnedkey
- The name of the attributedft
- The default boolean value to return if the named attribute doesn't exist
protected long getAttributeLong(org.w3c.dom.Element elem, java.lang.String key, long dft)
elem
- The element from which the attribute value will be returnedkey
- The name of the attributedft
- The default long value to return if the named attribute doesn't exist
public static void exec(java.lang.String[] cmdArgs)
cmdArgs
- The command and arguments to executepublic static boolean TestRange(java.lang.String range, int value, int type)
range
- The valid range (String representation)value
- The value tested for inclusion in the rangetype
- The type of range test to perform
public static void main(java.lang.String[] argv)
argv
- The command line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |