X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=83bc810836d2870dc0d1ab4fecccfe2f90a92d42;hb=cf64def09a8b741483854ddd8c034d0aefff15b4;hp=dc5084347e9bc01cab00b33cf6a8a44479085053;hpb=f4766a7bbcfae845fc95923b01fa14ff83d589ff;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index dc50843..83bc810 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -28,8 +28,6 @@ import jalview.schemes.UserColourScheme; import jalview.structure.StructureImportSettings; import jalview.urls.IdOrgSettings; import jalview.util.ColorUtils; -import jalview.ws.dbsources.das.api.DasSourceRegistryI; -import jalview.ws.dbsources.das.datamodel.DasSourceRegistry; import jalview.ws.sifts.SiftsSettings; import java.awt.Color; @@ -281,7 +279,7 @@ public class Cache @Override public synchronized Enumeration keys() { - return Collections.enumeration(new TreeSet(super.keySet())); + return Collections.enumeration(new TreeSet<>(super.keySet())); } }; @@ -334,7 +332,10 @@ public class Cache } } - /** Called when Jalview is started */ + /** + * Loads properties from the given properties file. Any existing properties + * are first cleared. + */ public static void loadProperties(String propsFile) { propertiesFile = propsFile; @@ -369,6 +370,7 @@ public class Cache { fis = new FileInputStream(propertiesFile); } + applicationProperties.clear(); applicationProperties.load(fis); // remove any old build properties @@ -621,14 +623,14 @@ public class Cache * @param obj * String value of property * - * @return String value of property + * @return previous value of property (or null) */ - public static String setProperty(String key, String obj) + public static Object setProperty(String key, String obj) { - + Object oldValue = null; try { - applicationProperties.setProperty(key, obj); + oldValue = applicationProperties.setProperty(key, obj); if (!propsAreReadOnly) { FileOutputStream out = new FileOutputStream(propertiesFile); @@ -640,7 +642,7 @@ public class Cache System.out.println( "Error setting property: " + key + " " + obj + "\n" + ex); } - return obj; + return oldValue; } /** @@ -978,22 +980,6 @@ public class Cache return null; } - private static DasSourceRegistryI sourceRegistry = null; - - /** - * initialise and .. - * - * @return instance of the das source registry - */ - public static DasSourceRegistryI getDasSourceRegistry() - { - if (sourceRegistry == null) - { - sourceRegistry = new DasSourceRegistry(); - } - return sourceRegistry; - } - /** * Set the specified value, or remove it if null or empty. Does not save the * properties file.