public class ConfigurableUWSFactory extends java.lang.Object implements UWSFactory
UWSFactory
which is parameterized by a UWS configuration file.Modifier and Type | Field and Description |
---|---|
protected java.lang.reflect.Constructor<? extends RequestParser> |
constructorRequestParser
Constructor of the
RequestParser to create for the whole UWS service. |
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,InputParamController>> |
jobParams
List of parameters (and eventually how to control them) for each job-list/job.
|
protected java.util.Map<java.lang.String,java.lang.reflect.Constructor<? extends JobThread>> |
jobThreads
Map associating the name of a job list with the constructor of the class of the jobs to create inside this job list.
|
protected static java.util.regex.Pattern |
PATTERN_PARAMETER
Regular Expression of a job parameters list.
|
Modifier | Constructor and Description |
---|---|
protected |
ConfigurableUWSFactory()
Create an empty factory.
|
|
ConfigurableUWSFactory(java.util.Properties uwsConfig)
Create and initialize a UWS factory thanks to properties coming from a UWS configuration file.
|
Modifier and Type | Method and Description |
---|---|
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.
|
JobThread |
createJobThread(UWSJob jobDescription)
Creates the thread which will executes the task described by the given
UWSJob instance. |
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.
|
protected void |
initParameters(java.lang.String jlName,
java.lang.String propValue)
Parse the given list of parameters + their limits/controller and update the list of parameters for the specified job list.
|
protected java.lang.reflect.Constructor<? extends RequestParser> constructorRequestParser
RequestParser
to create for the whole UWS service.
If null
, the default UWS request parser (i.e. UWSRequestParser
) will be used.
protected java.util.Map<java.lang.String,java.lang.reflect.Constructor<? extends JobThread>> jobThreads
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,InputParamController>> jobParams
protected static final java.util.regex.Pattern PATTERN_PARAMETER
The following parameter types are supported:
\s*([^,\[\]]*)\s*(,(.*))?
Example: param1
InputParamController
:
\s*\[([^,]+),(\{[^\}]*\})\s*\]\s*(,(.*))?
Example: [param1, {aPackage.MyCustomController}]
\s*\[([^,]+),([^,]*),\s*(string)\s*,\s*"([^,]*)"\s*,\s* /(([^\/]|//)*)/(i)?\s*\]\s*(,(.*))?
Example: [param1, true, string, "default", /mySuperRegexp/i]
string
i
if the regular expression must be evaluated in a case insensitive manner\s*\[([^,]+),([^,]*),\s*(numeric)\s*,([^,]*),([^,]*),([^,]*)\s*\]\s*(,(.*))?
Example: [param1, true, numeric, 10, 0, 20]
numeric
\s*\[([^,]+),([^,]*),\s*(duration)\s*,([^,]*),([^,]*),([^,]*)\s*\]\s*(,(.*))?
Example: [param1, true, numeric, 10, 0, 20]
numeric
The default, minimum and maximum value must a positive integer value followed eventually by a unit. If no unit is specified, the default is milliseconds
.
See below for all supported units:
protected ConfigurableUWSFactory()
Using this constructor, no JobThread
can be created.
You have to add some in jobThreads
for each job list you have to support.
The parameters of each job/job-list can be listed in jobParams
.
public ConfigurableUWSFactory(java.util.Properties uwsConfig) throws UWSException
The following properties are supported by this constructor:
uwsConfig
- Configuration of this factory.UWSException
- If the initialization fails.protected void initParameters(java.lang.String jlName, java.lang.String propValue) throws UWSException
The given string is parsed using PATTERN_PARAMETER
. The expected syntax of one item of this list is explained
in the javadoc of PATTERN_PARAMETER
.
If just a parameter name is given, it is anyway added to the map of parameters of the specified job list, but with a null
InputParamController
. The idea is to indicate the parameter is expected with this name, but there is no specific restriction on its value.
jlName
- Name of the job list for which the given list of parameters is expected.propValue
- String expressing the list of expected parameters (and eventually their limits/controller).UWSException
- If the syntax of a parameter description is incorrect.public JobThread createJobThread(UWSJob jobDescription) throws UWSException
UWSFactory
UWSJob
instance.createJobThread
in interface UWSFactory
jobDescription
- Description of the task to execute.UWSException
- If there is an error while creating the job task.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.