From: Jim Procter Date: Mon, 23 Sep 2019 15:52:31 +0000 (+0100) Subject: JAL-3066 JAL-3070 pull up non-jabaws specific service descriptor components for annot... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=dbf124d82413368d7aba34f8e3d8e7ad25167dea;p=jalview.git JAL-3066 JAL-3070 pull up non-jabaws specific service descriptor components for annotation style web services --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 5a5df3b..0ca7ddc 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -102,9 +102,9 @@ import jalview.viewmodel.AlignmentViewport; import jalview.viewmodel.ViewportRanges; import jalview.ws.DBRefFetcher; import jalview.ws.DBRefFetcher.FetchFinishedListenerI; +import jalview.ws.api.ServiceWithParameters; import jalview.ws.jws1.Discoverer; import jalview.ws.jws2.Jws2Discoverer; -import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.ArgumentI; import jalview.ws.params.ParamDatastoreI; import jalview.ws.params.WsParamSetI; @@ -4422,7 +4422,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (jws2servs.hasServices()) { jws2servs.attachWSMenuEntry(webService, me); - for (Jws2Instance sv : jws2servs.getServices()) + for (ServiceWithParameters sv : jws2servs.getServices()) { if (sv.getName().toLowerCase().contains("jpred")) { diff --git a/src/jalview/ws/api/ServiceWithParameters.java b/src/jalview/ws/api/ServiceWithParameters.java index cf82708..d345869 100644 --- a/src/jalview/ws/api/ServiceWithParameters.java +++ b/src/jalview/ws/api/ServiceWithParameters.java @@ -5,6 +5,8 @@ import jalview.ws.params.ParamManager; public abstract class ServiceWithParameters extends UIinfo { + protected jalview.ws.uimodel.AlignAnalysisUIText aaui; + public ServiceWithParameters(String serviceType, String action, String name, String description, String hosturl) { @@ -13,4 +15,68 @@ public abstract class ServiceWithParameters extends UIinfo public abstract void initParamStore(ParamManager userParameterStore); + public jalview.ws.uimodel.AlignAnalysisUIText getAlignAnalysisUI() + { + return aaui; + } + + public void setAlignAnalysisUI( + jalview.ws.uimodel.AlignAnalysisUIText aaui) + { + this.aaui = aaui; + } + + public boolean isInteractiveUpdate() + { + return aaui != null && aaui.isAA(); + } + // config flags for SeqAnnotationServiceCalcWorker + + public boolean isProteinService() + { + return aaui == null ? true : aaui.isPr(); + } + + public boolean isNucleotideService() + { + return aaui == null ? false : aaui.isNa(); + } + + public boolean isNeedsAlignedSequences() + { + return aaui == null ? false : aaui.isNeedsAlignedSeqs(); + } + + public boolean isAlignmentAnalysis() + { + return aaui == null ? false : aaui.isAA(); + } + + public boolean isFilterSymbols() + { + return aaui != null ? aaui.isFilterSymbols() : true; + } + + public int getMinimumInputSequences() + { + return aaui != null ? aaui.getMinimumSequences() : 1; + } + + public String getNameURI() + { + return "java:" + getName(); + } + + public String getUri() + { + // TODO verify that service parameter sets in projects are consistent with + // Jalview 2.10.4 + // this is only valid for Jaba 1.0 - this formula might have to change! + return getHostURL() + + (getHostURL().lastIndexOf("/") == (getHostURL().length() - 1) + ? "" + : "/") + + getName(); + } + } diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index e4ff459..2a05228 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -26,6 +26,7 @@ import jalview.gui.Desktop; import jalview.gui.JvSwingUtils; import jalview.util.MessageManager; import jalview.ws.WSMenuEntryProviderI; +import jalview.ws.api.ServiceWithParameters; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.ParamDatastoreI; @@ -439,7 +440,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI MessageManager.getString("label.switch_server"))); hitm.setToolTipText(JvSwingUtils.wrapTooltip(false, MessageManager.getString("label.choose_jabaws_server"))); - for (final Jws2Instance sv : alternates.get(service.getName())) + for (final ServiceWithParameters sv : alternates.get(service.getName())) { JMenuItem itm; hitm.add(itm = new JMenuItem(sv.getHostURL())); @@ -604,7 +605,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI System.out.println("Changesupport: There are now " + getDiscoverer().services.size() + " services"); int i = 1; - for (Jws2Instance instance : getDiscoverer().services) + for (ServiceWithParameters instance : getDiscoverer().services) { System.out.println("Service " + i++ + " " + instance.getClass() + "@" @@ -1029,7 +1030,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI } public void setPreferredServiceFor(AlignFrame af, String serviceName, - String serviceAction, Jws2Instance selectedServer) + String serviceAction, ServiceWithParameters selectedServer) { // TODO: pull out and generalise for the selectedServer's attributes String afid = (af == null) ? "" : af.getViewport().getSequenceSetId(); @@ -1048,7 +1049,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI } public void setPreferredServiceFor(String serviceType, - String serviceAction, Jws2Instance selectedServer) + String serviceAction, ServiceWithParameters selectedServer) { setPreferredServiceFor(null, serviceType, serviceAction, selectedServer); diff --git a/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java b/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java index e92a338..6ecc01f 100644 --- a/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java +++ b/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java @@ -38,12 +38,13 @@ import jalview.schemes.ResidueProperties; import jalview.util.MessageManager; import jalview.workers.AlignCalcWorker; import jalview.ws.api.CancellableI; +import jalview.ws.api.JalviewServiceEndpointProviderI; import jalview.ws.api.JobId; import jalview.ws.api.SequenceAnnotationServiceI; +import jalview.ws.api.ServiceWithParameters; import jalview.ws.api.WSAnnotationCalcManagerI; import jalview.ws.gui.AnnotationWsJob; import jalview.ws.jws2.dm.AAConSettings; -import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; @@ -56,7 +57,7 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker implements WSAnnotationCalcManagerI { - protected Jws2Instance service; + protected ServiceWithParameters service; protected WsParamSetI preset; @@ -157,7 +158,8 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker super(alignViewport, alignPanel); } - public SeqAnnotationServiceCalcWorker(Jws2Instance service, AlignFrame alignFrame, + public SeqAnnotationServiceCalcWorker(ServiceWithParameters service, + AlignFrame alignFrame, WsParamSetI preset, List paramset) { this(alignFrame.getCurrentView(), alignFrame.alignPanel); @@ -169,7 +171,7 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker this.service = service; try { - annotService = (jalview.ws.api.SequenceAnnotationServiceI) service + annotService = (jalview.ws.api.SequenceAnnotationServiceI) ((JalviewServiceEndpointProviderI) service) .getEndpoint(); } catch (ClassCastException cce) { diff --git a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java index bf5dc23..7163974 100644 --- a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java +++ b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java @@ -62,7 +62,7 @@ public class SequenceAnnotationWSClient extends Jws2Client // dan think. Do I need to change this method to run RNAalifold through the // GUI - public void initSequenceAnnotationWSClient(final Jws2Instance sh, + public void initSequenceAnnotationWSClient(final ServiceWithParameters sh, AlignFrame alignFrame, WsParamSetI preset, boolean editParams) { // dan changed! dan test. comment out if conditional diff --git a/src/jalview/ws/jws2/dm/AAConSettings.java b/src/jalview/ws/jws2/dm/AAConSettings.java index 5cc8f66..997913e 100644 --- a/src/jalview/ws/jws2/dm/AAConSettings.java +++ b/src/jalview/ws/jws2/dm/AAConSettings.java @@ -21,6 +21,7 @@ package jalview.ws.jws2.dm; import jalview.util.MessageManager; +import jalview.ws.api.ServiceWithParameters; import jalview.ws.jws2.JabaParamStore; import jalview.ws.jws2.JabaPreset; import jalview.ws.jws2.ParameterUtils; @@ -42,16 +43,16 @@ import compbio.metadata.Option; */ public class AAConSettings extends jalview.ws.params.AutoCalcSetting { - Jws2Instance service; + ServiceWithParameters service; - public AAConSettings(boolean autoUpdate, Jws2Instance service, + public AAConSettings(boolean autoUpdate, ServiceWithParameters service2, WsParamSetI preset, List jobArgset) { super(preset, jobArgset, autoUpdate); - this.service = service; + this.service = service2; } - public Jws2Instance getService() + public ServiceWithParameters getService() { return service; } diff --git a/src/jalview/ws/jws2/jabaws2/JabawsAnnotationInstance.java b/src/jalview/ws/jws2/jabaws2/JabawsAnnotationInstance.java index 8acf64f..e7f3022 100644 --- a/src/jalview/ws/jws2/jabaws2/JabawsAnnotationInstance.java +++ b/src/jalview/ws/jws2/jabaws2/JabawsAnnotationInstance.java @@ -8,9 +8,9 @@ import jalview.util.MessageManager; import jalview.ws.api.JobId; import jalview.ws.api.SequenceAnnotationServiceI; import jalview.ws.gui.AnnotationWsJob; -import jalview.ws.jws2.SeqAnnotationServiceCalcWorker; import jalview.ws.jws2.JabaParamStore; import jalview.ws.jws2.JabaPreset; +import jalview.ws.jws2.SeqAnnotationServiceCalcWorker; import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; @@ -50,7 +50,8 @@ public abstract class JabawsAnnotationInstance */ public String getCalcId() { - return our.aaui == null ? null : our.aaui.getCalcId(); + return our.getAlignAnalysisUI() == null ? null + : our.getAlignAnalysisUI().getCalcId(); } @Override diff --git a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java index 194b315..9f2d4ae 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java @@ -186,18 +186,6 @@ public class Jws2Instance extends ServiceWithParameters return paramStore; } - public String getUri() - { - // TODO verify that service parameter sets in projects are consistent with - // Jalview 2.10.4 - // this is only valid for Jaba 1.0 - this formula might have to change! - return getHostURL() - + (getHostURL().lastIndexOf("/") == (getHostURL().length() - 1) - ? "" - : "/") - + getName(); - } - private boolean hasParams = false, lookedForParams = false; @Override @@ -230,18 +218,6 @@ public class Jws2Instance extends ServiceWithParameters } } - public String getNameURI() - { - return "java:" + getName(); - } - - jalview.ws.uimodel.AlignAnalysisUIText aaui; - - public jalview.ws.uimodel.AlignAnalysisUIText getAlignAnalysisUI() - { - return aaui; - } - /** * initialise a parameter store for this service * @@ -300,40 +276,4 @@ public class Jws2Instance extends ServiceWithParameters return null; } } - - public boolean isInteractiveUpdate() - { - return aaui != null && aaui.isAA(); - } - // config flags for SeqAnnotationServiceCalcWorker - - public boolean isProteinService() - { - return aaui == null ? true : aaui.isPr(); - } - - public boolean isNucleotideService() - { - return aaui == null ? false : aaui.isNa(); - } - - public boolean isNeedsAlignedSequences() - { - return aaui == null ? false : aaui.isNeedsAlignedSeqs(); - } - - public boolean isAlignmentAnalysis() - { - return aaui == null ? false : aaui.isAA(); - } - - public boolean isFilterSymbols() - { - return aaui != null ? aaui.isFilterSymbols() : true; - } - - public int getMinimumInputSequences() - { - return aaui != null ? aaui.getMinimumSequences() : 1; - } } diff --git a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java index 00127b1..c328670 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java @@ -85,7 +85,7 @@ public class Jws2InstanceFactory init(); Jws2Instance svc = new Jws2Instance(jwsservers, serviceType, category_rewrite(name), description, service); - svc.aaui = aaConGUI.get(serviceType.toString()); + svc.setAlignAnalysisUI(aaConGUI.get(serviceType.toString())); return svc; }