Java Reference
In-Depth Information
public PersistenceService getPersistenceService() . Obtains the wrapped persis-
tence service.
public URL getUrl(String keyString) . It is the method used by the
PersistenceStorage class to translate the key strings in URLs.
Controlling Installations
The API for controlling the installation of resources (and applications) comprises the
DownloadService , DownloadServiceListener , and ExtensionInstallerService . We have
already seen many examples of these classes at work. In Chapter 13, “A Complete Example,”
there are also some examples of these classes in use.
In Listing 11.6, we present an interesting example of an installer that puts downloaded JAR
files into a specified directory—here the lib/ext/ directory of the currently installed JRE.
L ISTING 11.6 An Optional Packages Installer Example
package com.marinilli.b2.c11;
import com.marinilli.b2.c11.util.Utilities;
import javax.swing.*;
import java.awt.print.*;
import javax.jnlp.*;
import java.awt.*;
import java.io.*;
import java.net.*;
/**
* Chapter 11 - Another Installer Example
* @author Mauro Marinilli
* @version 1.0
*/
public class InstallerExample implements Runnable {
ExtensionInstallerService eis;
public InstallerExample() {
Utilities.getInstance(“installer-msgs”);
eis = (ExtensionInstallerService)Utilities.getService(
”javax.jnlp.ExtensionInstallerService”);
Thread t = new Thread(this);
t.start();
}
public void run() {
setupDownloadWindow();
doResourcesDownload();
installationCompleted(true, false);
}
Search WWH ::




Custom Search