3 import java.io.IOException;
6 import jalview.ws2.utils.WSJobList;
9 * {@link WebServiceWorkerI} interface is an extension of {@link PollableTaskI}
10 * that adds getter methods for fields that are specific for the web service
11 * tasks such as uid, sub-jobs and underlying web service client as well as a
12 * method to add listeners to the worker events. {@link WebServiceWorkerI}
13 * objects perform operations needed to start, poll and finalize jobs running on
14 * the server as well as store sub-jobs created in the process. They use their
15 * associated {@link WebServiceI} object to submit and poll the jobs and fetch
16 * and parse the result when it's ready.
21 public interface WebServiceWorkerI extends PollableTaskI
24 * Get unique identifier of this worker. Identifier should be randomly
25 * generated on object creation and must remain unchanged. Unique id can be
26 * generated using {@link jalview.util.MathUtils#getUID}.
28 * @return worker unique id
33 * Get the sub-jobs created by the worker during job submission.
40 * Gather and parse input data and submit one or more jobs to the web service
41 * using associated {@link WebServiceI} object.
43 void start() throws IOException;
45 boolean poll() throws IOException;
47 WebServiceI getWebService();
50 * Check if all sub-jobs finished execution and return whether this task has
53 default boolean isDone()
55 if (getJobs().size() == 0)
57 for (WSJob job : getJobs())
59 if (!job.getStatus().isDone() && !job.getStatus().isFailed())
68 * Add worker listeners to this worker that will be notified about any state
69 * changes to this worker.
74 public void addListener(WebServiceWorkerListener listener);