org.apache.turbine.services.schedule
Interface JobEntry

All Superinterfaces:
java.lang.Comparable

public interface JobEntry
extends java.lang.Comparable

This is a interface for a scheduled job. It does not specify how to configure when to run, that is left to subclasses. See the JobEntryTorque for an example of a JobEntry backed by Torque objects.

Version:
$Id: JobEntry.java,v 1.16 2003/10/24 15:15:06 epugh Exp $
Author:
Eric Pugh, Dave Bryson, Quinton McCombs

Method Summary
 void calcRunTime()
          Calculate how long before the next runtime.
 int compareTo(java.lang.Object je)
          Used for ordering Jobentries Note: this comparator imposes orderings that are inconsistent with equals.
 java.lang.String getNextRunAsString()
          Get the next runtime for this job as a String.
 java.util.Date getNextRunDate()
          Gets the next runtime as a date
 long getNextRuntime()
          Get the next runtime for this job as a long.
 java.lang.String getTask()
          Get the Task
 boolean isActive()
          Check to see if job is currently active/running
 void setActive(boolean isActive)
          Sets whether the job is running.
 void setTask(java.lang.String v)
          Set the value of Task
 

Method Detail

compareTo

public int compareTo(java.lang.Object je)
Used for ordering Jobentries Note: this comparator imposes orderings that are inconsistent with equals.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
je - The first JobEntry object.
Returns:
An int indicating the result of the comparison.

setActive

public void setActive(boolean isActive)
Sets whether the job is running.

Parameters:
isActive - Whether the job is running.

isActive

public boolean isActive()
Check to see if job is currently active/running

Returns:
true if job is currently geing run by the workerthread, otherwise false

getTask

public java.lang.String getTask()
Get the Task

Returns:
String

setTask

public void setTask(java.lang.String v)
Set the value of Task

Parameters:
v - new value

getNextRuntime

public long getNextRuntime()
Get the next runtime for this job as a long.

Returns:
The next run time as a long.

getNextRunDate

public java.util.Date getNextRunDate()
Gets the next runtime as a date

Returns:
Next run date

getNextRunAsString

public java.lang.String getNextRunAsString()
Get the next runtime for this job as a String.

Returns:
The next run time as a String.

calcRunTime

public void calcRunTime()
                 throws TurbineException
Calculate how long before the next runtime.
The runtime determines it's position in the job queue. Here's the logic:
1. Create a date the represents when this job is to run.
2. If this date has expired, them "roll" appropriate date fields forward to the next date.
3. Calculate the diff in time between the current time and the next run time.

Throws:
TurbineException - a generic exception.


Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.