All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.builder.resolver.ArchiveCreator

java.lang.Object
   |
   +----com.sun.wizards.builder.resolver.ArchiveCreator

public class ArchiveCreator
extends Object
implements Serializable
ArchiveCreator is responsible for creating a wizard archive.

The wizard archive consists of a ClassLoader (com.sun.wizards.builder.ArchiveClassLoader) which has a class attribute that contains the Java classes and information required to execute the wizard.

A subclass of ArchiveCreator must be written to define specifically what the wizard will contain.

Graphic of the first panel of the simple wizard.

Graphic of the second panel of the simple wizard.

Here is the code for this wizard builder:


 import com.sun.wizards.core.WizardState;
 import com.sun.wizards.builder.ArchiveCreator;
 import com.sun.wizards.panels.*;
 public class SimpleWizardBuilder extends ArchiveCreator
 {
   public SimpleWizardBuilder()
   {
     super();
     this.archiveName = "simpleWizard";
   }
   protected void createClientTree()
   {
     super.createClientTree();
     WizardState wizardState = getWizardState();
     // Create the client panels.
     TextImagePanel firstPanel = new TextImagePanel(wizardState, "First Panel");
     firstPanel.addText("This is the first panel in the simple wizard.",
 		       0, 25);
     TextImagePanel secondPanel = new TextImagePanel(wizardState, "Second Panel");
     secondPanel.addText("This is the second panel in the simple wizard.",
 			0, 25);
     // Add the panels to the wizard.
     root.addChild(firstPanel);
     root.addChild(secondPanel);
   }
   public static void main(String[] args)
   {
     SimpleWizardBuilder simpleWizardBuilder = new SimpleWizardBuilder();
     simpleWizardBuilder.writeArchive();
   }
 }
 

In order to create the wizard from the SimpleWizardBuilder code above, compile and run SimpleWizardBuilder.java. The result of running the SimpleWizardBuilder is a class file called "simpleWizard.class". This class represents a composite of the com.sun.wizards.builder.ArchiveClassLoader and all of the runtime classes required to execute the wizard.


Variable Index

 o API_VERSION
The version of the Web Start Wizards API currently in use
 o BUFFER_SIZE
The size of the stream buffer when reading resources.
 o MAGIC_NUMBER
Magic number for Web Start Wizards
 o systemInterface
SystemInterface for objects interacting with the native build-time platform.

Constructor Index

 o ArchiveCreator()
Creates empty Creator
 o ArchiveCreator(ResourceResolver, ResourceCollection)
Create an ArchiveCreator with the default resolver and collection of resources.

Method Index

 o addCollection(ResourceCollection)
Adds a collection to be written out to the archive.
 o addResource(String, ResourceWriter)
Add a resource to the archive. Deprecated.
 o closeSectionOutputStream()
Close the output stream.
 o copyStream(DataInput, DataOutput, long)
This utility method copies one stream to another.
 o finalize()
Finalizes this class before the runtime exits.
 o getArchiveName()
Returns the name of this wizard archive (without the ".class" extension)
 o getRoot()
Returns the WizardComposite object that is the root of the client tree.
 o getSectionOutputStream(DataOutputStream)
This method gets an output stream for a section in the wizard archive.
 o getWizardState()
Returns the WizardState object that will be written into the wizard archive.
 o setArchiveName(String)
Sets the name of this archive, omitting the ".class" extension.
 o setRoot(WizardComposite)
Sets the WizardComposite object that will be the root of the client panel tree.
 o setWizardState(WizardState)
Sets the WizardState object that will be written into the wizard archive.
 o writeArchive(File)
 o writeArchive(OutputStream)
Write the archive file to the specified output stream.
 o writeOffsetTable(DataOutput)
Write the offset table into the archive.

Variables

 o MAGIC_NUMBER
 public static final long MAGIC_NUMBER
Magic number for Web Start Wizards

 o API_VERSION
 public static final String API_VERSION
The version of the Web Start Wizards API currently in use

 o BUFFER_SIZE
 public static final int BUFFER_SIZE
The size of the stream buffer when reading resources. The buffer might be smaller than this if the required memory is not available.

 o systemInterface
 public static SystemInterface systemInterface
SystemInterface for objects interacting with the native build-time platform. Any object that needs to interact with the buildtime platform can use this static field to do so.

Constructors

 o ArchiveCreator
 public ArchiveCreator()
Creates empty Creator

 o ArchiveCreator
 public ArchiveCreator(ResourceResolver defaultResolver,
                       ResourceCollection defaultCollection)
Create an ArchiveCreator with the default resolver and collection of resources.

Parameters:
defaultResolver - The ResourceResolver for all resources that do not have an associated ResourceResolver.
defaultCollection - The default set of classes to be included in this archive.

Methods

 o addCollection
 public void addCollection(ResourceCollection collection)
Adds a collection to be written out to the archive. Each resource in the collection is associated with a ResourceResolver, which gets called upon to resolve each resource in the collection.

Parameters:
collection - The collection to add
 o addResource
 public void addResource(String name,
                         ResourceWriter writer)
Note: addResource() is deprecated.

Add a resource to the archive. At buildtime, this ResourceWriter will be called upon to write its contents to the archive.

Parameters:
name - The name of the resource.
writer - The object that will write the resource data into the archive.
 o getWizardState
 public WizardState getWizardState()
Returns the WizardState object that will be written into the wizard archive.

Returns:
The WizardState to be written into the wizard archive.
 o setWizardState
 public void setWizardState(WizardState state)
Sets the WizardState object that will be written into the wizard archive.

Parameters:
state - The state to be used to write into the wizard archive
 o getRoot
 public WizardComposite getRoot()
Returns the WizardComposite object that is the root of the client tree.

Returns:
The WizardComposite to be written into the wizard archive, or null if none has been set.
 o setRoot
 public void setRoot(WizardComposite root)
Sets the WizardComposite object that will be the root of the client panel tree. wizard archive.

Parameters:
root - The root of the client panel tree
 o getArchiveName
 public String getArchiveName()
Returns the name of this wizard archive (without the ".class" extension)

Returns:
the name of this wizard archive (without the ".class" extension)
 o setArchiveName
 public void setArchiveName(String archiveName)
Sets the name of this archive, omitting the ".class" extension.

Parameters:
archiveName - The name of this archive
 o writeArchive
 public void writeArchive(OutputStream archiveOut)
Write the archive file to the specified output stream.

The [archiveName].class file is the wizard archive, and can be executed by running the class through the Java virtual machine.

Parameters:
archiveOut - The output stream to which the archive will be written.
 o writeArchive
 public void writeArchive(File archiveFile)
 o copyStream
 public static void copyStream(DataInput in,
                               DataOutput out,
                               long length)
This utility method copies one stream to another.

Parameters:
in - The source stream
out - The target stream
length - The amount of data to copy
 o getSectionOutputStream
 protected DataOutput getSectionOutputStream(DataOutputStream out)
This method gets an output stream for a section in the wizard archive. This method will enable compression if the useCompression flag is set to true.

Parameters:
out - The stream to configure the outputstream on top of
Returns:
An output stream for the archive section.
 o closeSectionOutputStream
 protected void closeSectionOutputStream()
Close the output stream. This completes a compressed section, if compression is being used.

 o writeOffsetTable
 protected void writeOffsetTable(DataOutput out)
Write the offset table into the archive.

Parameters:
out - The output stream representing the archive.
 o finalize
 protected void finalize()
Finalizes this class before the runtime exits.

Overrides:
finalize in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index