package jalview.ws2.api; import java.util.Date; /** * {@code WebServiceJob} represents a job running on a remote server. The object * contains all the information needed to associate the job with an originating * client and url, service being run and to poll the job and retrieve the * results from the server. The {@code WebServiceJob} object is provided by the * {@link WebServiceClientI#submit} method when the job is created. * * @see WebServiceClientI * * @author mmwarowny */ public class WebServiceJobHandle { /** Name of the related client */ private final String serviceClient; /** Name of the related service */ private final String serviceName; /** URL the job is valid for */ private final String url; /** External job id as given by the server */ private final String jobId; private Date creationTime = new Date(); public WebServiceJobHandle(String serviceClient, String serviceName, String url, String jobId) { this.serviceClient = serviceClient; this.serviceName = serviceName; this.url = url; this.jobId = jobId; } /** * Get a URL this job originates from. * * @return job URL */ public String getUrl() { return url; } /** * Get an id assigned to the job by the server. * * @return job id handle */ public String getJobId() { return jobId; } /** * @return Job creation time */ public Date getCreationTime() { return creationTime; } public String toString() { return String.format("%s:%s [%s] Created %s", serviceClient, serviceName, jobId, creationTime); } }