org.mmbase.applications.crontab
Class CronEntry

java.lang.Object
  extended byorg.mmbase.applications.crontab.CronEntry

public class CronEntry
extends Object

Defines one entry for CronDaemon. This class is used by the CronDaemon.

Version:
$Id: CronEntry.java,v 1.5 2006/01/27 20:35:16 michiel Exp $
Author:
Kees Jongenburger, Michiel Meeuwissen

Field Summary
static int CANBEMORE_JOB_TYPE
          The 'can be more' type job is like a 'must be one' job, but the run() method of such jobs is even called (when scheduled) if it itself is still running.
static String CANBEMORE_JOB_TYPE_STRING
           
static int DEFAULT_JOB_TYPE
           
static String DEFAULT_JOB_TYPE_STRING
           
static int MUSTBEONE_JOB_TYPE
          The default job type is the 'must be one' job.
static String MUSTBEONE_JOB_TYPE_STRING
           
static int SHORT_JOB_TYPE
          A CronEntry of this type will run without the overhead of an extra thread.
static String SHORT_JOB_TYPE_STRING
           
 
Constructor Summary
CronEntry(String id, String cronTime, String name, String className, String configuration)
           
CronEntry(String id, String cronTime, String name, String className, String configuration, int type)
           
CronEntry(String id, String cronTime, String name, String className, String configuration, String typeString)
           
 
Method Summary
 boolean equals(Object o)
           
 String getClassName()
           
 String getConfiguration()
           
 String getCronTime()
           
 CronEntryField getDayOfMonthEntry()
           
 CronEntryField getDayOfWeekEntry()
           
 CronEntryField getHourEntry()
           
 String getId()
           
 CronEntryField getMinuteEntry()
           
 CronEntryField getMonthEntry()
           
 String getName()
           
 Interruptable getThread(int i)
           
 List getThreads()
           
 String getType()
           
 int hashCode()
           
 void init()
           
 boolean isAlive()
           
 boolean isAlive(int i)
           
static String jobTypeToString(int type)
          Convert a jobType int to a jobType String.
 boolean kick()
           
 void setConfiguration(String conf)
           
protected  void setCronTime(String cronTime)
           
 void stop()
           
static int stringToJobType(String type)
          Convert a jobType String to a jobType int.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SHORT_JOB_TYPE

public static final int SHORT_JOB_TYPE
A CronEntry of this type will run without the overhead of an extra thread. This does mean though that such a job will halt the cron-daemon itself. Such jobs must therefore be extremely short-living, and used with care (only if you have a lot of those which must run very often)

See Also:
Constant Field Values

SHORT_JOB_TYPE_STRING

public static final String SHORT_JOB_TYPE_STRING
See Also:
Constant Field Values

MUSTBEONE_JOB_TYPE

public static final int MUSTBEONE_JOB_TYPE
The default job type is the 'must be one' job. Such jobs are not started if the same job is still running. They are wrapped in a seperate thread, so other jobs can be started during the execution of this one.

See Also:
Constant Field Values

MUSTBEONE_JOB_TYPE_STRING

public static final String MUSTBEONE_JOB_TYPE_STRING
See Also:
Constant Field Values

CANBEMORE_JOB_TYPE

public static final int CANBEMORE_JOB_TYPE
The 'can be more' type job is like a 'must be one' job, but the run() method of such jobs is even called (when scheduled) if it itself is still running.

See Also:
Constant Field Values

CANBEMORE_JOB_TYPE_STRING

public static final String CANBEMORE_JOB_TYPE_STRING
See Also:
Constant Field Values

DEFAULT_JOB_TYPE

public static final int DEFAULT_JOB_TYPE
See Also:
Constant Field Values

DEFAULT_JOB_TYPE_STRING

public static final String DEFAULT_JOB_TYPE_STRING
See Also:
Constant Field Values
Constructor Detail

CronEntry

public CronEntry(String id,
                 String cronTime,
                 String name,
                 String className,
                 String configuration)
          throws Exception

CronEntry

public CronEntry(String id,
                 String cronTime,
                 String name,
                 String className,
                 String configuration,
                 String typeString)
          throws Exception

CronEntry

public CronEntry(String id,
                 String cronTime,
                 String name,
                 String className,
                 String configuration,
                 int type)
          throws Exception
Throws:
ClassCastException - if className does not refer to a Runnable.
RuntimeException - if the cronTime format isn't correct
Exception
Method Detail

init

public void init()

stop

public void stop()

getThread

public Interruptable getThread(int i)
Since:
MMBase-1.8

getThreads

public List getThreads()

isAlive

public boolean isAlive(int i)
Since:
MMBase-1.8

isAlive

public boolean isAlive()

kick

public boolean kick()

setCronTime

protected void setCronTime(String cronTime)

getCronTime

public String getCronTime()

getId

public String getId()

getName

public String getName()

setConfiguration

public void setConfiguration(String conf)

getConfiguration

public String getConfiguration()

getType

public String getType()

getClassName

public String getClassName()

getMinuteEntry

public CronEntryField getMinuteEntry()

getHourEntry

public CronEntryField getHourEntry()

getDayOfMonthEntry

public CronEntryField getDayOfMonthEntry()

getMonthEntry

public CronEntryField getMonthEntry()

getDayOfWeekEntry

public CronEntryField getDayOfWeekEntry()

toString

public String toString()

hashCode

public int hashCode()

equals

public boolean equals(Object o)

jobTypeToString

public static String jobTypeToString(int type)
Convert a jobType int to a jobType String. invalid types are accepted and return DEFAULT_JOB_TYPE_STRING

Parameters:
type - the job type
Returns:
The string representation of the job type

stringToJobType

public static int stringToJobType(String type)
Convert a jobType String to a jobType int. first the string is lowered cased and trimed. null values and invalid values are accepted and return the DEFAULT_JOB_TYPE

Parameters:
type - the string representation of the job type
Returns:
the int representation of the jobType


MMBase build 1.8.1.20060716