|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uws.service.controller.DestructionTimeController
public class DestructionTimeController
Let's controlling the destruction time of all jobs managed by a UWS. Thus it is possible to set a default and a maximum value. Moreover you can indicate whether the destruction time of jobs can be modified by the user or not.
Notes:
Nested Class Summary | |
---|---|
static class |
DestructionTimeController.DateField
Represents a date/time field. |
Field Summary | |
---|---|
protected boolean |
allowModification
Indicates whether the destruction time of jobs can be modified. |
protected int |
defaultInterval
The default interval from the initialization to the destruction of the concerned job. |
protected DestructionTimeController.DateField |
defaultIntervalField
The date-time field on which the default interval applies. |
protected java.util.Date |
defaultTime
The default destruction time. |
protected int |
maxInterval
The maximum interval from the initialization to the destruction of the concerned job. |
protected DestructionTimeController.DateField |
maxIntervalField
The date-time field on which the maximum interval applies. |
protected java.util.Date |
maxTime
The maximum destruction time. |
static int |
NO_INTERVAL
Default value of an interval: a null interval. |
Constructor Summary | |
---|---|
DestructionTimeController()
|
Method Summary | |
---|---|
boolean |
allowModification()
Tells whether the destruction time of any managed job can be modified. |
void |
allowModification(boolean allowModification)
Lets indicating whether the destruction time of any managed job can be modified. |
void |
control(AbstractJob jobToControl,
java.util.Date dateToCheck)
Controls the given destruction time. |
void |
control(AbstractJob job,
java.util.Map<java.lang.String,java.lang.String> params)
Extracts the destruction time from the given map and controls its value. |
static java.text.DateFormat |
getDateFormat(AbstractJob job)
Gets the date format used currently by the given job if not null or gets the default date format of a job (see AbstractJob.DEFAULT_DATE_FORMAT ). |
int |
getDefaultDestructionInterval()
Gets the default interval value. |
java.util.Date |
getDefaultDestructionTime()
Gets the default destruction time: either computed with an interval of time or obtained directly by a default destruction time. |
DestructionTimeController.DateField |
getDefaultIntervalField()
Gets the date-time field of the default interval. |
int |
getMaxDestructionInterval()
Gets the maximum interval value. |
java.util.Date |
getMaxDestructionTime()
Gets the maximum destruction time: either computed with an interval of time or obtained directly by a maximum destruction time. |
DestructionTimeController.DateField |
getMaxIntervalField()
Gets the date-time field of the maximum interval. |
void |
init(java.util.Map<java.lang.String,java.lang.String> params)
Controls the destruction time given in the map or initializes it with the default value if not present in the map. |
void |
setDefaultDestructionInterval(int defaultDestructionInterval)
Sets the default interval in minutes from the initialization to the destruction of the concerned job. |
void |
setDefaultDestructionInterval(int defaultDestructionInterval,
DestructionTimeController.DateField timeField)
Sets the default interval (in the given unit) from the initialization to the destruction of the concerned job. |
void |
setDefaultDestructionTime(AbstractJob job)
Sets the destruction time of the given job with the default value. |
void |
setDefaultDestructionTime(java.util.Date defaultDestructionTime)
Sets the default destruction time. |
void |
setDestructionTime(AbstractJob job,
java.util.Date date)
Controls the given value and sets the destruction time of the given job with this value. |
void |
setMaxDestructionInterval(int maxDestructionInterval)
Sets the maximum interval in minutes from the initialization to the destruction of the concerned job. |
void |
setMaxDestructionInterval(int maxDestructionInterval,
DestructionTimeController.DateField timeField)
Sets the maximum interval (in the given unit) from the initialization to the destruction of the concerned job. |
void |
setMaxDestructionTime(java.util.Date maxDestructionTime)
Sets the maximum destruction time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NO_INTERVAL
protected java.util.Date defaultTime
protected DestructionTimeController.DateField defaultIntervalField
protected int defaultInterval
protected java.util.Date maxTime
protected DestructionTimeController.DateField maxIntervalField
protected int maxInterval
protected boolean allowModification
Constructor Detail |
---|
public DestructionTimeController()
Method Detail |
---|
public final java.util.Date getDefaultDestructionTime()
public final void setDefaultDestructionTime(java.util.Date defaultDestructionTime)
Sets the default destruction time.
Note:
If there was a default interval, it is reset and so the given destruction time will be used by getDefaultDestructionTime()
.
defaultDestructionTime
- The default destruction time to set (null means jobs may stay forever).public final int getDefaultDestructionInterval()
Gets the default interval value.
Note: To get the corresponding unit, use getDefaultIntervalField()
and Enum.name()
.
public final DestructionTimeController.DateField getDefaultIntervalField()
public final void setDefaultDestructionInterval(int defaultDestructionInterval)
Sets the default interval in minutes from the initialization to the destruction of the concerned job.
Note:
If there was a default destruction time, it is reset and so the given interval will be used by getDefaultDestructionTime()
.
defaultDestructionInterval
- The default destruction interval (NO_INTERVAL
, 0 or a negative value mean the job may stay forever).setDefaultDestructionInterval(int, DateField)
public final void setDefaultDestructionInterval(int defaultDestructionInterval, DestructionTimeController.DateField timeField)
Sets the default interval (in the given unit) from the initialization to the destruction of the concerned job.
Note:
If there was a default destruction time, it is reset and so the given interval will be used by getDefaultDestructionTime()
.
defaultDestructionInterval
- The default destruction interval (NO_INTERVAL
, 0 or a negative value mean the job may stay forever).timeField
- The unit of the interval (null means the job may stay forever).public final java.util.Date getMaxDestructionTime()
public final void setMaxDestructionTime(java.util.Date maxDestructionTime)
Sets the maximum destruction time.
Note:
If there was a maximum interval, it is reset and so the given destruction time will be used by getMaxDestructionTime()
.
maxDestructionTime
- The maximum destruction time to set (null means jobs may stay forever).public final int getMaxDestructionInterval()
Gets the maximum interval value.
Note: To get the corresponding unit, use getMaxIntervalField()
and Enum.name()
.
public final DestructionTimeController.DateField getMaxIntervalField()
public final void setMaxDestructionInterval(int maxDestructionInterval)
Sets the maximum interval in minutes from the initialization to the destruction of the concerned job.
Note:
If there was a maximum destruction time, it is reset and so the given interval will be used by getMaxDestructionTime()
.
maxDestructionInterval
- The maximum destruction interval (NO_INTERVAL
, 0 or a negative value mean the job may stay forever).setMaxDestructionInterval(int, DateField)
public final void setMaxDestructionInterval(int maxDestructionInterval, DestructionTimeController.DateField timeField)
Sets the maximum interval (in the given unit) from the initialization to the destruction of the concerned job.
Note:
If there was a maximum destruction time, it is reset and so the given interval will be used by getMaxDestructionTime()
.
maxDestructionInterval
- The maximum destruction interval (NO_INTERVAL
, 0 or a negative value mean the job may stay forever).timeField
- The unit of the interval (null means the job may stay forever).public final boolean allowModification()
public final void allowModification(boolean allowModification)
allowModification
- true if the destruction time can be modified, false otherwise.public void init(java.util.Map<java.lang.String,java.lang.String> params) throws UWSException
params
- The map of all parameters to use for the creation of a job.
UWSException
- If the destruction time given in the map is not valid.control(AbstractJob, Map)
public void control(AbstractJob job, java.util.Map<java.lang.String,java.lang.String> params) throws UWSException
job
- The job whose the destruction time will be set.params
- The map which contains the new destruction time of the given job.
UWSException
- If the new destruction time does not respect the date format used by the given job or the default date format
or if the destruction time of the given job can not be modified
or if the given value exceeds the maximum value.control(AbstractJob, Date)
public void control(AbstractJob jobToControl, java.util.Date dateToCheck) throws UWSException
jobToControl
- The job whose the destruction time will be updated by the given value.dateToCheck
- The new destruction time of the given value.
UWSException
- If the current phase of the job doesn't allow any modification
or if this controller forbids the modification of the destruction time
or if the new destruction time exceeds the maximum value.public void setDefaultDestructionTime(AbstractJob job) throws UWSException
job
- The job whose the destruction time must be set.
UWSException
- If it is impossible to set the destruction time of the given job (for instance, if the job is running or is finished).setDestructionTime(AbstractJob, Date)
public void setDestructionTime(AbstractJob job, java.util.Date date) throws UWSException
job
- The job whose the destruction time must be set.date
- The new destruction time of the given job.
UWSException
- If the current phase of the job doesn't allow any modification
or if this controller forbids the modification of the destruction time
or if the new destruction time exceeds the maximum value.control(AbstractJob, Date)
,
AbstractJob.setDestructionTime(Date)
public static final java.text.DateFormat getDateFormat(AbstractJob job)
AbstractJob.DEFAULT_DATE_FORMAT
).
job
- The job whose the date format must be extracted.
AbstractJob.getDateFormat()
,
AbstractJob.DEFAULT_DATE_FORMAT
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |