Methods Summary |
---|
public boolean | confirmAuthPath(InstallState state)Called with the current state of the install so the user can be
asked to confirm the authentication path.
If false is returned, the an I/O exception thrown and
{@link Installer#wasStopped()} will return true if called.
return true;
|
public boolean | confirmJarDownload(InstallState state)Called with the current state of the install so the user can be
asked to confirm the jar download.
If false is returned, the an I/O exception thrown and
{@link Installer#wasStopped()} will return true if called.
return true;
|
public void | destroyApp(boolean unconditional)Destroy cleans up.
|
public boolean | keepRMS(InstallState state)Called with the current state of the install so the user can be
asked to confirm if the RMS data should be kept for new version of
an updated suite.
If false is returned, the an I/O exception thrown and
{@link Installer#wasStopped()} will return true if called.
return true;
|
public void | pauseApp()Pause; there are no resources that need to be released.
|
public void | run()Installs a new MIDlet suite.
Installer installer = null;
String installerClassName = null;
final String supportedUrlTypes[] = {
"http", "HttpInstaller",
"https", "HttpInstaller",
"file", "FileInstaller"
};
// parse the arguments
String arg0 = getAppProperty("arg-0");
if (arg0 == null || !"I".equals(arg0)) {
showUsage();
notifyDestroyed();
return;
}
String url = getAppProperty("arg-1");
if (url == null) {
showUsage();
notifyDestroyed();
return;
}
int storageId = Constants.INTERNAL_STORAGE_ID;
String strStorageId = getAppProperty("arg-2");
if (strStorageId != null) {
try {
storageId = Integer.parseInt(strStorageId);
} catch (NumberFormatException nfe) {
// Intentionally ignored
}
}
// If a scheme is omitted, handle the url
// as a file on the local file system.
final String scheme = Installer.getUrlScheme(url, "file");
for (int i = 0; i < supportedUrlTypes.length << 1; i++, i++) {
if (supportedUrlTypes[i].equals(scheme)) {
installerClassName = "com.sun.midp.installer." +
supportedUrlTypes[i+1];
break;
}
}
if (installerClassName != null) {
try {
installer = (Installer)
Class.forName(installerClassName).newInstance();
} catch (Throwable t) {
// Intentionally ignored: 'installer' is already null
}
}
if (installer == null) {
final String errMsg = "'" + scheme + "' URL type is not supported.";
System.out.println("ERROR: " + errMsg);
notifyDestroyed();
return;
}
// install the suite
int lastInstalledMIDletId;
int len = url.length();
boolean jarOnly = (len >= 4 &&
".jar".equalsIgnoreCase(url.substring(len - 4, len)));
try {
if (jarOnly) {
lastInstalledMIDletId = installer.installJar(url, null,
storageId, false, false, this);
} else {
lastInstalledMIDletId =
installer.installJad(url, storageId, false, false, this);
}
System.out.println("The suite was succesfully installed, ID: " +
lastInstalledMIDletId);
} catch (Throwable t) {
System.err.println("Error installing the suite: " + t.getMessage());
t.printStackTrace();
}
notifyDestroyed();
|
private void | showUsage()Prints a message about the midlet usage.
System.out.println("Usage: ./runMidlet internal " +
"CommandLineInstaller I <url> [storageId]");
|
public void | startApp()Start.
|
public void | updateStatus(int status, InstallState state)Called with the current status of the install. See
{@link Installer} for the status codes.
|
public boolean | warnUser(InstallState state)Called with the current state of the install so the user can be
asked to override the warning. To get the warning from the state
call {@link InstallState#getLastException()}. If false is returned,
the last exception in the state will be thrown and
{@link Installer#wasStopped()} will return true if called.
return true;
|