X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fseqfetcher%2FDbSourceProxyImpl.java;h=6c612820839b26fb15bef44e93ee633812be05cf;hb=2763845dada91cdfe266200cf852146c70392ad7;hp=21272bebfad1cca641625286cbd7f2a1ecb7557a;hpb=6b406c397d41a0f2d84b75f13e7ab478932bf57d;p=jalview.git diff --git a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java index 21272be..6c61282 100644 --- a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java +++ b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java @@ -1,3 +1,21 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) + * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ package jalview.ws.seqfetcher; import jalview.datamodel.Alignment; @@ -11,7 +29,7 @@ import java.util.Hashtable; * common methods for implementations of the DbSourceProxy interface. * * @author JimP - * + * */ public abstract class DbSourceProxyImpl implements DbSourceProxy { @@ -19,14 +37,23 @@ public abstract class DbSourceProxyImpl implements DbSourceProxy { // default constructor - do nothing probably. } - private Hashtable props=null; - /* (non-Javadoc) + + 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); @@ -34,14 +61,17 @@ public abstract class DbSourceProxyImpl implements DbSourceProxy protected void addDbSourceProperty(Object propname, Object propvalue) { - if (props==null) + if (props == null) { props = new Hashtable(); } props.put(propname, propvalue); } - boolean queryInProgress=false; + + boolean queryInProgress = false; + protected StringBuffer results = null; + /* * (non-Javadoc) * @@ -52,45 +82,51 @@ public abstract class DbSourceProxyImpl implements DbSourceProxy return results; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#queryInProgress() */ public boolean queryInProgress() { return queryInProgress; } + /** * call to set the queryInProgress flag - * + * */ protected void startQuery() { - queryInProgress=true; + queryInProgress = true; } + /** * call to clear the queryInProgress flag - * + * */ protected void stopQuery() { - queryInProgress=false; + queryInProgress = false; } /** * create an alignment from raw text file... + * * @param result * @return null or a valid alignment * @throws Exception */ - protected Alignment parseResult(String result) throws Exception { + protected Alignment parseResult(String result) throws Exception + { Alignment sequences = null; String format = new IdentifyFile().Identify(result, "Paste"); if (FormatAdapter.isValidFormat(format)) { sequences = new FormatAdapter().readFile(result.toString(), "Paste", - format); + format); } return sequences; } - + }