JAL-3878 Create Slivka Web Service adapter.
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 3 Sep 2021 15:27:36 +0000 (17:27 +0200)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Mon, 20 Sep 2021 16:43:55 +0000 (18:43 +0200)
src/jalview/ws2/slivka/SlivkaWS.java [new file with mode: 0644]

diff --git a/src/jalview/ws2/slivka/SlivkaWS.java b/src/jalview/ws2/slivka/SlivkaWS.java
new file mode 100644 (file)
index 0000000..3fbd8b7
--- /dev/null
@@ -0,0 +1,175 @@
+package jalview.ws2.slivka;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import jalview.datamodel.SequenceI;
+import jalview.ws.gui.WsJob;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.ParamDatastoreI;
+import jalview.ws.params.WsParamSetI;
+import jalview.ws.slivkaws.SlivkaDatastore;
+import jalview.ws2.JalviewWebServiceI;
+import jalview.ws2.WSJobID;
+import jalview.ws2.WSJobTrackerI;
+import uk.ac.dundee.compbio.slivkaclient.JobState;
+import uk.ac.dundee.compbio.slivkaclient.SlivkaClient;
+import uk.ac.dundee.compbio.slivkaclient.SlivkaService;
+
+public abstract class SlivkaWS<R> implements JalviewWebServiceI<R>
+{
+  protected final SlivkaClient client;
+  protected final SlivkaService service;
+  protected SlivkaDatastore store = null;
+  protected final String name;  
+  protected final String description;
+  protected final String operation;
+  protected int type = 0;
+
+  protected static final EnumMap<JobState, WsJob.JobState> stateMap = new EnumMap<>(JobState.class);
+  {
+    stateMap.put(JobState.PENDING, WsJob.JobState.QUEUED);
+    stateMap.put(JobState.REJECTED, WsJob.JobState.INVALID);
+    stateMap.put(JobState.ACCEPTED, WsJob.JobState.QUEUED);
+    stateMap.put(JobState.QUEUED, WsJob.JobState.QUEUED);
+    stateMap.put(JobState.RUNNING, WsJob.JobState.RUNNING);
+    stateMap.put(JobState.COMPLETED, WsJob.JobState.FINISHED);
+    stateMap.put(JobState.INTERRUPTED, WsJob.JobState.CANCELLED);
+    stateMap.put(JobState.DELETED, WsJob.JobState.CANCELLED);
+    stateMap.put(JobState.FAILED, WsJob.JobState.FAILED);
+    stateMap.put(JobState.ERROR, WsJob.JobState.SERVERERROR);
+    stateMap.put(JobState.UNKNOWN, WsJob.JobState.UNKNOWN);
+  }
+  protected final Set<WsJob.JobState> failedStates = new HashSet<>(Arrays.asList(
+      WsJob.JobState.INVALID, WsJob.JobState.BROKEN, WsJob.JobState.FAILED,
+      WsJob.JobState.SERVERERROR, WsJob.JobState.CANCELLED
+  ));
+  
+  public SlivkaWS(SlivkaClient client, SlivkaService service, String operation) {
+    this.client = client;
+    this.service = service;
+    this.operation = operation;
+    this.name = service.getName();
+    this.description = "";
+  }
+  
+  @Override
+  public String getHostName()
+  {
+    return client.getUrl().toString();
+  }
+
+  @Override
+  public String getName()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public String getDescription()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public String getOperationType()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public int getTypeFlags()
+  {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  @Override
+  public boolean canSubmitGaps()
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  @Override
+  public int getMinSequences()
+  {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  @Override
+  public int getMaxSequences()
+  {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  @Override
+  public boolean hasParameters()
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  @Override
+  public ParamDatastoreI getParamStore()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public WSJobID submit(List<SequenceI> sequences, WsParamSetI preset,
+          List<ArgumentI> parameters) throws IOException
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public void updateProgress(WSJobID id, WSJobTrackerI tracker)
+          throws IOException
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public R getResult(WSJobID id) throws IOException
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public void cancel(WSJobID id) throws IOException
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  @Override
+  public boolean handleSubmissionError(WSJobID id, Throwable th,
+          WSJobTrackerI tracker)
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  @Override
+  public boolean handleCollectionError(WSJobID id, Throwable th,
+          WSJobTrackerI tracker)
+  {
+    // TODO Auto-generated method stub
+    return false;
+  }
+  
+}