{@code
- *
- *
- * }
- * When a number is reached for which no value exists, we stop looking. */
- public static final String JVMARG_PREFIX = "jvmargs";
-
- /** A property specifying the names of additional appargs properties. Each apparg property will
- * be suffixed by a monotonically increasing integer starting at zero, e.g.
- * {@code
- *
- *
- * }
- * When a number is reached for which no value exists, we stop looking. */
- public static final String APPARG_PREFIX = "appargs";
-
- public String appbase;
-
- public String appname;
-
- /** The list of background images and their display time */
- public String imgpath;
-
- /** The error background image */
- public String errorimgpath;
-
- public File appdir;
-
- /** Additional jvmargs to supply to the launching app. */
- public String[] jvmargs;
-
- /** Additional appargs to supply to the launching app. */
- public String[] appargs;
-
- /** An optional URL to which the applet should redirect when done. */
- public URL redirectUrl;
-
- public String redirectTarget;
-
- public String installerFileContents;
-
- /** Indicates whether the downloaded app should be launched in the parent applet (true) or as a
- * separate java process (false). */
- public boolean invokeDirect;
-
- /** Indicates whether Getdown should allow the launched app to connect to it through a server
- * socket bound to localhost on any available port in order to allow interaction with
- * JavaScript code on the page containing the applet. */
- public boolean allowConnect;
-
- /** Optional default bounds for the status panel. */
- public Rectangle statusBounds;
-
- public Color statusColor;
-
- public GetdownAppletConfig (JApplet applet)
- {
- this(applet, null);
- }
-
- public GetdownAppletConfig (JApplet applet, String paramPrefix)
- {
- _applet = applet;
- _prefix = paramPrefix;
-
- appbase = getParameter(APPBASE, "");
- appname = getParameter(APPNAME, "");
- log.info("App Base: " + appbase);
- log.info("App Name: " + appname);
-
- imgpath = getParameter(BGIMAGE);
- errorimgpath = getParameter(ERRORBGIMAGE);
-
- // DEPRECATED LEGACY CRAP: extract system properties to set in applet JVM (not app JVM)
- String props = getParameter("properties");
- if (props != null) {
- String[] proparray = props.split(" ");
- for (String property : proparray) {
- String key = property.substring(property.indexOf("-D") + 2, property.indexOf("="));
- String value = property.substring(property.indexOf("=") + 1);
- _properties.setProperty(key, value);
- }
- }
- // END DLC
-
- String root;
- if (RunAnywhere.isWindows()) {
- root = "Application Data";
- String verStr = System.getProperty("os.version");
- try {
- if (Float.parseFloat(verStr) >= 6.0f) {
- // Vista makes us write it here.... Yay.
- root = "AppData" + File.separator + "LocalLow";
- }
- } catch (Exception e) {
- log.warning("Couldn't parse OS version", "vers", verStr, "error", e);
- }
- } else if (RunAnywhere.isMacOS()) {
- root = "Library" + File.separator + "Application Support";
- } else /* isLinux() or something wacky */{
- root = ".getdown";
- }
- appdir = new File(System.getProperty("user.home") + File.separator + root + File.separator
- + appname);
-
- installerFileContents = getParameter("installer");
-
- // extract arguments to be added to getdown.txt's jvmargs
- Listproperties into the System properties.
- */
- protected void setSystemProperties ()
- {
- System.getProperties().putAll(_properties);
- }
-
- /**
- * Makes sire that the appdir directory exists, creating it if necessary. Throws an exception if
- * the directory does not exist and cannot be created.
- */
- protected void ensureAppdirExists () throws Exception
- {
- // if our application directory does not exist, auto-create it
- if ((!appdir.exists() || !appdir.isDirectory()) && !appdir.mkdirs()) {
- throw new Exception("m.create_appdir_failed");
- }
- }
-
- /**
- * Writes the installer.txt and getdown.txt files to the local file system as needed.
- */
- protected void createFiles () throws Exception
- {
- // if an installer.txt file is desired, create that
- if (!StringUtil.isBlank(installerFileContents)) {
- File infile = new File(appdir, "installer.txt");
- if (!infile.exists()) {
- writeToFile(infile, installerFileContents);
- }
- }
-
- // if our getdown.txt file does not exist, or it is corrupt, auto-/recreate it
- File gdfile = new File(appdir, "getdown.txt");
- boolean createGetdown = !gdfile.exists();
- if (!createGetdown) {
- try {
- Config config = Config.parseConfig(gdfile, Config.createOpts(false));
- String oappbase = StringUtil.trim(config.getString(APPBASE));
- createGetdown = (appbase != null && !appbase.trim().equals(oappbase));
- if (createGetdown) {
- log.warning("Recreating getdown.txt due to appbase mismatch",
- "nappbase", appbase, "oappbase", oappbase);
- }
- } catch (Exception e) {
- log.warning("Failure checking validity of getdown.txt, forcing recreate.",
- "error", e);
- createGetdown = true;
- }
- }
- if (createGetdown) {
- if (StringUtil.isBlank(appbase)) {
- throw new Exception("m.missing_appbase");
- }
- if (!writeToFile(gdfile, "appbase = " + appbase)) {
- throw new Exception("m.create_getdown_failed");
- }
- }
- }
-
- /**
- * Creates the specified file and writes the supplied contents to it.
- */
- protected boolean writeToFile (File tofile, String contents)
- {
- try (FileOutputStream fos = new FileOutputStream(tofile);
- PrintStream out = new PrintStream(fos)) {
- out.println(contents);
- return true;
- } catch (IOException ioe) {
- log.warning("Failed to create '" + tofile + "'.", ioe);
- return false;
- }
- }
-
- /** A reference to the Applet in which Getdown is running */
- protected JApplet _applet;
-
- /** An optional prefix to prepend when looking for Getdown Applet params */
- protected String _prefix;
-
- /** The background images displayed on the status panel as Getdown is getting down. */
- protected RotatingBackgrounds bgimages;
-
- /** System properties to set in the applet JVM. */
- protected Properties _properties = new Properties();
-}
diff --git a/core/src/main/java/com/threerings/getdown/data/Application.java b/core/src/main/java/com/threerings/getdown/data/Application.java
index 30204c3..28818ab 100644
--- a/core/src/main/java/com/threerings/getdown/data/Application.java
+++ b/core/src/main/java/com/threerings/getdown/data/Application.java
@@ -25,8 +25,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
-import javax.swing.JApplet;
-
import com.samskivert.io.StreamUtil;
import com.samskivert.text.MessageUtil;
import com.samskivert.util.ArrayUtil;
@@ -141,12 +139,6 @@ public class Application
/** The patch notes URL. */
public String patchNotesUrl;
- /** The dimensions of the play again button. */
- public Rectangle playAgain;
-
- /** The path (relative to the appdir) to a single play again image. */
- public String playAgainImage;
-
/** Whether window decorations are hidden for the UI. */
public boolean hideDecorations;
@@ -172,7 +164,6 @@ public class Application
", pb=" + progressBar + ", srect=" + status + ", st=" + statusText +
", shadow=" + textShadow + ", err=" + installError + ", nrect=" + patchNotes +
", notes=" + patchNotesUrl + ", stepPercentages=" + stepPercentages +
- ", parect=" + playAgain + ", paimage=" + playAgainImage +
", hideProgressText" + hideProgressText + ", minShow=" + minShowSeconds + "]";
}
@@ -753,10 +744,6 @@ public class Application
ui.patchNotes = config.getRect("ui.patch_notes", ui.patchNotes);
ui.patchNotesUrl = config.getUrl("ui.patch_notes_url", null);
- // the play again bits
- ui.playAgain = config.getRect("ui.play_again", ui.playAgain);
- ui.playAgainImage = config.getString("ui.play_again_image");
-
// step progress percentages
for (UpdateInterface.Step step : UpdateInterface.Step.values()) {
String spec = config.getString("ui.percents." + step.name());
@@ -1058,7 +1045,7 @@ public class Application
/**
* Runs this application directly in the current VM.
*/
- public void invokeDirect (JApplet applet) throws IOException
+ public void invokeDirect () throws IOException
{
ClassPath classPath = ClassPaths.buildClassPath(this);
URL[] jarUrls = classPath.asUrls();
@@ -1103,9 +1090,6 @@ public class Application
System.setProperty(entry.getKey(), entry.getValue());
}
- // make a note that we're running in "applet" mode
- System.setProperty("applet", "true");
-
// prepare our app arguments
String[] args = new String[_appargs.size()];
for (int ii = 0; ii < args.length; ii++) args[ii] = processArg(_appargs.get(ii));
@@ -1113,17 +1097,9 @@ public class Application
try {
log.info("Loading " + _class);
Class> appclass = loader.loadClass(_class);
- Method main;
- try {
- // first see if the class has a special applet-aware main
- main = appclass.getMethod("main", JApplet.class, SA_PROTO.getClass());
- log.info("Invoking main(JApplet, {" + StringUtil.join(args, ", ") + "})");
- main.invoke(null, new Object[] { applet, args });
- } catch (NoSuchMethodException nsme) {
- main = appclass.getMethod("main", SA_PROTO.getClass());
- log.info("Invoking main({" + StringUtil.join(args, ", ") + "})");
- main.invoke(null, new Object[] { args });
- }
+ Method main = appclass.getMethod("main", SA_PROTO.getClass());
+ log.info("Invoking main({" + StringUtil.join(args, ", ") + "})");
+ main.invoke(null, new Object[] { args });
} catch (Exception e) {
e.printStackTrace(System.err);
}
@@ -1321,9 +1297,6 @@ public class Application
for (int ii = 0; ii < sizes.length; ii++) {
final Resource rsrc = rsrcs.get(ii);
- if (Thread.interrupted()) {
- throw new InterruptedException("m.applet_stopped");
- }
final int index = ii;
exec.execute(new Runnable() {
public void run () {
@@ -1414,9 +1387,6 @@ public class Application
ProgressAggregator pagg = new ProgressAggregator(obs, sizes);
for (int ii = 0; ii < sizes.length; ii++) {
- if (Thread.interrupted()) {
- throw new InterruptedException("m.applet_stopped");
- }
Resource rsrc = rsrcs.get(ii);
ProgressObserver pobs = pagg.startElement(ii);
try {
@@ -1539,12 +1509,6 @@ public class Application
* Downloads a new copy of the specified control file, optionally validating its signature.
* If the download is successful, moves it over the old file on the filesystem.
*
- * We implement simple signing of the digest.txt file for use with the Getdown applet, but - * this should never be used as-is with a non-applet getdown installation, as the signing - * format has no provisions for declaring arbitrary signing key IDs, signature algorithm, et al - * -- it is entirely reliant on the ability to upgrade the Getdown applet, and its signature - * validation implementation, at-will (ie, via an Applet). - * *
TODO: Switch to PKCS #7 or CMS.
*
* @param sigVersion if {@code 0} no validation will be performed, if {@code > 0} then this
diff --git a/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java b/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java
index 3c434be..08330b3 100644
--- a/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java
+++ b/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java
@@ -18,7 +18,6 @@ import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
-import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
@@ -70,7 +69,7 @@ import static com.threerings.getdown.Log.log;
* Manages the main control for the Getdown application updater and deployment system.
*/
public abstract class Getdown extends Thread
- implements Application.StatusDisplay, ImageLoader
+ implements Application.StatusDisplay, RotatingBackgrounds.ImageLoader
{
public static void main (String[] args)
{
@@ -128,7 +127,7 @@ public abstract class Getdown extends Thread
/**
* Installs the currently pending new resources.
*/
- public void install () throws IOException, InterruptedException
+ public void install () throws IOException
{
if (SysProps.noInstall()) {
log.info("Skipping install due to 'no_install' sysprop.");
@@ -136,9 +135,6 @@ public abstract class Getdown extends Thread
log.info("Installing " + _toInstallResources.size() + " downloaded resources:");
for (Resource resource : _toInstallResources) {
resource.install();
- if (Thread.interrupted()) {
- throw new InterruptedException("m.applet_stopped");
- }
}
_toInstallResources.clear();
_readyToInstall = false;
@@ -148,21 +144,6 @@ public abstract class Getdown extends Thread
}
}
- /**
- * This is used by the applet which always needs a user interface and wants to load it as soon
- * as possible.
- */
- public void preInit ()
- {
- try {
- _ifc = _app.init(true);
- createInterfaceAsync(true);
- } catch (Exception e) {
- log.warning("Failed to preinit: " + e);
- createInterfaceAsync(true);
- }
- }
-
@Override
public void run ()
{
@@ -530,10 +511,6 @@ public abstract class Getdown extends Thread
// Only launch if we aren't in silent mode. Some mystery program starting out
// of the blue would be disconcerting.
if (!_silent || _launchInSilent) {
- if (Thread.interrupted()) {
- // One last interrupted check so we don't launch as the applet aborts
- throw new InterruptedException("m.applet_stopped");
- }
// And another final check for the lock. It'll already be held unless
// we're in silent mode.
_app.lockForUpdates();
@@ -611,7 +588,7 @@ public abstract class Getdown extends Thread
* running with the necessary Java version.
*/
protected void updateJava ()
- throws IOException, InterruptedException
+ throws IOException
{
Resource vmjar = _app.getJavaVMResource();
if (vmjar == null) {
@@ -652,7 +629,7 @@ public abstract class Getdown extends Thread
* Called if the application is determined to be of an old version.
*/
protected void update ()
- throws IOException, InterruptedException
+ throws IOException
{
// first clear all validation markers
_app.clearValidationMarkers();
@@ -724,7 +701,7 @@ public abstract class Getdown extends Thread
* Called if the application is determined to require resource downloads.
*/
protected void download (Collectionbackgrounds.
- *
+ *
* Each String in backgrounds should be the path to the image, a semicolon, and the minimum
* amount of time to display the image in seconds. Each image will be active for an equal
* percentage of the download process, unless one hasn't been active for its minimum display
@@ -78,7 +82,7 @@ public class RotatingBackgrounds
}
long now = System.currentTimeMillis();
if (current != images.length - 1
- && (current == -1 || (progress >= percentages[current + 1] &&
+ && (current == -1 || (progress >= percentages[current + 1] &&
(now - currentDisplayStart) / 1000 > minDisplayTime[current]))) {
current++;
currentDisplayStart = now;
@@ -110,18 +114,18 @@ public class RotatingBackgrounds
/** Time at which the currently displayed image was first displayed in millis. */
protected long currentDisplayStart;
-
+
/** The index of the currently displayed image or -1 if we haven't displayed any. */
protected int current = -1;
-
+
protected Image[] images;
-
+
/** The image to display if getdown has failed due to an error. */
protected Image errorImage;
-
+
/** Percentage at which each image should be displayed. */
protected int[] percentages;
-
+
/** Time to show each image in seconds. */
protected int[] minDisplayTime;
}
diff --git a/pom.xml b/pom.xml
index c5ab586..efbff29 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,6 @@