/** The proxy that should be used to do HTTP downloads. This must be configured prior to using
* the application instance. Yes this is a public mutable field, no I'm not going to create a
* getter and setter just to pretend like that's not the case. */
- public Proxy proxy = Proxy.NO_PROXY;
+ public static Proxy proxy = Proxy.NO_PROXY;
/**
* Creates an application instance which records the location of the <code>getdown.txt</code>
// merge the locator file config into config (or replace config with)
if (locatorConfig != null) {
- if (config == null || locatorConfig.getBoolean(LOCATOR_FILE_EXTENSION+"_replace")) {
+ if (config == null || locatorConfig.getBoolean(LOCATOR_FILE_EXTENSION+"_replace") || locatorConfig.hasValue("appbase")) {
config = locatorConfig;
+ log.warning("Replacing config with locator file", LOCATOR_FILE_EXTENSION+" file", locatorConfig);
} else {
config.mergeConfig(locatorConfig, locatorConfig.getBoolean(LOCATOR_FILE_EXTENSION+"_merge"));
+ log.warning("Merging config with locator file", LOCATOR_FILE_EXTENSION+" file", locatorConfig);
}
}
_jalviewUri = uri;
}
- private Config createLocatorConfig(Config.ParseOpts opts) {
+ protected static Config createLocatorConfig(Config.ParseOpts opts) {
if (_locatorFile == null) {
return null;
}
import java.security.cert.X509Certificate;
import java.util.*;
+import com.threerings.getdown.util.Config;
import com.threerings.getdown.util.LaunchUtil;
import com.threerings.getdown.util.StringUtil;
appIdProv + "'"));
}
}
+ int skipArgs = 2;
boolean userAppDir = false;
// platform user appdir addition
}
}
- int skipArgs = 2;
// Look for locator file, pass to Application and remove from appArgs
String argvLocatorFilename = argv.length > 2 ? argv[2] : null;
if (!StringUtil.isBlank(argvLocatorFilename)
- && argvLocatorFilename.toLowerCase(Locale.ROOT).endsWith("."+Application.LOCATOR_FILE_EXTENSION)) {
+ && argvLocatorFilename.toLowerCase(Locale.ROOT).endsWith("." + Application.LOCATOR_FILE_EXTENSION)) {
argvLocatorFilename = HttpUtils.equivalentJalviewUrl(argvLocatorFilename);
- notes.add(Note.info("locatorFilename in args: '"+argv[2]+"'"));
+ notes.add(Note.info("locatorFilename in args: '" + argv[2] + "'"));
Application.setLocatorFile(argvLocatorFilename);
+ String lfAppBase = getLocatorFileAppBase(argvLocatorFilename);
+ if (!StringUtil.isBlank(lfAppBase)) {
+ appBase = lfAppBase;
+ appBaseProv = "from " + Application.LOCATOR_FILE_EXTENSION + " file";
+ }
skipArgs++;
}
public static boolean getRelaunched() {
return relaunched;
}
+
+ private static String getLocatorFileAppBase(String locatorFile) {
+ String lfAppBase = null;
+ Config.ParseOpts opts = Config.createOpts(false);
+ Config checkConfig = Application.createLocatorConfig(opts);
+ if (!StringUtil.isBlank(checkConfig.getString("appbase"))) {
+ lfAppBase = checkConfig.getString("appbase");
+ }
+ return lfAppBase;
+ }
private static boolean relaunched = false;
boolean launcherwait, boolean launcherstop, boolean debug,
boolean quiet)
{
- int exitValue = -1;
if (javaBinary == null)
{
javaBinary = findJavaBin(false, true, true);
// application args
command.addAll(applicationArguments);
+ return runProcess(command, launcherprint, launcherwait, launcherstop,
+ debug, quiet);
+ }
+
+ private static int runProcess(List<String> command, boolean launcherprint,
+ boolean launcherwait, boolean launcherstop, boolean debug,
+ boolean quiet)
+ {
final ProcessBuilder builder = new ProcessBuilder(command);
+ int exitValue = -1;
if (Boolean.parseBoolean(System.getProperty("launcherprint", "false"))
|| launcherprint)
return exitValue;
}
+ /*
+ public void invokeDirect() throws IOException
+ {
+ ClassPath classPath = PathBuilder.buildClassPath(this);
+ URL[] jarUrls = classPath.asUrls();
+
+ // create custom class loader
+ URLClassLoader loader = new URLClassLoader(jarUrls,
+ ClassLoader.getSystemClassLoader())
+ {
+ @Override
+ protected PermissionCollection getPermissions(CodeSource code)
+ {
+ Permissions perms = new Permissions();
+ perms.add(new AllPermission());
+ return perms;
+ }
+ };
+ Thread.currentThread().setContextClassLoader(loader);
+
+ log.info("Configured URL class loader:");
+ for (URL url : jarUrls)
+ log.info(" " + url);
+
+ // configure any system properties that we can
+ for (String jvmarg : _jvmargs)
+ {
+ if (jvmarg.startsWith("-D"))
+ {
+ jvmarg = processArg(jvmarg.substring(2));
+ int eqidx = jvmarg.indexOf("=");
+ if (eqidx == -1)
+ {
+ log.warning("Bogus system property: '" + jvmarg + "'?");
+ }
+ else
+ {
+ System.setProperty(jvmarg.substring(0, eqidx),
+ jvmarg.substring(eqidx + 1));
+ }
+ }
+ }
+
+ // pass along any pass-through arguments
+ Map<String, String> passProps = new HashMap<>();
+ for (Map.Entry<Object, Object> entry : System.getProperties()
+ .entrySet())
+ {
+ String key = (String) entry.getKey();
+ if (key.startsWith(PROP_PASSTHROUGH_PREFIX))
+ {
+ key = key.substring(PROP_PASSTHROUGH_PREFIX.length());
+ passProps.put(key, (String) entry.getValue());
+ }
+ }
+ // we can't set these in the above loop lest we get a
+ // ConcurrentModificationException
+ for (Map.Entry<String, String> entry : passProps.entrySet())
+ {
+ System.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ // prepare our app arguments
+ String[] args = new String[_appargs.size()];
+ for (int ii = 0; ii < args.length; ii++)
+ args[ii] = processArg(_appargs.get(ii));
+
+ try
+ {
+ log.info("Loading " + _class);
+ Class<?> appclass = loader.loadClass(_class);
+ Method main = appclass.getMethod("main",
+ EMPTY_STRING_ARRAY.getClass());
+ log.info("Invoking main({" + StringUtil.join(args, ", ") + "})");
+ main.invoke(null, new Object[] { args });
+ } catch (Exception e)
+ {
+ log.warning("Failure invoking app main", e);
+ }
+ }
+ */
+
public static void syserr(boolean debug, boolean quiet, String message)
{
if (debug && !quiet)
boolean launcherwait, boolean launcherstop, boolean debug,
boolean quiet)
{
- int exitValue = -1;
if (javaBinary == null)
{
javaBinary = findJavaBin(false, true, true);
// application args
command.addAll(applicationArguments);
+ return runProcess(command, launcherprint, launcherwait, launcherstop,
+ debug, quiet);
+ }
+
+ private static int runProcess(List<String> command, boolean launcherprint,
+ boolean launcherwait, boolean launcherstop, boolean debug,
+ boolean quiet)
+ {
final ProcessBuilder builder = new ProcessBuilder(command);
+ int exitValue = -1;
if (Boolean.parseBoolean(System.getProperty("launcherprint", "false"))
|| launcherprint)
return exitValue;
}
+ /*
+ public void invokeDirect() throws IOException
+ {
+ ClassPath classPath = PathBuilder.buildClassPath(this);
+ URL[] jarUrls = classPath.asUrls();
+
+ // create custom class loader
+ URLClassLoader loader = new URLClassLoader(jarUrls,
+ ClassLoader.getSystemClassLoader())
+ {
+ @Override
+ protected PermissionCollection getPermissions(CodeSource code)
+ {
+ Permissions perms = new Permissions();
+ perms.add(new AllPermission());
+ return perms;
+ }
+ };
+ Thread.currentThread().setContextClassLoader(loader);
+
+ log.info("Configured URL class loader:");
+ for (URL url : jarUrls)
+ log.info(" " + url);
+
+ // configure any system properties that we can
+ for (String jvmarg : _jvmargs)
+ {
+ if (jvmarg.startsWith("-D"))
+ {
+ jvmarg = processArg(jvmarg.substring(2));
+ int eqidx = jvmarg.indexOf("=");
+ if (eqidx == -1)
+ {
+ log.warning("Bogus system property: '" + jvmarg + "'?");
+ }
+ else
+ {
+ System.setProperty(jvmarg.substring(0, eqidx),
+ jvmarg.substring(eqidx + 1));
+ }
+ }
+ }
+
+ // pass along any pass-through arguments
+ Map<String, String> passProps = new HashMap<>();
+ for (Map.Entry<Object, Object> entry : System.getProperties()
+ .entrySet())
+ {
+ String key = (String) entry.getKey();
+ if (key.startsWith(PROP_PASSTHROUGH_PREFIX))
+ {
+ key = key.substring(PROP_PASSTHROUGH_PREFIX.length());
+ passProps.put(key, (String) entry.getValue());
+ }
+ }
+ // we can't set these in the above loop lest we get a
+ // ConcurrentModificationException
+ for (Map.Entry<String, String> entry : passProps.entrySet())
+ {
+ System.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ // prepare our app arguments
+ String[] args = new String[_appargs.size()];
+ for (int ii = 0; ii < args.length; ii++)
+ args[ii] = processArg(_appargs.get(ii));
+
+ try
+ {
+ log.info("Loading " + _class);
+ Class<?> appclass = loader.loadClass(_class);
+ Method main = appclass.getMethod("main",
+ EMPTY_STRING_ARRAY.getClass());
+ log.info("Invoking main({" + StringUtil.join(args, ", ") + "})");
+ main.invoke(null, new Object[] { args });
+ } catch (Exception e)
+ {
+ log.warning("Failure invoking app main", e);
+ }
+ }
+ */
+
public static void syserr(boolean debug, boolean quiet, String message)
{
if (debug && !quiet)
<?xml version="1.0" encoding="UTF-8"?>
-<install4j version="10.0.7" transformSequenceNumber="10">
+<install4j version="10.0.8" transformSequenceNumber="10">
<directoryPresets config="bin/Jalview" />
<application name="${compiler:JALVIEW_APPLICATION_NAME}" applicationId="${compiler:WINDOWS_APPLICATION_ID}" mediaDir="${compiler:BUILD_DIR}" lzmaCompression="true" shortName="${compiler:INTERNAL_ID}" publisher="University of Dundee" publisherWeb="https://www.jalview.org/" version="${compiler:JALVIEW_VERSION}" allPathsRelative="true" macVolumeId="5aac4968c304f65" javaMinVersion="${compiler:JAVA_MIN_VERSION}" javaMaxVersion="${compiler:JAVA_MAX_VERSION}" allowBetaVM="true" jdkMode="jdk" jdkName="JDK 11.0">
<searchSequence>
<versionLine x="85" y="109" text="version ${compiler:sys.version}" />
</text>
</splashScreen>
- <java mainClass="com.threerings.getdown.launcher.GetdownApp" vmParameters="-Duserdefaultappdir=true -Dpopulatedefaultappdir=true -Dappid=jalview -Dinstaller.template_version=${compiler:INSTALLER_TEMPLATE_VERSION} -Dinstaller.appdir="${launcher:sys.launcherDirectory}" -Dinstaller.application_folder="${compiler:APPLICATION_FOLDER}" -Dchannel.app_name="${compiler:JALVIEW_APPLICATION_NAME}"">
+ <java mainClass="com.threerings.getdown.launcher.GetdownApp" vmParameters="-Duserdefaultappdir=true -Dpopulatedefaultappdir=true -Dappid=jalview -Dinstaller.template_version=${compiler:INSTALLER_TEMPLATE_VERSION} -Dinstaller.appdir="${launcher:sys.launcherDirectory}" -Dinstaller.application_folder="${compiler:APPLICATION_FOLDER}" -Dchannel.app_name="${compiler:JALVIEW_APPLICATION_NAME}"" arguments=""" """>
<classPath>
<archive location="getdown-launcher.jar" failOnError="false" />
<archive location="${compiler:GETDOWN_INSTALL_DIR}/getdown-launcher.jar" failOnError="false" />