From 31c431a1707ed5d2b4aed45063b043b726c42b2b Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Fri, 3 Sep 2021 17:27:36 +0200 Subject: [PATCH] JAL-3878 Create Slivka Web Service adapter. --- src/jalview/ws2/slivka/SlivkaWS.java | 175 ++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 src/jalview/ws2/slivka/SlivkaWS.java diff --git a/src/jalview/ws2/slivka/SlivkaWS.java b/src/jalview/ws2/slivka/SlivkaWS.java new file mode 100644 index 0000000..3fbd8b7 --- /dev/null +++ b/src/jalview/ws2/slivka/SlivkaWS.java @@ -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 implements JalviewWebServiceI +{ + 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 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 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 sequences, WsParamSetI preset, + List 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; + } + +} -- 1.7.10.2