|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.threerings.getdown.data.Application
public class Application
Parses and provide access to the information contained in the getdown.txt
configuration file.
| Nested Class Summary | |
|---|---|
static class |
Application.AuxGroup
Contains metadata for an auxiliary resource group. |
static interface |
Application.StatusDisplay
Used by verifyMetadata(com.threerings.getdown.data.Application.StatusDisplay) to communicate status in circumstances where it needs to
take network actions. |
static class |
Application.UpdateInterface
Used to communicate information about the UI displayed when updating the application. |
| Field Summary | |
|---|---|
static String |
CONFIG_FILE
The name of our configuration file. |
static String |
PROP_PASSTHROUGH_PREFIX
System properties that are prefixed with this string will be passed through to our application (minus this prefix). |
static String |
SIGNATURE_SUFFIX
Suffix used for control file signatures. |
static String |
VERSION_FILE
The name of our target version file. |
| Constructor Summary | |
|---|---|
Application(File appdir,
String appid)
Creates an application instance with no signers. |
|
Application(File appdir,
String appid,
List<Certificate> signers,
String[] jvmargs,
String[] appargs)
Creates an application instance which records the location of the getdown.txt
configuration file from the supplied application directory. |
|
| Method Summary | |
|---|---|
void |
attemptRecovery(Application.StatusDisplay status)
Attempts to redownload the getdown.txt file based on information parsed from a
previous call to init(boolean). |
void |
clearValidationMarkers()
Clears all validation marker files. |
Process |
createProcess(boolean optimum)
Invokes the process associated with this application definition. |
List<Resource> |
getActiveCodeResources()
Returns all main code resources and all code resources from active auxiliary resource groups. |
List<Resource> |
getActiveResources()
Returns all non-code resources and all resources from active auxiliary resource groups. |
List<Resource> |
getAllActiveResources()
Returns a list of all the active Resource objects used by this application (code and
non-code). |
Application.AuxGroup |
getAuxGroup(String name)
Returns the auxiliary resource group with the specified name, or null. |
Iterable<Application.AuxGroup> |
getAuxGroups()
Returns the set of all auxiliary resource groups defined by the application. |
List<Resource> |
getCodeResources()
Returns a list of the code Resource objects used by this application. |
Resource |
getConfigResource()
Returns a resource that refers to the application configuration file itself. |
Resource |
getFullResource()
Returns a resource that can be used to download an archive containing all files belonging to the application. |
Resource |
getJavaVMResource()
Returns a resource for a zip file containing a Java VM that can be downloaded to use in place of the installed VM (in the case where the VM that launched Getdown does not meet the application's version requirements) or null if no VM is available for this platform. |
File |
getLocalPath(String path)
Returns the local path to the specified resource. |
Resource |
getPatchResource(String auxgroup)
Returns a resource that can be used to download a patch file that will bring this application from its current version to the target version. |
URL |
getRemoteURL(String path)
Returns a URL from which the specified path can be fetched. |
List<Resource> |
getResources()
Returns a list of the non-code Resource objects used by this application. |
String |
getTrackingCookieName()
Returns the name of our tracking cookie or null if it was not set. |
String |
getTrackingCookieProperty()
Returns the name of our tracking cookie system property or null if it was not set. |
URL |
getTrackingProgressURL(int percent)
Returns the URL to request to report that we have reached the specified percentage of our initial download. |
URL |
getTrackingURL(String event)
Returns the URL to use to report an initial download event. |
long |
getVersion()
Returns the version number for the application. |
boolean |
hasOptimumJvmArgs()
Checks whether the app has a set of "optimum" JVM args that we wish to try first, detecting whether the launch is successful and, if necessary, trying again without the optimum arguments. |
boolean |
haveValidJavaVersion()
Returns true if we either have no version requirement, are running in a JVM that meets our version requirements or have what appears to be a version of the JVM that meets our requirements. |
Application.UpdateInterface |
init(boolean checkPlatform)
Instructs the application to parse its getdown.txt configuration and prepare
itself for operation. |
static List<Integer> |
intsToList(int[] values)
Make an immutable List from the specified int array. |
void |
invokeDirect(JApplet applet)
Runs this application directly in the current VM. |
boolean |
isAuxGroupActive(String auxgroup)
Returns true if the specified auxgroup has been "activated", false if not. |
boolean |
lockForUpdates()
|
static Color |
parseColor(String hexValue)
Parses the given hex color value (e.g. |
static Rectangle |
parseRect(String name,
String value)
Takes a comma-separated String of four integers and returns a rectangle using those ints as the its x, y, width, and height. |
void |
releaseLock()
Release gettingdown.lock |
void |
unpackResources(ProgressObserver obs,
Set<Resource> unpacked)
Unpacks the resources that require it (we know that they're valid). |
void |
updateMetadata()
Downloads and replaces the getdown.txt and digest.txt files with
those for the target version of our application. |
boolean |
verifyMetadata(Application.StatusDisplay status)
Loads the digest.txt file and verifies the contents of both that file and the
getdown.text file. |
List<Resource> |
verifyResources(ProgressObserver obs,
int[] alreadyValid,
Set<Resource> unpacked)
Verifies the code and media resources associated with this application. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONFIG_FILE
public static final String VERSION_FILE
public static final String PROP_PASSTHROUGH_PREFIX
public static final String SIGNATURE_SUFFIX
| Constructor Detail |
|---|
public Application(File appdir,
String appid)
#Application(File, String, Object[], String[], String[])
public Application(File appdir,
String appid,
List<Certificate> signers,
String[] jvmargs,
String[] appargs)
getdown.txt
configuration file from the supplied application directory.
appid - usually null but a string identifier if a secondary application is desired to
be launched. That application will use appid.class and appid.apparg to
configure itself but all other parameters will be the same as the primary application.signers - a list of possible signers of this application. Used to verify the digest.jvmargs - additional arguments to pass on to launched jvms.appargs - additional arguments to pass on to launched application; these will be added
after the args in the getdown.txt file.| Method Detail |
|---|
public Resource getConfigResource()
public List<Resource> getCodeResources()
Resource objects used by this application.
public List<Resource> getResources()
Resource objects used by this application.
public List<Resource> getAllActiveResources()
Resource objects used by this application (code and
non-code).
public Application.AuxGroup getAuxGroup(String name)
public Iterable<Application.AuxGroup> getAuxGroups()
public boolean isAuxGroupActive(String auxgroup)
public List<Resource> getActiveCodeResources()
public List<Resource> getActiveResources()
public Resource getPatchResource(String auxgroup)
auxgroup - the auxiliary resource group for which a patch resource is desired or null
for the main application patch resource.public Resource getJavaVMResource()
public Resource getFullResource()
public URL getTrackingURL(String event)
event - the event to be reported: start, jvm_start, jvm_complete, complete.public URL getTrackingProgressURL(int percent)
public String getTrackingCookieName()
public String getTrackingCookieProperty()
public Application.UpdateInterface init(boolean checkPlatform)
throws IOException
getdown.txt configuration and prepare
itself for operation. The application base URL will be parsed first so that if there are
errors discovered later, the caller can use the application base to download a new
config.txt file and try again.
IOException - thrown if there is an error reading the file or an error encountered
during its parsing.
public URL getRemoteURL(String path)
throws MalformedURLException
MalformedURLExceptionpublic File getLocalPath(String path)
public boolean haveValidJavaVersion()
public boolean hasOptimumJvmArgs()
public void attemptRecovery(Application.StatusDisplay status)
throws IOException
getdown.txt file based on information parsed from a
previous call to init(boolean).
IOException
public void updateMetadata()
throws IOException
getdown.txt and digest.txt files with
those for the target version of our application.
IOException
public Process createProcess(boolean optimum)
throws IOException
optimum - whether or not to include the set of optimum arguments (as opposed to falling
back).
IOExceptionpublic void invokeDirect(JApplet applet)
public boolean verifyMetadata(Application.StatusDisplay status)
throws IOException
digest.txt file and verifies the contents of both that file and the
getdown.text file. Then it loads the version.txt and decides
whether or not the application needs to be updated or whether we can proceed to verification
and execution.
IOException - thrown if we encounter an unrecoverable error while verifying the
metadata.
public List<Resource> verifyResources(ProgressObserver obs,
int[] alreadyValid,
Set<Resource> unpacked)
throws InterruptedException
alreadyValid - if non-null a 1 element array that will have the number of "already
validated" resources filled in.unpacked - a set to populate with unpacked resources.
InterruptedException
public void unpackResources(ProgressObserver obs,
Set<Resource> unpacked)
throws InterruptedException
unpacked - a set of resources to skip because they're already unpacked.
InterruptedExceptionpublic void clearValidationMarkers()
public long getVersion()
public boolean lockForUpdates()
public void releaseLock()
public static List<Integer> intsToList(int[] values)
public static Rectangle parseRect(String name,
String value)
public static Color parseColor(String hexValue)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||