31081944b8d94394d50253a65224b3ceda35b3ab
[jalview.git] / src / jalview / ext / ensembl / EnsemblInfo.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.ext.ensembl;
22
23 /**
24  * A data class to model the data and rest version of one Ensembl domain,
25  * currently for rest.ensembl.org and rest.ensemblgenomes.org
26  * 
27  * @author gmcarstairs
28  */
29 class EnsemblInfo
30 {
31   /*
32    * The http domain this object is holding data values for
33    */
34   String domain;
35
36   /*
37    * The latest version Jalview has tested for, e.g. "4.5"; a minor version change should be
38    * ok, a major version change may break stuff 
39    */
40   String expectedRestVersion;
41
42   /*
43    * Major / minor / point version e.g. "4.5.1"
44    * @see http://rest.ensembl.org/info/rest/?content-type=application/json
45    */
46   String restVersion;
47
48   /*
49    * data version
50    * @see http://rest.ensembl.org/info/data/?content-type=application/json
51    */
52   String dataVersion;
53
54   /*
55    * true when http://rest.ensembl.org/info/ping/?content-type=application/json
56    * returns response code 200 and not {"error":"Database is unavailable"}
57    */
58   boolean restAvailable;
59
60   /*
61    * absolute time when availability was last checked
62    */
63   long lastAvailableCheckTime;
64
65   /*
66    * absolute time when version numbers were last checked
67    */
68   long lastVersionCheckTime;
69
70   // flag set to true if REST major version is not the one expected
71   boolean restMajorVersionMismatch;
72
73   /*
74    * absolute time to wait till if we overloaded the REST service
75    */
76   long retryAfter;
77
78   /**
79    * Constructor given expected REST version number e.g 4.5 or 3.4.3
80    * 
81    * @param restExpected
82    */
83   EnsemblInfo(String theDomain, String restExpected)
84   {
85     domain = theDomain;
86     expectedRestVersion = restExpected;
87     lastAvailableCheckTime = -1;
88     lastVersionCheckTime = -1;
89   }
90
91 }