JAL-3070 abstract class for services with adjustable parameters
authorJim Procter <jprocter@issues.jalview.org>
Thu, 26 Jul 2018 16:06:12 +0000 (17:06 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 26 Jul 2018 16:06:12 +0000 (17:06 +0100)
src/jalview/ws/api/ServiceWithParameters.java [new file with mode: 0644]
src/jalview/ws/jws2/jabaws2/Jws2Instance.java

diff --git a/src/jalview/ws/api/ServiceWithParameters.java b/src/jalview/ws/api/ServiceWithParameters.java
new file mode 100644 (file)
index 0000000..cf82708
--- /dev/null
@@ -0,0 +1,16 @@
+package jalview.ws.api;
+
+import jalview.ws.params.ParamManager;
+
+public abstract class ServiceWithParameters extends UIinfo
+{
+
+  public ServiceWithParameters(String serviceType, String action,
+          String name, String description, String hosturl)
+  {
+    super(serviceType, action, name, description, hosturl);
+  }
+
+  public abstract void initParamStore(ParamManager userParameterStore);
+
+}
index 85ac238..3bff20b 100644 (file)
@@ -23,11 +23,12 @@ package jalview.ws.jws2.jabaws2;
 import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
 import jalview.util.MessageManager;
-import jalview.ws.api.UIinfo;
+import jalview.ws.api.ServiceWithParameters;
 import jalview.ws.jws2.JabaParamStore;
 import jalview.ws.jws2.MsaWSClient;
 import jalview.ws.jws2.SequenceAnnotationWSClient;
 import jalview.ws.params.ParamDatastoreI;
+import jalview.ws.params.ParamManager;
 
 import java.io.Closeable;
 
@@ -39,7 +40,7 @@ import compbio.data.msa.SequenceAnnotation;
 import compbio.metadata.PresetManager;
 import compbio.metadata.RunnerConfig;
 
-public class Jws2Instance extends UIinfo
+public class Jws2Instance extends ServiceWithParameters
 {
 
   public JABAService service;
@@ -149,6 +150,7 @@ public class Jws2Instance extends UIinfo
     super.finalize();
   }
 
+  @Override
   public ParamDatastoreI getParamStore()
   {
     if (paramStore == null)
@@ -222,4 +224,19 @@ public class Jws2Instance extends UIinfo
   {
     return aaui;
   }
+
+  /**
+   * initialise a parameter store for this service
+   * 
+   * @param userParameterStore
+   *          - the user ParamManager (e.g. Desktop.getUserParameterStore() )
+   */
+  @Override
+  public void initParamStore(ParamManager userParameterStore)
+  {
+    if (paramStore == null)
+    {
+      paramStore = new JabaParamStore(this, userParameterStore);
+    }
+  }
 }