4 * Generic properties for an individual job within a Web Service Client thread.
5 * Derived from jalview web services version 1 statuses, and revised for Jws2.
8 public abstract class AWsJob
10 protected int jobnum = 0;
12 protected String jobId;
15 * @param jobId the jobId to set
17 public void setJobId(String jobId)
23 * has job been cancelled
25 protected boolean cancelled = false;
28 * number of exceptions left before job dies
30 int allowedServerExceptions = 3;
33 * @param allowedServerExceptions the allowedServerExceptions to set
35 public void setAllowedServerExceptions(int allowedServerExceptions)
37 this.allowedServerExceptions = allowedServerExceptions;
41 * has job been submitted to server ? if false, then no state info is
44 protected boolean submitted = false;
47 * @param jobnum the jobnum to set
49 public void setJobnum(int jobnum)
55 * @param submitted the submitted to set
57 public void setSubmitted(boolean submitted)
59 this.submitted = submitted;
63 * @param subjobComplete the subjobComplete to set
65 public void setSubjobComplete(boolean subjobComplete)
67 this.subjobComplete = subjobComplete;
73 public int getJobnum()
81 public String getJobId()
87 * @return the cancelled
89 public boolean isCancelled()
95 * @return the allowedServerExceptions
97 public int getAllowedServerExceptions()
99 return allowedServerExceptions;
103 * @return the submitted
105 public boolean isSubmitted()
111 * @return the subjobComplete
113 public boolean isSubjobComplete()
115 return subjobComplete;
119 * are all sub-jobs complete
121 protected boolean subjobComplete = false;
129 * @return true if job has completed and valid results are available
131 abstract public boolean hasResults();
135 * @return boolean true if job can be submitted.
137 public abstract boolean hasValidInput();
141 * @return true if job is running
143 abstract public boolean isRunning();
147 * @return true if job is queued
149 abstract public boolean isQueued();
153 * @return true if job has finished
155 abstract public boolean isFinished();
159 * @return true if the job failed due to some problem with the input data or
162 abstract public boolean isFailed();
166 * @return true if job failed due to an unhandled technical issue
168 abstract public boolean isBroken();
172 * @return true if there was a problem contacting the server.
174 abstract public boolean isServerError();
178 * @return true if the job has status text.
180 abstract public boolean hasStatus();
184 * @return status text for job to be displayed to user.
186 abstract public String getStatus();
188 abstract public boolean hasResponse();
189 abstract public void clearResponse();
190 abstract public String getState();
192 * generates response using the abstract service flags.
193 * @return a standard state response
195 protected String _defaultState() {