X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=5dbf5bc83ac034a2c2ed97ce7ff1cd287d0816e5;hb=bbfdb203ce3a889600caa52478478b75ab03809f;hp=f67377beefa8b43ff13f51aa19e0b3b6d595fcbd;hpb=9fe2470b6400c06457392d608763cbf65b535f4c;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index f67377b..5dbf5bc 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.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -19,6 +19,8 @@ package jalview.bin; import java.awt.Color; import java.io.*; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.*; import org.apache.log4j.*; @@ -40,9 +42,6 @@ import org.biojava.dasobert.dasregistry.Das1Source; * *
  • logs.Jalview.Level - Cache.log stringified level.
    *
  • - *
  • DISCOVERY_START - Boolean - controls if discovery services are queried on - * startup
  • - *
  • DISCOVERY_URLS - comma separated list of Discovery Service endpoints.
  • *
  • SCREEN_WIDTH
  • *
  • SCREEN_HEIGHT
  • *
  • SCREEN_Y=285
  • @@ -106,7 +105,7 @@ import org.biojava.dasobert.dasregistry.Das1Source; *
  • SHOW_MEMUSAGE boolean show memory usage and warning indicator on desktop * (false)
  • *
  • VERSION_CHECK (true) check for the latest release version from - * www.jalview.org
  • + * www.jalview.org (or the alias given by the www.jalview.org property) *
  • SHOW_NPFEATS_TOOLTIP (true) show non-positional features in the Sequence * ID tooltip
  • *
  • SHOW_DBREFS_TOOLTIP (true) show Database Cross References in the Sequence @@ -125,6 +124,8 @@ import org.biojava.dasobert.dasregistry.Das1Source; * histogram.
  • *
  • SHOW_CONSENSUS_LOGO (false) Show consensus annotation row's sequence * logo.
  • + *
  • NORMALISE_CONSENSUS_LOGO (false) Show consensus annotation row's sequence + * logo normalised to row height rather than histogram height.
  • *
  • FOLLOW_SELECTIONS (true) Controls whether a new alignment view should * respond to selections made in other alignments containing the same sequences. *
  • @@ -132,13 +133,19 @@ import org.biojava.dasobert.dasregistry.Das1Source; * warning dialog box is displayed. *
  • ANNOTATIONCOLOUR_MIN (orange) Shade used for minimum value of annotation when shading by annotation
  • *
  • ANNOTATIONCOLOUR_MAX (red) Shade used for maximum value of annotation when shading by annotation
  • - * - *
  • + *
  • www.jalview.org (http://www.jalview.org) a property enabling all HTTP requests to be redirected to a mirror of http://www.jalview.org
  • * *
  • * * - * + * Deprecated settings: + * * @author $author$ * @version $Revision$ */ @@ -273,6 +280,26 @@ public class Cache System.setProperty("http.proxyPort", getDefault("PROXY_PORT", null)); } + // LOAD THE AUTHORS FROM THE authors.props file + try + { + String authorDetails = "jar:".concat(Cache.class.getProtectionDomain() + .getCodeSource().getLocation().toString() + .concat("!/authors.props")); + + java.net.URL localJarFileURL = new java.net.URL(authorDetails); + + InputStream in = localJarFileURL.openStream(); + applicationProperties.load(in); + in.close(); + } catch (Exception ex) + { + System.out.println("Error reading author details: " + ex); + applicationProperties.remove("AUTHORS"); + applicationProperties.remove("AUTHORFNAMES"); + applicationProperties.remove("YEAR"); + } + // FIND THE VERSION NUMBER AND BUILD DATE FROM jalview.jar // MUST FOLLOW READING OF LOCAL PROPERTIES FILE AS THE // VERSION MAY HAVE CHANGED SINCE LAST USING JALVIEW @@ -331,7 +358,7 @@ public class Cache System.setProperty("sun.net.client.defaultConnectTimeout", "5000"); java.net.URL url = new java.net.URL( - "http://www.jalview.org/webstart/jalview.jnlp"); + Cache.getDefault("www.jalview.org", "http://www.jalview.org")+"/webstart/jalview.jnlp"); BufferedReader in = new BufferedReader(new InputStreamReader( url.openStream())); String line = null; @@ -765,4 +792,36 @@ public class Cache setProperty(property, jalview.util.Format .getHexString(colour)); } + + public static final DateFormat date_format = SimpleDateFormat.getDateTimeInstance(); + + /** + * store a date in a jalview property + * @param string + * @param time + */ + public static void setDateProperty(String property, Date time) + { + setProperty(property, date_format.format(time)); + } + /** + * read a date stored in a jalview property + * @param property + * @return valid date as stored by setDateProperty, or null + * + */ + public static Date getDateProperty(String property) + { + String val = getProperty(property); + if (val!=null) + { + try { + return date_format.parse(val); + } catch (Exception ex) + { + System.err.println("Invalid or corrupt date in property '"+property+"' : value was '"+val+"'"); + } + } + return null; + } }