2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
21 * Generic properties for an individual job within a Web Service Client thread.
22 * Derived from jalview web services version 1 statuses, and revised for Jws2.
25 public abstract class AWsJob
27 protected int jobnum = 0;
29 protected String jobId;
35 public void setJobId(String jobId)
41 * has job been cancelled
43 protected boolean cancelled = false;
46 * number of exceptions left before job dies
48 int allowedServerExceptions = 3;
51 * @param allowedServerExceptions
52 * the allowedServerExceptions to set
54 public void setAllowedServerExceptions(int allowedServerExceptions)
56 this.allowedServerExceptions = allowedServerExceptions;
60 * has job been submitted to server ? if false, then no state info is
63 protected boolean submitted = false;
69 public void setJobnum(int jobnum)
76 * the submitted to set
78 public void setSubmitted(boolean submitted)
80 this.submitted = submitted;
84 * @param subjobComplete
85 * the subjobComplete to set
87 public void setSubjobComplete(boolean subjobComplete)
89 this.subjobComplete = subjobComplete;
95 public int getJobnum()
103 public String getJobId()
109 * @return the cancelled
111 public boolean isCancelled()
117 * @return the allowedServerExceptions
119 public int getAllowedServerExceptions()
121 return allowedServerExceptions;
125 * @return the submitted
127 public boolean isSubmitted()
133 * @return the subjobComplete
135 public boolean isSubjobComplete()
137 return subjobComplete;
141 * are all sub-jobs complete
143 protected boolean subjobComplete = false;
151 * @return true if job has completed and valid results are available
153 abstract public boolean hasResults();
157 * @return boolean true if job can be submitted.
159 public abstract boolean hasValidInput();
163 * @return true if job is running
165 abstract public boolean isRunning();
169 * @return true if job is queued
171 abstract public boolean isQueued();
175 * @return true if job has finished
177 abstract public boolean isFinished();
181 * @return true if the job failed due to some problem with the input data or
184 abstract public boolean isFailed();
188 * @return true if job failed due to an unhandled technical issue
190 abstract public boolean isBroken();
194 * @return true if there was a problem contacting the server.
196 abstract public boolean isServerError();
200 * @return true if the job has status text.
202 abstract public boolean hasStatus();
206 * @return status text for job to be displayed to user.
208 abstract public String getStatus();
210 abstract public boolean hasResponse();
212 abstract public void clearResponse();
214 abstract public String getState();
217 * generates response using the abstract service flags.
219 * @return a standard state response
221 protected String _defaultState()