sequence db fetcher and db reference validation/annotation transfer
[jalview.git] / src / jalview / ws / seqfetcher / DbSourceProxy.java
1 package jalview.ws.seqfetcher;\r
2 \r
3 import jalview.datamodel.AlignmentI;\r
4 \r
5 import java.util.Hashtable;\r
6 \r
7 import com.stevesoft.pat.Regex;\r
8 /**\r
9  * generic Reference Retrieval interface for a particular database source/version as cited in DBRefEntry.\r
10  * TODO: add/define property to describe max number of queries that this source can cope with at once.\r
11  * TODO: add/define mechanism for retrieval of Trees and distance matrices from a database (unify with io)\r
12  * @author JimP\r
13  *\r
14  */\r
15 public interface DbSourceProxy\r
16 {\r
17   /**\r
18    * \r
19    * @return source string constant used for this DB source\r
20    */\r
21   public String getDbSource();\r
22   /**\r
23    * Short meaningful name for this data source for\r
24    * display in menus or selection boxes. \r
25    * @return String\r
26    */\r
27   public String getDbName();\r
28   /**\r
29    * \r
30    * @return version string for this database.\r
31    */\r
32   public String getDbVersion();\r
33   /**\r
34    * Separator between individual accession queries for a database that allows multiple IDs\r
35    * to be fetched in a single query. Null implies that only a single ID can be fetched at a time.\r
36    * @return string for separating concatenated queries (as individually validated by the accession validator)\r
37    */\r
38   public String getAccessionSeparator();\r
39   /**\r
40    * Regular expression for checking form of query string understood by this source.\r
41    * @return null or a validation regex\r
42    */\r
43   public Regex getAccessionValidator();\r
44   /**\r
45    * DbSource properties hash - define the capabilities of this source\r
46    * Property hash methods defined in DbSourceProxyImpl.\r
47    * See constants in jalview.datamodel.DBRefSource for definition of properties.\r
48    * @return \r
49    */\r
50   public Hashtable getDbSourceProperties();\r
51   /**\r
52    * \r
53    * @return a test/example query that can be used to validate retrieval and parsing mechanisms\r
54    */\r
55   public String getTestQuery();\r
56   /**\r
57    * optionally implemented\r
58    * @param accession\r
59    * @return\r
60    */\r
61   public boolean isValidReference(String accession);\r
62   /**\r
63    * make one or more queries to the database\r
64    * and attempt to parse the response into an alignment\r
65    * @param queries\r
66    * @return null if queries were successful but result was not parsable\r
67    * @throws Exception TODO\r
68    */\r
69   public AlignmentI getSequenceRecords(String queries) throws Exception;\r
70   /**\r
71    * \r
72    * @return true if a query is currently being made\r
73    */\r
74   public boolean queryInProgress();\r
75   /**\r
76    * get the raw reponse from the last set of queries\r
77    * @return one or more string buffers for each individual query\r
78    */\r
79   public StringBuffer getRawRecords();\r
80 }\r