1 /********************
\r
2 * 2004 Jalview Reengineered
\r
10 package jalview.bin;
\r
14 import java.util.jar.*;
\r
17 public static String VERSION = "ß test";
\r
18 public static String BUILD_DATE = "1-1-2005";
\r
20 public static Properties applicationProperties;
\r
21 // Current properties include:
\r
23 // LAST_DIRECTORY , use this to cache record of where the user looked to find a file
\r
25 // USER_DEFINED_COLOUR - file describing last user set colours
\r
29 // logs.Axis.Level - one of the stringified Levels for log4j controlling the logging level for axis (used for web services)
\r
31 public static void loadProperties()
\r
33 // get last build time.
\r
36 String localFile = Cache.class.getProtectionDomain().getCodeSource().getLocation().toString();
\r
37 localFile = localFile.concat("!/");
\r
38 String tmpString = "jar:";
\r
39 String localJarFileString = tmpString.concat(localFile);
\r
40 java.net.URL localJarFileURL = new java.net.URL(localJarFileString);
\r
41 java.net.JarURLConnection localJarFile = (java.net.JarURLConnection)localJarFileURL.openConnection();
\r
42 date = localJarFile.getLastModified();
\r
43 }catch(Exception ex){ex.printStackTrace();}
\r
46 // this is called for unpackaged class files.
\r
47 // not entirely accurate as it only tells you when Cache.class was last compiled
\r
48 java.net.URL url = Cache.class.getResource("/jalview/bin/Cache.class");
\r
49 java.io.File f = new java.io.File(url.getFile());
\r
50 date = f.lastModified();
\r
53 BUILD_DATE = new Date( date ).toString();
\r
57 applicationProperties = new Properties();
\r
61 FileInputStream in = new FileInputStream(System.getProperty("user.home") +
\r
62 "/.jalview_properties");
\r
63 applicationProperties = new Properties();
\r
64 applicationProperties.load(in);
\r
67 catch (Exception ex)
\r
71 public static String getProperty(String key)
\r
73 return applicationProperties.getProperty(key);
\r
76 public static String setProperty(String key, String obj)
\r
80 FileOutputStream out = new FileOutputStream(System.getProperty(
\r
81 "user.home") + "/.jalview_properties");
\r
83 applicationProperties.setProperty(key, obj);
\r
85 applicationProperties.store(out, "---JalviewX Properties File---");
\r
88 catch (Exception ex)
\r