Archive Structure

The wizard archive is the delivery mechanism for the wizard. Because all of the supporting classes, images, and data are written into this one archive file, the wizard can be distributed as an email attachment or, on a web page, as well as the more standard media for software deployment including floppy disks and cdroms. Having a single archive file means that the wizard itself does not need to be installed for the wizard to run. The simplicity of execution this provides makes the self-extracting wizard a good choice for web or email deployment. This section discusses the wizard archive structure.

The archive can be run through a Java Virtual Machine. It extracts the other classes and data. The Java class file that facilitates this is the ArchiveClassLoader. The ArchiveClassLoader class bytes comprise the beginning of the wizard archive. The remaining data (supporting classes, images, audio, initialization data) are written into a class attribute that is added to the ArchiveClassLoader at build time. Class attributes are generally ignored by the Java Virtual Machine. Attributes provide the virtual machine with extra information about the class to enable debugging features, such as source code line numbers. Java virtual machines are prohibited from throwing an exception or refusing to use a class simply because an attribute unknown to the virtual machine is present in the class bytes.

Here is a diagram that indicates the contents and order of the wizard archive:

Wizard archive structure

The Standard Archive Resources section of the wizard archive contains all of the supporting class files that the wizard requires. It also contains any images or audio data that the wizard uses. All of the resources written into the StandardArchiveResources section of the wizard archive are in the form of files. A common stream format is used to write that information into the archive:

	short resourceCount;    // The number of resources in this section.
	for each resource:
		UTF name;       // The classname, imagename, filename.
		int length;     // The number of bytes that comprise this resource.
                byte[] bytes;   // The actual bytes representing the resource.
        

Each resource in the Standard Archive Resources section has a type identifier. This identifier is used at build time to group sets of resources and at runtime to find the resources in the archive very quickly. The identifier is a string that indicates what type of resource the file represents. The pre-defined types are: ArchiveReader, RuntimeClasses, Images, and Audio. Most of these are self explanatory. The ArchiveReader type is used to identify the collection of classes required to instantiate an ArchiveReader object.

The Custom Archive Resources section can be used to contain any data that a particular wizard might require. For example, an installation wizard might put the files to be installed into the Custom Archive Resources section. The mechanism to accomplish that will be discussed in The Wizard Archive Builder.

The WizardState Initialization Data section contains all of the information required to properly initialize the WizardState object at runtime. The Java Serializable interface is used to accomplish most of the serialization of the server-side classes. The exception to this rule is the WizardState object. WizardState is not a Serializable object, to make accidental references to the WizardState object on the client side more obvious. Instead, the WizardState has a method (getSerializedData) that returns a byte array representing the entire WizardState (along with the Sequences, Tasks, and all data set into the WizardState at build time). Child wizard references are written into the WizardArchive as relative paths from the parent wizard archive to the child wizard archives. These paths are resolved at runtime to create the WizardState objects representing each child.

The Client Tree section of the archive represents the classes, order, structure, and panel initialization data of the panels that define the user experience for the wizard. The panel serialization is accomplished through the serialize method within each panel.

The Java Serializable interface is not used for the panels for a few reasons:

The actual classes that comprise the client tree are written into the Standard Archive Resources section of the archive, and are loaded through the ArchiveClassLoader object.

The Offset Table section of the wizard archive stores offsets that point to the various parts of the archive. This lookup table enables fast access to the data within the archive.

The Table Pointer section of the archive is a pointer to the beginning of the Offset Table section. Because this pointer falls at the end of the archive file, it is quite easy to access the Offset Table, which is the table of contents for the wizard. This feature facilitates the wizard hierarchy by making it easy for one wizard to read another wizard's archive file.


Last modified: Fri Nov 25 16:48 PDT