JAL-3878 Add javadocs to created classes and reformat code.
[jalview.git] / src / jalview / ws2 / WebServiceI.java
1 package jalview.ws2;
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.ws.params.ParamDatastoreI;
9 import jalview.ws.params.WsParamSetI;
10 import jalview.ws2.operations.Operation;
11
12 /**
13  * Provides information about the web service and sub-routines to submit, track
14  * and cancel the jobs running on the server as well as retrieve the results.
15  * The instances should not depend on any other jalview components, especially
16  * must be oblivious to the existence of any UI. They are used by other classes
17  * such as WebServiceWorkers rather than manipulate data themselves.
18  *
19  * @author mmwarowny
20  */
21 public interface WebServiceI
22 {
23   /**
24    * Get the hostname/url of the remote server which is supplying the service.
25    * 
26    * @return host name
27    */
28   public String getHostName();
29
30   /**
31    * Get the short name of the service supplier.
32    * 
33    * @return short service supplier name
34    */
35   public String getProviderName();
36
37   /**
38    * Get the name of the service
39    * 
40    * @return service name
41    */
42   String getName();
43
44   /**
45    * Get the description of the service.
46    * 
47    * @return service description
48    */
49   String getDescription();
50
51   /**
52    * Return whether the service provider user-adjustable parameters.
53    * 
54    * @return whether service has parameters
55    */
56   boolean hasParameters();
57
58   /**
59    * Get a {@link ParamDatastoreI} object containing service parameters and
60    * presets.
61    * 
62    * @return service parameters and presets
63    */
64   public ParamDatastoreI getParamStore();
65
66   /**
67    * Submit new job to the service with the supplied input sequences and
68    * arguments. Implementations should perform all data parsing necessary for
69    * the job submission and start a new job on the remote server.
70    * 
71    * @param sequences
72    *          input sequences
73    * @param args
74    *          user provided arguments
75    * @return job id
76    * @throws IOException
77    *           submission failed due to a connection error
78    */
79   public String submit(List<SequenceI> sequences, List<ArgumentI> args)
80       throws IOException;
81
82   /**
83    * Update the progress of the running job according to the state reported by
84    * the server. Implementations should fetch the current job status from the
85    * server and update status and log messages on the provided job object.
86    * 
87    * @param job
88    *          job to update
89    * @throws IOException
90    *           server error occurred
91    */
92   public void updateProgress(WSJob job) throws IOException;
93
94   public void cancel(WSJob job) throws IOException;
95
96   /**
97    * Handle an exception that happened during job submission. If the exception
98    * was handled property by this method, it returns true. Otherwise, returns
99    * false indicating the exception should be handled by the caller.
100    */
101   public boolean handleSubmissionError(WSJob job, Exception ex);
102
103   public boolean handleCollectionError(WSJob job, Exception ex);
104
105 }