From ff966589beea8e5a0571ce881ffe0d2b4e6da1c2 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 31 Jul 2008 10:15:50 +0000 Subject: [PATCH] refactored method for registering instance of a dbSource with the SequenceFetcher from the factory method for creating a dbSource instance --- src/jalview/ws/seqfetcher/ASequenceFetcher.java | 27 +++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) 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 -- 1.7.10.2