Well, no, that was silly. The application arguments go after the class

name.
This commit is contained in:
Andrzej Kapolka
2010-04-29 21:48:30 +00:00
parent 557421c7bd
commit 0769dcce9d
4 changed files with 22 additions and 10 deletions
@@ -164,7 +164,7 @@ public class Application
*/ */
public Application (File appdir, String appid) public Application (File appdir, String appid)
{ {
this(appdir, appid, null, null); this(appdir, appid, null, null, null);
} }
/** /**
@@ -177,8 +177,10 @@ public class Application
* the primary application. * the primary application.
* @param signers an array of possible signers of this application. Used to verify the digest. * @param signers an array of possible signers of this application. Used to verify the digest.
* @param jvmargs arguments to pass on to launched jvms * @param jvmargs arguments to pass on to launched jvms
* @param appargs arguments to pass on to launched application
*/ */
public Application (File appdir, String appid, Object[] signers, String[] jvmargs) public Application (
File appdir, String appid, Object[] signers, String[] jvmargs, String[] appargs)
{ {
_appdir = appdir; _appdir = appdir;
_appid = appid; _appid = appid;
@@ -187,6 +189,9 @@ public class Application
if (jvmargs != null) { if (jvmargs != null) {
_baseJvmArgs = jvmargs; _baseJvmArgs = jvmargs;
} }
if (appargs != null) {
_baseAppArgs = appargs;
}
} }
/** /**
@@ -567,6 +572,11 @@ public class Application
} }
} }
// add the launch specific application arguments
for (String arg : _baseAppArgs) {
_appargs.add(arg);
}
// look for custom arguments // look for custom arguments
fillAssignmentListFromPairs("extra.txt", _jvmargs); fillAssignmentListFromPairs("extra.txt", _jvmargs);
@@ -1461,6 +1471,7 @@ public class Application
protected ArrayList<String> _appargs = new ArrayList<String>(); protected ArrayList<String> _appargs = new ArrayList<String>();
protected String[] _baseJvmArgs = new String[0]; protected String[] _baseJvmArgs = new String[0];
protected String[] _baseAppArgs = new String[0];
protected Object[] _signers; protected Object[] _signers;
@@ -88,10 +88,11 @@ public abstract class Getdown extends Thread
public Getdown (File appDir, String appId) public Getdown (File appDir, String appId)
{ {
this(appDir, appId, null, null); this(appDir, appId, null, null, null);
} }
public Getdown (File appDir, String appId, Object[] signers, String[] jvmargs) public Getdown (
File appDir, String appId, Object[] signers, String[] jvmargs, String[] appargs)
{ {
super("Getdown"); super("Getdown");
try { try {
@@ -120,7 +121,7 @@ public abstract class Getdown extends Thread
"\nis invalid. The directory must not contain the '!' character. Please reinstall."; "\nis invalid. The directory must not contain the '!' character. Please reinstall.";
fail(errmsg); fail(errmsg);
} }
_app = new Application(appDir, appId, signers, jvmargs); _app = new Application(appDir, appId, signers, jvmargs, appargs);
_startup = System.currentTimeMillis(); _startup = System.currentTimeMillis();
} }
@@ -55,7 +55,7 @@ public class GetdownApp
if (StringUtil.isBlank(adarg)) { if (StringUtil.isBlank(adarg)) {
if (args.length < 1) { if (args.length < 1) {
System.err.println( System.err.println(
"Usage: java -jar getdown.jar app_dir [app_id] [jvm args]"); "Usage: java -jar getdown.jar app_dir [app_id] [app args]");
System.exit(-1); System.exit(-1);
} }
adarg = args[aidx++]; adarg = args[aidx++];
@@ -68,9 +68,9 @@ public class GetdownApp
} }
// pass along anything after that as jvm args // pass along anything after that as jvm args
String[] jvmargs = null; String[] appargs = null;
if (args.length > aidx) { if (args.length > aidx) {
jvmargs = ArrayUtil.splice(args, 0, aidx); appargs = ArrayUtil.splice(args, 0, aidx);
} }
// ensure a valid directory was supplied // ensure a valid directory was supplied
@@ -106,7 +106,7 @@ public class GetdownApp
log.info("---------------------------------------------"); log.info("---------------------------------------------");
try { try {
Getdown app = new Getdown(appDir, appId, null, jvmargs) { Getdown app = new Getdown(appDir, appId, null, null, appargs) {
@Override @Override
protected Container createContainer () { protected Container createContainer () {
// create our user interface, and display it // create our user interface, and display it
@@ -60,7 +60,7 @@ public class GetdownApplet extends JApplet
// a third party to insert a trusted certificate. This should be replaced with // a third party to insert a trusted certificate. This should be replaced with
// statically included trusted keys. // statically included trusted keys.
_getdown = new Getdown(_config.appdir, null, GetdownApplet.class.getSigners(), _getdown = new Getdown(_config.appdir, null, GetdownApplet.class.getSigners(),
_config.jvmargs) { _config.jvmargs, null) {
@Override @Override
protected Container createContainer () { protected Container createContainer () {
getContentPane().removeAll(); getContentPane().removeAll();