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
  • 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: SpallocServiceAPI
      Get a description of the overall service.
      Specified by:
      describeService in interface SpallocServiceAPI
      Parameters:
      ui - How to build URIs
      sec - 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

      public MachinesResponse getMachines(jakarta.ws.rs.core.UriInfo ui)
      Description copied from interface: SpallocServiceAPI
      Get a description of the machines.
      Specified by:
      getMachines in interface SpallocServiceAPI
      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: SpallocServiceAPI
      Get a sub-resource for managing a machine.
      Specified by:
      getMachine in interface SpallocServiceAPI
      Parameters:
      name - The name of the machine
      ui - How to build URIs
      sec - 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: SpallocServiceAPI
      Get a sub-resource for managing a job.
      Specified by:
      getJob in interface SpallocServiceAPI
      Parameters:
      id - The ID of the job
      ui - How to build URIs
      req - Information about the request
      security - 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: SpallocServiceAPI
      List jobs.
      Specified by:
      listJobs in interface SpallocServiceAPI
      Parameters:
      wait - Whether we are waiting for a change with a long query
      destroyed - Whether to include destroyed jobs
      limit - Paging support: how many values to bring back
      start - Paging support: where in the sequence to start
      ui - How to build URIs
      response - Filled out with a ListJobsResponse
    • 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: SpallocServiceAPI
      Create a job.
      Specified by:
      createJob in interface SpallocServiceAPI
      Parameters:
      req - Description of what to create
      ui - How to build URIs
      security - Information about the user
      response - Filled out with a CreateJobResponse
    • emergencyStop

      public void emergencyStop(String commandCode, jakarta.ws.rs.container.AsyncResponse response)
      Description copied from interface: SpallocServiceAPI
      Immediately stop all jobs and power down all boards.
      Specified by:
      emergencyStop in interface SpallocServiceAPI