public class ExecutionDurationController extends java.lang.Object implements InputParamController, java.io.Serializable
Let controlling the execution duration 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 execution duration of jobs can be modified by the user or not.
Note: the execution duration is always expressed in seconds.
Note:
By default, the execution duration can be modified by anyone without any limitation.
The default and maximum value is UWSJob.UNLIMITED_DURATION
.
The logic of the execution duration is set in this class. Here it is:
UWSJob.UNLIMITED_DURATION
).Modifier and Type | Field and Description |
---|---|
protected boolean |
allowModification
Indicates whether the execution duration of jobs can be modified.
|
protected long |
defaultDuration
The default duration (in seconds).
|
protected long |
maxDuration
The maximum duration (in seconds).
|
Constructor and Description |
---|
ExecutionDurationController()
Create a controller for the execution duration.
|
ExecutionDurationController(long defaultDuration,
long maxDuration,
boolean allowModification)
Create a controller for the execution duration.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allowModification()
Tells whether the execution duration of any managed job can be modified.
|
void |
allowModification(boolean allowModification)
Lets indicating whether the execution duration of any managed job can be modified.
|
java.lang.Object |
check(java.lang.Object value)
Checks the value of the controlled parameter and builds a new object from this value.
|
java.lang.Object |
getDefault()
Returns the default value of the controlled parameter.
|
long |
getDefaultExecutionDuration()
Deprecated.
This function is completely equivalent to
getDefault() . |
long |
getMaxExecutionDuration()
Gets the maximum execution duration.
|
boolean |
setDefaultExecutionDuration(long defaultExecutionDuration)
Sets the default execution duration.
|
void |
setMaxExecutionDuration(long maxExecutionDuration)
Sets the maximum execution duration.
|
protected long defaultDuration
protected long maxDuration
protected boolean allowModification
public ExecutionDurationController()
Create a controller for the execution duration.
By default, there is no maximum value and the default duration is UWSJob.UNLIMITED_DURATION
.
A default and/or maximum value can be set after creation using setDefaultExecutionDuration(long)
and setMaxExecutionDuration(long)
. By default this parameter can always be modified, but it can
be forbidden using allowModification(boolean)
.
public ExecutionDurationController(long defaultDuration, long maxDuration, boolean allowModification)
Create a controller for the execution duration. The default and the maximum duration are initialized with the given parameters. The third parameter allows also to forbid the modification of the execution duration by the user, if set to false.
A default and/or maximum value can be modified after creation using setDefaultExecutionDuration(long)
and setMaxExecutionDuration(long)
. The flag telling whether this parameter can be modified by the user
can be changed using allowModification(boolean)
.
defaultDuration
- Duration (in seconds) set by default to a job, when none is specified.maxDuration
- Maximum duration (in seconds) that can be set. If a greater value is provided by the user, an exception will be thrown by check(Object)
.allowModification
- true to allow the user to modify this value when creating a job, false otherwise.public java.lang.Object getDefault()
InputParamController
getDefault
in interface InputParamController
public java.lang.Object check(java.lang.Object value) throws UWSException
InputParamController
Checks the value of the controlled parameter and builds a new object from this value.
check
in interface InputParamController
value
- Parameter value to check.UWSException
- If the given value is strongly incorrect.@Deprecated public final long getDefaultExecutionDuration()
getDefault()
.public final boolean setDefaultExecutionDuration(long defaultExecutionDuration)
defaultExecutionDuration
- The new default execution duration (in seconds) (UWSJob.UNLIMITED_DURATION
, 0 or a negative value mean an unlimited duration).public final long getMaxExecutionDuration()
public final void setMaxExecutionDuration(long maxExecutionDuration)
maxExecutionDuration
- The maximum execution duration (in seconds) (UWSJob.UNLIMITED_DURATION
, 0 or a negative value mean an unlimited duration).public final boolean allowModification()
allowModification
in interface InputParamController
public final void allowModification(boolean allowModification)
allowModification
- true if the execution duration can be modified, false otherwise.