2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
24 * Generic properties for an individual job within a Web Service Client thread.
25 * Derived from jalview web services version 1 statuses, and revised for Jws2.
28 public abstract class AWsJob
30 protected int jobnum = 0;
32 protected String jobId;
38 public void setJobId(String jobId)
44 * has job been cancelled
46 protected boolean cancelled = false;
49 * number of exceptions left before job dies
51 int allowedServerExceptions = 3;
54 * @param allowedServerExceptions
55 * the allowedServerExceptions to set
57 public void setAllowedServerExceptions(int allowedServerExceptions)
59 this.allowedServerExceptions = allowedServerExceptions;
63 * has job been submitted to server ? if false, then no state info is
66 protected boolean submitted = false;
72 public void setJobnum(int jobnum)
79 * the submitted to set
81 public void setSubmitted(boolean submitted)
83 this.submitted = submitted;
87 * @param subjobComplete
88 * the subjobComplete to set
90 public void setSubjobComplete(boolean subjobComplete)
92 this.subjobComplete = subjobComplete;
98 public int getJobnum()
106 public String getJobId()
112 * @return the cancelled
114 public boolean isCancelled()
120 * @return the allowedServerExceptions
122 public int getAllowedServerExceptions()
124 return allowedServerExceptions;
128 * @return the submitted
130 public boolean isSubmitted()
136 * @return the subjobComplete
138 public boolean isSubjobComplete()
140 return subjobComplete;
144 * are all sub-jobs complete
146 protected boolean subjobComplete = false;
154 * @return true if job has completed and valid results are available
156 abstract public boolean hasResults();
160 * @return boolean true if job can be submitted.
162 public abstract boolean hasValidInput();
166 * @return true if job is running
168 abstract public boolean isRunning();
172 * @return true if job is queued
174 abstract public boolean isQueued();
178 * @return true if job has finished
180 abstract public boolean isFinished();
184 * @return true if the job failed due to some problem with the input data or
187 abstract public boolean isFailed();
191 * @return true if job failed due to an unhandled technical issue
193 abstract public boolean isBroken();
197 * @return true if there was a problem contacting the server.
199 abstract public boolean isServerError();
203 * @return true if the job has status text.
205 abstract public boolean hasStatus();
209 * @return status text for job to be displayed to user.
211 abstract public String getStatus();
213 abstract public boolean hasResponse();
215 abstract public void clearResponse();
217 abstract public String getState();
220 * generates response using the abstract service flags.
222 * @return a standard state response
224 protected String _defaultState()