Merge branch 'apifix/JAL-1926_JAL-2106' into develop
[jalview.git] / src / jalview / bin / Cache.java
index 4ea90e8..6f16a6e 100755 (executable)
  */
 package jalview.bin;
 
+import jalview.datamodel.PDBEntry;
+import jalview.structure.StructureImportSettings;
 import jalview.ws.dbsources.das.api.DasSourceRegistryI;
 import jalview.ws.dbsources.das.datamodel.DasSourceRegistry;
+import jalview.ws.sifts.SiftsSettings;
 
 import java.awt.Color;
 import java.io.BufferedReader;
@@ -216,6 +219,24 @@ public class Cache
 
   public static final String DAS_ACTIVE_SOURCE = "DAS_ACTIVE_SOURCE";
 
+  public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = System
+          .getProperty("user.home")
+          + File.separatorChar
+          + ".sifts_downloads" + File.separatorChar;
+
+  private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2";
+
+  private final static String DEFAULT_FAIL_SAFE_PID_THRESHOLD = "30";
+  
+  /**
+   * Allowed values are PDB or mmCIF
+   */
+  private final static String DEFAULT_STRUCTURE_FORMAT = PDBEntry.Type.MMCIF
+          .toString();
+
+  private final static String DEFAULT_PDB_FILE_PARSER = StructureImportSettings.StructureParser.JMOL_PARSER
+          .toString();
+
   /**
    * Initialises the Jalview Application Log
    */
@@ -394,9 +415,32 @@ public class Cache
       codeInstallation = " (" + codeInstallation + ")";
     }
     new BuildDetails(codeVersion, null, codeInstallation);
+
+    SiftsSettings
+            .setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false));
+
+    SiftsSettings.setSiftDownloadDirectory(jalview.bin.Cache.getDefault(
+            "sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR));
+
+    SiftsSettings.setFailSafePIDThreshold(jalview.bin.Cache.getDefault(
+            "sifts_fail_safe_pid_threshold",
+            DEFAULT_FAIL_SAFE_PID_THRESHOLD));
+
+    SiftsSettings.setCacheThresholdInDays(jalview.bin.Cache.getDefault(
+            "sifts_cache_threshold_in_days",
+            DEFAULT_CACHE_THRESHOLD_IN_DAYS));
+
     System.out
             .println("Jalview Version: " + codeVersion + codeInstallation);
 
+    StructureImportSettings.setDefaultStructureFileFormat(jalview.bin.Cache
+            .getDefault(
+            "DEFAULT_STRUCTURE_FORMAT", DEFAULT_STRUCTURE_FORMAT));
+    StructureImportSettings
+            .setDefaultPDBFileParser(jalview.bin.Cache.getDefault(
+                    "DEFAULT_PDB_FILE_PARSER", DEFAULT_PDB_FILE_PARSER));
+    StructureImportSettings.setProcessHETATMs(jalview.bin.Cache.getDefault(
+            "PROCESS_HETATM", false));
     // jnlpVersion will be null if we're using InstallAnywhere
     // Dont do this check if running in headless mode
     if (jnlpVersion == null
@@ -407,6 +451,7 @@ public class Cache
 
       class VersionChecker extends Thread
       {
+        @Override
         public void run()
         {
           String orgtimeout = System