*
* @author mmwarowny
*/
+// TODO: make class non-abstract by removing isInputValid()
public abstract class BaseJob implements JobI
{
protected final long internalId = MathUtils.getUID();
*
* @return {@code true} if the input is valid.
*/
+ // FIXME: method not necessary, may incorporate into task#prepare()
public abstract boolean isInputValid();
/**
import java.io.IOException;
import java.io.StringReader;
+import java.net.URI;
import java.util.List;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
+import jalview.io.DataSourceType;
import jalview.io.FileFormat;
+import jalview.io.FormatAdapter;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.simple.BooleanOption;
import jalview.ws.params.simple.DoubleParameter;
import jalview.ws2.api.Credentials;
import jalview.ws2.api.JobStatus;
import jalview.ws2.api.WebServiceJobHandle;
+import jalview.ws2.client.api.AlignmentWebServiceClientI;
import jalview.ws2.client.api.WebServiceClientI;
import uk.ac.dundee.compbio.hmmerclient.PhmmerClient;
import uk.ac.dundee.compbio.hmmerclient.PhmmerRequest;
import uk.ac.dundee.compbio.hmmerclient.PhmmerRequest.SequenceDatabase;
import uk.ac.dundee.compbio.hmmerclient.PhmmerRequest.SubstitutionMatrix;
-public class PhmmerWSClient implements WebServiceClientI
+public class PhmmerWSClient implements AlignmentWebServiceClientI
{
final PhmmerClient client;
"ebi job dispatcher does not support job cancellation");
}
+ /**
+ * FIXME: Temporary hack
+ */
+ @Override
+ public AlignmentI getAlignment(WebServiceJobHandle job) throws IOException
+ {
+ URI url = client.getResultURL(job.getJobId(), "sto");
+ return new FormatAdapter().readFile(url.toString(), DataSourceType.URL, FileFormat.Stockholm);
+ }
}
--- /dev/null
+package jalview.ws2.gui;
+
+import java.util.List;
+
+import jalview.bin.Console;
+import jalview.datamodel.AlignmentI;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.ws2.actions.api.JobI;
+import jalview.ws2.actions.api.TaskEventListener;
+import jalview.ws2.actions.api.TaskI;
+import jalview.ws2.api.JobStatus;
+
+public class SearchServiceGuiHandler implements TaskEventListener<AlignmentI>
+{
+ private final AlignFrame parentFrame;
+
+ public SearchServiceGuiHandler(AlignFrame parentFrame)
+ {
+ this.parentFrame = parentFrame;
+ }
+
+ @Override
+ public void taskStarted(TaskI<AlignmentI> source,
+ List<? extends JobI> subJobs)
+ {
+ Console.info("task started with " + subJobs.size() + " jobs");
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void taskStatusChanged(TaskI<AlignmentI> source, JobStatus status)
+ {
+ Console.info("task status " + status);
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void taskCompleted(TaskI<AlignmentI> source, AlignmentI result)
+ {
+ Console.info("task completed");
+ displayResultsNewFrame(result);
+ }
+
+ @Override
+ public void taskException(TaskI<AlignmentI> source, Exception e)
+ {
+ Console.info("task failed", e);
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void taskRestarted(TaskI<AlignmentI> source)
+ {
+ Console.info("task restarted");
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void subJobStatusChanged(TaskI<AlignmentI> source, JobI job,
+ JobStatus status)
+ {
+ Console.info("sub-job " + job.getInternalId() + " status " + status);
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void subJobLogChanged(TaskI<AlignmentI> source, JobI job,
+ String log)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void subJobErrorLogChanged(TaskI<AlignmentI> source, JobI job,
+ String log)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void displayResultsNewFrame(AlignmentI aln)
+ {
+ AlignFrame frame = new AlignFrame(aln, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ frame.getFeatureRenderer().transferSettings(
+ parentFrame.getFeatureRenderer().getSettings());
+ Desktop.addInternalFrame(frame, "title", AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ }
+}
import jalview.ws2.actions.api.ActionI;
import jalview.ws2.actions.api.TaskEventListener;
import jalview.ws2.actions.api.TaskI;
+import jalview.ws2.actions.hmmer.PhmmerAction;
import jalview.ws2.api.Credentials;
import jalview.ws2.api.WebService;
import jalview.ws2.client.api.WebServiceProviderI;
var handler = new AnnotationServiceGuiHandler(_action, frame);
return _action.perform(viewport, args, credentials, handler);
}
+ if (action instanceof PhmmerAction)
+ {
+ var _action = (PhmmerAction) action;
+ var handler = new SearchServiceGuiHandler(frame);
+ return _action.perform(viewport, args, credentials, handler);
+ }
Console.warn(String.format(
"No known handler for action type %s. All output will be discarded.",
action.getClass().getName()));