JAL-3878 Move status precedence list to JobStatus class
[jalview.git] / src / jalview / ws2 / api / WebServiceJobHandle.java
1 package jalview.ws2.api;
2
3 import java.util.Date;
4
5 /**
6  * {@code WebServiceJob} represents a job running on a remote server. The object
7  * contains all the information needed to associate the job with an originating
8  * client and url, service being run and to poll the job and retrieve the
9  * results from the server. The {@code WebServiceJob} object is provided by the
10  * {@link WebServiceClientI#submit} method when the job is created.
11  * 
12  * @see WebServiceClientI
13  * 
14  * @author mmwarowny
15  */
16 public class WebServiceJobHandle
17 {
18   /** Name of the related client */
19   private final String serviceClient;
20
21   /** Name of the related service */
22   private final String serviceName;
23
24   /** URL the job is valid for */
25   private final String url;
26
27   /** External job id as given by the server */
28   private final String jobId;
29
30   private Date creationTime = new Date();
31
32   public WebServiceJobHandle(String serviceClient, String serviceName,
33       String url, String jobId)
34   {
35     this.serviceClient = serviceClient;
36     this.serviceName = serviceName;
37     this.url = url;
38     this.jobId = jobId;
39   }
40
41   /**
42    * Get a URL this job originates from.
43    * 
44    * @return job URL
45    */
46   public String getUrl()
47   {
48     return url;
49   }
50
51   /**
52    * Get an id assigned to the job by the server.
53    * 
54    * @return job id handle
55    */
56   public String getJobId()
57   {
58     return jobId;
59   }
60
61   /**
62    * @return Job creation time
63    */
64   public Date getCreationTime()
65   {
66     return creationTime;
67   }
68
69   public String toString()
70   {
71     return String.format("%s:%s [%s] Created %s", serviceClient, serviceName,
72         jobId, creationTime);
73   }
74 }