Class SpallocServiceImpl
java.lang.Object
uk.ac.manchester.spinnaker.alloc.web.BackgroundSupport
uk.ac.manchester.spinnaker.alloc.web.SpallocServiceImpl
- All Implemented Interfaces:
SpallocServiceAPI
@Service("service") @Path("spalloc") public class SpallocServiceImpl extends BackgroundSupport implements SpallocServiceAPI
The implementation of the user-facing REST API. Operations are delegated to
SpallocAPI
for fulfilment; this class is responsible for turning the
operations described by users into the form understood by the service core,
and for converting the responses. It also handles the transfer of calls onto
suitable worker threads, where appropriate.- Author:
- Donal Fellows
-
Nested Class Summary
Nested classes/interfaces inherited from class uk.ac.manchester.spinnaker.alloc.web.BackgroundSupport
BackgroundSupport.BackgroundAction
Nested classes/interfaces inherited from interface uk.ac.manchester.spinnaker.alloc.web.SpallocServiceAPI
SpallocServiceAPI.JobAPI, SpallocServiceAPI.MachineAPI
-
Constructor Summary
Constructors Constructor Description SpallocServiceImpl()
-
Method Summary
Modifier and Type Method Description void
createJob(CreateJobRequest req, UriInfo ui, SecurityContext security, AsyncResponse response)
Create a job.ServiceDescription
describeService(UriInfo ui, SecurityContext sec, HttpServletRequest req)
Get a description of the overall service.SpallocServiceAPI.JobAPI
getJob(int id, UriInfo ui, HttpServletRequest req, SecurityContext security)
Get a sub-resource for managing a job.SpallocServiceAPI.MachineAPI
getMachine(String name, UriInfo ui, SecurityContext sec)
Get a sub-resource for managing a machine.MachinesResponse
getMachines(UriInfo ui)
Get a description of the machines.void
listJobs(boolean wait, boolean destroyed, int limit, int start, UriInfo ui, AsyncResponse response)
List jobs.Methods inherited from class uk.ac.manchester.spinnaker.alloc.web.BackgroundSupport
bgAction, bgAction, fgAction
-
Constructor Details
-
SpallocServiceImpl
public SpallocServiceImpl()
-
-
Method Details
-
describeService
Description copied from interface:SpallocServiceAPI
Get a description of the overall service.- Specified by:
describeService
in interfaceSpallocServiceAPI
- Parameters:
ui
- How to build URIssec
- What are the user's identity and granted permissions?req
- Details about the request, used to extract the CSRF token.- Returns:
- A wrapped
ServiceDescription
-
getMachines
Description copied from interface:SpallocServiceAPI
Get a description of the machines.- Specified by:
getMachines
in interfaceSpallocServiceAPI
- Parameters:
ui
- How to build URIs- Returns:
- A list of machines
-
getMachine
Description copied from interface:SpallocServiceAPI
Get a sub-resource for managing a machine.- Specified by:
getMachine
in interfaceSpallocServiceAPI
- Parameters:
name
- The name of the machineui
- How to build URIssec
- What are the user's identity and granted permissions?- Returns:
- The sub-resource
-
getJob
public SpallocServiceAPI.JobAPI getJob(int id, UriInfo ui, HttpServletRequest req, SecurityContext security)Description copied from interface:SpallocServiceAPI
Get a sub-resource for managing a job.- Specified by:
getJob
in interfaceSpallocServiceAPI
- Parameters:
id
- The ID of the jobui
- How to build URIsreq
- Information about the requestsecurity
- Information about the user- Returns:
- The sub-resource
-
listJobs
public void listJobs(boolean wait, boolean destroyed, int limit, int start, UriInfo ui, AsyncResponse response)Description copied from interface:SpallocServiceAPI
List jobs.- Specified by:
listJobs
in interfaceSpallocServiceAPI
- Parameters:
wait
- Whether we are waiting for a change with a long querydestroyed
- Whether to include destroyed jobslimit
- Paging support: how many values to bring backstart
- Paging support: where in the sequence to startui
- How to build URIsresponse
- Filled out with aListJobsResponse
-
createJob
public void createJob(CreateJobRequest req, UriInfo ui, SecurityContext security, AsyncResponse response)Description copied from interface:SpallocServiceAPI
Create a job.- Specified by:
createJob
in interfaceSpallocServiceAPI
- Parameters:
req
- Description of what to createui
- How to build URIssecurity
- Information about the userresponse
- Filled out with aCreateJobResponse
-