*/
package jalview.fts.service.pdb;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.datamodel.SequenceI;
import jalview.fts.api.FTSData;
import jalview.fts.api.FTSDataColumnI;
*
* @author tcnofoegbu
*/
-public class PDBFTSRestClient extends FTSRestClient
+public class PDBFTSRestClient extends FTSRestClient implements ApplicationSingletonI
{
-
- private static FTSRestClientI instance = null;
-
public static final String PDB_SEARCH_ENDPOINT = "https://www.ebi.ac.uk/pdbe/search/pdb/select?";
- protected PDBFTSRestClient()
+ public static FTSRestClientI getInstance()
+ {
+ return (FTSRestClientI) ApplicationSingletonProvider
+ .getInstance(PDBFTSRestClient.class);
+ }
+
+ private PDBFTSRestClient()
{
+ // singleton -- use getInstance()
}
/**
// Get the JSON string from the response object or directly from the
// client (JavaScript)
- Map<String, Object> jsonObj = (status == 200
+ Map<String, Object> jsonObj = (Platform.isJS() && status == 200
? clientResponse.getEntity(Map.class)
: null);
String responseString = (jsonObj == null
return "/fts/pdb_data_columns.txt";
}
- public static FTSRestClientI getInstance()
- {
- if (instance == null)
- {
- instance = new PDBFTSRestClient();
- }
- return instance;
- }
-
private Collection<FTSDataColumnI> allDefaultDisplayedStructureDataColumns;
public Collection<FTSDataColumnI> getAllDefaultDisplayedStructureDataColumns()
return allDefaultDisplayedStructureDataColumns;
}
- @SuppressWarnings("unchecked")
-public static void main(String[] args) {
-
-
- // check for transpiler fix associated with JSONParser yylex.java use of charAt()
- // instead of codePointAt()
-
- String s = "e";
- char c = 'c';
- char f = 'f';
- s += c | f;
- int x = c&f;
- int y = 2 & c;
- int z = c ^ 5;
- String result = s +x + y + z;
- assert (result == "e103982102");
- try
- {
- Map<String, Object> jsonObj = (Map<String, Object>) JSONUtils.parse("{\"a\":3}");
- System.out.println(jsonObj);
- } catch (ParseException e)
- {
- e.printStackTrace();
- }
-
- }
-
}