JAL-3247 JAL-3254 JAL-3260 Fixed: JVL file jalview.apparg args. File association...
authorBen Soares <bsoares@dundee.ac.uk>
Mon, 13 May 2019 14:17:24 +0000 (15:17 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Mon, 13 May 2019 14:17:24 +0000 (15:17 +0100)
12 files changed:
build.gradle
getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar
getdown/lib/getdown-launcher.jar
getdown/src/getdown/core/pom.xml
getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java
getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/Config.java
getdown/src/getdown/mvn_cmd
gradle.properties
j11lib/getdown-core.jar
j8lib/getdown-core.jar
resources/images/jalview_logo_background_getdown-progress-TEST2.png [new file with mode: 0755]
utils/install4j/install4j_template.install4j

index 2e51f15..07a4095 100644 (file)
@@ -800,7 +800,7 @@ install4j {
   }
   installDir = file(install4jHomeDir)
   mediaTypes = Arrays.asList(install4jMediaTypes.split(","))
-  if (dev.equals("true")) {
+  if (install4jFaster.equals("true")) {
     faster = true
   }
 }
index 67434e8..7230883 100644 (file)
Binary files a/getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar and b/getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar differ
index 43a9fb6..cb5f670 100644 (file)
Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ
index e564bf6..efec8b6 100644 (file)
@@ -34,7 +34,7 @@
        Wildcards can be used (*.mycompany.com) and multiple values can be
        separated by commas (app1.foo.com,app2.bar.com,app3.baz.com). -->
   <properties>
-    <getdown.host.whitelist />
+    <getdown.host.whitelist>jalview.org,*.jalview.org</getdown.host.whitelist>
   </properties>
 
   <build>
index 17e98f8..25cd109 100644 (file)
@@ -597,6 +597,11 @@ public class Application
         // process, our caller can use the appbase to download a new configuration file
         _appbase = config.getString("appbase");
         
+        // see if locatorConfig override
+        if (locatorConfig != null && !StringUtil.isBlank(locatorConfig.getString("appbase"))) {
+          _appbase = locatorConfig.getString("appbase");
+        }
+        
         if (_appbase == null) {
             throw new RuntimeException("m.missing_appbase");
         }
@@ -1844,7 +1849,6 @@ public class Application
     public static void addStartupFile(String filename) {
       _startupFiles.add(new File(filename));
     }
-
     
     private Config createLocatorConfig(Config.ParseOpts opts) {
       if (_locatorFile == null) {
@@ -1861,19 +1865,24 @@ public class Application
           log.warning("Given locator file does not exist", "file", _locatorFile);
         }
         
-        // appbase is sanitised in HostWhitelist and here!
-        Map<String, Object> tmpdata = new HashMap<>();
-        tmpdata.put("appbase", tmpConfig.getString("appbase"));
-        tmpdata.put("appargs", tmpConfig.getString("appargs"));
-        tmpdata.put("jvmargs", tmpConfig.getString("jvmargs"));
-        tmpdata.put(LOCATOR_FILE_EXTENSION+"replace", tmpConfig.getString(LOCATOR_FILE_EXTENSION+"replace"));
-        tmpdata.put(LOCATOR_FILE_EXTENSION+"merge", tmpConfig.getString(LOCATOR_FILE_EXTENSION+"merge"));
-        locatorConfig = new Config(tmpdata);
+        // appbase is sanitised in HostWhitelist
+        Map<String, Object> tmpData = new HashMap<>();
+        for (Map.Entry<String, Object> entry : tmpConfig.getData().entrySet()) {
+          String key = entry.getKey();
+          Object value = entry.getValue();
+          String mkey = key.indexOf('.') > -1 ? key.substring(key.indexOf('.') + 1) : key;
+          if (Config.allowedReplaceKeys.contains(mkey) || Config.allowedMergeKeys.contains(mkey)) {
+            tmpData.put(key, value);
+          }
+        }
+        locatorConfig = new Config(tmpData);
         
       } catch (Exception e) {
         log.warning("Failure reading locator file",  "file", _locatorFile, e);
       }
       
+      log.info("Returning locatorConfig", locatorConfig);
+      
       return locatorConfig;
     }
     
index 6f99fa6..e20bae2 100644 (file)
@@ -14,6 +14,7 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -254,6 +255,9 @@ public class Config
     public String[] getMultiValue (String name)
     {
         Object value = _data.get(name);
+        if (value == null) {
+          return new String[] {};
+        }
         if (value instanceof String) {
             return new String[] { (String)value };
         } else {
@@ -381,11 +385,10 @@ public class Config
         String key = entry.getKey();
         Object nvalue = entry.getValue();
 
-        if (!merge || key.equals("appbase")) {
-          _data.put(key, nvalue);
-        } else {
+        String mkey = key.indexOf('.') > -1 ? key.substring(key.indexOf('.') + 1) : key;
+        if (merge && allowedMergeKeys.contains(mkey)) {
           
-          // merge
+          // merge multi values
           
           Object value = _data.get(key);
           
@@ -430,15 +433,45 @@ public class Config
             }
           }
           
+        } else if (allowedReplaceKeys.contains(mkey)){
+          
+          // replace value
+          
+          _data.put(key, nvalue);
+        } else {
+          log.warning("Not merging key '"+key+"' into config");
         }
 
       }
       
     }
     
+    public String toString() {
+      StringBuilder sb = new StringBuilder();
+      for (Map.Entry<String, Object> entry : getData().entrySet()) {
+        String key = entry.getKey();
+        Object val = entry.getValue();
+        sb.append(key);
+        sb.append("=");
+        if (val instanceof String) {
+          sb.append((String)val);
+        } else if (val instanceof String[]) {
+          sb.append(Arrays.toString((String[])val));
+        } else {
+          sb.append("Value not String or String[]");
+        }
+        sb.append("\n");
+      }
+      return sb.toString();
+    }
+    
     public Map<String, Object> getData() {
       return _data;
     }
 
     private final Map<String, Object> _data;
+    public static final List<String> allowedReplaceKeys = Arrays.asList("appbase","apparg","jvmarg"); // these are the ones we might use
+    public static final List<String> allowedMergeKeys = Arrays.asList("apparg","jvmarg"); // these are the ones we might use
+    //private final List<String> allowedMergeKeys = Arrays.asList("apparg","jvmarg","resource","code","java_location"); // (not exhaustive list here)
 }
index db10789..d984902 100644 (file)
@@ -1 +1 @@
-mv clean package -Dgetdown.host.whitelist=jalview.org,*.jalview.org && cp launcher/target/getdown-launcher-1.8.3-SNAPSHOT.jar ../../../getdown/lib/getdown-launcher.jar && cp core/target/getdown-core-1.8.3-SNAPSHOT.jar ../../../getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar && cp core/target/getdown-core-1.8.3-SNAPSHOT.jar ../../../j8lib/getdown-core.jar && cp core/target/getdown-core-1.8.3-SNAPSHOT.jar ../../../j11lib/getdown-core.jar 
+mvn clean package -Dgetdown.host.whitelist=jalview.org,*.jalview.org && cp launcher/target/getdown-launcher-1.8.3-SNAPSHOT.jar ../../../getdown/lib/getdown-launcher.jar && cp core/target/getdown-core-1.8.3-SNAPSHOT.jar ../../../getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar && cp core/target/getdown-core-1.8.3-SNAPSHOT.jar ../../../j8lib/getdown-core.jar && cp core/target/getdown-core-1.8.3-SNAPSHOT.jar ../../../j11lib/getdown-core.jar 
index 0bc3280..294ac23 100644 (file)
@@ -102,6 +102,8 @@ install4jInfoPlistFileAssociations = file_associations_auto-Info_plist.xml
 install4jInstallerFileAssociations = file_associations_auto-install4j.xml
 install4jBuildDir = build/install4j
 install4jMediaTypes = windows,macosArchive,linuxRPM,linuxDeb,unixArchive
+install4jFaster = false
+
 OSX_KEYSTORE =
 OSX_KEYPASS =
 JSIGN_SH = echo
index 67434e8..7230883 100644 (file)
Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ
index 67434e8..7230883 100644 (file)
Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ
diff --git a/resources/images/jalview_logo_background_getdown-progress-TEST2.png b/resources/images/jalview_logo_background_getdown-progress-TEST2.png
new file mode 100755 (executable)
index 0000000..1a9bf34
Binary files /dev/null and b/resources/images/jalview_logo_background_getdown-progress-TEST2.png differ
index 4b05d18..7a924e2 100644 (file)
@@ -93,7 +93,7 @@
           <versionLine x="85" y="109" text="version ${compiler:sys.version}" fontSize="8" fontColor="0,0,0" bold="false" />
         </text>
       </splashScreen>
-      <java mainClass="com.threerings.getdown.launcher.GetdownApp" mainMode="1" vmParameters="" arguments=". noappid" allowVMPassthroughParameters="true" preferredVM="" bundleRuntime="true">
+      <java mainClass="com.threerings.getdown.launcher.GetdownApp" mainMode="1" vmParameters="" arguments=". jalview" allowVMPassthroughParameters="true" preferredVM="" bundleRuntime="true">
         <classPath>
           <archive location="getdown-launcher.jar" failOnError="true" />
         </classPath>
           <versionLine x="85" y="109" text="version ${compiler:sys.version}" fontSize="8" fontColor="0,0,0" bold="false" />
         </text>
       </splashScreen>
-      <java mainClass="com.threerings.getdown.launcher.GetdownApp" mainMode="1" vmParameters="" arguments=". noappid" allowVMPassthroughParameters="true" preferredVM="" bundleRuntime="true">
+      <java mainClass="com.threerings.getdown.launcher.GetdownApp" mainMode="1" vmParameters="" arguments=". jalview" allowVMPassthroughParameters="true" preferredVM="" bundleRuntime="true">
         <classPath>
           <archive location="getdown-launcher.jar" failOnError="true" />
         </classPath>
@@ -1858,9 +1858,7 @@ return console.askYesNo(message, true);
         <component id="1156" />
       </excludedComponents>
       <includedDownloadableComponents />
-      <excludedLaunchers>
-        <launcher id="737" />
-      </excludedLaunchers>
+      <excludedLaunchers />
       <excludedBeans />
       <overriddenPrincipalLanguage id="en" customLocalizationFile="" />
       <exclude>