<?xml version="1.0" standalone="yes"?>
<application xmlns="http://wadl.dev.java.net/2009/02" xmlns:uws="http://www.ivoa.net/xml/UWS/v1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <doc title="UWS Service">Implements the UWS service</doc>
   <grammars>
      <include href="http://ivoa.net/xml/UWS/UWS-v1.0.xsd"/></grammars>
   <resources base="http://localhost:8080/ppxf_uws/ppxf_spectra">
      <resource path="{job-id}">
         <doc title="Job Resource">This resource handles a job</doc>
         <method name="DELETE">
            <doc>Deleting a job</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="303">
               <doc>Redirects to /</doc>
            </response>
            <response status="403">
               <doc>DELETE action is not allowed because the job is being executed or is being queued</doc>
            </response>
            <response status="404">
               <doc>job does not exist</doc>
            </response>
            <response status="500"/></method>
         <method name="GET">
            <doc>Get a Job - The job is automatically destroyed when the currentDate is superior to destructionDate.</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="200">
               <representation mediaType="text/xml" element="uws:JobSummary">
                  <doc title="JobSummary">The complete representation of the state of a job</doc>
               </representation>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="500"/></method>
         <method name="POST">
            <doc>Delete a job</doc>
            <request>
               <param fixed="DELETE" style="query" name="ACTION" type="xs:string" required="true">
                  <doc>Deleting the job</doc>
               </param>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
               <representation mediaType="application/x-www-form-urlencoded"/></request>
            <response status="303">
               <doc>Redirects to /</doc>
            </response>
            <response status="400">
               <doc>only ACTION=DELETE is supported</doc>
            </response>
            <response status="403">
               <doc>DELETE action is not allowed because the job is being executed or is being queued</doc>
            </response>
            <response status="500"/></method>
      </resource>
      <resource path="{job-id}/phase">
         <doc title="Phase Resource">This resource handles job phase</doc>
         <method name="GET">
            <doc>Get job phase</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="200">
               <representation mediaType="text/plain" element="xs:string">
                  <doc title="ExecutionPhase">Enumeration of possible phases of job execution</doc>
               </representation>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="500"/></method>
         <method name="POST">
            <doc>Starting/Aborting the processing</doc>
            <request>
               <param name="PHASE" type="xs:string">
                  <option id="RUN"/>
                  <option id="ABORT"/></param>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
               <representation mediaType="application/x-www-form-urlencoded"/></request>
            <response status="303">
               <doc>Redirects to /{job-id}</doc>
            </response>
            <response status="400">
               <doc>Only PHASE=RUN or PHASE=ABORT can be send by the client at condition that the current PHASE is not RUN or ABORT</doc>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
         </method>
      </resource>
      <resource path="{job-id}/executionduration">
         <doc title="Execution duration Resource">This resource handles execution time</doc>
         <method name="GET">
            <doc>Get the execution duration</doc>
            <request>
               <param style="template" name="job-id" type="xs:int" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="200">
               <representation mediaType="text/plain" element="xs:int">
                  <doc title="ExecutionDuration">The duration (in seconds) for which the job should be allowed to run - a value of 0 is intended to mean unlimited - returned at /(jobs)/(jobid)/executionduration</doc>
               </representation>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
         </method>
         <method name="POST">
            <doc>Changing the Execution Duration</doc>
            <request>
               <param style="query" name="EXECUTIONTIME" type="xs:string" required="true">
                  <doc>Set the execution Time in seconds</doc>
               </param>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
               <representation mediaType="application/x-www-form-urlencoded"/></request>
            <response status="303">
               <doc>Redirects to /{job-id}</doc>
            </response>
            <response status="400">
               <doc>executionTime parameter is not valid</doc>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="500"/></method>
      </resource>
      <resource path="{job-id}/destruction">
         <doc title="Destruction Resource">This resource handles the destruction time of the job</doc>
         <method name="GET">
            <doc>Get the destruction time as ISO8601 format</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="200">
               <representation mediaType="text/plain" element="xs:dateTime">
                  <doc title="Destruction">The time at which the whole job + records + results will be destroyed.</doc>
               </representation>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="500"/></method>
         <method name="POST">
            <doc>Changing the Destruction Time</doc>
            <request>
               <param name="DESTRUCTION" type="xs:string" required="true"/>
               <param style="template" name="job-id" type="xs:date" required="true">
                  <doc>job-id value</doc>
               </param>
               <representation mediaType="application/x-www-form-urlencoded"/></request>
            <response status="303">
               <doc>Redirects to /{job-id}</doc>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="400">
               <doc>The format of the destructionTime parameter is not valid</doc>
            </response>
         </method>
      </resource>
      <resource path="{job-id}/error">
         <doc title="Error Resource">This resource handles error happening during the job processing</doc>
         <method name="GET">
            <doc>Get the generated error</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="200">
               <representation mediaType="text/xml" element="uws:ErrorSummary">
                  <doc title="ErrorSummary">This is arbitrary information that can be added to the job description by the UWS implementation.</doc>
               </representation>
            </response>
            <response status="404">
               <doc>Job does not exist or no error was happened</doc>
            </response>
            <response status="500"/></method>
      </resource>
      <resource path="{job-id}/quote">
         <doc title="Quote Resource">This resource handles quote prediction</doc>
         <method name="GET">
            <doc>Get quote value</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="200">
               <representation mediaType="text/plain" element="xs:dateTime">
                  <doc title="Quote">A Quote predicts when the job is likely to complete</doc>
               </representation>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="500"/></method>
      </resource>
      <resource path="{job-id}/results">
         <doc title="Results Resource">This resource handles job results</doc>
         <method name="GET">
            <doc>Getting Job results</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="200">
               <representation mediaType="text/xml" element="uws:results">
                  <doc title="Results">Results for the job. The result with the id "spectrum_bestfit" corresponds to a FITS file (binary table) containing the SpecDM-compliant wavelength resampled spectrum + an additional column in the binary table (BESTFIT) which contains the best-fitting model</doc>
               </representation>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="500"/></method>
      </resource>
      <resource path="{job-id}/parameters">
         <doc title="Parameters Resource">This resource handles job parameters</doc>
         <method name="GET">
            <doc>Get Job parameters</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="200">
               <representation mediaType="text/xml" element="uws:parameters">
                  <doc title="Parameters">the list of input parameters to the job - if the job description language does not naturally have parameters, then this list should contain one element which is the content of the original POST that created the job.</doc>
               </representation>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
         </method>
         <method name="POST">
            <doc>Add new parameters</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
               <representation mediaType="application/x-www-form-urlencoded"/></request>
            <response status="303">
               <doc>Redirects to /{job-id}</doc>
            </response>
            <response status="400"/>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="403">
               <doc>Parameters cannot be set while the job is running</doc>
            </response>
            <response status="500"/></method>
      </resource>
      <resource path="{job-id}/parameters/{parameter-name}">
         <doc title="ParameterName Resource">This resource handles parameter value</doc>
         <method name="GET">
            <doc>Get a parameter name</doc>
            <response status="200">
               <representation mediaType="text/plain" element="xs:string"/></response>
            <response status="404">
               <doc>job does not exist</doc>
            </response>
            <response status="500"/></method>
         <method name="PUT">
            <doc>Change a parameter value</doc>
            <request>
               <doc>Value to set</doc>
               <representation mediaType="text/plain"/></request>
            <response status="303">
               <doc>Redirects to /{job-id}</doc>
            </response>
            <response status="400">
               <doc>The key does not exist</doc>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="403">
               <doc>A parameter value cannot be set while the job is running</doc>
            </response>
         </method>
      </resource>
      <resource path="{job-id}/owner">
         <doc title="Owner Resource">This resource handles job owner</doc>
         <method name="GET">
            <doc>Getting an ownerId</doc>
            <request>
               <param style="template" name="job-id" type="xs:string" required="true">
                  <doc>job-id value</doc>
               </param>
            </request>
            <response status="200">
               <representation mediaType="text/plain" element="xs:string">
                  <doc title="Owner">the owner (creator) of the job - this should be expressed as a string that can be parsed in accordance with IVOA security standards. If there was no authenticated job creator then this should be set to NULL.</doc>
               </representation>
            </response>
            <response status="404">
               <doc>Job does not exist</doc>
            </response>
            <response status="500"/></method>
      </resource>
      <resource>
         <doc title="Jobs Resource">This resource contains the whole list of job for which the current date is inferior to destruction date</doc>
         <method name="GET">
            <doc>List all created jobs. The list may be empty if the UWS is idle</doc>
            <response status="200">
               <representation mediaType="text/xml" element="uws:ShortJobDescription">
                  <doc title="ShortJobDescription">The representation of the Job List is a list of links to extant jobs. The list may be empty if the UWS is idle.</doc>
               </representation>
            </response>
            <response status="500">
               <doc>Internal server error - Please contact the administrator</doc>
            </response>
         </method>
         <method name="POST">
            <doc>POSTing a request to the Job List creates a new job (unless the service rejects the request)</doc>
            <request>
               <param fixed="RUN" style="query" name="PHASE" type="xs:string">
                  <doc>Starting a job after its submission</doc>
               </param>
               
               <param style="query" name="inputspec" type="xs:anyURI" required="true">
                  <doc>a URL for the SpecDM-compliant spectrum to be fitted in the FITS format</doc>
               </param>
               <param style="query" name="charmetadata" type="xs:anyURI" required="true">
                  <doc>a URL for the Characterisation DM description of the spectrum in the XML format</doc>
               </param>
               <param style="query" name="start_v" type="xs:float" required="true">
                  <doc>initial guess for the radial velocity (km/s)</doc>
               </param>
               <param style="query" name="start_sigma" type="xs:float" required="false" default="100">
                  <doc>initial guess for the velocity dispersion (km/s)</doc>
               </param>
               <param style="query" name="degree" type="xs:int" required="false" default="-1">
                  <doc>degree of the additive polynomial continuum</doc>
               </param>
               <param style="query" name="mdegree" type="xs:int" required="false" default="9">
                  <doc>degree of the multiplicative polynomial continuum</doc>
               </param>
               <param style="query" name="wlmin" type="xs:float" required="false" default="3910.0">
                  <doc>(take from the input spectrum) -- minimal wavelength to fit (Angstrom)</doc>
               </param>
               <param style="query" name="wlmax" type="xs:float" required="false" default="6790.0">
                  <doc>(take from the input spectrum) maximal wavelength to fit (Angstrom)</doc>
               </param>
               <param style="query" name="velscale" type="xs:float" required="false" default="69">
                  <doc>radial velocity scale for the spectrum resampling (km/s)</doc>
               </param>
               <param style="query" name="emlines" type="xs:boolean" required="false" default="true">
                  <doc>cut emission lines during the fit?</doc>
               </param>
               
               <representation mediaType="multipart/form-data"/>
               <representation mediaType="application/x-www-form-urlencoded"/></request>
            <response status="303">
               <doc>Redirects to /{job-id}</doc>
            </response>
            <response status="400">
               <doc>only RUN value is accepted for PHASE keyword</doc>
            </response>
            <response status="403">
               <doc>The request from the client is correct but the server refuse it for some reasons</doc>
            </response>
            <response status="500"/></method>
      </resource>
   </resources>
</application>


