From: amwaterhouse Date: Mon, 7 Feb 2005 17:06:17 +0000 (+0000) Subject: Properties added X-Git-Tag: Release_2_0~698 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=0d79fdf165b3aa194d179e502b9f3c8e635ecd65;p=jalview.git Properties added --- 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) + {} + + } + + + + + +}