Class SpallocClientFactory

java.lang.Object
uk.ac.manchester.spinnaker.alloc.client.SpallocClientFactory

public class SpallocClientFactory
extends Object
A factory for clients to connect to the Spalloc service.

Implementation Note: Neither this class nor the client classes it creates maintain state that needs to be closed explicitly except for transceivers, as transceivers usually need to be closed.

Author:
Donal Fellows
  • Constructor Details

    • SpallocClientFactory

      public SpallocClientFactory​(URI baseUrl)
      Create a factory that can talk to a given service.
      Parameters:
      baseUrl - Where the server is.
  • Method Details

    • getJobFromProxyInfo

      public static SpallocClient.Job getJobFromProxyInfo​(ProxyInformation proxy) throws IOException
      Get a handle to a job given its proxy access information (derived from a database query).
      Parameters:
      proxy - The proxy information from the database. Handles null.
      Returns:
      The job handle, or null if proxy==null.
      Throws:
      IOException - If connecting to the job fails.
    • login

      public SpallocClient login​(String username, String password) throws IOException
      Create a client and log in.
      Parameters:
      username - The username to log in with.
      password - The password to log in with.
      Returns:
      The client API for the given server.
      Throws:
      IOException - If the server doesn't respond or logging in fails.
    • getJob

      public SpallocClient.Job getJob​(String uri, Map<String,​String> headers, Map<String,​String> cookies) throws IOException
      Get direct access to a Job.
      Parameters:
      uri - The URI of the job
      headers - The headers to read authentication from.
      cookies - The cookies to read authentication from.
      Returns:
      A job.
      Throws:
      IOException - If there is an error communicating with the server.