X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Ffts%2Fservice%2Fpdb%2FPDBFTSRestClient.java;h=8e929e784496c160f9570f8cd4bbed0d05f1ad03;hb=53b2ec17b88081e402f60deab2723750bc4867d1;hp=0e203382b485da15fa85c480c8f110e733ae2708;hpb=83a7efc57926ebf046f95de5291eb439563eb953;p=jalview.git diff --git a/src/jalview/fts/service/pdb/PDBFTSRestClient.java b/src/jalview/fts/service/pdb/PDBFTSRestClient.java index 0e20338..8e929e7 100644 --- a/src/jalview/fts/service/pdb/PDBFTSRestClient.java +++ b/src/jalview/fts/service/pdb/PDBFTSRestClient.java @@ -20,6 +20,7 @@ */ package jalview.fts.service.pdb; +import jalview.bin.Instance; import jalview.datamodel.SequenceI; import jalview.fts.api.FTSData; import jalview.fts.api.FTSDataColumnI; @@ -56,12 +57,19 @@ import com.sun.jersey.api.client.config.DefaultClientConfig; public class PDBFTSRestClient extends FTSRestClient { - private static FTSRestClientI instance = null; + public static FTSRestClientI getInstance() + { + Instance j = Instance.getInstance(); + return (j.pdbFTSRestClient == null + ? j.pdbFTSRestClient = new PDBFTSRestClient() + : j.pdbFTSRestClient); + } public static final String PDB_SEARCH_ENDPOINT = "https://www.ebi.ac.uk/pdbe/search/pdb/select?"; - protected PDBFTSRestClient() + private PDBFTSRestClient() { + // singleton } /** @@ -175,7 +183,7 @@ public class PDBFTSRestClient extends FTSRestClient // Get the JSON string from the response object or directly from the // client (JavaScript) - Map jsonObj = (status == 200 + Map jsonObj = (Platform.isJS() && status == 200 ? clientResponse.getEntity(Map.class) : null); String responseString = (jsonObj == null @@ -459,15 +467,6 @@ public static String parseJsonExceptionString(String jsonErrorResponse) return "/fts/pdb_data_columns.txt"; } - public static FTSRestClientI getInstance() - { - if (instance == null) - { - instance = new PDBFTSRestClient(); - } - return instance; - } - private Collection allDefaultDisplayedStructureDataColumns; public Collection getAllDefaultDisplayedStructureDataColumns()