merge from 2_4_Release branch
[jalview.git] / src / jalview / ws / seqfetcher / ASequenceFetcher.java
index 0785ea2..8a8cf44 100644 (file)
@@ -1,3 +1,21 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * \r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * \r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.ws.seqfetcher;\r
 \r
 import jalview.datamodel.AlignmentI;\r
@@ -86,10 +104,10 @@ public class ASequenceFetcher
                   "Don't know how to fetch from this database :" + db);\r
         DbSourceProxy fetcher = getSourceProxy(db);\r
         boolean doMultiple = fetcher.getAccessionSeparator() != null; // No\r
-                                                                      // separator\r
-                                                                      // - no\r
-                                                                      // Multiple\r
-                                                                      // Queries\r
+        // separator\r
+        // - no\r
+        // Multiple\r
+        // Queries\r
         Enumeration qs = query.elements();\r
         while (qs.hasMoreElements())\r
         {\r
@@ -98,20 +116,22 @@ public class ASequenceFetcher
           {\r
             qsb.append((String) qs.nextElement());\r
             if (qs.hasMoreElements() && doMultiple) // and not reached limit for\r
-                                                    // multiple queries at one\r
-                                                    // time for this source\r
+            // multiple queries at one\r
+            // time for this source\r
             {\r
               qsb.append(fetcher.getAccessionSeparator());\r
             }\r
           } while (doMultiple && qs.hasMoreElements());\r
-          \r
-          AlignmentI seqset=null;\r
-          try {\r
+\r
+          AlignmentI seqset = null;\r
+          try\r
+          {\r
             // create a fetcher and go to it\r
             seqset = fetcher.getSequenceRecords(qsb.toString());\r
           } catch (Exception ex)\r
           {\r
-            System.err.println("Failed to retrieve the following from "+db);\r
+            System.err.println("Failed to retrieve the following from "\r
+                    + db);\r
             System.err.println(qsb);\r
             ex.printStackTrace(System.err);\r
           }\r
@@ -176,7 +196,7 @@ public class ASequenceFetcher
     {\r
       ret = new SequenceI[rseqs.size()];\r
       Enumeration sqs = rseqs.elements();\r
-      int si=0;\r
+      int si = 0;\r
       while (sqs.hasMoreElements())\r
       {\r
         SequenceI s = (SequenceI) sqs.nextElement();\r
@@ -191,8 +211,8 @@ public class ASequenceFetcher
    * Retrieve an instance of the proxy for the given source\r
    * \r
    * @param db\r
-   *          database source string TODO: add version string/wildcard for\r
-   *          retrieval of specific DB source/version combinations.\r
+   *                database source string TODO: add version string/wildcard for\r
+   *                retrieval of specific DB source/version combinations.\r
    * @return an instance of DbSourceProxy for that db.\r
    */\r
   public DbSourceProxy getSourceProxy(String db)\r
@@ -215,11 +235,11 @@ public class ASequenceFetcher
   protected void addDBRefSourceImpl(Class dbSourceProxy)\r
           throws java.lang.IllegalArgumentException\r
   {\r
-    DbSourceProxy proxy = null; \r
+    DbSourceProxy proxy = null;\r
     try\r
     {\r
-      Object proxyObj = dbSourceProxy.getConstructor(\r
-              null).newInstance(null);\r
+      Object proxyObj = dbSourceProxy.getConstructor(null)\r
+              .newInstance(null);\r
       if (!DbSourceProxy.class.isInstance(proxyObj))\r
       {\r
         throw new IllegalArgumentException(\r
@@ -227,20 +247,21 @@ public class ASequenceFetcher
                         + " does not implement the jalview.ws.seqfetcher.DbSourceProxy");\r
       }\r
       proxy = (DbSourceProxy) proxyObj;\r
-    } \r
-    catch (IllegalArgumentException e)\r
+    } catch (IllegalArgumentException e)\r
     {\r
       throw e;\r
-    }\r
-    catch (Exception e)\r
+    } catch (Exception e)\r
     {\r
       // Serious problems if this happens.\r
       throw new Error("DBRefSource Implementation Exception", e);\r
     }\r
     addDbRefSourceImpl(proxy);\r
   }\r
+\r
   /**\r
-   * add the properly initialised DbSourceProxy object 'proxy' to the list of sequence fetchers\r
+   * add the properly initialised DbSourceProxy object 'proxy' to the list of\r
+   * sequence fetchers\r
+   * \r
    * @param proxy\r
    */\r
   protected void addDbRefSourceImpl(DbSourceProxy proxy)\r
@@ -257,6 +278,7 @@ public class ASequenceFetcher
 \r
   /**\r
    * test if the database handler for dbName contains the given dbProperty\r
+   * \r
    * @param dbName\r
    * @param dbProperty\r
    * @return true if proxy has the given property\r
@@ -265,9 +287,9 @@ public class ASequenceFetcher
   {\r
     // TODO: decide if invalidDbName exception is thrown here.\r
     DbSourceProxy proxy = getSourceProxy(dbName);\r
-    if (proxy!=null)\r
+    if (proxy != null)\r
     {\r
-      if (proxy.getDbSourceProperties()!=null)\r
+      if (proxy.getDbSourceProperties() != null)\r
       {\r
         return proxy.getDbSourceProperties().containsKey(dbProperty);\r
       }\r
@@ -275,4 +297,4 @@ public class ASequenceFetcher
     return false;\r
   }\r
 \r
-}
\ No newline at end of file
+}\r