com.atlassian.jira.util
Class SimpleToCronUtil

java.lang.Object
  extended by com.atlassian.jira.util.SimpleToCronUtil

public class SimpleToCronUtil
extends java.lang.Object

Helper class to carry out various cron conversion tasks.


Constructor Summary
SimpleToCronUtil(org.quartz.Scheduler scheduler, SimpleToCronTriggerConverter simpleToCronTriggerConverter)
           
 
Method Summary
 org.quartz.CronTrigger convertSimpleToCronTrigger(org.quartz.SimpleTrigger simpleTrigger)
          Convert the provided SimpleTrigger to a CronTrigger.
 ConversionResult convertToCronString(org.quartz.SimpleTrigger triggerFromSubscription)
          Converts the simpleTrigger to a cronExpression (stored in the ConversionResult).
 org.quartz.CronTrigger createCronTrigger(org.quartz.SimpleTrigger triggerFromSubscription, ConversionResult conversionResult)
          Creates a new CronTrigger, using the details from the SimpleTrigger, and the cron expression provided in the ConversionResult.
 boolean pauseScheduler()
          Pauses the scheduler if it isn't already paused.
 void restartScheduler(boolean restartScheduler)
          Restarts the scheduler if the provided flag is true.
 void unscheduleJob(org.quartz.Trigger triggerFromSubscription)
          Unschedules a trigger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleToCronUtil

public SimpleToCronUtil(org.quartz.Scheduler scheduler,
                        SimpleToCronTriggerConverter simpleToCronTriggerConverter)
Method Detail

convertSimpleToCronTrigger

public org.quartz.CronTrigger convertSimpleToCronTrigger(org.quartz.SimpleTrigger simpleTrigger)
Convert the provided SimpleTrigger to a CronTrigger. This method also schedules the new trigger and removes the old trigger.

Parameters:
simpleTrigger - The trigger to be converted.
Returns:
The new CronTrigger (or null if conversion failed).

createCronTrigger

public org.quartz.CronTrigger createCronTrigger(org.quartz.SimpleTrigger triggerFromSubscription,
                                                ConversionResult conversionResult)
                                         throws java.text.ParseException,
                                                org.quartz.SchedulerException
Creates a new CronTrigger, using the details from the SimpleTrigger, and the cron expression provided in the ConversionResult.

Parameters:
triggerFromSubscription - The old SimpleTrigger.
conversionResult - The ConversionResult from converting triggerFromSubscription
Returns:
The new CronTrigger
Throws:
java.text.ParseException - If the new Trigger is not valid
org.quartz.SchedulerException - If the new Trigger could not be scheduled.

convertToCronString

public ConversionResult convertToCronString(org.quartz.SimpleTrigger triggerFromSubscription)
Converts the simpleTrigger to a cronExpression (stored in the ConversionResult).

Parameters:
triggerFromSubscription - The old SimpleTrigger.
Returns:
A ConversionResult.

unscheduleJob

public void unscheduleJob(org.quartz.Trigger triggerFromSubscription)
Unschedules a trigger.

Parameters:
triggerFromSubscription - The trigger about to be removed.

pauseScheduler

public boolean pauseScheduler()
Pauses the scheduler if it isn't already paused.

Returns:
true if the schedulre was paused.

restartScheduler

public void restartScheduler(boolean restartScheduler)
Restarts the scheduler if the provided flag is true.

Parameters:
restartScheduler - flag to restart the scheduler


Copyright © 2002-2010 Atlassian. All Rights Reserved.