org.mailster.gui.prefs.utils
Class JobExecutionInterval

java.lang.Object
  extended by org.mailster.gui.prefs.utils.JobExecutionInterval

public class JobExecutionInterval
extends java.lang.Object

Represents an interval for a repeated automatic execution of an IJob within the JobManager scheduler context.

Author:
Sebastian Machhausen, Edouard De Oliveira

Field Summary
static JobExecutionInterval APPLICATION_STARTUP
          Default interval of 1 (execution at application startup)
static JobExecutionInterval[] DEFAULT_INTERVALS
          The predefined intervals
static JobExecutionInterval EIGHT_HOURS
          Default interval of 8 hours
static JobExecutionInterval FIFTEEN_MINUTES
          Default interval of 15 minutes
static JobExecutionInterval FIVE_MINUTES
          Default interval of 5 minutes
static JobExecutionInterval FOUR_HOURS
          Default interval of 4 hours
static JobExecutionInterval FOUR_MINUTES
          Default interval of 4 minutes
private  java.lang.String localizedPeriod
          The localized textual representation of a period
static JobExecutionInterval NO_EXECUTION
          Default interval of zero (no execution)
static JobExecutionInterval ONE_DAY
          Default interval of 1 day
static JobExecutionInterval ONE_HOUR
          Default interval of 1 hour
static JobExecutionInterval ONE_MINUTE
          Default interval of 1 minute
static JobExecutionInterval ONE_WEEK
          Default interval of 1 week
private  long period
          The period in milliseconds that separates executions of an IJob.
static JobExecutionInterval TEN_MINUTES
          Default interval of 10 minutes
static JobExecutionInterval THIRTY_MINUTES
          Default interval of 30 minutes
static JobExecutionInterval THREE_MINUTES
          Default interval of 3 minutes
static JobExecutionInterval TWELVE_HOURS
          Default interval of 12 hours
static JobExecutionInterval TWO_HOURS
          Default interval of 2 hours
static JobExecutionInterval TWO_MINUTES
          Default interval of 2 minutes
 
Constructor Summary
JobExecutionInterval(long period)
          Creates a new JobExceutionInterval.
 
Method Summary
static JobExecutionInterval getInterval(long period)
          Gets the JobExecutionInterval that matches the specified period.
 java.lang.String getLocalizedPeriod()
          Gets the localized textual representation of the currently set period as returned by the getPeriod() method, e.g. "5 minutes".
 long getPeriod()
          Gets the period in milliseconds that separates subsequent executions of an IJob.
private  void initializeLocalizedPeriod()
          Initializes the localized textual representation of the currently set period as returned by the getPeriod() method, e.g. "5 minutes".
 void setPeriod(long period)
          Sets the period in milliseconds that separates subsequent executions of an IJob.
 java.lang.String toString()
          Gets the textual representation of this JobExecutionInterval instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_EXECUTION

public static final JobExecutionInterval NO_EXECUTION
Default interval of zero (no execution)


APPLICATION_STARTUP

public static final JobExecutionInterval APPLICATION_STARTUP
Default interval of 1 (execution at application startup)


ONE_MINUTE

public static final JobExecutionInterval ONE_MINUTE
Default interval of 1 minute


TWO_MINUTES

public static final JobExecutionInterval TWO_MINUTES
Default interval of 2 minutes


THREE_MINUTES

public static final JobExecutionInterval THREE_MINUTES
Default interval of 3 minutes


FOUR_MINUTES

public static final JobExecutionInterval FOUR_MINUTES
Default interval of 4 minutes


FIVE_MINUTES

public static final JobExecutionInterval FIVE_MINUTES
Default interval of 5 minutes


TEN_MINUTES

public static final JobExecutionInterval TEN_MINUTES
Default interval of 10 minutes


FIFTEEN_MINUTES

public static final JobExecutionInterval FIFTEEN_MINUTES
Default interval of 15 minutes


THIRTY_MINUTES

public static final JobExecutionInterval THIRTY_MINUTES
Default interval of 30 minutes


ONE_HOUR

public static final JobExecutionInterval ONE_HOUR
Default interval of 1 hour


TWO_HOURS

public static final JobExecutionInterval TWO_HOURS
Default interval of 2 hours


FOUR_HOURS

public static final JobExecutionInterval FOUR_HOURS
Default interval of 4 hours


EIGHT_HOURS

public static final JobExecutionInterval EIGHT_HOURS
Default interval of 8 hours


TWELVE_HOURS

public static final JobExecutionInterval TWELVE_HOURS
Default interval of 12 hours


ONE_DAY

public static final JobExecutionInterval ONE_DAY
Default interval of 1 day


ONE_WEEK

public static final JobExecutionInterval ONE_WEEK
Default interval of 1 week


DEFAULT_INTERVALS

public static final JobExecutionInterval[] DEFAULT_INTERVALS
The predefined intervals


period

private long period
The period in milliseconds that separates executions of an IJob.


localizedPeriod

private java.lang.String localizedPeriod
The localized textual representation of a period

Constructor Detail

JobExecutionInterval

public JobExecutionInterval(long period)
Creates a new JobExceutionInterval.

Parameters:
period - period the period in milliseconds that separates executions of an IJob
Method Detail

setPeriod

public void setPeriod(long period)
Sets the period in milliseconds that separates subsequent executions of an IJob.

Parameters:
period - the period in milliseconds that separates subsequent executions of an IJob
Throws:
java.lang.IllegalArgumentException - if a value less than zero is specified for period

getPeriod

public long getPeriod()
Gets the period in milliseconds that separates subsequent executions of an IJob.

Returns:
the period in milliseconds that separates subsequent executions of an IJob

getLocalizedPeriod

public java.lang.String getLocalizedPeriod()
Gets the localized textual representation of the currently set period as returned by the getPeriod() method, e.g. "5 minutes".

Returns:
the localized textual representation of the currently set period as returned by the getPeriod() method, e.g. "5 minutes"

toString

public java.lang.String toString()
Gets the textual representation of this JobExecutionInterval instance. This method returns the localized textual representation of the currently set period as returned by the getLocalizedPeriod() method, e.g. "5 minutes".

Overrides:
toString in class java.lang.Object
Returns:
the textual representation of this JobExecutionInterval instance

getInterval

public static JobExecutionInterval getInterval(long period)
Gets the JobExecutionInterval that matches the specified period. If none of the predefined JobExecutionIntervals matches the specified period the default NO_EXECUTION JobExecutionInterval is returned.

Parameters:
period - the period to get the JobExecutionIntevral for
Returns:
the JobExecutionInterval matching the specified period

initializeLocalizedPeriod

private void initializeLocalizedPeriod()
Initializes the localized textual representation of the currently set period as returned by the getPeriod() method, e.g. "5 minutes".