From 0d79fdf165b3aa194d179e502b9f3c8e635ecd65 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 7 Feb 2005 17:06:17 +0000 Subject: [PATCH] Properties added --- src/jalview/bin/Cache.java | 83 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 15 deletions(-) diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index b054bc3..a5231e1 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -1,15 +1,68 @@ -/******************** - * 2004 Jalview Reengineered - * Barton Group - * Dundee University - * - * AM Waterhouse - *******************/ - - -package jalview.bin; - -public class Cache -{ - public static String LAST_DIRECTORY = "."; -} +/******************** + * 2004 Jalview Reengineered + * Barton Group + * Dundee University + * + * AM Waterhouse + *******************/ + + +package jalview.bin; +import java.util.*; +import java.io.*; + +public class Cache +{ + public static Properties applicationProperties; + // Current properties include: + // + // LAST_DIRECTORY , use this to cache record of where the user looked to find a file + // UNIPROT_CACHE + + public static void loadProperties() + { + applicationProperties = new Properties(); + + try + { + FileInputStream in = new FileInputStream(System.getProperty("user.home") + + "/.jalview_properties"); + applicationProperties = new Properties(); + applicationProperties.load(in); + in.close(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + + } + + public static String getProperty(String key) + { + return applicationProperties.getProperty(key); + } + + public static void setProperty(String key, String obj) + { + try + { + FileOutputStream out = new FileOutputStream(System.getProperty( + "user.home") + "/.jalview_properties"); + + applicationProperties.setProperty(key, obj); + + applicationProperties.store(out, "---JalviewX Properties File---"); + out.close(); + } + catch (Exception ex) + {} + + } + + + + + +} -- 1.7.10.2