revised version of Jdas with simpler connectionPropertyProviderI provider interface...
[jalview.git] / src / jalview / ws / dbsources / das / datamodel / DasSourceRegistry.java
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;
   }
 
 }