Class JobEntryQuartz
- java.lang.Object
-
- org.apache.turbine.services.schedule.JobEntryQuartz
-
- All Implemented Interfaces:
Comparable<JobEntry>
,JobEntry
,org.quartz.Job
public class JobEntryQuartz extends Object implements JobEntry, org.quartz.Job
This implements a Turbine scheduled job model for theQuartzScheduler
.- Author:
- Thomas Vandahl
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_JOB_GROUP_NAME
the default Quartz schedule group name for Turbine jobs
-
Constructor Summary
Constructors Constructor Description JobEntryQuartz()
Default constructorJobEntryQuartz(org.quartz.Trigger jobTrigger)
ConstructorJobEntryQuartz(org.quartz.Trigger jobTrigger, org.quartz.JobDetail jobDetail)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
calcRunTime()
Calculate how long before the next runtime.int
compareTo(JobEntry o)
void
execute(org.quartz.JobExecutionContext context)
org.quartz.JobDetail
getJobDetail()
int
getJobId()
Get the value of jobId.org.quartz.Trigger
getJobTrigger()
String
getNextRunAsString()
Get the next runtime for this job as a String.Date
getNextRunDate()
Gets the next runtime as a datelong
getNextRuntime()
Get the next runtime for this job as a long.String
getTask()
Get the value of task.boolean
isActive()
Check to see if job is currently active/runningboolean
isNew()
Return true, if the entry is not yet persistedvoid
setActive(boolean isActive)
Sets whether the job is running.void
setJobId(int v)
Set the value of jobId.void
setJobTrigger(org.quartz.Trigger jobTrigger)
void
setTask(String v)
Set the value of task.
-
-
-
Field Detail
-
DEFAULT_JOB_GROUP_NAME
public static final String DEFAULT_JOB_GROUP_NAME
the default Quartz schedule group name for Turbine jobs- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JobEntryQuartz
public JobEntryQuartz()
Default constructor
-
JobEntryQuartz
public JobEntryQuartz(org.quartz.Trigger jobTrigger)
Constructor- Parameters:
jobTrigger
- Job time table
-
JobEntryQuartz
public JobEntryQuartz(org.quartz.Trigger jobTrigger, org.quartz.JobDetail jobDetail)
Constructor- Parameters:
jobTrigger
- Job time tablejobDetail
- job details
-
-
Method Detail
-
isNew
public boolean isNew()
Return true, if the entry is not yet persisted
-
getJobId
public int getJobId()
Get the value of jobId.
-
setJobId
public void setJobId(int v)
Set the value of jobId.
-
getJobTrigger
public org.quartz.Trigger getJobTrigger()
- Returns:
- the jobTrigger
-
setJobTrigger
public void setJobTrigger(org.quartz.Trigger jobTrigger)
- Parameters:
jobTrigger
- the jobTrigger to set
-
getJobDetail
public org.quartz.JobDetail getJobDetail()
- Returns:
- the jobDetail
-
compareTo
public int compareTo(JobEntry o)
- Specified by:
compareTo
in interfaceComparable<JobEntry>
- See Also:
Comparable.compareTo(java.lang.Object)
-
setActive
public void setActive(boolean isActive)
Description copied from interface:JobEntry
Sets whether the job is running.- Specified by:
setActive
in interfaceJobEntry
- Parameters:
isActive
- Whether the job is running.- See Also:
JobEntry.setActive(boolean)
-
isActive
public boolean isActive()
Description copied from interface:JobEntry
Check to see if job is currently active/running- Specified by:
isActive
in interfaceJobEntry
- Returns:
- true if job is currently being run by the worker thread, otherwise false
- See Also:
JobEntry.isActive()
-
getNextRuntime
public long getNextRuntime()
Description copied from interface:JobEntry
Get the next runtime for this job as a long.- Specified by:
getNextRuntime
in interfaceJobEntry
- Returns:
- The next run time as a long.
- See Also:
JobEntry.getNextRuntime()
-
getNextRunDate
public Date getNextRunDate()
Description copied from interface:JobEntry
Gets the next runtime as a date- Specified by:
getNextRunDate
in interfaceJobEntry
- Returns:
- Next run date
- See Also:
JobEntry.getNextRunDate()
-
getNextRunAsString
public String getNextRunAsString()
Description copied from interface:JobEntry
Get the next runtime for this job as a String.- Specified by:
getNextRunAsString
in interfaceJobEntry
- Returns:
- The next run time as a String.
- See Also:
JobEntry.getNextRunAsString()
-
calcRunTime
public void calcRunTime() throws TurbineException
Description copied from interface:JobEntry
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.- Specified by:
calcRunTime
in interfaceJobEntry
- Throws:
TurbineException
- a generic exception.- See Also:
JobEntry.calcRunTime()
-
execute
public void execute(org.quartz.JobExecutionContext context) throws org.quartz.JobExecutionException
- Specified by:
execute
in interfaceorg.quartz.Job
- Throws:
org.quartz.JobExecutionException
- See Also:
Job.execute(org.quartz.JobExecutionContext)
-
-