From: jprocter Date: Thu, 31 Jul 2008 10:15:50 +0000 (+0000) Subject: refactored method for registering instance of a dbSource with the SequenceFetcher... X-Git-Tag: Release_2_4~75 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ff966589beea8e5a0571ce881ffe0d2b4e6da1c2;p=jalview.git refactored method for registering instance of a dbSource with the SequenceFetcher from the factory method for creating a dbSource instance --- diff --git a/src/jalview/ws/seqfetcher/ASequenceFetcher.java b/src/jalview/ws/seqfetcher/ASequenceFetcher.java index 9c2bfd4..c4f7e9a 100644 --- a/src/jalview/ws/seqfetcher/ASequenceFetcher.java +++ b/src/jalview/ws/seqfetcher/ASequenceFetcher.java @@ -215,6 +215,7 @@ public class ASequenceFetcher protected void addDBRefSourceImpl(Class dbSourceProxy) throws java.lang.IllegalArgumentException { + DbSourceProxy proxy = null; try { Object proxyObj = dbSourceProxy.getConstructor( @@ -225,15 +226,7 @@ public class ASequenceFetcher dbSourceProxy.toString() + " does not implement the jalview.ws.seqfetcher.DbSourceProxy"); } - DbSourceProxy proxy = (DbSourceProxy) proxyObj; - if (proxy != null) - { - if (FETCHABLEDBS == null) - { - FETCHABLEDBS = new Hashtable(); - } - FETCHABLEDBS.put(proxy.getDbSource(), proxy); - } + proxy = (DbSourceProxy) proxyObj; } catch (IllegalArgumentException e) { @@ -244,6 +237,22 @@ public class ASequenceFetcher // Serious problems if this happens. throw new Error("DBRefSource Implementation Exception", e); } + addDbRefSourceImpl(proxy); + } + /** + * add the properly initialised DbSourceProxy object 'proxy' to the list of sequence fetchers + * @param proxy + */ + protected void addDbRefSourceImpl(DbSourceProxy proxy) + { + if (proxy != null) + { + if (FETCHABLEDBS == null) + { + FETCHABLEDBS = new Hashtable(); + } + FETCHABLEDBS.put(proxy.getDbSource(), proxy); + } } } \ No newline at end of file