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.
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.
-
API_VERSION
- The version of the Web Start Wizards API currently in use
-
BUFFER_SIZE
- The size of the stream buffer when reading resources.
-
MAGIC_NUMBER
- Magic number for Web Start Wizards
-
systemInterface
- SystemInterface for objects interacting with the native build-time platform.
-
ArchiveCreator()
- Creates empty Creator
-
ArchiveCreator(ResourceResolver, ResourceCollection)
- Create an ArchiveCreator with the default resolver and collection of resources.
-
addCollection(ResourceCollection)
- Adds a collection to be written out to the archive.
-
addResource(String, ResourceWriter)
- Add a resource to the archive.
Deprecated.
-
closeSectionOutputStream()
- Close the output stream.
-
copyStream(DataInput, DataOutput, long)
- This utility method copies one stream to another.
-
finalize()
- Finalizes this class before the runtime exits.
-
getArchiveName()
- Returns the name of this wizard archive (without the ".class" extension)
-
getRoot()
- Returns the WizardComposite object that is the root of the client
tree.
-
getSectionOutputStream(DataOutputStream)
- This method gets an output stream for a section in the wizard
archive.
-
getWizardState()
- Returns the WizardState object that will be written into the
wizard archive.
-
setArchiveName(String)
- Sets the name of this archive, omitting the ".class" extension.
-
setRoot(WizardComposite)
- Sets the WizardComposite object that will be the root of the client panel tree.
-
setWizardState(WizardState)
- Sets the WizardState object that will be written into the
wizard archive.
-
writeArchive(File)
-
-
writeArchive(OutputStream)
- Write the archive file to the specified output stream.
-
writeOffsetTable(DataOutput)
- Write the offset table into the archive.
MAGIC_NUMBER
public static final long MAGIC_NUMBER
- Magic number for Web Start Wizards
API_VERSION
public static final String API_VERSION
- The version of the Web Start Wizards API currently in use
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.
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.
ArchiveCreator
public ArchiveCreator()
- Creates empty Creator
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.
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
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.
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.
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
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.
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
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)
setArchiveName
public void setArchiveName(String archiveName)
- Sets the name of this archive, omitting the ".class" extension.
- Parameters:
- archiveName - The name of this archive
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.
writeArchive
public void writeArchive(File archiveFile)
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
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.
closeSectionOutputStream
protected void closeSectionOutputStream()
- Close the output stream. This completes a compressed section,
if compression is being used.
writeOffsetTable
protected void writeOffsetTable(DataOutput out)
- Write the offset table into the archive.
- Parameters:
- out - The output stream representing the archive.
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