import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.TreeSet;
-import java.util.regex.Pattern;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
* <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>
* <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>
/** Default file is ~/.jalview_properties */
static String propertiesFile;
+ private static final String fallbackPropertiesFile = ".jalview_properties";
+
private static boolean propsAreReadOnly = Platform.isJS();
+ public static boolean isPropsAreReadOnly()
+ {
+ return propsAreReadOnly;
+ }
+
+ public static void setPropsAreReadOnly(boolean propsAreReadOnly)
+ {
+ Cache.propsAreReadOnly = propsAreReadOnly;
+ }
+
private final static String JS_PROPERTY_PREFIX = "jalview_";
/**
{
String channelPrefsFilename = ChannelProperties
.getProperty("preferences.filename");
- String releasePrefsFilename = ".jalview_properties";
+ String releasePrefsFilename = fallbackPropertiesFile;
propertiesFile = System.getProperty("user.home") + File.separatorChar
+ channelPrefsFilename;
releasePropertiesFile = System.getProperty("user.home")
+ 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);
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);
if (jalview.jbgui.GDesktop.class.getClassLoader()
.loadClass("uk.ac.vamsas.client.VorbaId") != null)
{
- Console.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",
Console.getCachedLogLevel("logs.Vamsas.Level"));
- JLoggerLog4j.addAppender(lvclient, Console.log, JALVIEW_LOGGER_NAME);
+ 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.");
if (Cache.class.getClassLoader()
.loadClass("groovy.lang.GroovyObject") != null)
{
- Console.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",
Console.getCachedLogLevel("logs.Groovy.Level"));
- JLoggerLog4j.addAppender(lgclient, Console.log, JALVIEW_LOGGER_NAME);
+ 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.");
.loadClass("com.boxysystems.jgoogleanalytics.FocusPoint");
} catch (Exception e)
{
- Console.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;
{
if (re != null)
{
- Console.debug("Caught runtime exception in googletracker init:", re);
+ Console.debug("Caught runtime exception in googletracker init:",
+ re);
}
if (ex != null)
{
- Console.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)
{
- Console.error("Whilst initing GoogleTracker for Jalview Desktop version "
- + vrs, err);
+ Console.error(
+ "Whilst initing GoogleTracker for Jalview Desktop version "
+ + vrs,
+ err);
}
}
else
Color col = ColorUtils.parseColourString(colprop);
if (col == null)
{
- Console.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;
}
{
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);
}
/**
sb.append("Java version: ");
sb.append(System.getProperty("java.version"));
sb.append("\n");
+ sb.append("Java platform: ");
sb.append(System.getProperty("os.arch"));
sb.append(" ");
sb.append(System.getProperty("os.name"));
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")))
+ appendIfNotNull(sb, "Channel: ",
+ ChannelProperties.getProperty("channel"), "\n", null);
+ if (Console.isDebugEnabled()
+ || !"release".equals(ChannelProperties.getProperty("channel")))
{
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");
+ appendIfNotNull(sb, "Preferences file: ", propertiesFile, "\n",
+ "unknown");
}
return sb.toString();
}
char[] displayHttpPw = new char[httpPassword == null ? 0
: httpPassword.length];
Arrays.fill(displayHttpPw, '*');
- Console.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
*
*/
{
- Console.debug("AUTHENTICATOR setting default Authenticator to null");
+ Console.debug(
+ "AUTHENTICATOR setting default Authenticator to null");
Authenticator.setDefault(null);
}
}
// nonProxyHosts not currently configurable in Preferences
- Console.debug("AUTHENTICATOR setting property 'http.nonProxyHosts' to \""
- + nonProxyHosts + "\"");
+ Console.debug(
+ "AUTHENTICATOR setting property 'http.nonProxyHosts' to \""
+ + nonProxyHosts + "\"");
setOrClearSystemProperty("http.nonProxyHosts", nonProxyHosts);
}
String appbase = getGetdownAppbase();
return appbase + "/" + getdownDistDir + "/build_properties";
}
+
+ private static final Collection<String> bootstrapProperties = new ArrayList<>(
+ Arrays.asList(JALVIEWLOGLEVEL));
+
+ public static Properties bootstrapProperties(String filename)
+ {
+ Properties bootstrapProps = new Properties();
+ File file = null;
+ if (filename != null)
+ {
+ file = new File(filename);
+ }
+ if (file == null || !file.exists())
+ {
+ String channelPrefsFilename = ChannelProperties
+ .getProperty("preferences.filename");
+ String propertiesFilename = System.getProperty("user.home")
+ + File.separatorChar + channelPrefsFilename;
+ file = new File(propertiesFilename);
+ }
+ if (file == null || !file.exists())
+ {
+ String releasePrefsFilename = fallbackPropertiesFile;
+ String releasePropertiesFilename = System.getProperty("user.home")
+ + File.separatorChar + releasePrefsFilename;
+ file = new File(releasePropertiesFilename);
+ }
+
+ if (filename == null || !file.exists())
+ {
+ System.err.println("Could not load bootstrap preferences file '"
+ + filename + "'");
+ return null;
+ }
+
+ try
+ {
+ FileInputStream in = new FileInputStream(file.getAbsoluteFile());
+ Properties props = new Properties();
+ props.load(in);
+ for (String prop : bootstrapProperties)
+ {
+ if (props.containsKey(prop))
+ bootstrapProps.put(prop, props.getProperty(prop));
+ }
+ } catch (FileNotFoundException e)
+ {
+ System.err.println("Could not find bootstrap preferences file '"
+ + file.getAbsolutePath() + "'");
+ } catch (IOException e)
+ {
+ System.err.println(
+ "IOException when loading bootstrap preferences file '"
+ + file.getAbsolutePath() + "'");
+ }
+ return bootstrapProps;
+ }
}