X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=7eaae62cf7b606e900ac906ace4b15f71ad95da3;hb=7490127af372f38fe79963113ebc990f7e989255;hp=3cf62c6c8656b94a45e2e8d78ea83cd9876d0ceb;hpb=c0e090c6af2bf9b9b2ab721695e54a322dd82c02;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 3cf62c6..7eaae62 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -11,16 +11,53 @@ package jalview.bin; import java.util.*; import java.io.*; +import java.util.jar.*; public class Cache { + public static String VERSION = "ß test"; + public static String BUILD_DATE = "1-1-2005"; + 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 + // USER_DEFINED_COLOUR - file describing last user set colours + // FONT_NAME + // FONT_STYLE + // FONT_SIZE + // logs.Axis.Level - one of the stringified Levels for log4j controlling the logging level for axis (used for web services) public static void loadProperties() { + // get last build time. + try{ + long date = 0; + + String localFile = Cache.class.getProtectionDomain().getCodeSource().getLocation().toString(); + localFile = localFile.concat("!/"); + String tmpString = "jar:"; + String localJarFileString = tmpString.concat(localFile); + java.net.URL localJarFileURL = new java.net.URL(localJarFileString); + java.net.JarURLConnection localJarFile = (java.net.JarURLConnection)localJarFileURL.openConnection(); + + date = localJarFile.getLastModified(); + + if(date==0) + { + // this is called for unpackaged class files. + // not entirely accurate as it only tells you when Cache.class was last compiled + java.net.URL url = Cache.class.getResource("/jalview/bin/Cache.class"); + java.io.File f = new java.io.File(url.getFile()); + date = f.lastModified(); + } + + BUILD_DATE = new Date( date ).toString(); + + + }catch(Exception ex){ex.printStackTrace();} + + applicationProperties = new Properties(); try @@ -32,7 +69,7 @@ public class Cache in.close(); } catch (Exception ex) - { } + { } } public static String getProperty(String key)