JAL-1925 update source version in license
[jalview.git] / src / jalview / ws / seqfetcher / DbSourceProxyImpl.java
index 549a5f4..47cf1ff 100644 (file)
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)\r
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview 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 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE.  See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.seqfetcher;\r
-\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.DBRefSource;\r
-import jalview.io.FormatAdapter;\r
-import jalview.io.IdentifyFile;\r
-\r
-import java.util.Hashtable;\r
-\r
-/**\r
- * common methods for implementations of the DbSourceProxy interface.\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public abstract class DbSourceProxyImpl implements DbSourceProxy\r
-{\r
-  public DbSourceProxyImpl()\r
-  {\r
-    // default constructor - do nothing probably.\r
-  }\r
-\r
-  private Hashtable props = null;\r
-\r
-  /*\r
-   * (non-Javadoc)\r
-   * \r
-   * @see jalview.ws.DbSourceProxy#getDbSourceProperties()\r
-   */\r
-  public Hashtable getDbSourceProperties()\r
-  {\r
-    if (props == null)\r
-    {\r
-      props = new Hashtable();\r
-    }\r
-    return props;\r
-  }\r
-\r
-  protected void addDbSourceProperty(Object propname)\r
-  {\r
-    addDbSourceProperty(propname, propname);\r
-  }\r
-\r
-  protected void addDbSourceProperty(Object propname, Object propvalue)\r
-  {\r
-    if (props == null)\r
-    {\r
-      props = new Hashtable();\r
-    }\r
-    props.put(propname, propvalue);\r
-  }\r
-\r
-  boolean queryInProgress = false;\r
-\r
-  protected StringBuffer results = null;\r
-\r
-  /*\r
-   * (non-Javadoc)\r
-   * \r
-   * @see jalview.ws.DbSourceProxy#getRawRecords()\r
-   */\r
-  public StringBuffer getRawRecords()\r
-  {\r
-    return results;\r
-  }\r
-\r
-  /*\r
-   * (non-Javadoc)\r
-   * \r
-   * @see jalview.ws.DbSourceProxy#queryInProgress()\r
-   */\r
-  public boolean queryInProgress()\r
-  {\r
-    return queryInProgress;\r
-  }\r
-\r
-  /**\r
-   * call to set the queryInProgress flag\r
-   * \r
-   */\r
-  protected void startQuery()\r
-  {\r
-    queryInProgress = true;\r
-  }\r
-\r
-  /**\r
-   * call to clear the queryInProgress flag\r
-   * \r
-   */\r
-  protected void stopQuery()\r
-  {\r
-    queryInProgress = false;\r
-  }\r
-\r
-  /**\r
-   * create an alignment from raw text file...\r
-   * \r
-   * @param result\r
-   * @return null or a valid alignment\r
-   * @throws Exception\r
-   */\r
-  protected Alignment parseResult(String result) throws Exception\r
-  {\r
-    Alignment sequences = null;\r
-    String format = new IdentifyFile().Identify(result, "Paste");\r
-    if (FormatAdapter.isValidFormat(format))\r
-    {\r
-      sequences = new FormatAdapter().readFile(result.toString(), "Paste",\r
-              format);\r
-    }\r
-    return sequences;\r
-  }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
+ * Copyright (C) 2015 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.
+ *  
+ * 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/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.ws.seqfetcher;
+
+import jalview.datamodel.AlignmentI;
+import jalview.io.FormatAdapter;
+import jalview.io.IdentifyFile;
+
+import java.util.Hashtable;
+
+/**
+ * common methods for implementations of the DbSourceProxy interface.
+ * 
+ * @author JimP
+ * 
+ */
+public abstract class DbSourceProxyImpl implements DbSourceProxy
+{
+  public DbSourceProxyImpl()
+  {
+    // default constructor - do nothing probably.
+  }
+
+  private Hashtable props = null;
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see jalview.ws.DbSourceProxy#getDbSourceProperties()
+   */
+  public Hashtable getDbSourceProperties()
+  {
+    if (props == null)
+    {
+      props = new Hashtable();
+    }
+    return props;
+  }
+
+  protected void addDbSourceProperty(Object propname)
+  {
+    addDbSourceProperty(propname, propname);
+  }
+
+  protected void addDbSourceProperty(Object propname, Object propvalue)
+  {
+    if (props == null)
+    {
+      props = new Hashtable();
+    }
+    props.put(propname, propvalue);
+  }
+
+  boolean queryInProgress = false;
+
+  protected StringBuffer results = null;
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see jalview.ws.DbSourceProxy#getRawRecords()
+   */
+  public StringBuffer getRawRecords()
+  {
+    return results;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see jalview.ws.DbSourceProxy#queryInProgress()
+   */
+  public boolean queryInProgress()
+  {
+    return queryInProgress;
+  }
+
+  /**
+   * call to set the queryInProgress flag
+   * 
+   */
+  protected void startQuery()
+  {
+    queryInProgress = true;
+  }
+
+  /**
+   * call to clear the queryInProgress flag
+   * 
+   */
+  protected void stopQuery()
+  {
+    queryInProgress = false;
+  }
+
+  /**
+   * create an alignment from raw text file...
+   * 
+   * @param result
+   * @return null or a valid alignment
+   * @throws Exception
+   */
+  protected AlignmentI parseResult(String result) throws Exception
+  {
+    AlignmentI sequences = null;
+    String format = new IdentifyFile().Identify(result, "Paste");
+    if (FormatAdapter.isValidFormat(format))
+    {
+      sequences = new FormatAdapter().readFile(result.toString(), "Paste",
+              format);
+    }
+    return sequences;
+  }
+
+  @Override
+  public boolean isA(Object dbsourceproperty)
+  {
+    assert (dbsourceproperty != null);
+    return (props == null) ? false : props.containsKey(dbsourceproperty);
+  }
+
+}