revised version of Jdas with simpler connectionPropertyProviderI provider interface...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 1 Mar 2012 11:04:45 +0000 (11:04 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 1 Mar 2012 11:04:45 +0000 (11:04 +0000)
lib/jdas-1.0.4.jar
src/jalview/ws/dbsources/das/api/DasSourceRegistryI.java
src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java

index 84cec39..8316f65 100644 (file)
Binary files a/lib/jdas-1.0.4.jar and b/lib/jdas-1.0.4.jar differ
index 187f436..b745519 100644 (file)
@@ -5,6 +5,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.biodas.jdas.client.ConnectionPropertyProviderI;
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
 import org.biodas.jdas.schema.sources.SOURCE;
 
 /**
@@ -31,5 +32,5 @@ public interface DasSourceRegistryI
 
   List<jalviewSourceI> resolveSourceNicknames(List<String> sources);
   // TODO: refactor to jDAS specific interface
-  Map<String,ConnectionPropertyProviderI> getSessionHandler();
+  MultipleConnectionPropertyProviderI getSessionHandler();
 }
index b17f7f2..cf78202 100644 (file)
@@ -22,6 +22,7 @@ import javax.swing.JOptionPane;
 import org.apache.http.auth.InvalidCredentialsException;
 import org.biodas.jdas.client.ConnectionPropertyProviderI;
 import org.biodas.jdas.client.SourcesClient;
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
 import org.biodas.jdas.dassources.Capabilities;
 import org.biodas.jdas.schema.sources.CAPABILITY;
 import org.biodas.jdas.schema.sources.SOURCE;
@@ -35,7 +36,8 @@ import jalview.ws.dbsources.das.api.jalviewSourceI;
 /**
  *
  */
-public class DasSourceRegistry implements DasSourceRegistryI
+public class DasSourceRegistry implements DasSourceRegistryI,
+        MultipleConnectionPropertyProviderI
 {
   // private org.biodas.jdas.schema.sources.SOURCE[] dasSources = null;
   private List<jalviewSourceI> dasSources = null;
@@ -326,8 +328,16 @@ public class DasSourceRegistry implements DasSourceRegistryI
   }
 
   @Override
-  public Map<String, ConnectionPropertyProviderI> getSessionHandler()
+  public MultipleConnectionPropertyProviderI getSessionHandler()
   {
+    return this;
+  }
+
+  @Override
+  public ConnectionPropertyProviderI getConnectionPropertyProviderFor(
+          String arg0)
+  {
+
     final ConnectionPropertyProviderI conprov = new ConnectionPropertyProviderI()
     {
       boolean authed = false;
@@ -380,8 +390,8 @@ public class DasSourceRegistry implements DasSourceRegistryI
           if (asuc != null && asuc.trim().length() > 0)
           {
             // authentication was successful
-            Cache.log.debug("Authenticated successfully as " + asuc
-                    + " with " + connection.getURL().toString());
+            Cache.log.debug("Authenticated successfully to "
+                    + connection.getURL().toString());
             return false;
           }
           // it wasn't - so we should tell the user it failed and ask if they
@@ -397,95 +407,7 @@ public class DasSourceRegistry implements DasSourceRegistryI
         }
       }
     };
-    return new Map<String, ConnectionPropertyProviderI>()
-    {
-
-      @Override
-      public void clear()
-      {
-        // TODO Auto-generated method stub
-
-      }
-
-      @Override
-      public boolean containsKey(Object key)
-      {
-        // TODO Auto-generated method stub
-        return false;
-      }
-
-      @Override
-      public boolean containsValue(Object value)
-      {
-        // TODO Auto-generated method stub
-        return false;
-      }
-
-      @Override
-      public Set<java.util.Map.Entry<String, ConnectionPropertyProviderI>> entrySet()
-      {
-        // TODO Auto-generated method stub
-        return null;
-      }
-
-      @Override
-      public ConnectionPropertyProviderI get(Object key)
-      {
-        return conprov;
-      }
-
-      @Override
-      public boolean isEmpty()
-      {
-        // TODO Auto-generated method stub
-        return false;
-      }
-
-      @Override
-      public Set<String> keySet()
-      {
-        // TODO Auto-generated method stub
-        return null;
-      }
-
-      @Override
-      public ConnectionPropertyProviderI put(String key,
-              ConnectionPropertyProviderI value)
-      {
-        // TODO Auto-generated method stub
-        return null;
-      }
-
-      @Override
-      public void putAll(
-              Map<? extends String, ? extends ConnectionPropertyProviderI> m)
-      {
-        // TODO Auto-generated method stub
-
-      }
-
-      @Override
-      public ConnectionPropertyProviderI remove(Object key)
-      {
-        // TODO Auto-generated method stub
-        return null;
-      }
-
-      @Override
-      public int size()
-      {
-        // TODO Auto-generated method stub
-        return 0;
-      }
-
-      @Override
-      public Collection<ConnectionPropertyProviderI> values()
-      {
-        // TODO Auto-generated method stub
-        return null;
-      }
-
-    };
+    return conprov;
   }
 
 }