added SeqSearch service interface. Documented and refactored web service client ...
[jalview.git] / src / jalview / ws / Discoverer.java
index 02028b4..8aea33d 100755 (executable)
@@ -380,4 +380,41 @@ public class Discoverer
     };
     discoverThread.start();
   }
+  /**
+   * binding service abstract name to handler class
+   */
+  private static Hashtable serviceClientBindings;
+  public static WSClient getServiceClient(ServiceHandle sh)
+  {
+    if (serviceClientBindings==null)
+    {
+      // get a list from Config or create below
+      serviceClientBindings = new Hashtable();
+      serviceClientBindings.put("MsaWS",new MsaWSClient());
+      serviceClientBindings.put("SecStrPred",new JPredClient());
+      serviceClientBindings.put("SeqSearch",new SeqSearchWSClient());
+    }
+    WSClient instance = (WSClient) serviceClientBindings.get(sh.getAbstractName());
+    if (instance==null)
+    {
+      System.err.println("WARNING - POSSIBLE IMPLEMENTATION ERROR - cannot find WSClient implementation for "+sh.getAbstractName());
+    } else
+    {
+      instance.serviceHandle = sh;
+    }
+    return instance;
+  }
+  /**
+   * notes on discovery service
+   * 1. need to allow multiple discovery source urls.
+   * 2. user interface to add/control list of urls in preferences
+   * notes on wsclient discovery
+   * 1. need a classpath property with list of additional plugin directories
+   * 2. optional config to cite specific bindings between class name and Abstract service name.
+   * 3. precedence for automatic discovery by using getAbstractName for WSClient - user added plugins override default plugins ?
+   * notes on wsclient gui
+   * code for gui attachment now moved to wsclient implementation. Needs more abstraction but approach seems to work.
+   * is it possible to 'generalise' the data retrieval calls further ? current methods are very specific (gatherForMSA or gatherForSeqOrMsaSecStrPred), new methods for conservation (group or alignment), treecalc (aligned profile), seqannot (sequences selected from dataset, annotation back to dataset).
+   *  
+   */
 }