public class UWSUrl
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected java.lang.String[] |
attributes
Name of the job attribute found in uwsURI (i.e.
|
protected java.lang.String |
baseURI
Base UWS URI (i.e.
|
protected java.lang.String |
jobId
The JobID found in uwsURI (i.e.
|
protected java.lang.String |
jobListName
Name of a jobs list found in uwsURI (i.e.
|
protected java.lang.String |
requestURI
The request URI (i.e.
|
protected java.lang.String |
requestURL
The whole request URL (i.e.
|
protected java.lang.String |
urlHeader
The URL prefix (i.e.
|
protected java.lang.String |
uwsURI
The URI from the base UWS URI (i.e.
|
Constructor and Description |
---|
UWSUrl(javax.servlet.http.HttpServletRequest request)
Builds a UWSUrl considering the given request to set the baseURI.
|
UWSUrl(java.lang.String baseURI)
Builds a UWSUrl with a fixed baseURI.
|
UWSUrl(UWSUrl toCopy)
Builds a copy of the given UWSUrl.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
abortJob(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL (HTTP-GET ONLY) to abort the specified job.
|
java.lang.String |
changeDestructionTime(java.lang.String jobListName,
java.lang.String jobId,
java.lang.String newDestructionTime)
Gets the UWS URL (HTTP-GET ONLY) to change the destruction time.
|
java.lang.String |
changeExecDuration(java.lang.String jobListName,
java.lang.String jobId,
java.lang.String newExecDuration)
Gets the UWS URL (HTTP-GET ONLY) to change the execution duration.
|
java.lang.String |
changeJobName(java.lang.String jobListName,
java.lang.String jobId,
java.lang.String newName)
Gets the UWS URL (HTTP-GET ONLY) to change the run ID.
|
java.lang.String |
changeJobParam(java.lang.String jobListName,
java.lang.String jobId,
java.lang.String paramName,
java.lang.String paramValue)
Gets the UWS URL (HTTP-GET ONLY) to change the specified parameter.
|
java.lang.String |
createJob(java.lang.String jobListName,
java.util.Map<java.lang.String,java.lang.String> parameters)
Gets the UWS URL (HTTP-GET ONLY) to create a job with the given parameters.
|
java.lang.String |
deleteJob(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL (HTTP-GET ONLY) to delete the specified job.
|
protected java.lang.String |
extractBaseURI(javax.servlet.http.HttpServletRequest request)
Extracts the base UWS URI from the given request.
|
java.lang.String[] |
getAttributes()
Gets all the job attributes extracted from the last request or request URL.
|
java.lang.String |
getBaseURI()
Gets the base UWS URI given at the initialization of this instance of
UWSUrl . |
java.lang.String |
getJobId()
Gets the job ID extracted from the last parsed request or request URL.
|
java.lang.String |
getJobListName()
Gets the jobs list name extracted from the last parsed request or request URL.
|
java.lang.String |
getRequestURI()
Gets the request URI.
|
java.lang.String |
getRequestURL()
Gets the request URL.
|
java.lang.String |
getUrlHeader()
Gets the URL header of the request URL.
|
java.lang.String |
getUWSName()
Gets the SUPPOSED name of the UWS from its baseURI.
|
java.lang.String |
getUwsURI()
Gets the UWS URI.
|
boolean |
hasAttribute()
Tells whether the last loaded request or request URL contains at least one job attribute.
|
boolean |
hasAttribute(java.lang.String attributeName)
Tells whether the last loaded request or request URL contains a job attribute with the given name.
|
boolean |
hasJob()
Tells whether the last loaded request or request URL contains a job ID.
|
boolean |
hasJobList()
Tells whether the last loaded request or request URL contains a jobs list name.
|
UWSUrl |
homePage()
Gets the base UWS URI = UWS home page.
|
UWSUrl |
jobDestruction(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the destruction time.
|
UWSUrl |
jobError(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the error summary.
|
UWSUrl |
jobExecDuration(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the execution duration.
|
UWSUrl |
jobName(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the runID.
|
UWSUrl |
jobOwner(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the owner ID.
|
UWSUrl |
jobParameter(java.lang.String jobListName,
java.lang.String jobId,
java.lang.String paramName)
Gets the UWS URL to get the parameters/parameter.
|
UWSUrl |
jobParameters(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the parameters.
|
UWSUrl |
jobPhase(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the phase.
|
UWSUrl |
jobQuote(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the quote.
|
UWSUrl |
jobResult(java.lang.String jobListName,
java.lang.String jobId,
java.lang.String resultId)
Gets the UWS URL to get the specified result.
|
UWSUrl |
jobResults(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the results.
|
UWSUrl |
jobSummary(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL to get the summary.
|
UWSUrl |
listJobs(java.lang.String jobListName)
Gets the UWS URL to get the specified jobs list.
|
void |
load(javax.servlet.http.HttpServletRequest request)
Parses and loads the given request.
|
void |
load(java.net.URL requestUrl)
Parses and loads the given request URL.
|
protected void |
loadUwsURI()
Loads and parses the URI stored in the member
uwsURI . |
protected static java.lang.String |
normalizeURI(java.lang.String uri)
Normalizes the given URI.
|
void |
setAttributes(java.lang.String[] newAttributes)
Sets all the job attributes.
|
void |
setJobId(java.lang.String jobId)
Sets the job ID.
|
void |
setJobListName(java.lang.String jobListName)
Sets the jobs list name.
|
void |
setUwsURI(java.lang.String uwsURI)
Sets the whole UWS URI (that is to say a URI starting with the jobs list name).
|
java.lang.String |
startJob(java.lang.String jobListName,
java.lang.String jobId)
Gets the UWS URL (HTTP-GET ONLY) to start the specified job.
|
java.lang.String |
toString()
Gets the corresponding request URL.
|
java.lang.String |
toURI()
Gets the full request URI corresponding to this UWSUrl.
|
java.net.URL |
toURL()
Gets the full request URL corresponding to this UWSUrl.
|
protected void |
updateRequestURL()
Updates the fields
requestURI and requestURL as following:
requestURI = baseURI+uwsURI
requestURL = urlHeader+requestURI (or null if urlHeader is null)
|
protected void |
updateUwsURI()
Updates the field
uwsURI in function of jobListName , jobId and attributes as following:
uwsURI = "/"+jobListName+"/"+jobId+"/"+attributes. |
protected java.lang.String requestURL
protected java.lang.String urlHeader
protected java.lang.String requestURI
protected final java.lang.String baseURI
protected java.lang.String uwsURI
protected java.lang.String jobListName
protected java.lang.String jobId
protected java.lang.String[] attributes
public UWSUrl(UWSUrl toCopy)
toCopy
- The UWSUrl to copy.public UWSUrl(java.lang.String baseURI) throws java.lang.NullPointerException
baseURI
- The baseURI to consider in all URL or request parsing.java.lang.NullPointerException
- If the given baseURI is null or is an empty string.public UWSUrl(javax.servlet.http.HttpServletRequest request) throws java.lang.NullPointerException
request
- The request to parse to get the baseURI.java.lang.NullPointerException
- If the given request is null or if the extracted baseURI is null or is an empty string.extractBaseURI(HttpServletRequest)
protected java.lang.String extractBaseURI(javax.servlet.http.HttpServletRequest request)
request
- The request from which the base UWS URI must be extracted.protected static final java.lang.String normalizeURI(java.lang.String uri)
Normalizes the given URI.
Note: A normalized URI always starts with a / and ends with no /.
uri
- The URI to normalize.public void load(javax.servlet.http.HttpServletRequest request)
Parses and loads the given request.
Before all, extractBaseURI(HttpServletRequest)
is called so that extracting the base URI from the request.
If this URI is different from the URI stored in this UWSUrl, load(URL)
is called so that parsing only the request URL
and then this method ends immediately.
Otherwise this method sets its fields as following:
HttpServletRequest.getRequestURL()
ServletRequest.getScheme()
+"://"+ServletRequest.getServerName()
+":"+ServletRequest.getServerPort()
+HttpServletRequest.getContextPath()
HttpServletRequest.getRequestURI()
HttpServletRequest.getPathInfo()
loadUwsURI()
Note: If the given request is NULL, all fields are set to NULL.
request
- The request to parse and to load.extractBaseURI(HttpServletRequest)
,
load(URL)
,
loadUwsURI()
public void load(java.net.URL requestUrl)
Parses and loads the given request URL.
All the fields are set as following:
loadUwsURI()
Note: If the given URL is NULL, all fields are set to NULL.
requestUrl
- The URL to parse and to load.loadUwsURI()
protected void loadUwsURI()
Loads and parses the URI stored in the member uwsURI
.
The URI is split by the / character. The items of the resulting array corresponds to:
Note: If uwsURI
is NULL, jobListName and jobId are set to null while attributes is set to an empty array.
public final java.lang.String getBaseURI()
UWSUrl
.public final java.lang.String getUWSName()
public final java.lang.String getRequestURL()
public final java.lang.String getUrlHeader()
Gets the URL header of the request URL.
Example: If the base URI is "/uws" and the request URL is "http://foo.org/mySite/uws/jobList/job1/results/report", then the URL header will be: "http://foo.org/mySite".
public final java.lang.String getRequestURI()
Gets the request URI.
Example: If the base URI is "/uws" and the request URL is "http://foo.org/mySite/uws/jobList/job1/results/report", then the request URI will be: "/uws/jobList/jobId/results/report".
public final java.lang.String getUwsURI()
Gets the UWS URI.
Example: If the base URI is "/uws" and the request URL is "http://foo.org/mySite/uws/jobList/job1/results/report", then the request URI will be: "/jobList/jobId/results/report".
public final boolean hasJobList()
public final java.lang.String getJobListName()
public final boolean hasJob()
public final java.lang.String getJobId()
public final boolean hasAttribute()
public final boolean hasAttribute(java.lang.String attributeName)
attributeName
- The name of the job attribute expected in the last request or request URL.public final java.lang.String[] getAttributes()
protected void updateUwsURI()
Updates the field uwsURI
in function of jobListName
, jobId
and attributes
as following:
uwsURI = "/"+jobListName+"/"+jobId+"/"+attributes.
Once uwsURI
updated the request URL and URI are also updated.
updateRequestURL()
protected void updateRequestURL()
Updates the fields requestURI
and requestURL
as following:
public final void setUwsURI(java.lang.String uwsURI)
uwsURI
- The UWS URI to set.loadUwsURI()
,
updateRequestURL()
public final void setJobListName(java.lang.String jobListName)
jobListName
- A jobs list name.updateUwsURI()
public final void setJobId(java.lang.String jobId)
jobId
- A job ID.updateUwsURI()
public final void setAttributes(java.lang.String[] newAttributes)
Sets all the job attributes. Once done all the other fields of this UWS URL are updated.
Note: The given array is entirely copied.
newAttributes
- The new job attributes.updateUwsURI()
public final UWSUrl homePage()
public final UWSUrl listJobs(java.lang.String jobListName)
public final UWSUrl jobSummary(java.lang.String jobListName, java.lang.String jobId)
public final UWSUrl jobName(java.lang.String jobListName, java.lang.String jobId)
public final UWSUrl jobPhase(java.lang.String jobListName, java.lang.String jobId)
public final UWSUrl jobExecDuration(java.lang.String jobListName, java.lang.String jobId)
public final UWSUrl jobDestruction(java.lang.String jobListName, java.lang.String jobId)
public final UWSUrl jobError(java.lang.String jobListName, java.lang.String jobId)
public final UWSUrl jobQuote(java.lang.String jobListName, java.lang.String jobId)
public final UWSUrl jobResults(java.lang.String jobListName, java.lang.String jobId)
public final UWSUrl jobResult(java.lang.String jobListName, java.lang.String jobId, java.lang.String resultId)
public final UWSUrl jobParameters(java.lang.String jobListName, java.lang.String jobId)
public final UWSUrl jobParameter(java.lang.String jobListName, java.lang.String jobId, java.lang.String paramName)
public final UWSUrl jobOwner(java.lang.String jobListName, java.lang.String jobId)
public final java.lang.String createJob(java.lang.String jobListName, java.util.Map<java.lang.String,java.lang.String> parameters)
public final java.lang.String deleteJob(java.lang.String jobListName, java.lang.String jobId)
public final java.lang.String startJob(java.lang.String jobListName, java.lang.String jobId)
public final java.lang.String abortJob(java.lang.String jobListName, java.lang.String jobId)
public final java.lang.String changeJobName(java.lang.String jobListName, java.lang.String jobId, java.lang.String newName)
public final java.lang.String changeDestructionTime(java.lang.String jobListName, java.lang.String jobId, java.lang.String newDestructionTime)
public final java.lang.String changeExecDuration(java.lang.String jobListName, java.lang.String jobId, java.lang.String newExecDuration)
public final java.lang.String changeJobParam(java.lang.String jobListName, java.lang.String jobId, java.lang.String paramName, java.lang.String paramValue)
public java.net.URL toURL() throws java.net.MalformedURLException
java.net.MalformedURLException
- If there is an error while building the URL object from the requestURL
field.getRequestURL()
public java.lang.String toURI()
getRequestURI()
public java.lang.String toString()
toString
in class java.lang.Object
getRequestURL()
,
Object.toString()