JAL-972 JAL-1084 propagate reference to local authentication provider so it can be...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 10 May 2012 16:14:26 +0000 (17:14 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 10 May 2012 16:14:26 +0000 (17:14 +0100)
src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java
src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java
src/jalview/ws/dbsources/das/datamodel/JalviewSource.java

index 7a78d8d..4f053aa 100644 (file)
@@ -25,8 +25,10 @@ import java.util.Map;
 import java.util.StringTokenizer;\r
 import java.util.Vector;\r
 \r
+import org.biodas.jdas.client.ConnectionPropertyProviderI;\r
 import org.biodas.jdas.client.SequenceClient;\r
 import org.biodas.jdas.client.adapters.sequence.DasSequenceAdapter;\r
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;\r
 import org.biodas.jdas.client.threads.SequenceClientMultipleSources;\r
 import org.biodas.jdas.schema.sequence.SEQUENCE;\r
 import org.biodas.jdas.schema.sources.COORDINATES;\r
@@ -65,7 +67,7 @@ public class DasSequenceSource extends DbSourceProxyImpl implements
   protected String dbname = "DASCS";\r
 \r
   protected String dbrefname = "das:source";\r
-\r
+  protected MultipleConnectionPropertyProviderI connprops=null;\r
   /**\r
    * create a new DbSource proxy for a DAS 1 source\r
    * \r
@@ -82,9 +84,9 @@ public class DasSequenceSource extends DbSourceProxyImpl implements
    *           if source is not capable of the 'sequence' command\r
    */\r
   public DasSequenceSource(String dbname, String dbrefname, SOURCE source,\r
-          VERSION version, COORDINATES coordsys) throws Exception\r
+          VERSION version, COORDINATES coordsys, MultipleConnectionPropertyProviderI connprops) throws Exception\r
   {\r
-    if (!(jsrc = new JalviewSource(source, false)).isSequenceSource())\r
+    if (!(jsrc = new JalviewSource(source, connprops, false)).isSequenceSource())\r
     {\r
       throw new Exception("Source " + source.getTitle()\r
               + " does not support the sequence command.");\r
@@ -93,6 +95,7 @@ public class DasSequenceSource extends DbSourceProxyImpl implements
     this.dbname = dbname;\r
     this.dbrefname = dbrefname;\r
     this.coordsys = coordsys;\r
+    this.connprops=connprops;\r
   }\r
 \r
   public String getAccessionSeparator()\r
@@ -149,8 +152,7 @@ public class DasSequenceSource extends DbSourceProxyImpl implements
           System.err\r
                   .println("Retrieving IDs individually from das source: "\r
                           + sr);\r
-          // todo : get conn property provider\r
-          org.biodas.jdas.client.SequenceClient sq = new SequenceClient();\r
+          org.biodas.jdas.client.SequenceClient sq = new SequenceClient(connprops.getConnectionPropertyProviderFor(sr));\r
           for (String q : toks)\r
           {\r
             List<String> qset = Arrays.asList(new String[]\r
index 2bc33b6..3ed597e 100644 (file)
@@ -83,7 +83,7 @@ public class DasSourceRegistry implements DasSourceRegistryI,
   private List<jalviewSourceI> 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<jalviewSourceI> getDASSources(String registryURL)
+  private static List<jalviewSourceI> 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<String, jalviewSourceI>();
     }
-    jalviewSourceI src = new JalviewSource(local, true);
+    jalviewSourceI src = new JalviewSource(local, this, true);
     localSources.put(local.getTitle(), src);
     return src;
   }
index c9caf6e..11bdf02 100644 (file)
@@ -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