public abstract class AbstractUWSFactory extends java.lang.Object implements UWSFactory
UWSFactory
.
Only the function which creates a JobThread
from a UWSJob
needs to be implemented.Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<java.lang.String> |
expectedAdditionalParams
List of all expected additional parameters.
|
protected java.util.HashMap<java.lang.String,InputParamController> |
inputParamControllers
List the controllers of all the input parameters.
|
Constructor and Description |
---|
AbstractUWSFactory() |
AbstractUWSFactory(java.lang.String[] expectedAdditionalParams)
Builds a factory with a list of the name of all expected additional parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
addExpectedAdditionalParameter(java.lang.String paramName)
Adds the name of an additional parameter which must be identified without taking into account its case
and then stored with the case of the given name.
|
void |
configureDestruction(int defaultTime,
DestructionTimeController.DateField defaultTimeUnit,
int maxTime,
DestructionTimeController.DateField maxTimeUnit,
boolean allowModif)
Lets configuring the destruction time default and maximum value.
|
void |
configureExecution(long defaultDuration,
long maxDuration,
boolean allowModif)
Lets configuring the execution duration default and maximum value.
|
UWSJob |
createJob(javax.servlet.http.HttpServletRequest request,
JobOwner user)
Creates a (PENDING) UWS job from the given HTTP request.
|
UWSJob |
createJob(java.lang.String jobID,
long creationTime,
JobOwner owner,
UWSParameters params,
long quote,
long startTime,
long endTime,
java.util.List<Result> results,
ErrorSummary error)
Creates a UWS job with the following attributes.
|
RequestParser |
createRequestParser(UWSFileManager fileManager)
Create a parser of HTTP requests.
|
UWSParameters |
createUWSParameters(javax.servlet.http.HttpServletRequest req)
Lets extracting all parameters from the given request.
|
UWSParameters |
createUWSParameters(java.util.Map<java.lang.String,java.lang.Object> params)
Lets extracting all parameters from the given map.
|
java.util.Iterator<java.lang.String> |
expectedAdditionalParametersIterator()
Gets an iterator on the names of the expected additional parameters.
|
java.util.List<java.lang.String> |
getExpectedAdditionalParameters()
Gets the names of the expected additional parameters.
|
InputParamController |
getInputParamController(java.lang.String inputParamName)
Gets the controller of the specified UWS input parameter.
|
java.util.Map<java.lang.String,InputParamController> |
getInputParamControllers()
Gets the list of all UWS input parameter controllers.
|
java.util.Iterator<java.util.Map.Entry<java.lang.String,InputParamController>> |
getInputParamControllersIterator()
Gets an iterator on the list of all UWS input parameter controllers.
|
int |
getNbExpectedAdditionalParameters()
Gets the number of additional parameters which must be identified with no case sensitivity.
|
void |
removeExpectedAdditionalParam(java.lang.String paramName)
Removes the name of an expected additional parameter.
|
InputParamController |
removeInputParamController(java.lang.String paramName)
Removes the controller of the specified input UWS job parameter.
|
InputParamController |
setInputParamController(java.lang.String paramName,
InputParamController controller)
Sets the controller of the specified input UWS job parameter.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createJobThread
protected final java.util.HashMap<java.lang.String,InputParamController> inputParamControllers
UWSParameters
and InputParamController
for more details.protected final java.util.ArrayList<java.lang.String> expectedAdditionalParams
public AbstractUWSFactory()
public AbstractUWSFactory(java.lang.String[] expectedAdditionalParams)
UWSParameters
without taking into account their case
and they will stored with the case of their name in the given list.expectedAdditionalParams
- Names of the expected parameters.public UWSJob createJob(javax.servlet.http.HttpServletRequest request, JobOwner user) throws UWSException
UWSFactory
createJob
in interface UWSFactory
request
- Request which triggers the creation of a UWS job.user
- The identified UWS user (see UserIdentifier
).UWSException
- If there is an error while creating the job.public UWSJob createJob(java.lang.String jobID, long creationTime, JobOwner owner, UWSParameters params, long quote, long startTime, long endTime, java.util.List<Result> results, ErrorSummary error) throws UWSException
UWSFactory
Creates a UWS job with the following attributes.
createJob
in interface UWSFactory
jobID
- ID of the job (NOT NULL).creationTime
- Creation date/time of the job (SHOULD NOT BE
NEGATIVE OR NULL).owner
- Owner of the job.params
- List of all input UWS job parameters.quote
- Its quote (in seconds).startTime
- Date/Time of the start of this job.endTime
- Date/Time of the end of this job.results
- All results of this job.error
- The error which ended the job to create.UWSException
- If there is an error while creating the job.public UWSParameters createUWSParameters(java.util.Map<java.lang.String,java.lang.Object> params) throws UWSException
UWSFactory
createUWSParameters
in interface UWSFactory
params
- All the parameters to check and to store.UWSException
- If an error occurs while extracting parameters.public UWSParameters createUWSParameters(javax.servlet.http.HttpServletRequest req) throws UWSException
UWSFactory
createUWSParameters
in interface UWSFactory
req
- The request from which parameters must be extracted.UWSException
- If an error occurs while extracting parameters.public RequestParser createRequestParser(UWSFileManager fileManager) throws UWSException
UWSFactory
createRequestParser
in interface UWSFactory
fileManager
- File manager to use if files are uploaded in an HTTP request.UWSException
- If an error occurs while creating the parser.public final void addExpectedAdditionalParameter(java.lang.String paramName)
paramName
- Name of an additional parameter.public final int getNbExpectedAdditionalParameters()
public final java.util.List<java.lang.String> getExpectedAdditionalParameters()
public final java.util.Iterator<java.lang.String> expectedAdditionalParametersIterator()
public final void removeExpectedAdditionalParam(java.lang.String paramName)
paramName
- Name of an additional parameter.public final java.util.Map<java.lang.String,InputParamController> getInputParamControllers()
public final java.util.Iterator<java.util.Map.Entry<java.lang.String,InputParamController>> getInputParamControllersIterator()
public final InputParamController getInputParamController(java.lang.String inputParamName)
inputParamName
- Name of the parameter whose the controller must be returned.public final InputParamController setInputParamController(java.lang.String paramName, InputParamController controller)
paramName
- Name of the parameter with which the given controller will be associated.controller
- An input parameter controller.public final InputParamController removeInputParamController(java.lang.String paramName)
paramName
- Name of the parameter whose the controller must be removed.public final void configureExecution(long defaultDuration, long maxDuration, boolean allowModif)
Lets configuring the execution duration default and maximum value.
note: A new controller is created if needed.
Otherwise the current one (if it is an instance of DestructionTimeController
) is updated.
defaultDuration
- Default duration between the start and the end of the execution of a job.maxDuration
- Maximum duration between the start and the end of the execution of a job that a user can set when creating/initializing a job.allowModif
- true to allow the modification of this parameter after its initialization, false otherwise.ExecutionDurationController
public final void configureDestruction(int defaultTime, DestructionTimeController.DateField defaultTimeUnit, int maxTime, DestructionTimeController.DateField maxTimeUnit, boolean allowModif)
Lets configuring the destruction time default and maximum value.
note: A new controller is created if needed.
Otherwise the current one (if it is an instance of ExecutionDurationController
) is updated.
defaultTime
- Default time since the job creation and its destruction.defaultTimeUnit
- Unit of the default time (i.e. minutes, days, ...).maxTime
- Maximum time since the job creation and its destruction that a user can set when creating/initializing a job.maxTimeUnit
- Unit of the maximum time (i.e. minutes, days, ...).allowModif
- true to allow the modification of this parameter after its initialization, false otherwise.DestructionTimeController