refactored method for registering instance of a dbSource with the SequenceFetcher...
[jalview.git] / src / jalview / ws / seqfetcher / ASequenceFetcher.java
index 9c2bfd4..c4f7e9a 100644 (file)
@@ -215,6 +215,7 @@ public class ASequenceFetcher
   protected void addDBRefSourceImpl(Class dbSourceProxy)\r
           throws java.lang.IllegalArgumentException\r
   {\r
+    DbSourceProxy proxy = null; \r
     try\r
     {\r
       Object proxyObj = dbSourceProxy.getConstructor(\r
@@ -225,15 +226,7 @@ public class ASequenceFetcher
                 dbSourceProxy.toString()\r
                         + " does not implement the jalview.ws.seqfetcher.DbSourceProxy");\r
       }\r
-      DbSourceProxy proxy = (DbSourceProxy) proxyObj; \r
-      if (proxy != null)\r
-      {\r
-        if (FETCHABLEDBS == null)\r
-        {\r
-          FETCHABLEDBS = new Hashtable();\r
-        }\r
-        FETCHABLEDBS.put(proxy.getDbSource(), proxy);\r
-      }\r
+      proxy = (DbSourceProxy) proxyObj;\r
     } \r
     catch (IllegalArgumentException e)\r
     {\r
@@ -244,6 +237,22 @@ public class ASequenceFetcher
       // Serious problems if this happens.\r
       throw new Error("DBRefSource Implementation Exception", e);\r
     }\r
+    addDbRefSourceImpl(proxy);\r
+  }\r
+  /**\r
+   * add the properly initialised DbSourceProxy object 'proxy' to the list of sequence fetchers\r
+   * @param proxy\r
+   */\r
+  protected void addDbRefSourceImpl(DbSourceProxy proxy)\r
+  {\r
+    if (proxy != null)\r
+    {\r
+      if (FETCHABLEDBS == null)\r
+      {\r
+        FETCHABLEDBS = new Hashtable();\r
+      }\r
+      FETCHABLEDBS.put(proxy.getDbSource(), proxy);\r
+    }\r
   }\r
 \r
 }
\ No newline at end of file