|
|
||||||||||||||||||||
Class SystemVersionManagerpublic class SystemVersionManager implements Runnable { // Methods public static Properties createVersion (int major, int minor, int buildnum, int buildinc, String description); public static Enumeration enumerate (); public static Properties getPackageVersion (String pkgname); public static Properties getSystemComponentVersion ( String compname); public static Properties getVMVersion (); public void run (); } This class provides methods that set and retrieve system version properties. Typically, this class is not called directly. Rather, it is used by implementing a VersionManager class that is derived from it. For a standard implementation of a VersionManager class, refer to the Samples\Version directory in the Microsoft SDK for Java. This class can be added, without editing, directly to your distributed packages. In doing so, applications can check the version information of the system components and your distributed classes. The VersionManager sample class works on any virtual machine, but the SystemVersionManager class is provided specifically for use with the Microsoft Win32 VM for Java. When VersionManager methods are called, the VersionManager object first calls the SystemVersionManager methods to return system information. If the SystemVersionManager class returns nothing or does not exist, and the applet or application runs on the Microsoft VM, the sample implementation of the VersionManager class returns the information for the 3.0 release of Internet Explorer (since Internet Explorer 3.0 was the only version not to include SystemVersionManager). The package information retrieved by the VersionManager works in any virtual machine. The system information, of course, only works on the Microsoft VM. You can request a package by name by using the getPackageVersion method. This method searches for the information in a Version (*.Version) class in the requested package or a superpackage. The version information is in a Properties object. All version objects have the following keys:
All values are stored as instances of Strings. You can also use getSystemComponentVersion to request information about the following system components:
The following is an example of using the VersionManager class to retrieve the version of the Microsoft Virtual Machine for Java: // vmver.java import java.util.Properties; import java.util.Enumeration; public class vmver { public static void main (String[] args) { try { Properties props = VersionManager.getSystemComponentVersion("VM"); if (props == null) { System.out.println("Not a Microsoft VM."); } else { Enumeration e = props.keys(); while (e.hasMoreElements()) { String prop = (String)e.nextElement(); System.out.println(prop+": "+props.get(prop)); } } } catch (Throwable e) { System.out.println("unexpected error:"); e.printStackTrace(); } } } MethodscreateVersionpublic static Properties createVersion (int major, int minor, int buildnum, int buildinc, String description); enumeratepublic static Enumeration enumerate (); getPackageVersionpublic static Properties getPackageVersion (String pkgname); getSystemComponentVersionpublic static Properties getSystemComponentVersion (String compname); getVMVersionpublic static Properties getVMVersion (); runpublic void run ();
|
© 1998 Microsoft Corporation. All rights reserved. Terms of use. |