All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.core.ArchiveReader

java.lang.Object
   |
   +----com.sun.wizards.core.ArchiveReader

public class ArchiveReader
extends Object
ArchiveReader is responsible for reading the wizard archive and submitting class byte descriptions to the ArchiveClassLoader. NOTE: Any objects created or called from this class must be done through reflection. When this object is created, the class loader does not know about all of the classes within the archive. Any use of non-core java classes in this class will result in a resolution error when this class is created.


Variable Index

 o offsetTable
This is a table used to look up sections in the archive.
 o openStreams
A lookup table for open streams.
 o systemInterface
Class to be used at runtime to interact with the underlying platform using platform-independent system interface calls.
 o wizardState
The wizard state is the server side of the wizard.

Constructor Index

 o ArchiveReader(Object, String, Boolean, Object)
Creates an ArchiveReader with the specified class loader and archive file name.

Method Index

 o bind(Integer)
Binds the wizardState to the rmi registry.
 o callObjectMethod(Object, String, String[], Object[])
Call an object method through reflection.
 o cleanup()
This method is called before exiting to remove temporary files, including the native support.
 o closeNamedResourceStream(String)
Close the stream currently accessing the named resource.
 o createObject(String, Class[], Object[])
Create an object through reflection.
 o finalize()
The finalizer is responsible for deleting temporary files created by this object.
 o getArchiveFilename()
Get the archive filename.
 o getArchivePath()
Get the archive path.
 o getClassLoader()
Get the class loader being used by this ArchiveReader object.
 o getID()
Retrieves the WizardID of the wizard this ArchiveReader is reading from
 o getNamedResource(String, String)
This method returns the bytes of the named resource of the specified type.
 o getNamedResourceStream(String)
This method returns the bytes of the named resource of the specified type.
 o getSectionInputStream(FileInputStream)
This method returns an input stream for a section in the wizard archive.
 o getSectionInputStream(RandomAccessFile)
This method returns an input stream for a section in the wizard archive.
 o getVersion()
Retrieves the API version used to build the wizard this ArchiveReader is reading from
 o getWizardManager()
Returns the WizardTreeManager.
 o getWizardState()
Get the WizardState object this ArchiveReader is working with.
 o getWizardTree(String)
Get the data representing a client subtree.
 o loadOffsetTable()
loadOffsetTable loads the archive offset table from the archive.
 o readState()
 o registerClasses()
This method registers the RuntimeClasses found in the archive with the class loader.
 o registerTempFile(String)
Register a temporary file that will be removed when the wizard exits.
 o removeTempFile(String)
Remove the specified temporary file now.
 o writeNativeComponents(String)
Write the native support for this platform into the specified directory.
 o writeState()
Writes the statefile for this wizard, and any child wizards present.

Variables

 o offsetTable
 protected Hashtable offsetTable
This is a table used to look up sections in the archive. This table contains named offsets.

 o wizardState
 protected Object wizardState
The wizard state is the server side of the wizard. This object is created by the ArchiveReader.

 o openStreams
 protected Hashtable openStreams
A lookup table for open streams. This table is used to identify open streams and close them.

 o systemInterface
 public static SystemInterface systemInterface
Class to be used at runtime to interact with the underlying platform using platform-independent system interface calls.

Constructors

 o ArchiveReader
 public ArchiveReader(Object classLoader,
                      String archiveFilename,
                      Boolean startGUI,
                      Object parent)
Creates an ArchiveReader with the specified class loader and archive file name. The archive file name should specify an absolute path and filename for the archive file.

Parameters:
classLoader - The class loader to be used by this ArchiveReader.
archiveFilename - The absolute path and filename for the archive this reader will read.
startGUI - Indicates whether the graphical user interface should be started.
parent - The WizardState object that is the parent of the wizard being instantiated by this ArchiveReader object.

Methods

 o getVersion
 public String getVersion()
Retrieves the API version used to build the wizard this ArchiveReader is reading from

 o getID
 public String getID()
Retrieves the WizardID of the wizard this ArchiveReader is reading from

 o writeState
 public void writeState()
Writes the statefile for this wizard, and any child wizards present.

 o readState
 public void readState()
 o getWizardState
 public synchronized Object getWizardState()
Get the WizardState object this ArchiveReader is working with.

Returns:
The WizardState.
 o getArchivePath
 public synchronized String getArchivePath()
Get the archive path.

Returns:
The path to this archive.
 o getArchiveFilename
 public synchronized String getArchiveFilename()
Get the archive filename.

Returns:
The filename of this archive, including the path.
 o getSectionInputStream
 public DataInput getSectionInputStream(RandomAccessFile file)
This method returns an input stream for a section in the wizard archive. This method will determine from the archive section if compression is being used, and return an appropriate input stream.

Parameters:
file - The file, correctly positioned to read the desired archive section.
Returns:
An input stream that can read the archive section.
 o getSectionInputStream
 public DataInput getSectionInputStream(FileInputStream file)
This method returns an input stream for a section in the wizard archive. This method will determine from the archive section if compression is being used, and return an appropriate input stream.

Parameters:
file - The file, correctly positioned to read the desired archive section.
Returns:
An input stream that can read the archive section.
 o getClassLoader
 public synchronized Object getClassLoader()
Get the class loader being used by this ArchiveReader object.

Returns:
The class loader.
 o bind
 public Boolean bind(Integer rmiPort)
Binds the wizardState to the rmi registry. The wizardState should be a GenericRemoteWizardState. The only object to call this method is the ArchiveClassLoader, and only if we are running remote. We simply reflect to call into the wizardState, which takes care of binding itself.

Parameters:
rmiPort - The desired port with which client proxy objects should attempt to find exported GenericRemoteWizardStates on.
Returns:
Whether the binding was successful or not
 o getNamedResource
 public byte[] getNamedResource(String type,
                                String name)
This method returns the bytes of the named resource of the specified type.

Parameters:
type - The type of resource.
name - The name of the resource.
Returns:
The byte array representing the requested resource.
 o getNamedResourceStream
 public ResourceSection getNamedResourceStream(String name)
This method returns the bytes of the named resource of the specified type.

Parameters:
name - The name of the resource.
Returns:
The requested resource section.
 o closeNamedResourceStream
 public void closeNamedResourceStream(String name)
Close the stream currently accessing the named resource.

Parameters:
name - The name of the resource the stream is reading.
 o registerClasses
 protected void registerClasses()
This method registers the RuntimeClasses found in the archive with the class loader.

 o loadOffsetTable
 public synchronized void loadOffsetTable()
loadOffsetTable loads the archive offset table from the archive.

 o callObjectMethod
 public Object callObjectMethod(Object target,
                                String methodName,
                                String argTypes[],
                                Object args[])
Call an object method through reflection.

Parameters:
target - The object to call the method on.
methodName - The name of the method to call.
argTypes - The parameter list identifying the correct method.
args - The parameters to pass to the method.
Returns:
The method return value.
 o createObject
 public Object createObject(String classname,
                            Class argTypes[],
                            Object args[])
Create an object through reflection.

Parameters:
classname - The class name of the object to create.
argTypes - The paramater list identifying the correct constructor.
args - The arguments to pass to the constructor.
Returns:
The created object.
 o getWizardTree
 public synchronized byte[] getWizardTree(String subtreeName)
Get the data representing a client subtree.

Parameters:
subtreeName - The name of the subtree, or null for the entire client tree.
Returns:
The data representing the client tree.
 o writeNativeComponents
 public synchronized void writeNativeComponents(String nativeLibDirectory)
Write the native support for this platform into the specified directory.

Parameters:
nativeLibDirectory - The directory into which the native support should be written.
 o registerTempFile
 public void registerTempFile(String filename)
Register a temporary file that will be removed when the wizard exits.

Parameters:
filename - The absolute path to the file to be removed.
 o removeTempFile
 public void removeTempFile(String filename)
Remove the specified temporary file now.

Parameters:
filename - The absolute path to the temporary file to be removed.
 o getWizardManager
 public Object getWizardManager()
Returns the WizardTreeManager.

 o finalize
 protected void finalize() throws Throwable
The finalizer is responsible for deleting temporary files created by this object.

Throws: Throwable
If there are problems shutting down the wizard or deleting any temporary files.
Overrides:
finalize in class Object
 o cleanup
 public void cleanup()
This method is called before exiting to remove temporary files, including the native support.


All Packages  Class Hierarchy  This Package  Previous  Next  Index