JAL-3878 Move CredentialType class to jalview.ws2.api package
[jalview.git] / src / jalview / ws2 / client / api / WebServiceClientI.java
1 package jalview.ws2.client.api;
2
3 import java.io.IOException;
4 import java.util.List;
5
6 import jalview.datamodel.SequenceI;
7 import jalview.ws.params.ArgumentI;
8 import jalview.ws2.api.Credentials;
9
10 public interface WebServiceClientI
11 {
12   /**
13    * Get the hostname/url of the remote server which is supplying the service.
14    * 
15    * @return host name
16    */
17   String getUrl();
18
19   /**
20    * Get the name of the web service client.
21    * 
22    * @return client name
23    */
24   String getClientName();
25
26   /**
27    * Submit new job to the service with the supplied input sequences and
28    * arguments. Optionally, some services may require additional credentials to
29    * run. Implementations should perform all data serialization necessary for
30    * the job submission, start a new job on the remote server and return a
31    * handler for that job.
32    * 
33    * @param sequences
34    *          input sequences
35    * @param args
36    *          user provided arguments
37    * @param credentials
38    *          optional user credentials needed to run the job
39    * @return job handler
40    * @throws IOException
41    *           submission failed due to a connection error
42    */
43   WebServiceJob submit(List<SequenceI> sequences, List<ArgumentI> args,
44       Credentials credentials) throws IOException;
45
46   /**
47    * Poll the server and update the progress of the running job accordingly.
48    * Implementations should fetch the current job status from the server and
49    * update the status and log strings on the provided job object.
50    * 
51    * @param job
52    *          job to update
53    * @throws IOException
54    *           server error occurred
55    */
56   void updateProgress(WebServiceJob job) throws IOException;
57
58   /**
59    * Send the cancellation request to the server for the specified job.
60    * 
61    * @param job
62    *          job to cancel
63    * @throws IOException
64    *           server error occurred
65    * @throws UnsupportedOperationException
66    *           server does not support job cancellation
67    */
68   void cancel(WebServiceJob job) throws IOException, UnsupportedOperationException;
69 }