public abstract class UWSAction
extends java.lang.Object
implements java.io.Serializable
Action of a UWS (i.e. "List Jobs", "Get Job", etc...). An instance of a UWSAction can be added to a given UWS thanks to the method
UWSService.addUWSAction(UWSAction)
.
WARNING: The action of a UWS have, each one, a different name. So be careful about the name of your UWS action ! By default the name of a UWS action is the full java name of the class !
UWSService
,
Serialized FormModifier and Type | Field and Description |
---|---|
static java.lang.String |
ADD_JOB
Name of the UWS action
AddJob . |
static java.lang.String |
DESTROY_JOB
Name of the UWS action
DestroyJob . |
static java.lang.String |
GET_JOB_PARAM
Name of the UWS action
GetJobParam . |
static java.lang.String |
HOME_PAGE
Name of the UWS action
ShowHomePage . |
static java.lang.String |
JOB_SUMMARY
Name of the UWS action
JobSummary . |
static java.lang.String |
LIST_JOBS
Name of the UWS action
ListJobs . |
static java.lang.String |
SET_JOB_PARAM
Name of the UWS action
SetJobParam . |
static java.lang.String |
SET_UWS_PARAMETER
Name of the UWS action
SetUWSParameter . |
protected UWSService |
uws
The UWS on which this action must be applied.
|
Modifier | Constructor and Description |
---|---|
protected |
UWSAction(UWSService u)
Builds a UWSAction.
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
apply(UWSUrl urlInterpreter,
JobOwner user,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Applies this UWS action in function of the given request
and writes the result in the given response.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getDescription()
Gets the description of this UWS action.
|
protected UWSJob |
getJob(UWSUrl urlInterpreter)
Extracts the job ID from the given UWS URL
and gets the corresponding job from the UWS.
|
protected UWSJob |
getJob(UWSUrl urlInterpreter,
JobList jobsList)
Extracts the job ID from the given UWS URL and gets the corresponding job from the given jobs list.
|
protected UWSJob |
getJob(UWSUrl urlInterpreter,
JobList jobsList,
JobOwner user)
Extracts the job ID from the given UWS URL and gets the corresponding job from the given jobs list.
|
protected UWSJob |
getJob(UWSUrl urlInterpreter,
JobOwner user)
Extracts the job ID from the given UWS URL and gets the corresponding job from the UWS.
|
protected JobList |
getJobsList(UWSUrl urlInterpreter)
Extracts the name of the jobs list from the given UWS URL
and gets the jobs list from the UWS.
|
UWSLog |
getLogger()
Get the logger associated with this UWS service.
|
java.lang.String |
getName()
Gets the name of this UWS action.
|
UWSService |
getUWS()
Gets the UWS which contains this action.
|
abstract boolean |
match(UWSUrl urlInterpreter,
JobOwner user,
javax.servlet.http.HttpServletRequest request)
Indicates whether the given request corresponds to this UWS action.
|
java.lang.String |
toString() |
public static final java.lang.String LIST_JOBS
ListJobs
.public static final java.lang.String ADD_JOB
AddJob
.public static final java.lang.String SET_UWS_PARAMETER
SetUWSParameter
.public static final java.lang.String DESTROY_JOB
DestroyJob
.public static final java.lang.String JOB_SUMMARY
JobSummary
.public static final java.lang.String GET_JOB_PARAM
GetJobParam
.public static final java.lang.String SET_JOB_PARAM
SetJobParam
.public static final java.lang.String HOME_PAGE
ShowHomePage
.protected final UWSService uws
protected UWSAction(UWSService u)
u
- The UWS which contains this action.public final UWSService getUWS()
public final UWSLog getLogger()
public java.lang.String getName()
Gets the name of this UWS action. MUST BE UNIQUE !
Note: By default the name of the class is returned (Class.getName()
).
public java.lang.String getDescription()
Gets the description of this UWS action.
Note: By default an empty string is returned.
protected final JobList getJobsList(UWSUrl urlInterpreter) throws UWSException
urlInterpreter
- The UWS URL which contains the name of the jobs list to get.UWSException
- If there is no jobs list name in the given UWS URL
or if no corresponding jobs list can be found in the UWS.UWSUrl.getJobListName()
,
UWSService.getJobList(String)
protected final UWSJob getJob(UWSUrl urlInterpreter) throws UWSException
Extracts the job ID from the given UWS URL and gets the corresponding job from the UWS.
Note: This function calls getJob(UWSUrl, JobOwner)
with userId=null and checkUser=false !
urlInterpreter
- The UWS URL which contains the ID of the job to get.UWSException
- If no jobs list name or/and job ID can be found in the given UWS URL
or if there are no corresponding jobs list and/or job in the UWS
or if the specified user has not enough rights to get the specified job.getJob(UWSUrl, JobOwner)
protected final UWSJob getJob(UWSUrl urlInterpreter, JobOwner user) throws UWSException
Extracts the job ID from the given UWS URL and gets the corresponding job from the UWS. The specified job is returned ONLY IF the specified user has enough rights.
urlInterpreter
- The UWS URL which contains the ID of the job to get.user
- The user who asks for the specified job.UWSException
- If no jobs list name or/and job ID can be found in the given UWS URL
or if there are no corresponding jobs list and/or job in the UWS
or if the specified user has not enough rights to get the specified job.UWSUrl.getJobId()
,
getJobsList(UWSUrl)
,
JobList.getJob(String, JobOwner)
protected final UWSJob getJob(UWSUrl urlInterpreter, JobList jobsList) throws UWSException
Extracts the job ID from the given UWS URL and gets the corresponding job from the given jobs list.
Note: This function calls getJob(UWSUrl, JobList, JobOwner)
with userId=null and checkUser=false !
urlInterpreter
- The UWS URL which contains the ID of the job to get.jobsList
- The jobs list which is supposed to contain the job to get.UWSException
- If no job ID can be found in the given UWS URL
or if there are no corresponding job in the UWS.getJob(UWSUrl, JobList, JobOwner)
protected final UWSJob getJob(UWSUrl urlInterpreter, JobList jobsList, JobOwner user) throws UWSException
Extracts the job ID from the given UWS URL and gets the corresponding job from the given jobs list. If checkUser=true, the specified job is returned ONLY IF the specified user has enough rights.
urlInterpreter
- The UWS URL which contains the ID of the job to get.jobsList
- The jobs list which is supposed to contain the job to get.user
- The user who asks for the specified job.UWSException
- If no job ID can be found in the given UWS URL
or if there are no corresponding job in the UWS
or if the specified user has not enough rights.UWSUrl.getJobId()
,
JobList.getJob(String, JobOwner)
public abstract boolean match(UWSUrl urlInterpreter, JobOwner user, javax.servlet.http.HttpServletRequest request) throws UWSException
urlInterpreter
- The UWS URL of the given request.user
- The user who has sent the given request.request
- The received request.UWSException
- If any error occurs during the tests.public abstract boolean apply(UWSUrl urlInterpreter, JobOwner user, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws UWSException, java.io.IOException
Applies this UWS action in function of the given request and writes the result in the given response.
Note: You can use the functions getJobsList(UWSUrl)
, getJob(UWSUrl)
and getJob(UWSUrl, JobList)
to
get more easily the jobs list and/or the job from the given UWS URL !
urlInterpreter
- The UWS URL of the given request.user
- The user who has sent the given request.request
- The received request.response
- The response of the given request (MUST BE UPDATED).UWSException
- If any error occurs during the action application.java.io.IOException
- If there is an error while the result is written in the given response.public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object