X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=38aa55f0a7799ab83edf8f828b56c10191defd8f;hb=5431cd565122d8baa2ca28e35500f2b5291e281f;hp=3b0a23ef0cb43cd9a20378cfb9acf1bb2f687649;hpb=9d139ca8d1af8f0f2d78193d418ae9e9168a3e8a;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 3b0a23e..38aa55f 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -20,8 +20,11 @@ */ package jalview.bin; +import jalview.datamodel.DBRefSource; +import jalview.ws.dbsources.Pdb; import jalview.ws.dbsources.das.api.DasSourceRegistryI; import jalview.ws.dbsources.das.datamodel.DasSourceRegistry; +import jalview.ws.sifts.SiftsSettings; import java.awt.Color; import java.io.BufferedReader; @@ -216,17 +219,30 @@ public class Cache public static final String DAS_ACTIVE_SOURCE = "DAS_ACTIVE_SOURCE"; + public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = System + .getProperty("user.home") + + File.separatorChar + + ".sifts_downloads" + File.separatorChar; + + private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2"; + + private final static String DEFAULT_FAIL_SAFE_PID_THRESHOLD = "30"; + + private final static String DEFAULT_STRUCTURE_FORMAT = DBRefSource.PDB; + /** * Initialises the Jalview Application Log */ public static Logger log; /** Jalview Properties */ - public static Properties applicationProperties = new Properties() { + public static Properties applicationProperties = new Properties() + { // override results in properties output in alphabetical order @Override - public synchronized Enumeration keys() { - return Collections.enumeration(new TreeSet(super.keySet())); + public synchronized Enumeration keys() + { + return Collections.enumeration(new TreeSet(super.keySet())); } }; @@ -315,9 +331,9 @@ public class Cache fis = new FileInputStream(propertiesFile); } applicationProperties.load(fis); - + // remove any old build properties - + deleteBuildProperties(); fis.close(); } catch (Exception ex) @@ -379,16 +395,39 @@ public class Cache String jnlpVersion = System.getProperty("jalview.version"); String codeVersion = getProperty("VERSION"); - + String codeInstallation = getProperty("INSTALLATION"); if (codeVersion == null) { // THIS SHOULD ONLY BE THE CASE WHEN TESTING!! codeVersion = "Test"; jnlpVersion = "Test"; + codeInstallation = ""; + } + else + { + codeInstallation = " (" + codeInstallation + ")"; } + new BuildDetails(codeVersion, null, codeInstallation); + + SiftsSettings + .setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false)); + + SiftsSettings.setSiftDownloadDirectory(jalview.bin.Cache.getDefault( + "sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR)); + + SiftsSettings.setFailSafePIDThreshold(jalview.bin.Cache.getDefault( + "sifts_fail_safe_pid_threshold", + DEFAULT_FAIL_SAFE_PID_THRESHOLD)); + + SiftsSettings.setCacheThresholdInDays(jalview.bin.Cache.getDefault( + "sifts_cache_threshold_in_days", + DEFAULT_CACHE_THRESHOLD_IN_DAYS)); - System.out.println("Jalview Version: " + codeVersion); + System.out + .println("Jalview Version: " + codeVersion + codeInstallation); + Pdb.setCurrentDefaultFormat(jalview.bin.Cache.getDefault( + "DEFAULT_STRUCTURE_FORMAT", DEFAULT_STRUCTURE_FORMAT)); // jnlpVersion will be null if we're using InstallAnywhere // Dont do this check if running in headless mode if (jnlpVersion == null @@ -399,6 +438,7 @@ public class Cache class VersionChecker extends Thread { + @Override public void run() { String orgtimeout = System @@ -409,7 +449,7 @@ public class Cache System.out.println("# INFO: Setting default net timeout to " + orgtimeout + " seconds."); } - String jnlpVersion = null; + String remoteVersion = null; try { System.setProperty("sun.net.client.defaultConnectTimeout", @@ -429,20 +469,20 @@ public class Cache line = line.substring(line.indexOf("value=") + 7); line = line.substring(0, line.lastIndexOf("\"")); - jnlpVersion = line; + remoteVersion = line; break; } } catch (Exception ex) { System.out - .println("Non-fatal exceptions when checking version at www.jalview.org :"); + .println("Non-fatal exception when checking version at www.jalview.org :"); System.out.println(ex); - jnlpVersion = getProperty("VERSION"); + remoteVersion = getProperty("VERSION"); } System.setProperty("sun.net.client.defaultConnectTimeout", orgtimeout); - setProperty("LATEST_VERSION", jnlpVersion); + setProperty("LATEST_VERSION", remoteVersion); } } @@ -477,6 +517,8 @@ public class Cache applicationProperties.remove("AUTHORS"); applicationProperties.remove("AUTHORFNAMES"); applicationProperties.remove("YEAR"); + applicationProperties.remove("BUILD_DATE"); + applicationProperties.remove("INSTALLATION"); } /** @@ -710,21 +752,22 @@ public class Cache try { // Google analytics tracking code for Library Finder - tracker = jgoogleanalyticstracker.getConstructor(new Class[] - { String.class, String.class, String.class }).newInstance( - new Object[] - { - "Jalview Desktop", - (vrs = jalview.bin.Cache.getProperty("VERSION") - + "_" - + jalview.bin.Cache.getDefault("BUILD_DATE", - "unknown")), "UA-9060947-1" }); + tracker = jgoogleanalyticstracker.getConstructor( + new Class[] { String.class, String.class, String.class }) + .newInstance( + new Object[] { + "Jalview Desktop", + (vrs = jalview.bin.Cache.getProperty("VERSION") + + "_" + + jalview.bin.Cache.getDefault( + "BUILD_DATE", "unknown")), + "UA-9060947-1" }); jgoogleanalyticstracker.getMethod("trackAsynchronously", - new Class[] - { trackerfocus }).invoke(tracker, new Object[] - { trackerfocus.getConstructor(new Class[] - { String.class }).newInstance(new Object[] - { "Application Started." }) }); + new Class[] { trackerfocus }).invoke( + tracker, + new Object[] { trackerfocus.getConstructor( + new Class[] { String.class }).newInstance( + new Object[] { "Application Started." }) }); } catch (RuntimeException e) { re = e;