+++ /dev/null
-package jalview.ws;\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
- private Hashtable props=null;\r
- /* (non-Javadoc)\r
- * @see jalview.ws.DbSourceProxy#getDbSourceProperties()\r
- */\r
- public Hashtable getDbSourceProperties()\r
- {\r
- return props;\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
- boolean queryInProgress=false;\r
- protected StringBuffer results = null;\r
- /*\r
- * (non-Javadoc)\r
- * \r
- * @see jalview.ws.DbSourceProxy#getRawRecords()\r
- */\r
- public StringBuffer getRawRecords()\r
- {\r
- return results;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see jalview.ws.DbSourceProxy#queryInProgress()\r
- */\r
- public boolean queryInProgress()\r
- {\r
- return queryInProgress;\r
- }\r
- /**\r
- * call to set the queryInProgress flag\r
- *\r
- */\r
- protected void startQuery()\r
- {\r
- queryInProgress=true;\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
- * @param result\r
- * @return null or a valid alignment\r
- * @throws Exception\r
- */\r
- protected Alignment parseResult(String result) throws Exception {\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