2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import java.awt.Color;
24 import java.io.BufferedReader;
26 import java.io.FileInputStream;
27 import java.io.FileOutputStream;
28 import java.io.InputStream;
29 import java.io.InputStreamReader;
30 import java.io.PrintWriter;
31 import java.io.StringWriter;
32 import java.net.Authenticator;
33 import java.net.PasswordAuthentication;
35 import java.text.DateFormat;
36 import java.text.SimpleDateFormat;
37 import java.util.Arrays;
38 import java.util.Collections;
39 import java.util.Date;
40 import java.util.Enumeration;
41 import java.util.Locale;
42 import java.util.Properties;
43 import java.util.StringTokenizer;
44 import java.util.TreeSet;
45 import java.util.regex.Pattern;
47 import javax.swing.LookAndFeel;
48 import javax.swing.UIManager;
50 import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
51 import jalview.datamodel.PDBEntry;
52 import jalview.gui.Preferences;
53 import jalview.gui.UserDefinedColours;
54 import jalview.log.JLoggerLog4j;
55 import jalview.schemes.ColourSchemeLoader;
56 import jalview.schemes.ColourSchemes;
57 import jalview.schemes.UserColourScheme;
58 import jalview.structure.StructureImportSettings;
59 import jalview.urls.IdOrgSettings;
60 import jalview.util.ChannelProperties;
61 import jalview.util.ColorUtils;
62 import jalview.util.MessageManager;
63 import jalview.util.Platform;
64 import jalview.ws.sifts.SiftsSettings;
67 * Stores and retrieves Jalview Application Properties Lists and fields within
68 * list entries are separated by '|' symbols unless otherwise stated (|) clauses
69 * are alternative values for a tag. <br>
71 * Current properties include:
74 * logs.Axis.Level - one of the stringified Levels for log4j controlling the
75 * logging level for axis (used for web services) <br>
77 * <li>logs.Castor.Level - one of the stringified Levels for log4j controlling
78 * the logging level for castor (used for serialization) <br>
80 * <li>logs.Jalview.Level - Cache.log stringified level. <br>
82 * <li>SCREEN_WIDTH</li>
83 * <li>SCREEN_HEIGHT</li>
84 * <li>SCREEN_Y=285</li>
85 * <li>SCREEN_X=371</li>
86 * <li>SHOW_FULLSCREEN boolean</li>
87 * <li>FONT_NAME java font name for alignment text display</li>
88 * <li>FONT_SIZE size of displayed alignment text</li>
89 * <li>FONT_STYLE style of font displayed (sequence labels are always
91 * <li>GAP_SYMBOL character to treat as gap symbol (usually -,.,' ')</li>
92 * <li>LAST_DIRECTORY last directory for browsing alignment</li>
93 * <li>USER_DEFINED_COLOURS list of user defined colour scheme files</li>
94 * <li>SHOW_FULL_ID show id with '/start-end' numbers appended</li>
95 * <li>SHOW_IDENTITY show percentage identity annotation</li>
96 * <li>SHOW_QUALITY show alignment quality annotation</li>
97 * <li>SHOW_ANNOTATIONS show alignment annotation rows</li>
98 * <li>SHOW_CONSERVATION show alignment conservation annotation</li>
99 * <li>SORT_ANNOTATIONS currently either SEQUENCE_AND_LABEL or
100 * LABEL_AND_SEQUENCE</li>
101 * <li>SHOW_AUTOCALC_ABOVE true to show autocalculated annotations above
102 * sequence annotations</li>
103 * <li>CENTRE_COLUMN_LABELS centre the labels at each column in a displayed
104 * annotation row</li>
105 * <li>DEFAULT_COLOUR default colour scheme to apply for a new alignment</li>
106 * <li>DEFAULT_FILE_FORMAT file format used to save</li>
107 * <li>STARTUP_FILE file loaded on startup (may be a fully qualified url)</li>
108 * <li>SHOW_STARTUP_FILE flag to control loading of startup file</li>
109 * <li>VERSION the version of the jalview build</li>
110 * <li>BUILD_DATE date of this build</li>
111 * <li>LATEST_VERSION the latest jalview version advertised on the
112 * www.jalview.org</li>
113 * <li>PIR_MODELLER boolean indicating if PIR files are written with MODELLER
115 * <li>(FASTA,MSF,PILEUP,CLUSTAL,BLC,PIR,PFAM)_JVSUFFIX boolean for adding jv
116 * suffix to file</li>
117 * <li>RECENT_URL list of recently retrieved URLs</li>
118 * <li>RECENT_FILE list of recently opened files</li>
119 * <li>USE_PROXY flag for whether a http proxy is to be used</li>
120 * <li>PROXY_SERVER the proxy</li>
121 * <li>PROXY_PORT</li>
122 * <li>NOQUESTIONNAIRES true to prevent jalview from checking the questionnaire
124 * <li>QUESTIONNAIRE last questionnaire:responder id string from questionnaire
126 * <li>USAGESTATS (false - user prompted) Enable google analytics tracker for
127 * collecting usage statistics</li>
128 * <li>SHOW_OVERVIEW boolean for overview window display</li>
129 * <li>ANTI_ALIAS boolean for smooth fonts</li>
130 * <li>RIGHT_ALIGN_IDS boolean</li>
131 * <li>AUTO_CALC_CONSENSUS boolean for automatic recalculation of consensus</li>
132 * <li>PAD_GAPS boolean</li>
133 * <li>ID_ITALICS boolean</li>
134 * <li>SHOW_JV_SUFFIX</li>
135 * <li>WRAP_ALIGNMENT</li>
136 * <li>EPS_RENDERING (Prompt each time|Lineart|Text) default for EPS rendering
138 * <li>SORT_ALIGNMENT (No sort|Id|Pairwise Identity)</li>
139 * <li>SEQUENCE_LINKS list of name|URL pairs for opening a url with
141 * <li>STORED_LINKS list of name|url pairs which user has entered but are not
143 * <li>DEFAULT_LINK name of single url to be used when user double clicks a
144 * sequence id (must be in SEQUENCE_LINKS or STORED_LINKS)
145 * <li>GROUP_LINKS list of name|URL[|<separator>] tuples - see
146 * jalview.utils.GroupURLLink for more info</li>
147 * <li>DEFAULT_BROWSER for unix</li>
148 * <li>SHOW_MEMUSAGE boolean show memory usage and warning indicator on desktop
150 * <li>VERSION_CHECK (true) check for the latest release version from
151 * www.jalview.org (or the alias given by the www.jalview.org property)</li>
152 * <li>SHOW_NPFEATS_TOOLTIP (true) show non-positional features in the Sequence
154 * <li>SHOW_DBREFS_TOOLTIP (true) show Database Cross References in the Sequence
156 * <li>SHOW_UNCONSERVED (false) only render unconserved residues - conserved
157 * displayed as '.'</li>
158 * <li>SORT_BY_TREE (false) sort the current alignment view according to the
159 * order of a newly displayed tree</li>
160 * <li>DBFETCH_USEPICR (false) use PICR to recover valid DB references from
161 * sequence ID strings before attempting retrieval from any datasource</li>
162 * <li>SHOW_GROUP_CONSENSUS (false) Show consensus annotation for groups in the
164 * <li>SHOW_GROUP_CONSERVATION (false) Show conservation annotation for groups
165 * in the alignment.</li>
166 * <li>SHOW_CONSENSUS_HISTOGRAM (false) Show consensus annotation row's
168 * <li>SHOW_CONSENSUS_LOGO (false) Show consensus annotation row's sequence
170 * <li>NORMALISE_CONSENSUS_LOGO (false) Show consensus annotation row's sequence
171 * logo normalised to row height rather than histogram height.</li>
172 * <li>FOLLOW_SELECTIONS (true) Controls whether a new alignment view should
173 * respond to selections made in other alignments containing the same sequences.
175 * <li>SHOW_JWS2_SERVICES (true) when set to false, jalview will not
176 * auto-discover JABAWS services</li>
177 * <li>JWS2HOSTURLS comma-separated list of URLs to try for JABAWS services</li>
178 * <li>SHOW_WSDISCOVERY_ERRORS (true) Controls if the web service URL discovery
179 * warning dialog box is displayed.</li>
180 * <li>ANNOTATIONCOLOUR_MIN (orange) Shade used for minimum value of annotation
181 * when shading by annotation</li>
182 * <li>ANNOTATIONCOLOUR_MAX (red) Shade used for maximum value of annotation
183 * when shading by annotation</li>
184 * <li>www.jalview.org (https://www.jalview.org) a property enabling all HTTP
185 * requests to be redirected to a mirror of https://www.jalview.org</li>
186 * <li>FIGURE_AUTOIDWIDTH (false) Expand the left hand column of an exported
187 * alignment figure to accommodate even the longest sequence ID or annotation
189 * <li>FIGURE_FIXEDIDWIDTH Specifies the width to use for the left-hand column
190 * when exporting an alignment as a figure (setting FIGURE_AUTOIDWIDTH to true
191 * will override this).</li>
192 * <li>STRUCT_FROM_PDB (false) derive secondary structure annotation from PDB
194 * <li>USE_RNAVIEW (false) use RNAViewer to derive secondary structure</li>
195 * <li>ADD_SS_ANN (false) add secondary structure annotation to alignment
197 * <li>ADD_TEMPFACT_ANN (false) add Temperature Factor annotation to alignment
199 * <li>STRUCTURE_DISPLAY choose from JMOL (default) or CHIMERA for 3D structure
201 * <li>CHIMERA_PATH specify full path to Chimera program (if non-standard)</li>
202 * <li>ID_ORG_HOSTURL location of jalview service providing identifiers.org urls
204 * <li>NONEWS - when set disables Jalview News from automatically appearing</li>
205 * <li>NOHTMLTEMPLATES - when set, the
206 * https://github.com/jalview/exporter-templates/tree/master/biojs repository is
207 * not downloaded automatically</li>
208 * <li>NOIDENTIFIERSSERVICE - when set, jalview won't automatically download
209 * available URL linkouts via www.jalview.org/services/identifiers</li>
212 * Deprecated settings:
215 * <li>DISCOVERY_START - Boolean - controls if discovery services are queried on
216 * startup (JWS1 services only)</li>
217 * <li>DISCOVERY_URLS - comma separated list of Discovery Service endpoints.
218 * (JWS1 services only)</li>
219 * <li>SHOW_JWS1_SERVICES (true) enable or disable the original Jalview 2
220 * services in the desktop GUI</li>
221 * <li>ENABLE_RSBS_EDITOR (false for 2.7 release) enable or disable RSBS editing
222 * panel in web service preferences</li>
226 * @version $Revision$
228 public class Cache implements ApplicationSingletonI
236 * In Java, this will be a static field instance, which will be
237 * application-specific; in JavaScript it will be an applet-specific instance
238 * tied to the applet's ThreadGroup.
242 public static Cache getInstance()
244 return (Cache) ApplicationSingletonProvider.getInstance(Cache.class);
247 * property giving log4j level for CASTOR loggers
249 public static final String CASTORLOGLEVEL = "logs.Castor.level";
252 * property giving log4j level for AXIS loggers
254 public static final String AXISLOGLEVEL = "logs.Axis.level";
257 * property giving log4j level for Jalview Log
259 public static final String JALVIEWLOGLEVEL = "logs.Jalview.level";
264 public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = Platform.getUserPath(".sifts_downloads/");
267 private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2";
269 private final static String DEFAULT_FAIL_SAFE_PID_THRESHOLD = "30";
272 * Identifiers.org download settings
274 private static final String ID_ORG_FILE = Platform.getUserPath(".identifiers.org.ids.json");
277 * Allowed values are PDB or mmCIF
279 private final static String PDB_DOWNLOAD_FORMAT = PDBEntry.Type.MMCIF
282 private final static String DEFAULT_PDB_FILE_PARSER = StructureImportSettings.StructureParser.JMOL_PARSER
286 * a date formatter using a fixed (rather than the user's) locale;
287 * this ensures that date properties can be written and re-read successfully
288 * even if the user changes their locale setting
290 private static final DateFormat date_format = SimpleDateFormat
291 .getDateTimeInstance(SimpleDateFormat.MEDIUM,
292 SimpleDateFormat.MEDIUM, Locale.UK);
295 * Initialises the Jalview Application Log
297 public final static String JALVIEW_LOGGER_NAME = "JalviewLogger";
299 // save the proxy properties set at startup
300 public final static String[] startupProxyProperties = {
301 System.getProperty("http.proxyHost"),
302 System.getProperty("http.proxyPort"),
303 System.getProperty("https.proxyHost"),
304 System.getProperty("https.proxyPort"),
305 System.getProperty("http.proxyUser"),
306 System.getProperty("http.proxyPassword"),
307 System.getProperty("https.proxyUser"),
308 System.getProperty("https.proxyPassword"),
309 System.getProperty("http.nonProxyHosts") };
311 public final static String PROXYTYPE_NONE = "none";
313 // "false" and "true" for backward compatibility
314 public final static String PROXYTYPE_SYSTEM = "false";
316 public final static String PROXYTYPE_CUSTOM = "true";
318 // in-memory only storage of proxy password, safer to use char array
319 public static char[] proxyAuthPassword = null;
321 /** Jalview Properties */
322 private Properties applicationProperties = new Properties()
324 // override results in properties output in alphabetical order
326 public synchronized Enumeration<Object> keys()
328 return Collections.enumeration(new TreeSet<>(super.keySet()));
332 /* build Properties (not all saved to .jalview_properties) */
333 public static Properties buildProperties = new Properties();
335 /** Default file is ~/.jalview_properties */
336 static String propertiesFile;
338 private static boolean propsAreReadOnly = Platform.isJS();
340 private final static String JS_PROPERTY_PREFIX = "jalview_";
344 * Loads properties from the given properties file. Any existing properties are
347 public static void loadProperties(String propsFile)
349 getInstance().loadPropertiesImpl(propsFile);
353 private void loadPropertiesImpl(String propsFile)
355 propertiesFile = propsFile;
356 String releasePropertiesFile = null;
357 boolean defaultProperties = false;
358 if (propsFile == null && !propsAreReadOnly)
360 // TODO: @bsoares - for 2.12 testing: check test,develop,release props are located correctly
361 String channelPrefsFilename = ChannelProperties
362 .getProperty("preferences.filename");
363 String releasePrefsFilename = ".jalview_properties";
364 propertiesFile = Platform.getUserPath(channelPrefsFilename);
365 releasePropertiesFile = Platform.getUserPath(releasePrefsFilename);
366 defaultProperties = true;
370 // don't corrupt the file we've been given.
371 propsAreReadOnly = true;
374 if (propertiesFile == null)
376 Platform.readInfoProperties(JS_PROPERTY_PREFIX,
377 applicationProperties);
386 // props file provided as URL
387 fis = new URL(propertiesFile).openStream();
389 "Loading jalview properties from : " + propertiesFile);
391 "Disabling Jalview writing to user's local properties file.");
392 propsAreReadOnly = true;
393 } catch (Exception ex)
399 String readPropertiesFile = propertiesFile;
400 // if we're using the usual properties file and the channel properties
401 // file doesn't exist, read .jalview_properties
402 // (but we'll still save to the channel properties file).
403 if (defaultProperties && (!new File(propertiesFile).exists())
404 && (new File(releasePropertiesFile).exists()))
406 readPropertiesFile = releasePropertiesFile;
408 fis = new FileInputStream(readPropertiesFile);
410 applicationProperties.clear();
411 applicationProperties.load(fis);
413 // remove any old build properties
415 deleteBuildProperties();
417 } catch (Exception ex)
419 System.out.println("Error reading properties file: " + ex);
423 /* TO BE REPLACED WITH PROXY_TYPE SETTINGS
424 if (getDefault("USE_PROXY", false))
426 String proxyServer = getDefault("PROXY_SERVER", ""),
427 proxyPort = getDefault("PROXY_PORT", "8080");
431 // PROXY TYPE settings (now three options "none", "false", "true", but using
432 // backward compatible strings)
433 String proxyType = getDefault("USE_PROXY", PROXYTYPE_SYSTEM);
434 // default to upgrading old settings
438 clearProxyProperties();
440 case PROXYTYPE_SYSTEM: // use system settings
441 resetProxyProperties();
443 case PROXYTYPE_CUSTOM: // use specified proxy settings
444 String httpHost = getDefault("PROXY_SERVER", "");
445 String httpPort = getDefault("PROXY_PORT", "8080");
446 String httpsHost = getDefault("PROXY_SERVER_HTTPS", httpHost);
447 String httpsPort = getDefault("PROXY_PORT_HTTPS", httpPort);
448 String httpUser = getDefault("PROXY_AUTH_USER", null);
449 // https.proxyUser and https.proxyPassword are not able to be
450 // independently set in Preferences yet (or http.nonProxyHosts)
451 String httpsUser = getDefault("PROXY_AUTH_USER_HTTPS", httpUser);
452 setProxyProperties(httpHost, httpPort, httpsHost, httpsPort, httpUser,
453 proxyAuthPassword, httpsUser, proxyAuthPassword, "localhost");
456 String message = "Incorrect PROXY_TYPE - should be 'none' (clear proxy properties), 'false' (system settings), 'true' (custom settings): "
458 Console.warn(message);
461 // LOAD THE AUTHORS FROM THE authors.props file
462 String authorDetails = resolveResourceURLFor("/authors.props");
466 if (authorDetails != null)
468 URL localJarFileURL = new URL(authorDetails);
469 InputStream in = localJarFileURL.openStream();
470 applicationProperties.load(in);
473 } catch (Exception ex)
475 System.out.println("Error reading author details: " + ex);
476 authorDetails = null;
478 if (authorDetails == null)
480 applicationProperties.remove("AUTHORS");
481 applicationProperties.remove("AUTHORFNAMES");
482 applicationProperties.remove("YEAR");
485 loadBuildProperties(false);
488 .setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false));
490 SiftsSettings.setSiftDownloadDirectory(Cache
491 .getDefault("sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR));
493 SiftsSettings.setFailSafePIDThreshold(
494 Cache.getDefault("sifts_fail_safe_pid_threshold",
495 DEFAULT_FAIL_SAFE_PID_THRESHOLD));
497 SiftsSettings.setCacheThresholdInDays(
498 Cache.getDefault("sifts_cache_threshold_in_days",
499 DEFAULT_CACHE_THRESHOLD_IN_DAYS));
501 IdOrgSettings.setUrl(getDefault("ID_ORG_HOSTURL",
502 "https://www.jalview.org/services/identifiers"));
503 IdOrgSettings.setDownloadLocation(ID_ORG_FILE);
505 StructureImportSettings.setDefaultStructureFileFormat(
506 Cache.getDefault("PDB_DOWNLOAD_FORMAT", PDB_DOWNLOAD_FORMAT));
507 StructureImportSettings
508 .setDefaultPDBFileParser(DEFAULT_PDB_FILE_PARSER);
509 // StructureImportSettings
510 // .setDefaultPDBFileParser(Cache.getDefault(
511 // "DEFAULT_PDB_FILE_PARSER", DEFAULT_PDB_FILE_PARSER));
513 String jnlpVersion = System.getProperty("jalview.version");
515 // jnlpVersion will be null if a latest version check for the channel needs
517 // Dont do this check if running in headless mode
519 if (jnlpVersion == null && getDefault("VERSION_CHECK", true)
520 && (System.getProperty("java.awt.headless") == null || System
521 .getProperty("java.awt.headless").equals("false")))
524 class VersionChecker extends Thread
530 String remoteBuildPropertiesUrl = Cache
531 .getAppbaseBuildProperties();
533 String orgtimeout = System
534 .getProperty("sun.net.client.defaultConnectTimeout");
535 if (orgtimeout == null)
538 System.out.println("# INFO: Setting default net timeout to "
539 + orgtimeout + " seconds.");
541 String remoteVersion = null;
542 if (remoteBuildPropertiesUrl.startsWith("http"))
546 System.setProperty("sun.net.client.defaultConnectTimeout",
549 URL url = new URL(remoteBuildPropertiesUrl);
551 BufferedReader in = new BufferedReader(
552 new InputStreamReader(url.openStream()));
554 Properties remoteBuildProperties = new Properties();
555 remoteBuildProperties.load(in);
556 remoteVersion = remoteBuildProperties.getProperty("VERSION");
557 } catch (Exception ex)
560 "Non-fatal exception when checking version at "
561 + remoteBuildPropertiesUrl + ":");
562 System.out.println(ex);
563 remoteVersion = getProperty("VERSION");
566 System.setProperty("sun.net.client.defaultConnectTimeout",
569 setProperty("LATEST_VERSION", remoteVersion);
573 VersionChecker vc = new VersionChecker();
578 if (jnlpVersion != null)
580 setProperty("LATEST_VERSION", jnlpVersion);
584 applicationProperties.remove("LATEST_VERSION");
588 // LOAD USERDEFINED COLOURS
589 Cache.initUserColourSchemes(getProperty("USER_DEFINED_COLOURS"));
590 jalview.io.PIRFile.useModellerOutput = Cache.getDefault("PIR_MODELLER",
595 * construct a resource URL for the given absolute resource pathname
597 * @param resourcePath
600 private static String resolveResourceURLFor(String resourcePath)
603 if (Platform.isJS() || !Cache.class.getProtectionDomain()
604 .getCodeSource().getLocation().toString().endsWith(".jar"))
608 url = Cache.class.getResource(resourcePath).toString();
609 } catch (Exception ex)
611 System.err.println("Failed to resolve resource " + resourcePath
612 + ": " + ex.getMessage());
617 url = "jar:".concat(Cache.class.getProtectionDomain().getCodeSource()
618 .getLocation().toString().concat("!" + resourcePath));
623 public void loadBuildProperties(boolean reportVersion)
625 String codeInstallation = getProperty("INSTALLATION");
626 boolean printVersion = codeInstallation == null;
629 * read build properties - from the Jalview jar for a Java distribution,
630 * or from codebase file in test or JalviewJS context
634 String buildDetails = resolveResourceURLFor("/.build_properties");
635 URL localJarFileURL = new URL(buildDetails);
636 InputStream in = localJarFileURL.openStream();
637 buildProperties.load(in);
639 if (buildProperties.getProperty("BUILD_DATE", null) != null)
641 applicationProperties.put("BUILD_DATE",
642 buildProperties.getProperty("BUILD_DATE"));
644 if (buildProperties.getProperty("INSTALLATION", null) != null)
646 applicationProperties.put("INSTALLATION",
647 buildProperties.getProperty("INSTALLATION"));
649 if (buildProperties.getProperty("VERSION", null) != null)
651 applicationProperties.put("VERSION",
652 buildProperties.getProperty("VERSION"));
654 if (buildProperties.getProperty("JAVA_COMPILE_VERSION", null) != null)
656 applicationProperties.put("JAVA_COMPILE_VERSION",
657 buildProperties.getProperty("JAVA_COMPILE_VERSION"));
659 } catch (Exception ex)
661 System.out.println("Error reading build details: " + ex);
662 applicationProperties.remove("VERSION");
664 String codeVersion = getProperty("VERSION");
665 codeInstallation = getProperty("INSTALLATION");
667 if (codeVersion == null)
669 // THIS SHOULD ONLY BE THE CASE WHEN TESTING!!
670 codeVersion = "Test";
671 codeInstallation = "";
675 codeInstallation = " (" + codeInstallation + ")";
677 setProperty("VERSION", codeVersion);
678 new BuildDetails(codeVersion, null, codeInstallation);
679 if (printVersion && reportVersion)
681 System.out.println(ChannelProperties.getProperty("app_name")
682 + " Version: " + codeVersion + codeInstallation);
686 private void deleteBuildProperties()
688 applicationProperties.remove("LATEST_VERSION");
689 applicationProperties.remove("VERSION");
690 applicationProperties.remove("AUTHORS");
691 applicationProperties.remove("AUTHORFNAMES");
692 applicationProperties.remove("YEAR");
693 applicationProperties.remove("BUILD_DATE");
694 applicationProperties.remove("INSTALLATION");
698 * Gets Jalview application property of given key. Returns null if key not found
703 * @return Property value
705 public static String getProperty(String key)
707 String prop = getInstance().applicationProperties.getProperty(key);
708 // if (prop == null && Platform.isJS())
710 // prop = applicationProperties.getProperty(Platform.getUniqueAppletID()
711 // + "_" + JS_PROPERTY_PREFIX + key);
717 * These methods are used when checking if the saved preference is different to
718 * the default setting
721 public static boolean getDefault(String property, boolean def)
723 String string = getProperty(property);
726 def = Boolean.valueOf(string).booleanValue();
732 public static int getDefault(String property, int def)
734 String string = getProperty(property);
739 def = Integer.parseInt(string);
740 } catch (NumberFormatException e)
742 System.out.println("Error parsing int property '" + property
743 + "' with value '" + string + "'");
751 * Answers the value of the given property, or the supplied default value if the
752 * property is not set
754 public static String getDefault(String property, String def)
756 String value = getProperty(property);
757 return value == null ? def : value;
761 * Stores property in the file "HOME_DIR/.jalview_properties"
766 * String value of property
768 * @return previous value of property (or null)
770 public static Object setProperty(String key, String obj)
772 return getInstance().setPropertyImpl(key, obj, true);
776 * Removes the specified property from the jalview properties file
780 public static void removeProperty(String key)
782 getInstance().removePropertyImpl(key, true);
786 * Removes the named property for the running application, without saving the
789 * BH noting that ColourMenuHelper calls this. If the intent is to save, then
790 * simply chanet that call to removeProperty(key).
794 public static void removePropertyNoSave(String key)
799 removePropertyImpl(key, false);
803 * Removes the named property, and optionally saves the current properties to
809 private void removePropertyImpl(String key, boolean andSave)
811 applicationProperties.remove(key);
817 * save the properties to the jalview properties path
819 public static void saveProperties()
821 getInstance().savePropertiesImpl();
825 * save the properties to the jalview properties path
827 private void savePropertiesImpl()
830 if (!propsAreReadOnly)
834 FileOutputStream out = new FileOutputStream(propertiesFile);
835 applicationProperties.store(out, "---JalviewX Properties File---");
837 } catch (Exception ex)
839 System.out.println("Error saving properties: " + ex);
845 * internal vamsas class discovery state
847 private static int vamsasJarsArePresent = -1;
850 * Searches for vamsas client classes on class path.
852 * @return true if vamsas client is present on classpath
854 public static boolean vamsasJarsPresent()
856 if (vamsasJarsArePresent == -1)
860 if (jalview.jbgui.GDesktop.class.getClassLoader()
861 .loadClass("uk.ac.vamsas.client.VorbaId") != null)
864 "Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)");
865 vamsasJarsArePresent = 1;
866 JLoggerLog4j lvclient = JLoggerLog4j.getLogger("uk.ac.vamsas",
867 Console.getCachedLogLevel("logs.Vamsas.Level"));
868 JLoggerLog4j.addAppender(lvclient, Console.log,
869 JALVIEW_LOGGER_NAME);
870 // Tell the user that debug is enabled
871 lvclient.debug(ChannelProperties.getProperty("app_name")
872 + " Vamsas Client Debugging Output Follows.");
874 } catch (Exception e)
876 vamsasJarsArePresent = 0;
877 Console.debug("Vamsas Classes are not present");
880 return (vamsasJarsArePresent > 0);
884 * internal vamsas class discovery state
886 private static int groovyJarsArePresent = -1;
889 * Searches for vamsas client classes on class path.
891 * @return true if vamsas client is present on classpath
893 public static boolean groovyJarsPresent()
895 if (groovyJarsArePresent == -1)
899 if (Cache.class.getClassLoader()
900 .loadClass("groovy.lang.GroovyObject") != null)
903 "Found Groovy (groovy.lang.GroovyObject can be loaded)");
904 groovyJarsArePresent = 1;
905 JLoggerLog4j lgclient = JLoggerLog4j.getLogger("groovy",
906 Console.getCachedLogLevel("logs.Groovy.Level"));
907 JLoggerLog4j.addAppender(lgclient, Console.log,
908 JALVIEW_LOGGER_NAME);
909 // Tell the user that debug is enabled
910 lgclient.debug(ChannelProperties.getProperty("app_name")
911 + " Groovy Client Debugging Output Follows.");
915 groovyJarsArePresent = 0;
916 Console.debug("Groovy Classes are not present", e);
917 } catch (Exception e)
919 groovyJarsArePresent = 0;
920 Console.debug("Groovy Classes are not present");
923 return (groovyJarsArePresent > 0);
927 * GA tracker object - actually JGoogleAnalyticsTracker null if tracking not
930 protected static Object tracker = null;
932 protected static Class trackerfocus = null;
934 protected static Class jgoogleanalyticstracker = null;
937 * Initialise the google tracker if it is not done already.
939 public static void initGoogleTracker()
943 if (jgoogleanalyticstracker == null)
945 // try to get the tracker class
948 jgoogleanalyticstracker = Cache.class.getClassLoader().loadClass(
949 "com.boxysystems.jgoogleanalytics.JGoogleAnalyticsTracker");
950 trackerfocus = Cache.class.getClassLoader()
951 .loadClass("com.boxysystems.jgoogleanalytics.FocusPoint");
952 } catch (Exception e)
955 "com.boxysystems.jgoogleanalytics package is not present - tracking not enabled.");
957 jgoogleanalyticstracker = null;
962 // now initialise tracker
963 Exception re = null, ex = null;
965 String vrs = "No Version Accessible";
968 // Google analytics tracking code for Library Finder
969 tracker = jgoogleanalyticstracker
970 .getConstructor(new Class[]
971 { String.class, String.class, String.class })
972 .newInstance(new Object[]
973 { ChannelProperties.getProperty("app_name") + " Desktop",
974 (vrs = Cache.getProperty("VERSION") + "_"
975 + Cache.getDefault("BUILD_DATE", "unknown")),
977 jgoogleanalyticstracker
978 .getMethod("trackAsynchronously", new Class[]
980 .invoke(tracker, new Object[]
981 { trackerfocus.getConstructor(new Class[] { String.class })
982 .newInstance(new Object[]
983 { "Application Started." }) });
984 } catch (RuntimeException e)
987 } catch (Exception e)
994 if (re != null || ex != null || err != null)
998 Console.debug("Caught runtime exception in googletracker init:",
1004 "Failed to initialise GoogleTracker for Jalview Desktop with version "
1011 "Whilst initing GoogleTracker for Jalview Desktop version "
1018 Console.debug("Successfully initialised tracker.");
1024 * get the user's default colour if available
1030 public static Color getDefaultColour(String property, Color defcolour)
1032 String colprop = getProperty(property);
1033 if (colprop == null)
1037 Color col = ColorUtils.parseColourString(colprop);
1040 Console.warn("Couldn't parse '" + colprop + "' as a colour for "
1043 return (col == null) ? defcolour : col;
1047 * store a colour as a Jalview user default property
1052 public static void setColourPropertyNoSave(String property, Color colour)
1054 setPropertyNoSave(property, jalview.util.Format.getHexString(colour));
1058 * Stores a formatted date in a jalview property, using a fixed locale.
1060 * @param propertyName
1062 * @return the formatted date string
1064 public static String setDateProperty(String propertyName, Date date)
1066 String formatted = date_format.format(date);
1067 setProperty(propertyName, formatted);
1072 * Reads a date stored in a Jalview property, parses it (using a fixed locale
1073 * format) and returns as a Date, or null if parsing fails
1075 * @param propertyName
1079 public static Date getDateProperty(String propertyName)
1081 String val = getProperty(propertyName);
1087 if ((val = val.trim()).indexOf(",") < 0 && val.indexOf("-") >= 0 && val.indexOf(" ") == val.lastIndexOf(" ")) {
1088 val = val.replace(" ",", ").replace('-',' ');
1090 Date date = date_format.parse(val);
1092 } catch (Exception ex)
1094 System.err.println("Invalid or corrupt date in property '"
1095 + propertyName + "' : value was '" + val + "'");
1102 * get and parse a property as an integer. send any parsing problems to
1106 * @return null or Integer
1108 public static Integer getIntegerProperty(String property)
1110 String val = getProperty(property);
1111 if (val != null && (val = val.trim()).length() > 0)
1115 return Integer.valueOf(val);
1116 } catch (NumberFormatException x)
1118 System.err.println("Invalid integer in property '" + property
1119 + "' (value was '" + val + "')");
1126 * Set the specified value, or remove it if null or empty. Does not save the
1132 public static void setOrRemove(String propName, String value)
1134 if (propName == null)
1138 if (value == null || value.trim().length() < 1)
1140 getInstance().applicationProperties.remove(propName);
1144 getInstance().applicationProperties.setProperty(propName, value);
1149 * Loads in user colour schemes from files.
1152 * a '|'-delimited list of file paths
1154 public static void initUserColourSchemes(String files)
1156 if (files == null || files.length() == 0)
1161 // In case colours can't be loaded, we'll remove them
1162 // from the default list here.
1163 StringBuffer coloursFound = new StringBuffer();
1164 StringTokenizer st = new StringTokenizer(files, "|");
1165 while (st.hasMoreElements())
1167 String file = st.nextToken();
1170 UserColourScheme ucs = ColourSchemeLoader.loadColourScheme(file);
1173 if (coloursFound.length() > 0)
1175 coloursFound.append("|");
1177 coloursFound.append(file);
1178 ColourSchemes.getInstance().registerColourScheme(ucs);
1180 } catch (Exception ex)
1182 System.out.println("Error loading User ColourFile\n" + ex);
1185 if (!files.equals(coloursFound.toString()))
1187 if (coloursFound.toString().length() > 1)
1189 setProperty(UserDefinedColours.USER_DEFINED_COLOURS,
1190 coloursFound.toString());
1194 getInstance().applicationProperties
1195 .remove(UserDefinedColours.USER_DEFINED_COLOURS);
1201 * Initial logging information helper for various versions output
1205 * @param defaultValue
1207 private static void appendIfNotNull(StringBuilder sb, String prefix,
1208 String value, String suffix, String defaultValue)
1210 if (value == null && defaultValue == null)
1216 sb.append(value == null ? defaultValue : value);
1223 * @return Jalview version, build details and JVM platform version for console
1225 public static String getVersionDetailsForConsole()
1227 StringBuilder sb = new StringBuilder();
1228 sb.append(ChannelProperties.getProperty("app_name"))
1229 .append(" Version: ");
1230 sb.append(Cache.getDefault("VERSION", "TEST"));
1232 sb.append(ChannelProperties.getProperty("app_name"))
1233 .append(" Installation: ");
1234 sb.append(Cache.getDefault("INSTALLATION", "unknown"));
1236 sb.append("Build Date: ");
1237 sb.append(Cache.getDefault("BUILD_DATE", "unknown"));
1239 sb.append("Java version: ");
1240 sb.append(System.getProperty("java.version"));
1242 sb.append(System.getProperty("os.arch"));
1244 sb.append(System.getProperty("os.name"));
1246 sb.append(System.getProperty("os.version"));
1248 appendIfNotNull(sb, "Install4j version: ",
1249 System.getProperty("sys.install4jVersion"), "\n", null);
1250 appendIfNotNull(sb, "Install4j template version: ",
1251 System.getProperty("installer_template_version"), "\n", null);
1252 appendIfNotNull(sb, "Launcher version: ",
1253 System.getProperty("launcher_version"), "\n", null);
1254 LookAndFeel laf = UIManager.getLookAndFeel();
1255 String lafName = laf == null ? "Not obtained" : laf.getName();
1256 String lafClass = laf == null ? "unknown" : laf.getClass().getName();
1257 sb.append("LookAndFeel: ");
1260 sb.append(lafClass);
1262 if (Console.isDebugEnabled()
1263 || !"release".equals(ChannelProperties.getProperty("channel")))
1265 appendIfNotNull(sb, "Channel: ",
1266 ChannelProperties.getProperty("channel"), "\n", null);
1267 appendIfNotNull(sb, "Getdown appdir: ",
1268 System.getProperty("getdowninstanceappdir"), "\n", null);
1269 appendIfNotNull(sb, "Getdown appbase: ",
1270 System.getProperty("getdowninstanceappbase"), "\n", null);
1271 appendIfNotNull(sb, "Java home: ", System.getProperty("java.home"),
1274 return sb.toString();
1279 * @return build details as reported in splashscreen
1281 public static String getBuildDetailsForSplash()
1283 // consider returning more human friendly info
1284 // eg 'built from Source' or update channel
1285 return Cache.getDefault("INSTALLATION", "unknown");
1290 * For AppletParams and Preferences ok_actionPerformed and
1291 * startupFileTextfield_mouseClicked
1293 * Sets a property value for the running application, without saving it to the
1299 public static void setPropertyNoSave(String key, String obj)
1301 getInstance().setPropertyImpl(key, obj, false);
1305 * Sets a property value, and optionally also saves the current properties to
1313 private Object setPropertyImpl(
1314 String key, String obj, boolean andSave)
1316 Object oldValue = null;
1319 oldValue = applicationProperties.setProperty(key, obj);
1320 if (andSave && !propsAreReadOnly && propertiesFile != null)
1322 FileOutputStream out = new FileOutputStream(propertiesFile);
1323 applicationProperties.store(out, "---JalviewX Properties File---");
1326 } catch (Exception ex)
1329 "Error setting property: " + key + " " + obj + "\n" + ex);
1334 public static String getStackTraceString(Throwable t)
1336 StringWriter sw = new StringWriter();
1337 PrintWriter pw = new PrintWriter(sw);
1338 t.printStackTrace(pw);
1339 return sw.toString();
1342 // proxy properties methods
1343 public static void clearProxyProperties()
1345 setProxyProperties(null, null, null, null, null, null, null, null,
1349 public static void resetProxyProperties()
1351 setProxyProperties(startupProxyProperties[0], startupProxyProperties[1],
1352 startupProxyProperties[2], startupProxyProperties[3],
1353 startupProxyProperties[4],
1354 startupProxyProperties[5] == null ? null
1355 : startupProxyProperties[5].toCharArray(),
1356 startupProxyProperties[6],
1357 startupProxyProperties[7] == null ? null
1358 : startupProxyProperties[7].toCharArray(),
1359 startupProxyProperties[8]);
1360 StringBuilder sb = new StringBuilder();
1361 sb.append("Setting proxy properties to: http.proxyHost=")
1362 .append(startupProxyProperties[0]).append(", http.proxyPort=")
1363 .append(startupProxyProperties[1])
1364 .append(startupProxyProperties[4] != null
1365 && !startupProxyProperties[4].isEmpty()
1366 ? " [" + startupProxyProperties[4] + "]"
1368 .append(", https.proxyHost=").append(startupProxyProperties[2])
1369 .append(", https.proxyPort=").append(startupProxyProperties[3])
1370 .append(startupProxyProperties[6] != null
1371 && !startupProxyProperties[6].isEmpty()
1372 ? " [" + startupProxyProperties[6] + "]"
1375 Console.debug(sb.toString());
1378 public static void setProxyPropertiesFromPreferences()
1380 setProxyPropertiesFromPreferences(Cache.PROXYTYPE_SYSTEM);
1383 public static void setProxyPropertiesFromPreferences(
1384 String previousProxyType)
1386 String proxyType = Cache.getDefault("USE_PROXY",
1387 Cache.PROXYTYPE_SYSTEM);
1388 if (previousProxyType != null
1389 && !proxyType.equals(Cache.PROXYTYPE_CUSTOM) // always apply
1391 && proxyType.equals(previousProxyType))
1398 case Cache.PROXYTYPE_NONE:
1399 if (!previousProxyType.equals(proxyType))
1401 Console.info("Setting no proxy settings");
1402 Cache.setProxyProperties(null, null, null, null, null, null, null,
1406 case Cache.PROXYTYPE_CUSTOM:
1407 // always re-set a custom proxy -- it might have changed, particularly
1409 Console.info("Setting custom proxy settings");
1410 boolean proxyAuthSet = Cache.getDefault("PROXY_AUTH", false);
1411 Cache.setProxyProperties(Cache.getDefault("PROXY_SERVER", null),
1412 Cache.getDefault("PROXY_PORT", null),
1413 Cache.getDefault("PROXY_SERVER_HTTPS", null),
1414 Cache.getDefault("PROXY_PORT_HTTPS", null),
1415 proxyAuthSet ? Cache.getDefault("PROXY_AUTH_USERNAME", "")
1417 proxyAuthSet ? Cache.proxyAuthPassword : null,
1418 proxyAuthSet ? Cache.getDefault("PROXY_AUTH_USERNAME", "")
1420 proxyAuthSet ? Cache.proxyAuthPassword : null, "localhost");
1422 default: // system proxy settings by default
1423 Console.info("Setting system proxy settings");
1424 Cache.resetProxyProperties();
1428 public static void setProxyProperties(String httpHost, String httpPort,
1429 String httpsHost, String httpsPort, String httpUser,
1430 char[] httpPassword, String httpsUser, char[] httpsPassword,
1431 String nonProxyHosts)
1433 setOrClearSystemProperty("http.proxyHost", httpHost);
1434 setOrClearSystemProperty("http.proxyPort", httpPort);
1435 setOrClearSystemProperty("https.proxyHost", httpsHost);
1436 setOrClearSystemProperty("https.proxyPort", httpsPort);
1437 setOrClearSystemProperty("http.proxyUser", httpUser);
1438 setOrClearSystemProperty("https.proxyUser", httpsUser);
1439 // note: passwords for http.proxyPassword and https.proxyPassword are sent
1440 // via the Authenticator, properties do not need to be set
1442 // are we using a custom proxy (password prompt might be required)?
1443 boolean customProxySet = getDefault("USE_PROXY", PROXYTYPE_SYSTEM)
1444 .equals(PROXYTYPE_CUSTOM);
1447 * A bug in Java means the AuthCache does not get reset, so once it has working credentials,
1448 * it never asks for more, so changing the Authenticator has no effect (as getPasswordAuthentication()
1449 * is not re-called).
1450 * This could lead to password leak to a hostile proxy server, so I'm putting in a hack to clear
1452 * see https://www.generacodice.com/en/articolo/154918/Reset-the-Authenticator-credentials
1454 * Turns out this is only accessible in Java 8, and not in Java 9 onwards, so commenting out
1459 sun.net.www.protocol.http.AuthCacheValue
1460 .setAuthCache(new sun.net.www.protocol.http.AuthCacheImpl());
1461 } catch (Throwable t)
1463 Cache.error(t.getMessage());
1464 Cache.debug(getStackTraceString(t));
1468 if (httpUser != null || httpsUser != null)
1472 char[] displayHttpPw = new char[httpPassword == null ? 0
1473 : httpPassword.length];
1474 Arrays.fill(displayHttpPw, '*');
1476 "CACHE Proxy: setting new Authenticator with httpUser='"
1477 + httpUser + "' httpPassword='" + displayHttpPw
1479 if (!Platform.isJS())
1481 * java.net.Authenticator not implemented in SwingJS yet
1487 Authenticator.setDefault(new Authenticator()
1490 protected PasswordAuthentication getPasswordAuthentication()
1492 if (getRequestorType() == RequestorType.PROXY)
1494 String protocol = getRequestingProtocol();
1495 boolean needProxyPasswordSet = false;
1496 if (customProxySet &&
1497 // we have a username but no password for the scheme being
1499 (protocol.equalsIgnoreCase("http")
1500 && (httpUser != null && httpUser.length() > 0
1501 && (httpPassword == null
1502 || httpPassword.length == 0)))
1503 || (protocol.equalsIgnoreCase("https")
1504 && (httpsUser != null
1505 && httpsUser.length() > 0
1506 && (httpsPassword == null
1507 || httpsPassword.length == 0))))
1509 // open Preferences -> Connections
1510 String message = MessageManager
1511 .getString("label.proxy_password_required");
1512 Preferences.openPreferences(
1513 Preferences.TabRef.CONNECTIONS_TAB, message);
1514 Preferences.getInstance()
1515 .proxyAuthPasswordCheckHighlight(true, true);
1521 if (protocol.equalsIgnoreCase("http")
1522 && getRequestingHost()
1523 .equalsIgnoreCase(httpHost)
1524 && getRequestingPort() == Integer
1528 "AUTHENTICATOR returning PasswordAuthentication(\""
1529 + httpUser + "\", '"
1530 + new String(displayHttpPw) + "')");
1531 return new PasswordAuthentication(httpUser,
1534 if (protocol.equalsIgnoreCase("https")
1535 && getRequestingHost()
1536 .equalsIgnoreCase(httpsHost)
1537 && getRequestingPort() == Integer
1538 .valueOf(httpsPort))
1540 char[] displayHttpsPw = new char[httpPassword.length];
1541 Arrays.fill(displayHttpsPw, '*');
1543 "AUTHENTICATOR returning PasswordAuthentication(\""
1544 + httpsUser + "\", '" + displayHttpsPw
1546 return new PasswordAuthentication(httpsUser,
1549 } catch (NumberFormatException e)
1551 Console.error("Problem with proxy port values [http:"
1552 + httpPort + ", https:" + httpsPort + "]");
1555 "AUTHENTICATOR after trying to get PasswordAuthentication");
1558 // non proxy request
1559 Console.debug("AUTHENTICATOR returning null");
1563 } // end of j2sIgnore for java.net.Authenticator
1565 // required to re-enable basic authentication (should be okay for a
1568 "AUTHENTICATOR setting property 'jdk.http.auth.tunneling.disabledSchemes' to \"\"");
1569 System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
1570 } catch (SecurityException e)
1572 Console.error("Could not set default Authenticator");
1573 Console.debug(getStackTraceString(e));
1578 // reset the Authenticator to protect http.proxyUser and
1579 // http.proxyPassword Just In Case
1580 /* as noted above, due to bug in java this doesn't work if the sun.net.www.protocol.http.AuthCache
1581 * has working credentials. No workaround for Java 11.
1583 if (!Platform.isJS())
1585 * java.net.Authenticator not implemented in SwingJS yet
1592 "AUTHENTICATOR setting default Authenticator to null");
1593 Authenticator.setDefault(null);
1597 // nonProxyHosts not currently configurable in Preferences
1599 "AUTHENTICATOR setting property 'http.nonProxyHosts' to \""
1600 + nonProxyHosts + "\"");
1601 setOrClearSystemProperty("http.nonProxyHosts", nonProxyHosts);
1604 public static void setOrClearSystemProperty(String key, char[] value)
1606 setOrClearSystemProperty(key,
1607 (value == null) ? null : new String(value));
1610 public static void setOrClearSystemProperty(String key, String value)
1618 System.clearProperty(key);
1622 System.setProperty(key, value);
1627 * Getdown appbase methods
1630 private static final String releaseAppbase;
1632 private static String getdownAppbase;
1634 private static String getdownDistDir;
1638 if (!Platform.isJS())
1640 Float specversion = Float
1641 .parseFloat(System.getProperty("java.specification.version"));
1642 releaseAppbase = (specversion < 9)
1643 ? "https://www.jalview.org/getdown/release/1.8"
1644 : "https://www.jalview.org/getdown/release/11";
1648 // this value currenly made up, can be changed to URL that will be
1649 // "https://www.jalview.org/jalview-js/swingjs/j2s/build_properties"
1650 releaseAppbase = "https://www.jalview.org/jalview-js";
1651 getdownAppbase = releaseAppbase;
1652 getdownDistDir = "/swingjs/j2s";
1656 // look for properties (passed in by getdown) otherwise default to release
1657 private static void setGetdownAppbase()
1659 if (getdownAppbase != null)
1663 String appbase = System.getProperty("getdownappbase");
1664 String distDir = System.getProperty("getdowndistdir");
1665 if (appbase == null)
1667 appbase = buildProperties.getProperty("GETDOWNAPPBASE");
1668 distDir = buildProperties.getProperty("GETDOWNAPPDISTDIR");
1670 if (appbase == null)
1672 appbase = releaseAppbase;
1673 distDir = "release";
1675 if (appbase.endsWith("/"))
1677 appbase = appbase.substring(0, appbase.length() - 1);
1679 if (distDir == null)
1681 distDir = appbase.equals(releaseAppbase) ? "release" : "alt";
1683 getdownAppbase = appbase;
1684 getdownDistDir = distDir;
1687 public static String getGetdownAppbase()
1689 setGetdownAppbase();
1690 return getdownAppbase;
1693 public static String getAppbaseBuildProperties()
1695 String appbase = getGetdownAppbase();
1696 return appbase + "/" + getdownDistDir + "/build_properties";