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 Summary
Constructors Constructor Description SpallocClientFactory(URI baseUrl)
Create a factory that can talk to a given service. -
Method Summary
Modifier and Type Method Description SpallocClient.Job
getJob(String uri, Map<String,String> headers, Map<String,String> cookies)
Get direct access to a Job.static SpallocClient.Job
getJobFromProxyInfo(ProxyInformation proxy)
Get a handle to a job given its proxy access information (derived from a database query).SpallocClient
login(String username, String password)
Create a client and log in.
-
Constructor Details
-
SpallocClientFactory
Create a factory that can talk to a given service.- Parameters:
baseUrl
- Where the server is.
-
-
Method Details
-
getJobFromProxyInfo
Get a handle to a job given its proxy access information (derived from a database query).- Parameters:
proxy
- The proxy information from the database. Handlesnull
.- Returns:
- The job handle, or
null
ifproxy==null
. - Throws:
IOException
- If connecting to the job fails.
-
login
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 IOExceptionGet direct access to a Job.- Parameters:
uri
- The URI of the jobheaders
- 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.
-