public abstract class UWSSerializer
extends java.lang.Object
implements java.io.Serializable
Lets returning any UWS resource in a given format.
By default two formats are already implemented:XMLSerializer
JSONSerializer
XMLSerializer
,
JSONSerializer
,
Serialized FormModifier and Type | Field and Description |
---|---|
static java.lang.String |
MIME_TYPE_HTML
MIME type for HTML: text/html
|
static java.lang.String |
MIME_TYPE_JSON
MIME type for JSON: application/json
|
static java.lang.String |
MIME_TYPE_TEXT
MIME type for TEXT: text/plain
|
static java.lang.String |
MIME_TYPE_XML
MIME type for XML: application/xml
|
Constructor and Description |
---|
UWSSerializer() |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.String |
getAdditionalParameter(java.lang.String paramName,
java.lang.Object paramValue,
boolean root)
Serializes the specified parameter.
|
abstract java.lang.String |
getAdditionalParameters(UWSJob job,
boolean root)
Serializes the parameters of the given job.
|
abstract java.lang.String |
getCreationTime(UWSJob job,
boolean root)
Serializes the creation date/time of the given job.
|
abstract java.lang.String |
getDestructionTime(UWSJob job,
boolean root)
Serializes the destruction time of the given job.
|
abstract java.lang.String |
getEndTime(UWSJob job,
boolean root)
Serializes the end time of the given job.
|
abstract java.lang.String |
getErrorSummary(ErrorSummary error,
boolean root)
Serializes the given error summary.
|
abstract java.lang.String |
getExecutionDuration(UWSJob job,
boolean root)
Serializes the execution duration of the given job.
|
abstract java.lang.String |
getJob(UWSJob job,
boolean root)
Serializes the whole given job.
|
java.lang.String |
getJob(UWSJob job,
java.lang.String[] attributes,
boolean root)
Serializes the given parameter of the given job
or serializes the whole job if the given attributes array is empty or null.
|
abstract java.lang.String |
getJobID(UWSJob job,
boolean root)
Serializes the ID of the given job.
|
java.lang.String |
getJobList(JobList jobsList,
boolean root)
Serializes the given jobs list.
|
java.lang.String |
getJobList(JobList jobsList,
JobOwner owner,
boolean root)
Serializes the given jobs list, by filtering by user.
|
abstract java.lang.String |
getJobList(JobList jobsList,
JobOwner owner,
JobListRefiner listRefiner,
boolean root)
Serializes the given jobs list, by filtering using user-specified
filters.
|
abstract java.lang.String |
getJobRef(UWSJob job,
UWSUrl jobsListUrl)
Serializes just a reference on the given job.
|
abstract java.lang.String |
getMimeType()
Gets the MIME type of the serialization format used by this serializer.
|
abstract java.lang.String |
getOwnerID(UWSJob job,
boolean root)
Serializes the owner ID of the given job.
|
abstract java.lang.String |
getPhase(UWSJob job,
boolean root)
Serializes the phase of the given job.
|
abstract java.lang.String |
getQuote(UWSJob job,
boolean root)
Serializes the quote of the given job.
|
abstract java.lang.String |
getResult(Result result,
boolean root)
Serializes the given result.
|
abstract java.lang.String |
getResults(UWSJob job,
boolean root)
Serializes the results of the given job.
|
abstract java.lang.String |
getRunID(UWSJob job,
boolean root)
Serializes the run ID of the given job.
|
abstract java.lang.String |
getStartTime(UWSJob job,
boolean root)
Serializes the start time of the given job.
|
java.lang.String |
getUWS(UWS uws)
Serializes the given UWS.
|
abstract java.lang.String |
getUWS(UWS uws,
JobOwner user)
Serializes the given UWS for the specified user.
|
java.lang.String |
toString() |
public static final java.lang.String MIME_TYPE_XML
public static final java.lang.String MIME_TYPE_JSON
public static final java.lang.String MIME_TYPE_TEXT
public static final java.lang.String MIME_TYPE_HTML
public java.lang.String getJob(UWSJob job, java.lang.String[] attributes, boolean root) throws java.lang.Exception
job
- The job whose the attribute must be serialized.attributes
- All the given attributes (may be null or empty).root
- false if the attribute to serialize will be included
in a top level serialization (for a job attribute: job), true otherwise.java.lang.Exception
- If an error occurs while serializing the specified job/attribute/parameter/result.public java.lang.String toString()
toString
in class java.lang.Object
public abstract java.lang.String getMimeType()
public java.lang.String getUWS(UWS uws) throws java.lang.Exception
uws
- The UWS to serialize.java.lang.Exception
- If there is an error during the serialization.getUWS(UWS, JobOwner)
public abstract java.lang.String getUWS(UWS uws, JobOwner user) throws java.lang.Exception
uws
- The UWS to serialize.user
- The user which has asked the serialization of the given UWS.java.lang.Exception
- If there is an error during the serialization.public java.lang.String getJobList(JobList jobsList, boolean root) throws java.lang.Exception
jobsList
- The jobs list to serialize.root
- false if the jobs list to serialize will be included
in a top level serialization (for a jobs list: uws), true otherwise.java.lang.Exception
- If there is an error during the serialization.getJobList(JobList, JobOwner, boolean)
public java.lang.String getJobList(JobList jobsList, JobOwner owner, boolean root) throws java.lang.Exception
jobsList
- The jobs list to serialize.owner
- The user which has asked the serialization of the
given jobs list. If NULL, all anonymous jobs are
displayed.root
- false
if the jobs list to serialize
will be included in a top level serialization (for a
jobs list: uws),
true
otherwise.java.lang.Exception
- If there is an error during the serialization.getJobList(JobList, JobOwner, JobListRefiner, boolean)
public abstract java.lang.String getJobList(JobList jobsList, JobOwner owner, JobListRefiner listRefiner, boolean root) throws java.lang.Exception
jobsList
- The jobs list to serialize.owner
- The user which has asked the serialization of the
given jobs list. If NULL, all anonymous jobs are
displayed.listRefiner
- Represent all the specified job filters to apply ;
only the job that pass through this filter should be
displayed. If NULL, all jobs are displayed.root
- false
if the jobs list to serialize
will be included in a top level serialization (for a
jobs list: uws),
true
otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getJob(UWSJob job, boolean root) throws java.lang.Exception
job
- The job to serialize.root
- false if the job to serialize will be included
in a top level serialization (for a job: jobList), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getJobRef(UWSJob job, UWSUrl jobsListUrl) throws java.lang.Exception
job
- The job to reference.jobsListUrl
- URL to the jobs lists which contains the given job.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getJobID(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the ID must be serialized.root
- false if the job ID to serialize will be included
in a top level serialization (for a job ID: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getRunID(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the run ID must be serialized.root
- false if the run ID to serialize will be included
in a top level serialization (for a run ID: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getOwnerID(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the owner ID must be serialized.root
- false if the owner ID to serialize will be included
in a top level serialization (for a owner ID: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getPhase(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the phase must be serialized.root
- false if the phase to serialize will be included
in a top level serialization (for a phase: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getQuote(UWSJob job, boolean root) throws java.lang.Exception
Warning!
UWSJob.getQuote()
is a long, BUT the UWS standard explicitly
requires a quote as an ISO-8601 date (cf section "2.2.1. Resources and
URIs").
This function MUST return a quote only when the job is
started/finished and MUST add the quote duration to the startTime and
format it as an ISO-8601 date.
job
- The job whose the quote must be serialized.root
- false if the quote to serialize will be
included in a top level serialization (for a quote:
job),
true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getCreationTime(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the creation date/time must be serialized.root
- false if the creation time to serialize will be
included in a top level serialization (for a creation time:
job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getStartTime(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the start time must be serialized.root
- false if the start time to serialize will be included
in a top level serialization (for a start time: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getEndTime(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the end time must be serialized.root
- false if the end time to serialize will be included
in a top level serialization (for a end time: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getExecutionDuration(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the execution duration must be serialized.root
- false if the execution duration to serialize will be included
in a top level serialization (for a execution duration: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getDestructionTime(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the destruction time must be serialized.root
- false if the destruction time to serialize will be included
in a top level serialization (for a destruction time: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getErrorSummary(ErrorSummary error, boolean root) throws java.lang.Exception
error
- The error to serialize.root
- false if the error summary to serialize will be included
in a top level serialization (for an error summary: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getResults(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the results must be serialized.root
- false if the results list to serialize will be included
in a top level serialization (for a list of results: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getResult(Result result, boolean root) throws java.lang.Exception
result
- The result to serialize.root
- false if the result to serialize will be included
in a top level serialization (for a result: results), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getAdditionalParameters(UWSJob job, boolean root) throws java.lang.Exception
job
- The job whose the parameters must be serialized.root
- false if the parameters list to serialize will be included
in a top level serialization (for a list of parameters: job), true otherwise.java.lang.Exception
- If there is an error during the serialization.public abstract java.lang.String getAdditionalParameter(java.lang.String paramName, java.lang.Object paramValue, boolean root) throws java.lang.Exception
paramName
- The name of the parameter to serialize.paramValue
- The value of the parameter to serialize.root
- false if the parameter to serialize will be included
in a top level serialization (for a parameter: parameters), true otherwise.java.lang.Exception
- If there is an error during the serialization.