JAL-3878 Add uid to WS Tasks
[jalview.git] / src / jalview / ws2 / actions / api / TaskI.java
index 3a3fcbb..cb84944 100644 (file)
@@ -2,9 +2,7 @@ package jalview.ws2.actions.api;
 
 import java.util.List;
 
-import jalview.viewmodel.AlignmentViewport;
 import jalview.ws2.api.JobStatus;
-import jalview.ws2.client.api.WebServiceJob;
 
 /**
  * {@code TaskI} objects represent running services. Tasks are created by
@@ -19,25 +17,38 @@ import jalview.ws2.client.api.WebServiceJob;
 public interface TaskI<T>
 {
   /**
-   * Get the current status of the task. The resultant status should be
-   * a combination of individual sub-job statuses. 
+   * Get the universal identifier of this task.
    * 
-   * @return global status of 
+   * @return identifier
+   */
+  long getUid();
+
+  /**
+   * Get the current status of the task. The resultant status should be a
+   * combination of individual sub-job statuses.
+   * 
+   * @return global status of
    */
   JobStatus getStatus();
 
   /**
    * Get the current list of sub-jobs of that task.
-   *  
+   * 
    * @return sub-jobs
    */
-  List<? extends WebServiceJob> getSubJobs();
+  List<? extends JobI> getSubJobs();
 
   /**
-   * Get the last result of the task or {@code null} if not present.
-   * Note that the result is subject to change for restartable tasks.
+   * Get the last result of the task or {@code null} if not present. Note that
+   * the result is subject to change for restartable tasks.
    * 
    * @return last task result
    */
   T getResult();
+
+  /**
+   * Cancel the task, stop all sub-jobs running on a server and stop all threads
+   * managing this task.
+   */
+  void cancel();
 }