public abstract class UWSServlet extends javax.servlet.http.HttpServlet implements UWS, UWSFactory
This servlet lets initialize and manage a web service implementing the UWS pattern. That's to say all methods and functionalities of a UWS are already implemented. All you have to do is to initialize and maybe to customize your UWS.
To create a such servlet, you have to extend this class. Once done, only two functions must be
implemented: createJob(HttpServletRequest, JobOwner)
and initUWS()
.
The first one will be called by the library each time a job must be created. All the job parameters given by the user and the identity of the user are given in the arguments. You just have to return an appropriate instance of a job using all these information.
initUWS()
must contain at least one line: the creation of a job list. For instance:
addJobList(new JobList<MyJob>("jlName"));
The below code show an example of usage of this class:
public class MyUWSServlet extends UWSServlet { // Initialize the UWS service by creating at least one job list. public void initUWS() throws UWSException { addJobList(new JobList("jobList")); } // Create the job process corresponding to the job to execute ; generally, the process identification can be merely done by checking the job list name. public JobThread createJobThread(UWSJob job) throws UWSException { if (job.getJobList().getName().equals("jobList")) return new MyJobThread(job); else throw new UWSException("Impossible to create a job inside the jobs list \"" + job.getJobList().getName() + "\" !"); } }
The name and the description of the UWS may be specified in the web.xml file as init-param of the servlet:
name
and description
. The other way is to directly set the corresponding
attributes: name
and description
.
Note:
If any error occurs while the initialization or the creation of a UWSServlet
instance, a ServletException
will be thrown with a basic message dedicated to the service users. This basic and non-informative message is
obviously not intended to the administrator which will be able to get the reason of the failure
(with a stack trace when available) in the log files.
As for the classic HTTP servlets, this servlet has one method for each method of the implemented protocol. Thus, you have one function for the "add job" action, another one for the "get job list" action, ... These functions are:
doAddJob(UWSUrl, HttpServletRequest, HttpServletResponse, JobOwner)
doDestroyJob(UWSUrl, HttpServletRequest, HttpServletResponse, JobOwner)
doGetJobParam(UWSUrl, HttpServletRequest, HttpServletResponse, JobOwner)
doJobSummary(UWSUrl, HttpServletRequest, HttpServletResponse, JobOwner)
doListJob(UWSUrl, HttpServletRequest, HttpServletResponse, JobOwner)
doSetJobParam(UWSUrl, HttpServletRequest, HttpServletResponse, JobOwner)
They are all already implemented following their definition in the IVOA document. However, if needed, they can be overridden in order to do your own actions.
Besides, the classic HTTP servlet methods (i.e. HttpServlet.doGet(HttpServletRequest, HttpServletResponse)
, HttpServlet.doPost(HttpServletRequest, HttpServletResponse)
, ...)
are called normally if none of the UWS actions match to the received HTTP request.
So, they can be overridden as in any HTTP servlet.
Modifier and Type | Field and Description |
---|---|
protected UWSBackupManager |
backupManager
Lets saving and/or restoring the whole UWS.
|
protected java.lang.String |
defaultSerializer
The MIME type of the default serialization format.
|
protected java.lang.String |
description
Description of this UWS.
|
protected ServiceErrorWriter |
errorWriter
Lets writing/formatting any exception/throwable in a HttpServletResponse.
|
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.
|
protected static java.lang.String |
lastRequestID |
protected UWSLog |
logger
Lets logging info/debug/warnings/errors about this UWS.
|
protected java.lang.String |
name
Name of this UWS.
|
protected RequestParser |
requestParser
Lets extract all parameters from an HTTP request, whatever is its content-type.
|
protected UserIdentifier |
userIdentifier
The object to use to extract the user ID from the received request.
|
protected BlockingPolicy |
waitPolicy
Strategy to use for the blocking/wait process concerning the
doJobSummary(UWSUrl, HttpServletRequest, HttpServletResponse, JobOwner)
action. |
REQ_ATTRIBUTE_ID, REQ_ATTRIBUTE_JOB_DESCRIPTION, REQ_ATTRIBUTE_PARAMETERS, REQ_ATTRIBUTE_USER, STANDARD_ID, VERSION
Constructor and Description |
---|
UWSServlet() |
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.
|
boolean |
addJobList(JobList jl)
Adds a jobs list to this UWS.
|
boolean |
addSerializer(UWSSerializer serializer)
Adds a serializer to this UWS
|
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.
|
UWSFileManager |
createFileManager() |
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.
|
void |
destroy()
End properly this UWS: jobs should be backuped (if this feature is enable), timers and threads should be stopped,
open files and database connections should be closed, etc...
|
boolean |
destroyJobList(JobList jl)
Destroys the given jobs list.
|
boolean |
destroyJobList(java.lang.String name)
Destroys the specified jobs list.
|
protected void |
doAddJob(UWSUrl requestUrl,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
JobOwner user) |
protected void |
doDestroyJob(UWSUrl requestUrl,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
JobOwner user) |
protected void |
doGetJobParam(UWSUrl requestUrl,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
JobOwner user) |
protected void |
doJobSummary(UWSUrl requestUrl,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
JobOwner user) |
protected void |
doListJob(UWSUrl requestUrl,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
JobOwner user) |
protected void |
doSetJobParam(UWSUrl requestUrl,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
JobOwner user) |
protected void |
doSetUWSParameter(UWSUrl requestUrl,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
JobOwner user) |
java.util.Iterator<java.lang.String> |
expectedAdditionalParametersIterator()
Gets an iterator on the names of the expected additional parameters.
|
protected java.lang.String |
generateRequestID(javax.servlet.http.HttpServletRequest request) |
UWSBackupManager |
getBackupManager()
Gets its backup manager.
|
java.lang.String |
getDescription()
Gets the description of this UWS.
|
ServiceErrorWriter |
getErrorWriter()
Gets the object used to write/format any error in a HttpServletResponse.
|
java.util.List<java.lang.String> |
getExpectedAdditionalParameters()
Gets the names of the expected additional parameters.
|
UWSFactory |
getFactory()
Gets its job factory.
|
UWSFileManager |
getFileManager()
Gets its file manager.
|
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.
|
UWSJob |
getJob(UWSUrl requestUrl) |
UWSJob |
getJob(UWSUrl requestUrl,
JobOwner user) |
JobList |
getJobList(java.lang.String name)
Gets the jobs list whose the name matches exactly the given one.
|
UWSLog |
getLogger()
Gets the logger of this UWS.
|
java.lang.String |
getName()
Gets the name of this UWS.
|
int |
getNbExpectedAdditionalParameters()
Gets the number of additional parameters which must be identified with no case sensitivity.
|
int |
getNbJobList()
Gets the number of managed jobs lists.
|
RequestParser |
getRequestParser()
Get its HTTP request parser.
|
UWSSerializer |
getSerializer(java.lang.String mimeTypes)
Gets the serializer whose the MIME type is the same as the given one.
|
UWSUrl |
getUrlInterpreter()
Gets the UWS URL interpreter of this UWS.
|
UserIdentifier |
getUserIdentifier()
Gets the object which lets extracting the user ID from a HTTP request.
|
BlockingPolicy |
getWaitPolicy()
Get the currently used strategy for the blocking behavior of the
Job Summary action.
|
java.lang.String |
getXsltURL()
Gets the URL of the XSLT style-sheet that the XML serializer of this UWS is using.
|
void |
init() |
void |
init(javax.servlet.ServletConfig config) |
abstract void |
initUWS() |
java.util.Iterator<JobList> |
iterator() |
void |
redirect(java.lang.String url,
javax.servlet.http.HttpServletRequest request,
JobOwner user,
java.lang.String uwsAction,
javax.servlet.http.HttpServletResponse response)
Sends a redirection (with the HTTP status code 303) to the given URL/URI into the given response.
|
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.
|
UWSSerializer |
removeSerializer(java.lang.String mimeType)
Removes the serializer whose the MIME type is the same as the given one.
|
void |
sendError(java.lang.Throwable error,
javax.servlet.http.HttpServletRequest request,
java.lang.String reqID,
JobOwner user,
java.lang.String uwsAction,
javax.servlet.http.HttpServletResponse response)
Fills the response with the given error.
|
void |
sendError(UWSException error,
javax.servlet.http.HttpServletRequest request,
java.lang.String reqID,
JobOwner user,
java.lang.String uwsAction,
javax.servlet.http.HttpServletResponse response)
Fills the response with the given error.
|
protected void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
void |
service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse resp) |
void |
setErrorWriter(ServiceErrorWriter errorWriter)
Sets the object used to write/format any error in a HttpServletResponse.
|
InputParamController |
setInputParamController(java.lang.String paramName,
InputParamController controller)
Sets the controller of the specified input UWS job parameter.
|
void |
setUrlInterpreter(UWSUrl urlInterpreter)
Sets the UWS URL interpreter to use in this UWS.
|
void |
setUserIdentifier(UserIdentifier identifier)
Sets the object which lets extracting the use ID from a received request.
|
void |
setWaitPolicy(BlockingPolicy waitPolicy)
Set the strategy to use for the blocking behavior of the
Job Summary action.
|
boolean |
setXsltURL(java.lang.String xsltPath)
Sets the URL of the XSLT style-sheet that the XML serializer of this UWS must use.
|
protected void |
writeHomePage(UWSUrl requestUrl,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
JobOwner user) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createJobThread
protected java.lang.String name
protected java.lang.String description
protected java.lang.String defaultSerializer
protected UserIdentifier userIdentifier
protected final java.util.ArrayList<java.lang.String> expectedAdditionalParams
protected final java.util.HashMap<java.lang.String,InputParamController> inputParamControllers
UWSParameters
and InputParamController
for more details.protected UWSBackupManager backupManager
protected UWSLog logger
protected RequestParser requestParser
protected ServiceErrorWriter errorWriter
protected BlockingPolicy waitPolicy
doJobSummary(UWSUrl, HttpServletRequest, HttpServletResponse, JobOwner)
action.
If NULL, the standard strategy will be used: wait exactly the time asked by the user (or indefinitely if none is specified).
protected static java.lang.String lastRequestID
public final void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public final void init() throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public abstract void initUWS() throws UWSException
UWSException
public void destroy()
UWS
End properly this UWS: jobs should be backuped (if this feature is enable), timers and threads should be stopped, open files and database connections should be closed, etc... In brief, this function should release all used resources.
IMPORTANT: This function should be called only when the JVM or the Web Application Server is stopping.
Note:
A call to this function may prevent this instance of UWS
to execute any subsequent HTTP request, or the behavior
would be unpredictable.
public UWSFileManager createFileManager() throws UWSException
UWSException
public UWSFileManager getFileManager()
UWS
Gets its file manager.
note: A file manager tells to a UWS how to create, read and write the different managed files
(i.e. log, result, errors, backup). A default implementation is available: LocalUWSFileManager
.
getFileManager
in interface UWS
public RequestParser getRequestParser()
UWS
Get its HTTP request parser.
note: This parser is the only one to be able to extract UWS and TAP parameters from any HTTP request.
Its behavior is adapted in function of the used HTTP method and of the content-type. A default implementation is
provided by the UWS library: UWSRequestParser
.
getRequestParser
in interface UWS
public final void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
service
in interface javax.servlet.Servlet
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException
protected java.lang.String generateRequestID(javax.servlet.http.HttpServletRequest request)
protected final void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException
public final BlockingPolicy getWaitPolicy()
This strategy lets decide how long a WAIT request must block a HTTP request. With a such policy, the waiting time specified by the user may be modified.
public final void setWaitPolicy(BlockingPolicy waitPolicy)
This strategy lets decide whether a WAIT request must block a HTTP request and how long. With a such policy, the waiting time specified by the user may be modified.
waitPolicy
- The WAIT strategy to use,
or NULL if the default one (i.e. wait the time
specified by the user ;
if no time is specified the HTTP request may be
blocked indefinitely) must be used.protected void writeHomePage(UWSUrl requestUrl, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, JobOwner user) throws UWSException, javax.servlet.ServletException, java.io.IOException
UWSException
javax.servlet.ServletException
java.io.IOException
protected void doListJob(UWSUrl requestUrl, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, JobOwner user) throws UWSException, javax.servlet.ServletException, java.io.IOException
UWSException
javax.servlet.ServletException
java.io.IOException
protected void doAddJob(UWSUrl requestUrl, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, JobOwner user) throws UWSException, javax.servlet.ServletException, java.io.IOException
UWSException
javax.servlet.ServletException
java.io.IOException
protected void doSetUWSParameter(UWSUrl requestUrl, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, JobOwner user) throws UWSException, javax.servlet.ServletException, java.io.IOException
UWSException
javax.servlet.ServletException
java.io.IOException
protected void doDestroyJob(UWSUrl requestUrl, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, JobOwner user) throws UWSException, javax.servlet.ServletException, java.io.IOException
UWSException
javax.servlet.ServletException
java.io.IOException
protected void doJobSummary(UWSUrl requestUrl, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, JobOwner user) throws UWSException, javax.servlet.ServletException, java.io.IOException
UWSException
javax.servlet.ServletException
java.io.IOException
protected void doGetJobParam(UWSUrl requestUrl, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, JobOwner user) throws UWSException, javax.servlet.ServletException, java.io.IOException
UWSException
javax.servlet.ServletException
java.io.IOException
protected void doSetJobParam(UWSUrl requestUrl, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, JobOwner user) throws UWSException, javax.servlet.ServletException, java.io.IOException
UWSException
javax.servlet.ServletException
java.io.IOException
public UWSJob getJob(UWSUrl requestUrl) throws UWSException
UWSException
public UWSJob getJob(UWSUrl requestUrl, JobOwner user) throws UWSException
UWSException
public final UWSFactory getFactory()
UWS
Gets its job factory.
note: This objects is the only one to know how to extract job parameters from an HTTP request,
how to create a job and how to create its respective thread. A partial implementation which answers to
the 2 first questions is available: AbstractUWSFactory
getFactory
in interface UWS
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 void redirect(java.lang.String url, javax.servlet.http.HttpServletRequest request, JobOwner user, java.lang.String uwsAction, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
Sends a redirection (with the HTTP status code 303) to the given URL/URI into the given response.
url
- The redirection URL/URI.request
- The HttpServletRequest
which may be used to make a redirection.response
- The HttpServletResponse
which must contain all information to make a redirection.java.io.IOException
- If there is an error during the redirection.UWSException
- If there is any other error.javax.servlet.ServletException
public final void sendError(UWSException error, javax.servlet.http.HttpServletRequest request, java.lang.String reqID, JobOwner user, java.lang.String uwsAction, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException
Fills the response with the given error. The HTTP status code is set in function of the error code of the given UWSException.
If the error code is UWSException.SEE_OTHER
this method calls redirect(String, HttpServletRequest, JobOwner, String, HttpServletResponse)
.
Otherwise the function HttpServletResponse.sendError(int, String)
is called.
error
- The error to send/display.request
- The request which has caused the given error (not used by default).reqID
- ID of the request.user
- The user which executes the given request.uwsAction
- The UWS action corresponding to the given request.response
- The response in which the error must be published.java.io.IOException
- If there is an error when calling redirect(String, HttpServletRequest, JobOwner, String, HttpServletResponse)
or HttpServletResponse.sendError(int, String)
.UWSException
- If there is an error when calling redirect(String, HttpServletRequest, JobOwner, String, HttpServletResponse)
.javax.servlet.ServletException
redirect(String, HttpServletRequest, JobOwner, String, HttpServletResponse)
,
sendError(Throwable, HttpServletRequest, String, JobOwner, String, HttpServletResponse)
public final void sendError(java.lang.Throwable error, javax.servlet.http.HttpServletRequest request, java.lang.String reqID, JobOwner user, java.lang.String uwsAction, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException
Fills the response with the given error.
The stack trace of the error is printed on the standard output and then the function
HttpServletResponse.sendError(int, String)
is called with the HTTP status code is UWSException.INTERNAL_SERVER_ERROR
and the message of the given exception.
error
- The error to send/display.request
- The request which has caused the given error (not used by default).reqID
- ID of the request.user
- The user which executes the given request.uwsAction
- The UWS action corresponding to the given request.response
- The response in which the error must be published.java.io.IOException
- If there is an error when calling HttpServletResponse.sendError(int, String)
.UWSException
javax.servlet.ServletException
ServiceErrorWriter.writeError(Throwable, HttpServletResponse, HttpServletRequest, String, JobOwner, String)
public UWSLog getLogger()
UWS
Gets the logger of this UWS.
note:A UWS logger is used to watch the HTTP requests received by the UWS and their responses.
The activity of the UWS is also logged and particularly the life of the different jobs and their threads.
A default implementation is available: DefaultUWSLog
.
public final ServiceErrorWriter getErrorWriter()
public final void setErrorWriter(ServiceErrorWriter errorWriter)
Sets the object used to write/format any error in a HttpServletResponse.
Note: Nothing is done if the given writer is NULL !
errorWriter
- The new error writer/formatter.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
public final java.lang.String getName()
UWS
public final java.lang.String getDescription()
UWS
getDescription
in interface UWS
public final java.util.Iterator<JobList> iterator()
iterator
in interface java.lang.Iterable<JobList>
public JobList getJobList(java.lang.String name) throws UWSException
UWS
getJobList
in interface UWS
name
- Name of the jobs list to get.UWSException
- If the given name is null or empty, or if no jobs list matches.public final int getNbJobList()
UWS
getNbJobList
in interface UWS
public final boolean addJobList(JobList jl)
UWS
addJobList
in interface UWS
jl
- The jobs list to add.public final boolean destroyJobList(java.lang.String name)
UWS
Destroys the specified jobs list.
note: After the call of this function, the UWS reference of the given jobs list should be removed (see JobList.setUWS(UWS)
).
destroyJobList
in interface UWS
name
- Name of the jobs list to destroy.public boolean destroyJobList(JobList jl)
jl
- The jobs list to destroy.JobList.clear()
,
JobList.setUWS(UWS)
public final boolean addSerializer(UWSSerializer serializer)
Adds a serializer to this UWS
WARNING: If there is already a serializer with the same MIME type (see UWSSerializer.getMimeType()
) in this UWS ,
it should be replaced by the given one !
serializer
- The serializer to add.public final UWSSerializer getSerializer(java.lang.String mimeTypes) throws UWSException
Gets the serializer whose the MIME type is the same as the given one.
Note: If this UWS has no corresponding serializer, its default one will be returned !
getSerializer
in interface UWS
mimeTypes
- The MIME type of the searched serializer (may be more than one MIME types
- comma separated ; see the format of the Accept header of a HTTP-Request).UWSException
- If there is no corresponding serializer AND if the default serializer of this UWS can not be found.AcceptHeader.AcceptHeader(String)
,
AcceptHeader.getOrderedMimeTypes()
public final UWSSerializer removeSerializer(java.lang.String mimeType)
mimeType
- MIME type of the serializer to remove.public final java.lang.String getXsltURL()
public final boolean setXsltURL(java.lang.String xsltPath)
xsltPath
- The new XSLT URL.public final UserIdentifier getUserIdentifier()
Gets the object which lets extracting the user ID from a HTTP request.
note:If the returned user identifier is NULL, no job should have an owner.
getUserIdentifier
in interface UWS
public final void setUserIdentifier(UserIdentifier identifier)
identifier
- The UserIdentifier to use (may be null).public final UWSUrl getUrlInterpreter()
getUrlInterpreter
in interface UWS
public final void setUrlInterpreter(UWSUrl urlInterpreter)
urlInterpreter
- Its new UWS URL interpreter (may be null. In this case, it will be created from the next request ; see service(HttpServletRequest, HttpServletResponse)
).public final UWSBackupManager getBackupManager()
Gets its backup manager.
getBackupManager
in interface UWS