This section describes the method of download status notification supported by JBK Plugin.
JBK Plugin provides an interface for reporting information about the download of JAR files to the user. You can embed a progress bar or similar item indicating the status of JAR file downloading by creating a class with this interface implemented and specifying that class with jbkplugin.properties.
Download status notification interface
Details of the JBK Plugin download status notification API are as follows.
Interface:
com.fujitsu.jbk.plugin.browser.PluginDownloadNotify
(extends java.lang.Object)
Methods:
jarLoaded
This method is called when all class files in the JAR files have been completely loaded for an applet that is to be loaded. If java.net.URLConnection is used in an applet to download files, this method is not invoked. Therefore, explicitly invoke the method from the applet.
public abstract void jarLoaded() |
setCurrentJar
This method is invoked when an applet is loaded. It is also invoked when java.net.URLConnection is used in an applet to download files.
public abstract void setCurrentJar(java.net.URL jar) |
URL of a JAR file to be loaded
setJars
This method delivers an array of the JAR files to be loaded by an applet.
public abstract void setJars(java.net.URL[] jars) |
Array of URLs of JAR files to be loaded
・Applet codebase
・JAR files coded in the archive attribute
In addition, the getPluginDownloadNotify() method has been added. This method gets a class by using the com.fujitsu.jbk.plugin.browser.PluginAppletContext interface to implement the PluginDownloadNotify interface.
The class file for the PluginDownloadNotify class is stored in the jar file for the development of the JBK plugin ("classes\jbkstd.jar" in the JBK installation folder). When compiling the class of an applet that uses the PluginAppletContext interface, check whether the jar file for the development of the JBK plugin is included in the classpath.
Specifying a download status notification class
To specify a class with download status notification implemented, code the following line in jbkplugin.properties:
jbk.plugin.interface.download_notify=<name-of-a-class-with-download-status-notification-implemented> |
For <name-of-a-class-with-download-status-notification-implemented>, specify the name of a class that includes a package name.
Using download status notification
Use download status notification as follows:
Create a class with the PluginDownloadNotify interface implemented.
Place the class created in step 1 on the client. A class path needs to be set for the class .
To set the class path, add it to the CLASSPATH environment variable or use jbk.plugin.vmoption of jbkplugin.properties.
Add the jbk.plugin.interface.download_notify property to jbkplugin.properties to set the name of the class.
Note
When an implemented class internally uses the Class.getResource() method, it may fail to acquire resources. If such a failure occurs, edit the policy file to add the java.io.FilePermission read attribute to the class.
Example) grant { java.io.FilePermission "C:\\JBKPLG\\classes\\Progress.jar", "read"; }; |
Note
When an implemented class generates a new thread, it may throw AccessControlException. If such a failure occurs, edit the policy file to add java.lang.RuntimePermission to the class.
Example) grant codebase "file:/C:/JBKPLG/classes/Progress.jar" { java.lang.RuntimePermission "modifyThread"; java.lang.RuntimePermission "modifyThreadGroup"; }; |
Alternatively, you can prevent the failure by adding the implemented class as follows to the boot class path, not to the regular class path:
Using the -Xbootclasspath option, specify the path to the execution class.
Create a classes folder under the JRE folder, then store the implemented class in the classes folder.
(The JRE classes folder has been specified in the boot class path by default.)