JAL-591
[jalview.git] / src / jalview / ws / jws2 / Jws2Discoverer.java
index eccbdaf..2ef9cfd 100644 (file)
@@ -23,6 +23,7 @@ import org.apache.log4j.Level;
 import jalview.bin.Cache;
 import jalview.datamodel.AlignmentView;
 import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
 import jalview.ws.WSMenuEntryProviderI;
 import jalview.ws.params.ParamDatastoreI;
 import compbio.data.msa.MsaWS;
@@ -182,7 +183,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
 
     PresetManager presets = null;
 
-    public JabaParamStore paramStore=null;
+    public JabaParamStore paramStore = null;
 
     /**
      * non thread safe - gets the presets for this service (blocks whilst it
@@ -260,14 +261,24 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     {
       if (paramStore == null)
       {
-        try {
-        paramStore = new JabaParamStore(this);
+        try
+        {
+          paramStore = new JabaParamStore(this,
+                  (Desktop.instance != null ? Desktop
+                          .getUserParameterStore() : null));
         } catch (Exception ex)
-        {}
-        
+        {
+        }
+
       }
       return paramStore;
     }
+
+    public String getUri()
+    {
+      // this is only valid for Jaba 1.0 - this formula might have to change!
+      return hosturl+"/"+serviceType;
+    }
   };
 
   /**
@@ -307,8 +318,10 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
   {
     // dynamically regenerate service list.
     final JMenu jws2al = new JMenu("JABA Alignment");
-    jws2al.addMenuListener(new MenuListener() {
-      // TODO: future: add menu listener to parent menu - so submenus are populated *before* they are selected.
+    jws2al.addMenuListener(new MenuListener()
+    {
+      // TODO: future: add menu listener to parent menu - so submenus are
+      // populated *before* they are selected.
       @Override
       public void menuSelected(MenuEvent e)
       {
@@ -319,19 +332,20 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
       public void menuDeselected(MenuEvent e)
       {
         // TODO Auto-generated method stub
-        
+
       }
 
       @Override
       public void menuCanceled(MenuEvent e)
       {
         // TODO Auto-generated method stub
-        
+
       }
-      
+
     });
     wsmenu.add(jws2al);
   }
+
   private void populateWSMenuEntry(JMenu jws2al, final AlignFrame alignFrame)
   {
     if (running || services == null || services.size() == 0)
@@ -524,22 +538,23 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
 
   /**
    * test the given URL with the JabaWS test code
+   * 
    * @param foo
    * @return
    */
   public static boolean testServiceUrl(URL foo)
   {
-    try {
-      compbio.ws.client.WSTester.main(new String[] { "-h="+foo.toString()});
+    try
+    {
+      compbio.ws.client.WSTester.main(new String[]
+      { "-h=" + foo.toString() });
     } catch (Exception e)
     {
       return false;
-    }
-    catch (OutOfMemoryError e)
+    } catch (OutOfMemoryError e)
     {
       return false;
-    }
-    catch (Error e)
+    } catch (Error e)
     {
       return false;
     }