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.BackgroundActionNested classes/interfaces inherited from interface uk.ac.manchester.spinnaker.alloc.web.SpallocServiceAPI
SpallocServiceAPI.JobAPI, SpallocServiceAPI.MachineAPI -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateJob(CreateJobRequest req, jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.core.SecurityContext security, jakarta.ws.rs.container.AsyncResponse response) Create a job.describeService(jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.core.SecurityContext sec, jakarta.servlet.http.HttpServletRequest req) Get a description of the overall service.voidemergencyStop(String commandCode, jakarta.ws.rs.container.AsyncResponse response) Immediately stop all jobs and power down all boards.getJob(int id, jakarta.ws.rs.core.UriInfo ui, jakarta.servlet.http.HttpServletRequest req, jakarta.ws.rs.core.SecurityContext security) Get a sub-resource for managing a job.getMachine(String name, jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.core.SecurityContext sec) Get a sub-resource for managing a machine.getMachines(jakarta.ws.rs.core.UriInfo ui) Get a description of the machines.voidlistJobs(boolean wait, boolean destroyed, int limit, int start, jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.container.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
public ServiceDescription describeService(jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.core.SecurityContext sec, jakarta.servlet.http.HttpServletRequest req) Description copied from interface:SpallocServiceAPIGet a description of the overall service.- Specified by:
describeServicein 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:SpallocServiceAPIGet a description of the machines.- Specified by:
getMachinesin interfaceSpallocServiceAPI- Parameters:
ui- How to build URIs- Returns:
- A list of machines
-
getMachine
public SpallocServiceAPI.MachineAPI getMachine(String name, jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.core.SecurityContext sec) Description copied from interface:SpallocServiceAPIGet a sub-resource for managing a machine.- Specified by:
getMachinein 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, jakarta.ws.rs.core.UriInfo ui, jakarta.servlet.http.HttpServletRequest req, jakarta.ws.rs.core.SecurityContext security) Description copied from interface:SpallocServiceAPIGet a sub-resource for managing a job.- Specified by:
getJobin 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, jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.container.AsyncResponse response) Description copied from interface:SpallocServiceAPIList jobs.- Specified by:
listJobsin 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, jakarta.ws.rs.core.UriInfo ui, jakarta.ws.rs.core.SecurityContext security, jakarta.ws.rs.container.AsyncResponse response) Description copied from interface:SpallocServiceAPICreate a job.- Specified by:
createJobin interfaceSpallocServiceAPI- Parameters:
req- Description of what to createui- How to build URIssecurity- Information about the userresponse- Filled out with aCreateJobResponse
-
emergencyStop
Description copied from interface:SpallocServiceAPIImmediately stop all jobs and power down all boards.- Specified by:
emergencyStopin interfaceSpallocServiceAPI
-