JAL-1727 patch to make EBI mirror the default server Release_2_8_2b1_Branch
authorJames Procter <jprocter@lifesci-29958.dyn.lifesci.dundee.ac.uk>
Mon, 11 May 2015 06:16:20 +0000 (07:16 +0100)
committerJames Procter <jprocter@lifesci-29958.dyn.lifesci.dundee.ac.uk>
Mon, 11 May 2015 06:16:20 +0000 (07:16 +0100)
src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java

index 88d9db1..9c12665 100644 (file)
  */
 package jalview.ws.dbsources.das.datamodel;
 
+import jalview.bin.Cache;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -39,10 +43,6 @@ import org.biodas.jdas.schema.sources.SOURCE;
 import org.biodas.jdas.schema.sources.SOURCES;
 import org.biodas.jdas.schema.sources.VERSION;
 
-import jalview.bin.Cache;
-import jalview.ws.dbsources.das.api.DasSourceRegistryI;
-import jalview.ws.dbsources.das.api.jalviewSourceI;
-
 /**
  *
  */
@@ -56,8 +56,11 @@ public class DasSourceRegistry implements DasSourceRegistryI,
 
   private Hashtable<String, jalviewSourceI> localSources = null;
 
-  public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das/";
+  // This is the EBI DAS registry archive - temporary fix
+  public static String DEFAULT_REGISTRY = "http://www.ebi.ac.uk/das-srv/registry/das";
 
+  private static String[] blackList = new String[]
+  { "http://www.dasregistry.org", "sanger.ac.uk/registry/das1/sources/" };
   /**
    * true if thread is running and we are talking to DAS registry service
    */
@@ -72,12 +75,16 @@ public class DasSourceRegistry implements DasSourceRegistryI,
   {
     String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
             DEFAULT_REGISTRY);
-
-    if (registry.indexOf("/registry/das1/sources/") > -1)
+    // replace and update old entries
+    for (String blacklisted : blackList)
     {
-      jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
-              DEFAULT_REGISTRY);
-      registry = DEFAULT_REGISTRY;
+      if (registry.indexOf(blacklisted) > -1)
+      {
+        jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
+                DEFAULT_REGISTRY);
+        registry = DEFAULT_REGISTRY;
+        break;
+      }
     }
     if (registry.lastIndexOf("sources.xml") == registry.length() - 11)
     {