Merge branch 'develop' into update_212_Dec_merge_with_21125_chamges
[jalview.git] / src / jalview / bin / Cache.java
index 1a4f341..8a06b7b 100755 (executable)
@@ -47,10 +47,10 @@ import java.util.regex.Pattern;
 import javax.swing.LookAndFeel;
 import javax.swing.UIManager;
 
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
 import jalview.datamodel.PDBEntry;
 import jalview.gui.Preferences;
 import jalview.gui.UserDefinedColours;
-import jalview.log.JLogger;
 import jalview.log.JLoggerLog4j;
 import jalview.schemes.ColourSchemeLoader;
 import jalview.schemes.ColourSchemes;
@@ -59,7 +59,6 @@ import jalview.structure.StructureImportSettings;
 import jalview.urls.IdOrgSettings;
 import jalview.util.ChannelProperties;
 import jalview.util.ColorUtils;
-import jalview.util.Log4j;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
 import jalview.ws.sifts.SiftsSettings;
@@ -173,6 +172,8 @@ import jalview.ws.sifts.SiftsSettings;
  * <li>FOLLOW_SELECTIONS (true) Controls whether a new alignment view should
  * respond to selections made in other alignments containing the same sequences.
  * </li>
+ * <li>SHOW_JWS2_SERVICES (true) when set to false, jalview will not
+ * auto-discover JABAWS services</li>
  * <li>JWS2HOSTURLS comma-separated list of URLs to try for JABAWS services</li>
  * <li>SHOW_WSDISCOVERY_ERRORS (true) Controls if the web service URL discovery
  * warning dialog box is displayed.</li>
@@ -200,7 +201,13 @@ import jalview.ws.sifts.SiftsSettings;
  * <li>CHIMERA_PATH specify full path to Chimera program (if non-standard)</li>
  * <li>ID_ORG_HOSTURL location of jalview service providing identifiers.org urls
  * </li>
- * 
+ * <li>NONEWS - when set disables Jalview News from automatically appearing</li>
+ * <li>NOHTMLTEMPLATES - when set, the
+ * https://github.com/jalview/exporter-templates/tree/master/biojs repository is
+ * not downloaded automatically</li>
+ * <li>NOIDENTIFIERSSERVICE - when set, jalview won't automatically download
+ * available URL linkouts via www.jalview.org/services/identifiers</li>
+ * <li>
  * </ul>
  * Deprecated settings:
  * <ul>
@@ -218,8 +225,24 @@ import jalview.ws.sifts.SiftsSettings;
  * @author $author$
  * @version $Revision$
  */
-public class Cache
+public class Cache implements ApplicationSingletonI
 {
+  private Cache()
+  {
+    // private singleton
+  }
+
+  /**
+   * In Java, this will be a static field instance, which will be
+   * application-specific; in JavaScript it will be an applet-specific instance
+   * tied to the applet's ThreadGroup.
+   * 
+   * @return
+   */
+  public static Cache getInstance()
+  {
+    return (Cache) ApplicationSingletonProvider.getInstance(Cache.class);
+  }
   /**
    * property giving log4j level for CASTOR loggers
    */
@@ -238,9 +261,8 @@ public class Cache
   /**
    * Sifts settings
    */
-  public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = System
-          .getProperty("user.home") + File.separatorChar
-          + ".sifts_downloads" + File.separatorChar;
+  public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = Platform.getUserPath(".sifts_downloads/");
+  
 
   private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2";
 
@@ -249,8 +271,7 @@ public class Cache
   /**
    * Identifiers.org download settings
    */
-  private static final String ID_ORG_FILE = System.getProperty("user.home")
-          + File.separatorChar + ".identifiers.org.ids.json";
+  private static final String ID_ORG_FILE = Platform.getUserPath(".identifiers.org.ids.json");
 
   /**
    * Allowed values are PDB or mmCIF
@@ -273,11 +294,8 @@ public class Cache
   /**
    * Initialises the Jalview Application Log
    */
-
   public final static String JALVIEW_LOGGER_NAME = "JalviewLogger";
 
-  public static JLoggerLog4j log;
-
   // save the proxy properties set at startup
   public final static String[] startupProxyProperties = {
       System.getProperty("http.proxyHost"),
@@ -301,7 +319,7 @@ public class Cache
   public static char[] proxyAuthPassword = null;
 
   /** Jalview Properties */
-  public static Properties applicationProperties = new Properties()
+  private Properties applicationProperties = new Properties()
   {
     // override results in properties output in alphabetical order
     @Override
@@ -321,79 +339,30 @@ public class Cache
 
   private final static String JS_PROPERTY_PREFIX = "jalview_";
 
-  public final static String LOGGING_TEST_MESSAGE = "Logging to STDERR";
 
-  public static JLogger.LogLevel getCachedLogLevel()
+  /**
+   * Loads properties from the given properties file. Any existing properties are
+   * first cleared.
+   */
+  public static void loadProperties(String propsFile)
   {
-    return getCachedLogLevel(JALVIEWLOGLEVEL);
-  }
+    getInstance().loadPropertiesImpl(propsFile);
 
-  public static JLogger.LogLevel getCachedLogLevel(String key)
-  {
-    return JLogger.toLevel(Cache.getDefault(key, "INFO"));
   }
 
-  public static boolean initLogger()
-  {
-    if (log != null)
-    {
-      return true;
-    }
-    try
-    {
-      JLogger.LogLevel cachedLevel = getCachedLogLevel();
-      if (!Platform.isJS())
-      {
-        Log4j.init(cachedLevel);
-      }
-      // log output
-      // is laxis used? Does getLogger do anything without a Logger object?
-      // Logger laxis = Log4j.getLogger("org.apache.axis", myLevel);
-      JLoggerLog4j.getLogger("org.apache.axis", cachedLevel);
-
-      // The main application logger
-      log = JLoggerLog4j.getLogger(JALVIEW_LOGGER_NAME, cachedLevel);
-    } catch (NoClassDefFoundError e)
-    {
-      System.err.println("Could not initialise the logger framework");
-      e.printStackTrace();
-    }
-
-    // Test message
-    if (log != null)
-    {
-      // Logging test message should got through the logger object
-      if (log.loggerExists())
-        log.debug(LOGGING_TEST_MESSAGE);
-      // Tell the user that debug is enabled
-      Cache.debug(ChannelProperties.getProperty("app_name")
-              + " Debugging Output Follows.");
-      return true;
-    }
-    else
-    {
-      return false;
-    }
-  }
-
-  /**
-   * Loads properties from the given properties file. Any existing properties
-   * are first cleared.
-   */
-  public static void loadProperties(String propsFile)
+  private void loadPropertiesImpl(String propsFile)
   {
     propertiesFile = propsFile;
     String releasePropertiesFile = null;
     boolean defaultProperties = false;
     if (propsFile == null && !propsAreReadOnly)
     {
+      // TODO: @bsoares - for 2.12 testing: check test,develop,release props are located correctly
       String channelPrefsFilename = ChannelProperties
               .getProperty("preferences.filename");
       String releasePrefsFilename = ".jalview_properties";
-      propertiesFile = System.getProperty("user.home") + File.separatorChar
-              + channelPrefsFilename;
-      releasePropertiesFile = System.getProperty("user.home")
-              + File.separatorChar + releasePrefsFilename;
+      propertiesFile = Platform.getUserPath(channelPrefsFilename);
+      releasePropertiesFile = Platform.getUserPath(releasePrefsFilename);
       defaultProperties = true;
     }
     else
@@ -486,7 +455,7 @@ public class Cache
     default:
       String message = "Incorrect PROXY_TYPE - should be 'none' (clear proxy properties), 'false' (system settings), 'true' (custom settings): "
               + proxyType;
-      Cache.warn(message);
+      Console.warn(message);
     }
 
     // LOAD THE AUTHORS FROM THE authors.props file
@@ -570,25 +539,29 @@ public class Cache
                     + orgtimeout + " seconds.");
           }
           String remoteVersion = null;
-          try
+          if (remoteBuildPropertiesUrl.startsWith("http"))
           {
-            System.setProperty("sun.net.client.defaultConnectTimeout",
-                    "5000");
-            java.net.URL url = new java.net.URL(remoteBuildPropertiesUrl);
+            try
+            {
+              System.setProperty("sun.net.client.defaultConnectTimeout",
+                      "5000");
 
-            BufferedReader in = new BufferedReader(
-                    new InputStreamReader(url.openStream()));
+              URL url = new URL(remoteBuildPropertiesUrl);
 
-            Properties remoteBuildProperties = new Properties();
-            remoteBuildProperties.load(in);
-            remoteVersion = remoteBuildProperties.getProperty("VERSION");
-          } catch (Exception ex)
-          {
-            System.out
-                    .println("Non-fatal exception when checking version at "
-                            + remoteBuildPropertiesUrl + ":");
-            System.out.println(ex);
-            remoteVersion = getProperty("VERSION");
+              BufferedReader in = new BufferedReader(
+                      new InputStreamReader(url.openStream()));
+
+              Properties remoteBuildProperties = new Properties();
+              remoteBuildProperties.load(in);
+              remoteVersion = remoteBuildProperties.getProperty("VERSION");
+            } catch (Exception ex)
+            {
+              System.out.println(
+                      "Non-fatal exception when checking version at "
+                              + remoteBuildPropertiesUrl + ":");
+              System.out.println(ex);
+              remoteVersion = getProperty("VERSION");
+            }
           }
           System.setProperty("sun.net.client.defaultConnectTimeout",
                   orgtimeout);
@@ -647,7 +620,7 @@ public class Cache
     return url;
   }
 
-  public static void loadBuildProperties(boolean reportVersion)
+  public void loadBuildProperties(boolean reportVersion)
   {
     String codeInstallation = getProperty("INSTALLATION");
     boolean printVersion = codeInstallation == null;
@@ -678,6 +651,11 @@ public class Cache
         applicationProperties.put("VERSION",
                 buildProperties.getProperty("VERSION"));
       }
+      if (buildProperties.getProperty("JAVA_COMPILE_VERSION", null) != null)
+      {
+        applicationProperties.put("JAVA_COMPILE_VERSION",
+                buildProperties.getProperty("JAVA_COMPILE_VERSION"));
+      }
     } catch (Exception ex)
     {
       System.out.println("Error reading build details: " + ex);
@@ -705,7 +683,7 @@ public class Cache
     }
   }
 
-  private static void deleteBuildProperties()
+  private void deleteBuildProperties()
   {
     applicationProperties.remove("LATEST_VERSION");
     applicationProperties.remove("VERSION");
@@ -717,28 +695,27 @@ public class Cache
   }
 
   /**
-   * Gets Jalview application property of given key. Returns null if key not
-   * found
+   * Gets Jalview application property of given key. Returns null if key not found
    * 
    * @param key
-   *          Name of property
+   *              Name of property
    * 
    * @return Property value
    */
   public static String getProperty(String key)
   {
-    String prop = applicationProperties.getProperty(key);
-    if (prop == null && Platform.isJS())
-    {
-      prop = applicationProperties.getProperty(Platform.getUniqueAppletID()
-              + "_" + JS_PROPERTY_PREFIX + key);
-    }
+    String prop = getInstance().applicationProperties.getProperty(key);
+    // if (prop == null && Platform.isJS())
+    // {
+    // prop = applicationProperties.getProperty(Platform.getUniqueAppletID()
+    // + "_" + JS_PROPERTY_PREFIX + key);
+    // }
     return prop;
   }
 
   /**
-   * These methods are used when checking if the saved preference is different
-   * to the default setting
+   * These methods are used when checking if the saved preference is different to
+   * the default setting
    */
 
   public static boolean getDefault(String property, boolean def)
@@ -771,8 +748,8 @@ public class Cache
   }
 
   /**
-   * Answers the value of the given property, or the supplied default value if
-   * the property is not set
+   * Answers the value of the given property, or the supplied default value if the
+   * property is not set
    */
   public static String getDefault(String property, String def)
   {
@@ -784,41 +761,56 @@ public class Cache
    * Stores property in the file "HOME_DIR/.jalview_properties"
    * 
    * @param key
-   *          Name of object
+   *              Name of object
    * @param obj
-   *          String value of property
+   *              String value of property
    * 
    * @return previous value of property (or null)
    */
   public static Object setProperty(String key, String obj)
   {
-    Object oldValue = null;
-    try
-    {
-      oldValue = applicationProperties.setProperty(key, obj);
-      if (propertiesFile != null && !propsAreReadOnly)
-      {
-        FileOutputStream out = new FileOutputStream(propertiesFile);
-        applicationProperties.store(out, "---JalviewX Properties File---");
-        out.close();
-      }
-    } catch (Exception ex)
-    {
-      System.out.println(
-              "Error setting property: " + key + " " + obj + "\n" + ex);
-    }
-    return oldValue;
+    return getInstance().setPropertyImpl(key, obj, true);
   }
 
   /**
-   * remove the specified property from the jalview properties file
+   * Removes the specified property from the jalview properties file
    * 
-   * @param string
+   * @param key
    */
-  public static void removeProperty(String string)
+  public static void removeProperty(String key)
   {
-    applicationProperties.remove(string);
-    saveProperties();
+    getInstance().removePropertyImpl(key, true);
+  }
+
+  /**
+   * Removes the named property for the running application, without saving the
+   * properties file
+   * 
+   * BH noting that ColourMenuHelper calls this. If the intent is to save, then
+   * simply chanet that call to removeProperty(key).
+   * 
+   * @param key
+   */
+  public static void removePropertyNoSave(String key)
+  {
+
+    getInstance().
+
+            removePropertyImpl(key, false);
+  }
+
+  /**
+   * Removes the named property, and optionally saves the current properties to
+   * file
+   * 
+   * @param key
+   * @param andSave
+   */
+  private void removePropertyImpl(String key, boolean andSave)
+  {
+    applicationProperties.remove(key);
+    if (andSave)
+      saveProperties();
   }
 
   /**
@@ -826,6 +818,15 @@ public class Cache
    */
   public static void saveProperties()
   {
+    getInstance().savePropertiesImpl();
+  }
+
+  /**
+   * save the properties to the jalview properties path
+   */
+  private void savePropertiesImpl()
+
+  {
     if (!propsAreReadOnly)
     {
       try
@@ -859,11 +860,13 @@ public class Cache
         if (jalview.jbgui.GDesktop.class.getClassLoader()
                 .loadClass("uk.ac.vamsas.client.VorbaId") != null)
         {
-          debug("Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)");
+          Console.debug(
+                  "Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)");
           vamsasJarsArePresent = 1;
           JLoggerLog4j lvclient = JLoggerLog4j.getLogger("uk.ac.vamsas",
-                  getCachedLogLevel("logs.Vamsas.Level"));
-          JLoggerLog4j.addAppender(lvclient, log, JALVIEW_LOGGER_NAME);
+                  Console.getCachedLogLevel("logs.Vamsas.Level"));
+          JLoggerLog4j.addAppender(lvclient, Console.log,
+                  JALVIEW_LOGGER_NAME);
           // Tell the user that debug is enabled
           lvclient.debug(ChannelProperties.getProperty("app_name")
                   + " Vamsas Client Debugging Output Follows.");
@@ -871,7 +874,7 @@ public class Cache
       } catch (Exception e)
       {
         vamsasJarsArePresent = 0;
-        debug("Vamsas Classes are not present");
+        Console.debug("Vamsas Classes are not present");
       }
     }
     return (vamsasJarsArePresent > 0);
@@ -896,11 +899,13 @@ public class Cache
         if (Cache.class.getClassLoader()
                 .loadClass("groovy.lang.GroovyObject") != null)
         {
-          debug("Found Groovy (groovy.lang.GroovyObject can be loaded)");
+          Console.debug(
+                  "Found Groovy (groovy.lang.GroovyObject can be loaded)");
           groovyJarsArePresent = 1;
           JLoggerLog4j lgclient = JLoggerLog4j.getLogger("groovy",
-                  getCachedLogLevel("logs.Groovy.Level"));
-          JLoggerLog4j.addAppender(lgclient, log, JALVIEW_LOGGER_NAME);
+                  Console.getCachedLogLevel("logs.Groovy.Level"));
+          JLoggerLog4j.addAppender(lgclient, Console.log,
+                  JALVIEW_LOGGER_NAME);
           // Tell the user that debug is enabled
           lgclient.debug(ChannelProperties.getProperty("app_name")
                   + " Groovy Client Debugging Output Follows.");
@@ -908,11 +913,11 @@ public class Cache
       } catch (Error e)
       {
         groovyJarsArePresent = 0;
-        debug("Groovy Classes are not present", e);
+        Console.debug("Groovy Classes are not present", e);
       } catch (Exception e)
       {
         groovyJarsArePresent = 0;
-        debug("Groovy Classes are not present");
+        Console.debug("Groovy Classes are not present");
       }
     }
     return (groovyJarsArePresent > 0);
@@ -946,7 +951,8 @@ public class Cache
                   .loadClass("com.boxysystems.jgoogleanalytics.FocusPoint");
         } catch (Exception e)
         {
-          debug("com.boxysystems.jgoogleanalytics package is not present - tracking not enabled.");
+          Console.debug(
+                  "com.boxysystems.jgoogleanalytics package is not present - tracking not enabled.");
           tracker = null;
           jgoogleanalyticstracker = null;
           trackerfocus = null;
@@ -989,22 +995,27 @@ public class Cache
       {
         if (re != null)
         {
-          debug("Caught runtime exception in googletracker init:", re);
+          Console.debug("Caught runtime exception in googletracker init:",
+                  re);
         }
         if (ex != null)
         {
-          warn("Failed to initialise GoogleTracker for Jalview Desktop with version "
-                  + vrs, ex);
+          Console.warn(
+                  "Failed to initialise GoogleTracker for Jalview Desktop with version "
+                          + vrs,
+                  ex);
         }
         if (err != null)
         {
-          error("Whilst initing GoogleTracker for Jalview Desktop version "
-                  + vrs, err);
+          Console.error(
+                  "Whilst initing GoogleTracker for Jalview Desktop version "
+                          + vrs,
+                  err);
         }
       }
       else
       {
-        debug("Successfully initialised tracker.");
+        Console.debug("Successfully initialised tracker.");
       }
     }
   }
@@ -1026,7 +1037,8 @@ public class Cache
     Color col = ColorUtils.parseColourString(colprop);
     if (col == null)
     {
-      warn("Couldn't parse '" + colprop + "' as a colour for " + property);
+      Console.warn("Couldn't parse '" + colprop + "' as a colour for "
+              + property);
     }
     return (col == null) ? defcolour : col;
   }
@@ -1037,9 +1049,9 @@ public class Cache
    * @param property
    * @param colour
    */
-  public static void setColourProperty(String property, Color colour)
+  public static void setColourPropertyNoSave(String property, Color colour)
   {
-    setProperty(property, jalview.util.Format.getHexString(colour));
+    setPropertyNoSave(property, jalview.util.Format.getHexString(colour));
   }
 
   /**
@@ -1067,11 +1079,16 @@ public class Cache
   public static Date getDateProperty(String propertyName)
   {
     String val = getProperty(propertyName);
+    
     if (val != null)
     {
       try
       {
-        return date_format.parse(val);
+        if ((val = val.trim()).indexOf(",") < 0 && val.indexOf("-") >= 0 && val.indexOf(" ") == val.lastIndexOf(" ")) {
+          val = val.replace(" ",", ").replace('-',' ');
+        }
+        Date date =  date_format.parse(val);
+        return date;
       } catch (Exception ex)
       {
         System.err.println("Invalid or corrupt date in property '"
@@ -1120,11 +1137,11 @@ public class Cache
     }
     if (value == null || value.trim().length() < 1)
     {
-      Cache.applicationProperties.remove(propName);
+      getInstance().applicationProperties.remove(propName);
     }
     else
     {
-      Cache.applicationProperties.setProperty(propName, value);
+      getInstance().applicationProperties.setProperty(propName, value);
     }
   }
 
@@ -1132,7 +1149,7 @@ public class Cache
    * Loads in user colour schemes from files.
    * 
    * @param files
-   *          a '|'-delimited list of file paths
+   *                a '|'-delimited list of file paths
    */
   public static void initUserColourSchemes(String files)
   {
@@ -1174,7 +1191,7 @@ public class Cache
       }
       else
       {
-        applicationProperties
+        getInstance().applicationProperties
                 .remove(UserDefinedColours.USER_DEFINED_COLOURS);
       }
     }
@@ -1194,8 +1211,11 @@ public class Cache
     {
       return;
     }
-    String line = prefix + (value != null ? value : defaultValue) + suffix;
-    sb.append(line);
+    if (prefix != null)
+      sb.append(prefix);
+    sb.append(value == null ? defaultValue : value);
+    if (suffix != null)
+      sb.append(suffix);
   }
 
   /**
@@ -1239,15 +1259,15 @@ public class Cache
     sb.append(" (");
     sb.append(lafClass);
     sb.append(")\n");
-    // Not displayed in release version ( determined by possible version number
-    // regex 9[9.]*9[.-_a9]* )
-    if (Pattern.matches("^\\d[\\d\\.]*\\d[\\.\\-\\w]*$",
-            Cache.getDefault("VERSION", "TEST")))
+    if (Console.isDebugEnabled()
+            || !"release".equals(ChannelProperties.getProperty("channel")))
     {
+      appendIfNotNull(sb, "Channel: ",
+              ChannelProperties.getProperty("channel"), "\n", null);
       appendIfNotNull(sb, "Getdown appdir: ",
-              System.getProperty("getdownappdir"), "\n", null);
+              System.getProperty("getdowninstanceappdir"), "\n", null);
       appendIfNotNull(sb, "Getdown appbase: ",
-              System.getProperty("getdownappbase"), "\n", null);
+              System.getProperty("getdowninstanceappbase"), "\n", null);
       appendIfNotNull(sb, "Java home: ", System.getProperty("java.home"),
               "\n", "unknown");
     }
@@ -1262,7 +1282,53 @@ public class Cache
   {
     // consider returning more human friendly info
     // eg 'built from Source' or update channel
-    return Cache.getDefault("INSTALLATION", "unknown");
+        return Cache.getDefault("INSTALLATION", "unknown");
+  }
+
+  /**
+   * 
+   * For AppletParams and Preferences ok_actionPerformed and
+   * startupFileTextfield_mouseClicked
+   * 
+   * Sets a property value for the running application, without saving it to the
+   * properties file
+   * 
+   * @param key
+   * @param obj
+   */
+  public static void setPropertyNoSave(String key, String obj)
+  {
+    getInstance().setPropertyImpl(key, obj, false);
+  }
+
+  /**
+   * Sets a property value, and optionally also saves the current properties to
+   * file
+   * 
+   * @param key
+   * @param obj
+   * @param andSave
+   * @return
+   */
+  private Object setPropertyImpl(
+          String key, String obj, boolean andSave)
+  {
+    Object oldValue = null;
+    try
+    {
+      oldValue = applicationProperties.setProperty(key, obj);
+      if (andSave && !propsAreReadOnly && propertiesFile != null)
+      {
+        FileOutputStream out = new FileOutputStream(propertiesFile);
+        applicationProperties.store(out, "---JalviewX Properties File---");
+        out.close();
+      }
+    } catch (Exception ex)
+    {
+      System.out.println(
+              "Error setting property: " + key + " " + obj + "\n" + ex);
+    }
+    return oldValue;
   }
 
   public static String getStackTraceString(Throwable t)
@@ -1306,7 +1372,7 @@ public class Cache
                             ? " [" + startupProxyProperties[6] + "]"
                             : "");
 
-    Cache.debug(sb.toString());
+    Console.debug(sb.toString());
   }
 
   public static void setProxyPropertiesFromPreferences()
@@ -1332,7 +1398,7 @@ public class Cache
     case Cache.PROXYTYPE_NONE:
       if (!previousProxyType.equals(proxyType))
       {
-        Cache.info("Setting no proxy settings");
+        Console.info("Setting no proxy settings");
         Cache.setProxyProperties(null, null, null, null, null, null, null,
                 null, null);
       }
@@ -1340,7 +1406,7 @@ public class Cache
     case Cache.PROXYTYPE_CUSTOM:
       // always re-set a custom proxy -- it might have changed, particularly
       // password
-      Cache.info("Setting custom proxy settings");
+      Console.info("Setting custom proxy settings");
       boolean proxyAuthSet = Cache.getDefault("PROXY_AUTH", false);
       Cache.setProxyProperties(Cache.getDefault("PROXY_SERVER", null),
               Cache.getDefault("PROXY_PORT", null),
@@ -1354,7 +1420,7 @@ public class Cache
               proxyAuthSet ? Cache.proxyAuthPassword : null, "localhost");
       break;
     default: // system proxy settings by default
-      Cache.info("Setting system proxy settings");
+      Console.info("Setting system proxy settings");
       Cache.resetProxyProperties();
     }
   }
@@ -1406,8 +1472,10 @@ public class Cache
         char[] displayHttpPw = new char[httpPassword == null ? 0
                 : httpPassword.length];
         Arrays.fill(displayHttpPw, '*');
-        Cache.debug("CACHE Proxy: setting new Authenticator with httpUser='"
-                + httpUser + "' httpPassword='" + displayHttpPw + "'");
+        Console.debug(
+                "CACHE Proxy: setting new Authenticator with httpUser='"
+                        + httpUser + "' httpPassword='" + displayHttpPw
+                        + "'");
         if (!Platform.isJS())
         /* *
          * java.net.Authenticator not implemented in SwingJS yet
@@ -1456,7 +1524,7 @@ public class Cache
                             && getRequestingPort() == Integer
                                     .valueOf(httpPort))
                     {
-                      Cache.debug(
+                      Console.debug(
                               "AUTHENTICATOR returning PasswordAuthentication(\""
                                       + httpUser + "\", '"
                                       + new String(displayHttpPw) + "')");
@@ -1471,7 +1539,7 @@ public class Cache
                     {
                       char[] displayHttpsPw = new char[httpPassword.length];
                       Arrays.fill(displayHttpsPw, '*');
-                      Cache.debug(
+                      Console.debug(
                               "AUTHENTICATOR returning PasswordAuthentication(\""
                                       + httpsUser + "\", '" + displayHttpsPw
                                       + "'");
@@ -1480,15 +1548,15 @@ public class Cache
                     }
                   } catch (NumberFormatException e)
                   {
-                    Cache.error("Problem with proxy port values [http:"
+                    Console.error("Problem with proxy port values [http:"
                             + httpPort + ", https:" + httpsPort + "]");
                   }
-                  Cache.debug(
+                  Console.debug(
                           "AUTHENTICATOR after trying to get PasswordAuthentication");
                 }
               }
               // non proxy request
-              Cache.debug("AUTHENTICATOR returning null");
+              Console.debug("AUTHENTICATOR returning null");
               return null;
             }
           });
@@ -1496,13 +1564,13 @@ public class Cache
 
         // required to re-enable basic authentication (should be okay for a
         // local proxy)
-        Cache.debug(
+        Console.debug(
                 "AUTHENTICATOR setting property 'jdk.http.auth.tunneling.disabledSchemes' to \"\"");
         System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
       } catch (SecurityException e)
       {
-        Cache.error("Could not set default Authenticator");
-        Cache.debug(getStackTraceString(e));
+        Console.error("Could not set default Authenticator");
+        Console.debug(getStackTraceString(e));
       }
     }
     else
@@ -1520,14 +1588,16 @@ public class Cache
        * 
        */
       {
-        Cache.debug("AUTHENTICATOR setting default Authenticator to null");
+        Console.debug(
+                "AUTHENTICATOR setting default Authenticator to null");
         Authenticator.setDefault(null);
       }
     }
 
     // nonProxyHosts not currently configurable in Preferences
-    Cache.debug("AUTHENTICATOR setting property 'http.nonProxyHosts' to \""
-            + nonProxyHosts + "\"");
+    Console.debug(
+            "AUTHENTICATOR setting property 'http.nonProxyHosts' to \""
+                    + nonProxyHosts + "\"");
     setOrClearSystemProperty("http.nonProxyHosts", nonProxyHosts);
   }
 
@@ -1553,176 +1623,6 @@ public class Cache
     }
   }
 
-  public static void trace(String message)
-  {
-    if (initLogger())
-    {
-      log.trace(message, null);
-    }
-    else
-    {
-      System.out.println(message);
-    }
-  }
-
-  public static void trace(String message, Throwable t)
-  {
-    if (initLogger())
-    {
-      log.trace(message, t);
-    }
-    else
-    {
-      System.out.println(message);
-      t.printStackTrace();
-    }
-  }
-
-  public static void debug(String message)
-  {
-    if (initLogger())
-    {
-      log.debug(message, null);
-    }
-    else
-    {
-      System.out.println(message);
-    }
-
-  }
-
-  public static void debug(String message, Throwable t)
-  {
-    if (initLogger())
-    {
-      log.debug(message, t);
-    }
-    else
-    {
-      System.out.println(message);
-      t.printStackTrace();
-    }
-
-  }
-
-  public static void info(String message)
-  {
-    if (initLogger())
-    {
-      log.info(message, null);
-    }
-    else
-    {
-      System.out.println(message);
-    }
-
-  }
-
-  public static void info(String message, Throwable t)
-  {
-    if (initLogger())
-    {
-      log.info(message, t);
-    }
-    else
-    {
-      System.out.println(message);
-      t.printStackTrace();
-    }
-
-  }
-
-  public static void warn(String message)
-  {
-    if (initLogger())
-    {
-      log.warn(message, null);
-    }
-    else
-    {
-      System.out.println(message);
-    }
-
-  }
-
-  public static void warn(String message, Throwable t)
-  {
-    if (initLogger())
-    {
-      log.warn(message, t);
-    }
-    else
-    {
-      System.out.println(message);
-      t.printStackTrace();
-    }
-
-  }
-
-  public static void error(String message)
-  {
-    if (initLogger())
-    {
-      log.error(message, null);
-    }
-    else
-    {
-      System.err.println(message);
-    }
-
-  }
-
-  public static void error(String message, Throwable t)
-  {
-    if (initLogger())
-    {
-      log.error(message, t);
-    }
-    else
-    {
-      System.err.println(message);
-      t.printStackTrace(System.err);
-    }
-
-  }
-
-  public static void fatal(String message)
-  {
-    if (initLogger())
-    {
-      log.fatal(message, null);
-    }
-    else
-    {
-      System.err.println(message);
-    }
-
-  }
-
-  public static void fatal(String message, Throwable t)
-  {
-    if (initLogger())
-    {
-      log.fatal(message, t);
-    }
-    else
-    {
-      System.err.println(message);
-      t.printStackTrace(System.err);
-    }
-
-  }
-
-  public static boolean isDebugEnabled()
-  {
-    return log == null ? false : log.isDebugEnabled();
-  }
-
-  public static boolean isTraceEnabled()
-  {
-    return log == null ? false : log.isTraceEnabled();
-  }
-
   /**
    * Getdown appbase methods
    */