Java Reference
In-Depth Information
L ISTING D.1 Continued
* return true if the given module is installed
*/
public static boolean isModuleInstalled(String part){
if (util==null)
getInstance();
DownloadService ds =
(DownloadService)getService(“javax.jnlp.DownloadService”);
return ds.isPartCached(part);
}
/**
* default Singleton initialization.
* It is performed automatically by all methods.
*/
public static GeneralUtilities getInstance(){
if (util==null)
util = new GeneralUtilities();
return util;
}
/**
* Singleton initialization with a given resource bundle
*/
public static GeneralUtilities getInstance(String resourceBundleName){
bundleFilename = resourceBundleName;
if (util==null)
getInstance();
else
System.out.println(
util.getClass()+” getInstance must be invoked at initialization
D
time.”);
return util;
}
}
Note that the GeneralUtilities can tell the different execution modality (whether launched as
a standalone application or by a JNLP Client) by obtaining a JNLP service (line 35 in Listing
D.1). If that service is null, the utility library's AServiceManagerStub is installed; otherwise,
the application is assumed to be running within a JNLP Client container.
The net effect from the client application is always the same. In the following listings in this
appendix, we will see how the various JNLP runtime services are implemented in order to be
provided to applications launched without JNLP support in a standalone way.
Search WWH ::




Custom Search