JAL-2808 don't capture or report min-max for mixed text/numeric attribute
[jalview.git] / src / jalview / ws / dbsources / das / datamodel / DasSourceRegistry.java
index 761bcc8..de7f380 100644 (file)
@@ -1,22 +1,29 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
  *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' 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;
@@ -36,15 +43,11 @@ 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;
-
 /**
  *
  */
-public class DasSourceRegistry implements DasSourceRegistryI,
-        MultipleConnectionPropertyProviderI
+public class DasSourceRegistry
+        implements DasSourceRegistryI, MultipleConnectionPropertyProviderI
 {
   // private org.biodas.jdas.schema.sources.SOURCE[] dasSources = null;
   private List<jalviewSourceI> dasSources = null;
@@ -53,7 +56,8 @@ public class DasSourceRegistry implements DasSourceRegistryI,
 
   private Hashtable<String, jalviewSourceI> localSources = null;
 
-  public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das/";
+  // public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das/";
+  public static String DEFAULT_REGISTRY = "http://www.ebi.ac.uk/das-srv/registry/das/";
 
   /**
    * true if thread is running and we are talking to DAS registry service
@@ -65,6 +69,7 @@ public class DasSourceRegistry implements DasSourceRegistryI,
     return loadingDasSources;
   }
 
+  @Override
   public String getDasRegistryURL()
   {
     String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
@@ -79,8 +84,7 @@ public class DasSourceRegistry implements DasSourceRegistryI,
     if (registry.lastIndexOf("sources.xml") == registry.length() - 11)
     {
       // no trailing sources.xml document for registry in JDAS
-      jalview.bin.Cache.setProperty(
-              jalview.bin.Cache.DAS_REGISTRY_URL,
+      jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
               registry = registry.substring(0,
                       registry.lastIndexOf("sources.xml")));
     }
@@ -133,8 +137,8 @@ public class DasSourceRegistry implements DasSourceRegistryI,
           }
           else
           {
-            System.out.println("Debug: Ignored older source "
-                    + jsrc.getTitle());
+            System.out.println(
+                    "Debug: Ignored older source " + jsrc.getTitle());
           }
         }
         else
@@ -146,9 +150,8 @@ public class DasSourceRegistry implements DasSourceRegistryI,
       return dsrc;
     } catch (Exception ex)
     {
-      System.err.println("Failed to contact DAS1 registry at "
-              + registryURL);
-      ex.printStackTrace();
+      System.out.println(
+              "DAS1 registry at " + registryURL + " no longer exists");
       return new ArrayList<jalviewSourceI>();
     }
   }
@@ -189,8 +192,8 @@ public class DasSourceRegistry implements DasSourceRegistryI,
           int bar = token.indexOf("|");
           if (bar == -1)
           {
-            System.err
-                    .println("Warning: DAS user local source appears to have no nickname (expected a '|' followed by nickname)\nOffending definition: '"
+            System.err.println(
+                    "Warning: DAS user local source appears to have no nickname (expected a '|' followed by nickname)\nOffending definition: '"
                             + token + "'");
           }
           String url = token.substring(bar + 1);
@@ -214,8 +217,8 @@ public class DasSourceRegistry implements DasSourceRegistryI,
             }
           } catch (Exception q)
           {
-            System.err
-                    .println("Unexpected exception when creating local source from '"
+            System.err.println(
+                    "Unexpected exception when creating local source from '"
                             + token + "'");
             q.printStackTrace();
           }
@@ -255,8 +258,8 @@ public class DasSourceRegistry implements DasSourceRegistryI,
   }
 
   /*
- * 
- */
+  * 
+  */
 
   @Override
   public jalviewSourceI createLocalSource(String url, String name,
@@ -369,8 +372,7 @@ public class DasSourceRegistry implements DasSourceRegistryI,
       {
         String token = en.nextElement().toString();
         jalviewSourceI srco = localSources.get(token);
-        sb.append(token + "|"
-                + (srco.isSequenceSource() ? "sequence:" : "")
+        sb.append(token + "|" + (srco.isSequenceSource() ? "sequence:" : "")
                 + srco.getUri() + "\t");
       }
       return sb.toString();
@@ -386,8 +388,8 @@ public class DasSourceRegistry implements DasSourceRegistryI,
     try
     {
       // TODO: allow same credentials for https and http
-      authStash.put(new URL(
-              "http://www.compbio.dundee.ac.uk/geneweb/das/myseq/"),
+      authStash.put(
+              new URL("http://www.compbio.dundee.ac.uk/geneweb/das/myseq/"),
               "Basic SmltOm1pSg==");
     } catch (MalformedURLException e)
     {