2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 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 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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
22 * Generic properties for an individual job within a Web Service Client thread.
23 * Derived from jalview web services version 1 statuses, and revised for Jws2.
26 public abstract class AWsJob
28 protected int jobnum = 0;
30 protected String jobId;
36 public void setJobId(String jobId)
42 * has job been cancelled
44 protected boolean cancelled = false;
47 * number of exceptions left before job dies
49 int allowedServerExceptions = 3;
52 * @param allowedServerExceptions
53 * the allowedServerExceptions to set
55 public void setAllowedServerExceptions(int allowedServerExceptions)
57 this.allowedServerExceptions = allowedServerExceptions;
61 * has job been submitted to server ? if false, then no state info is
64 protected boolean submitted = false;
70 public void setJobnum(int jobnum)
77 * the submitted to set
79 public void setSubmitted(boolean submitted)
81 this.submitted = submitted;
85 * @param subjobComplete
86 * the subjobComplete to set
88 public void setSubjobComplete(boolean subjobComplete)
90 this.subjobComplete = subjobComplete;
96 public int getJobnum()
104 public String getJobId()
110 * @return the cancelled
112 public boolean isCancelled()
118 * @return the allowedServerExceptions
120 public int getAllowedServerExceptions()
122 return allowedServerExceptions;
126 * @return the submitted
128 public boolean isSubmitted()
134 * @return the subjobComplete
136 public boolean isSubjobComplete()
138 return subjobComplete;
142 * are all sub-jobs complete
144 protected boolean subjobComplete = false;
152 * @return true if job has completed and valid results are available
154 abstract public boolean hasResults();
158 * @return boolean true if job can be submitted.
160 public abstract boolean hasValidInput();
164 * @return true if job is running
166 abstract public boolean isRunning();
170 * @return true if job is queued
172 abstract public boolean isQueued();
176 * @return true if job has finished
178 abstract public boolean isFinished();
182 * @return true if the job failed due to some problem with the input data or
185 abstract public boolean isFailed();
189 * @return true if job failed due to an unhandled technical issue
191 abstract public boolean isBroken();
195 * @return true if there was a problem contacting the server.
197 abstract public boolean isServerError();
201 * @return true if the job has status text.
203 abstract public boolean hasStatus();
207 * @return status text for job to be displayed to user.
209 abstract public String getStatus();
211 abstract public boolean hasResponse();
213 abstract public void clearResponse();
215 abstract public String getState();
218 * generates response using the abstract service flags.
220 * @return a standard state response
222 protected String _defaultState()