From: jprocter Date: Thu, 10 May 2012 16:14:26 +0000 (+0100) Subject: JAL-972 JAL-1084 propagate reference to local authentication provider so it can be... X-Git-Tag: Jalview_2_9~532^2~11 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7526a82c54f0ef8434f826a1f2323ca5ec1eb3b1;p=jalview.git JAL-972 JAL-1084 propagate reference to local authentication provider so it can be passed to JDAS clients when querying sources. --- diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java index 7a78d8d..4f053aa 100644 --- a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java +++ b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java @@ -25,8 +25,10 @@ import java.util.Map; import java.util.StringTokenizer; import java.util.Vector; +import org.biodas.jdas.client.ConnectionPropertyProviderI; import org.biodas.jdas.client.SequenceClient; import org.biodas.jdas.client.adapters.sequence.DasSequenceAdapter; +import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI; import org.biodas.jdas.client.threads.SequenceClientMultipleSources; import org.biodas.jdas.schema.sequence.SEQUENCE; import org.biodas.jdas.schema.sources.COORDINATES; @@ -65,7 +67,7 @@ public class DasSequenceSource extends DbSourceProxyImpl implements protected String dbname = "DASCS"; protected String dbrefname = "das:source"; - + protected MultipleConnectionPropertyProviderI connprops=null; /** * create a new DbSource proxy for a DAS 1 source * @@ -82,9 +84,9 @@ public class DasSequenceSource extends DbSourceProxyImpl implements * if source is not capable of the 'sequence' command */ public DasSequenceSource(String dbname, String dbrefname, SOURCE source, - VERSION version, COORDINATES coordsys) throws Exception + VERSION version, COORDINATES coordsys, MultipleConnectionPropertyProviderI connprops) throws Exception { - if (!(jsrc = new JalviewSource(source, false)).isSequenceSource()) + if (!(jsrc = new JalviewSource(source, connprops, false)).isSequenceSource()) { throw new Exception("Source " + source.getTitle() + " does not support the sequence command."); @@ -93,6 +95,7 @@ public class DasSequenceSource extends DbSourceProxyImpl implements this.dbname = dbname; this.dbrefname = dbrefname; this.coordsys = coordsys; + this.connprops=connprops; } public String getAccessionSeparator() @@ -149,8 +152,7 @@ public class DasSequenceSource extends DbSourceProxyImpl implements System.err .println("Retrieving IDs individually from das source: " + sr); - // todo : get conn property provider - org.biodas.jdas.client.SequenceClient sq = new SequenceClient(); + org.biodas.jdas.client.SequenceClient sq = new SequenceClient(connprops.getConnectionPropertyProviderFor(sr)); for (String q : toks) { List qset = Arrays.asList(new String[] diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java b/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java index 2bc33b6..3ed597e 100644 --- a/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java +++ b/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java @@ -83,7 +83,7 @@ public class DasSourceRegistry implements DasSourceRegistryI, private List getDASSources() { - return getDASSources(getDasRegistryURL()); + return getDASSources(getDasRegistryURL(), this); } /** @@ -92,7 +92,7 @@ public class DasSourceRegistry implements DasSourceRegistryI, * @param registryURL * return sources from registryURL */ - private static List getDASSources(String registryURL) + private static List getDASSources(String registryURL, MultipleConnectionPropertyProviderI registry) { try { @@ -108,7 +108,7 @@ public class DasSourceRegistry implements DasSourceRegistryI, Integer latest; for (SOURCE src : dassources) { - JalviewSource jsrc=new JalviewSource(src, false); + JalviewSource jsrc=new JalviewSource(src, registry, false); latest=latests.get(jsrc.getSourceURL()); if (latest!=null) { @@ -223,7 +223,7 @@ public class DasSourceRegistry implements DasSourceRegistryI, { localSources = new Hashtable(); } - jalviewSourceI src = new JalviewSource(local, true); + jalviewSourceI src = new JalviewSource(local, this, true); localSources.put(local.getTitle(), src); return src; } diff --git a/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java b/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java index c9caf6e..11bdf02 100644 --- a/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java +++ b/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java @@ -7,6 +7,7 @@ import java.util.Hashtable; import java.util.List; import java.util.Map; +import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI; import org.biodas.jdas.dassources.Capabilities; import org.biodas.jdas.dassources.utils.DasTimeFormat; import org.biodas.jdas.dassources.utils.RegistrySourceAdapter; @@ -23,9 +24,10 @@ import jalview.ws.seqfetcher.DbSourceProxy; public class JalviewSource implements jalviewSourceI { SOURCE source; - - public JalviewSource(SOURCE local2, boolean local) + MultipleConnectionPropertyProviderI connprov; + public JalviewSource(SOURCE local2, MultipleConnectionPropertyProviderI connprov, boolean local) { + this.connprov=connprov; this.local = local; source = local2; } @@ -257,7 +259,7 @@ public class JalviewSource implements jalviewSourceI seqsources.add(ds = new DasSequenceSource(getTitle() + " (" + cs.getAuthority() + " " + cs.getSource() + (cs.getVersion() != null ? " " + cs.getVersion() : "") - + ")", cs.getAuthority(), source, v, cs)); + + ")", cs.getAuthority(), source, v, cs, connprov)); if (seqsources.size() > 1) { System.err.println("Added another sequence DB source for " @@ -277,7 +279,7 @@ public class JalviewSource implements jalviewSourceI try { seqsources.add(new DasSequenceSource(getTitle(), getTitle(), - source, getVersion(), null)); + source, getVersion(), null, connprov)); } catch (Exception e) { // TODO Auto-generated catch block