JAL-3446 from JAL-3253 Discoverers
[jalview.git] / src / jalview / ws / rest / RestClient.java
index 08f137d..eea6474 100644 (file)
@@ -20,6 +20,8 @@
  */
 package jalview.ws.rest;
 
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
 import jalview.bin.Cache;
 import jalview.datamodel.AlignmentView;
 import jalview.gui.AlignFrame;
@@ -49,8 +51,20 @@ import javax.swing.event.MenuListener;
  * 
  */
 public class RestClient extends WSClient
-        implements WSClientI, WSMenuEntryProviderI
+implements WSClientI, WSMenuEntryProviderI, ApplicationSingletonI
 {
+
+private static RestClient getInstance()
+{
+return (RestClient) ApplicationSingletonProvider.getInstance(RestClient.class);
+}
+
+public static final String RSBS_SERVICES = "RSBS_SERVICES";
+
+
+  protected Vector<String> services = null;
+
+
   RestServiceDescription service;
 
   public RestClient(RestServiceDescription rsd)
@@ -399,12 +413,13 @@ public class RestClient extends WSClient
     return true;
   }
 
-  protected static Vector<String> services = null;
-
-  public static final String RSBS_SERVICES = "RSBS_SERVICES";
-
   public static RestClient[] getRestClients()
   {
+    return getInstance().getClients();
+  }
+    
+  private RestClient[] getClients()
+  {
     if (services == null)
     {
       services = new Vector<String>();
@@ -458,10 +473,11 @@ public class RestClient extends WSClient
   {
     if (rsbsUrls != null)
     {
+      
       // TODO: consider validating services ?
-      services = new Vector<String>(rsbsUrls);
+      getInstance().services = new Vector<String>(rsbsUrls);
       StringBuffer sprop = new StringBuffer();
-      for (String s : services)
+      for (String s : getInstance().services)
       {
         sprop.append(s);
       }