From e24d9e7304d6e1e78dfb8c21a4dce70c96eaf391 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 30 Aug 2011 13:58:50 +0100 Subject: [PATCH] JAL-715 store/reset .jalview_properties setting for RSBS service list --- src/jalview/ws/rest/RestClient.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/jalview/ws/rest/RestClient.java b/src/jalview/ws/rest/RestClient.java index ee23790..0d56e87 100644 --- a/src/jalview/ws/rest/RestClient.java +++ b/src/jalview/ws/rest/RestClient.java @@ -15,6 +15,7 @@ import javax.swing.JOptionPane; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; +import jalview.bin.Cache; import jalview.datamodel.AlignmentView; import jalview.gui.AlignFrame; import jalview.gui.AlignViewport; @@ -343,13 +344,14 @@ public class RestClient extends WSClient implements WSClientI, } protected static Vector services=null; + public static final String RSBS_SERVICES="RSBS_SERVICES"; public static RestClient[] getRestClients() { if (services==null) { services = new Vector(); try { - for (RestServiceDescription descr: RestServiceDescription.parseDescriptions(jalview.bin.Cache.getDefault("RSBS_SERVICES",makeShmmrRestClient().service.toString()))) + for (RestServiceDescription descr: RestServiceDescription.parseDescriptions(jalview.bin.Cache.getDefault(RSBS_SERVICES,makeShmmrRestClient().service.toString()))) { services.add(descr.toString()); } @@ -412,8 +414,21 @@ public class RestClient extends WSClient implements WSClientI, public static void setRsbsServices(Vector rsbsUrls) { - // TODO: consider validating services ? - services = new Vector(rsbsUrls); + if (rsbsUrls!=null) + { + // TODO: consider validating services ? + services = new Vector(rsbsUrls); + StringBuffer sprop = new StringBuffer(); + for (String s:services) + { + sprop.append(s); + } + Cache.setProperty(RSBS_SERVICES, sprop.toString()); + } + else + { + Cache.removeProperty(RSBS_SERVICES); + } } } -- 1.7.10.2