All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.install.products.FileUnit

java.lang.Object
   |
   +----com.sun.install.products.InstallComponent
           |
           +----com.sun.install.products.InstallLeaf
                   |
                   +----com.sun.install.products.FileUnit

public class FileUnit
extends InstallLeaf
implements ResourceResolver
The FileUnit is able to install files directly from the wizard archive. FileUnit is also able to remove the files at uninstall time, provided the files appear in the current directory.


Variable Index

 o resourceName
The resource name is the key used on the archive to get a stream containing files to be installed by this unit.

Constructor Index

 o FileUnit()
Create a FileUnit.
 o FileUnit(String)
Create a FileUnit that reads from the specified resource section in the archive.
 o FileUnit(String, String, String)
Create a FileUnit that reads from the specified resource section in the archive, which installs to the specified relative path offset from the directory specified by the installDirKey value.

Method Index

 o addFile(String, String, Hashtable)
Adds the specified file or directory to the resource.
 o addRuntimeResources(Vector)
Add the runtime resources required by this class.
 o getCollection()
Retrieves the vector of files this unit will write into the archive, along with each file's attributes.
 o getComponentDescription()
Gets the component's description.
 o getInstallLocation()
Form the install location based on the installDirKey and a possible relative path.
 o initialize(WizardState)
Initialize the FileUnit by removing the alternate root.
 o install(WizardState)
Install the files that are embedded in the wizard archive.
 o mkdirs(Vector, File)
Recursively makes directories, registering each directory with the supplied vector so that it gets removed at uninstall time.
 o readDestinationTable()
sets the destination table that is used for disk space checking.
 o refresh(Vector, String)
Update this file.
 o resolveResource(String, String, byte[])
This method resolves the resources required by this FileUnit.
 o setFileTable(Vector)
Sets the table of files to be written into the archive at buildtime.
 o toString()
Represent this object as a string.
 o uninstall(WizardState)
Uninstall this Leaf.

Variables

 o resourceName
 protected String resourceName
The resource name is the key used on the archive to get a stream containing files to be installed by this unit.

Constructors

 o FileUnit
 public FileUnit()
Create a FileUnit.

 o FileUnit
 public FileUnit(String resourceName)
Create a FileUnit that reads from the specified resource section in the archive. The files will be installed and removed from the directory chosen by the user.

Parameters:
resourceName - The name of the archive resource containing files for this unit. Doubles as the name of this component.
 o FileUnit
 public FileUnit(String resourceName,
                 String installDirKey,
                 String relativePath)
Create a FileUnit that reads from the specified resource section in the archive, which installs to the specified relative path offset from the directory specified by the installDirKey value.

Parameters:
resourceName - The name of the archive resource containing files for this unit.
installDirKey - The WizardState key that references a String object indicating where this FileUnit should be installed. If this path is relative, the parent's path is appended. Otherwise, it is not.
relativePath - The relative path from the directory specified by the DirectorySelectionPanel where this unit will install its contents.

Methods

 o refresh
 public boolean refresh(Vector targets,
                        String sharedPoolKey)
Update this file. For the FileUnit, the files are read out of the archive and their sizes updated against what is already installed. This is a relatively expensive operation in terms of I/O requirements.

Parameters:
targets - The target properties (set via setProperty()) to update.
sharedPoolKey - the key to use during shared pooling.
Returns:
true if the refresh was sucessful, falseotherwise.
Overrides:
refresh in class InstallComponent
 o initialize
 public boolean initialize(WizardState state)
Initialize the FileUnit by removing the alternate root.

Parameters:
state - The WizardState.
Returns:
true if the initialization was successful; false otherwise.
Overrides:
initialize in class InstallComponent
 o getInstallLocation
 public String getInstallLocation()
Form the install location based on the installDirKey and a possible relative path. Althernate root is not considered in this method.

Returns:
The location this FileUnit will install to
Overrides:
getInstallLocation in class InstallComponent
 o readDestinationTable
 public void readDestinationTable()
sets the destination table that is used for disk space checking. called by refresh() with a rule of "destinationTable"

 o getCollection
 public ResourceCollection getCollection()
Retrieves the vector of files this unit will write into the archive, along with each file's attributes.

Returns:
The data table representing the files this FileUnit will write into the archive
 o getComponentDescription
 public ComponentDescription getComponentDescription()
Gets the component's description.

Returns:
The ComponentDescription object associated with this FileUnit.
Overrides:
getComponentDescription in class InstallComponent
 o setFileTable
 public boolean setFileTable(Vector fileTable)
Sets the table of files to be written into the archive at buildtime. The passed-in table is checked for sanity and is discarded in the event the table is not in the correct form.

Parameters:
fileTable - the filetable to set into this FileUnit.
Returns:
true if the fileTable was sucessfully checked and set into this fileleaf. false otherwise.
 o install
 public boolean install(WizardState state)
Install the files that are embedded in the wizard archive.

Parameters:
state - The wizard state.
Returns:
Whether the install was successful or not.
Overrides:
install in class InstallComponent
 o mkdirs
 public static void mkdirs(Vector result,
                           File directory)
Recursively makes directories, registering each directory with the supplied vector so that it gets removed at uninstall time.

Parameters:
result - The vector to add the created directories to. The directories are inserted at the beginning of the vector as they are made.
directory - The desired directory to be made.
 o uninstall
 public boolean uninstall(WizardState state)
Uninstall this Leaf. This is run by the uninstaller at uninstall time and has no information about where the install actually took place. Hence, it must guess the install directory. The only guess is the directory specified at buildtime (the default install directory)

Parameters:
state - The WizardState.
Returns:
Whether the uninstall was sucessful or not.
Overrides:
uninstall in class InstallComponent
 o addFile
 public void addFile(String path,
                     String fileName,
                     Hashtable forcedPermissions)
Adds the specified file or directory to the resource.

Parameters:
path - The path to the desired file to be added. The pathargument will not be remembered.
filename - The name of the desired file/directory to be added. If filename is a directory, this method will recursively add all files in that directory, and the files will be laid down in the same relative directories as when collected.
forcedPermissions - A hashtable consisting of filenames and the desired permissions or null if no forced permissions should be appliet.. These permissions will override any other permissions for this file at install-time. The filenames should be specified relative the the supplied path parameter.
 o resolveResource
 public ResourceInputStream resolveResource(String type,
                                            String name,
                                            byte extData[])
This method resolves the resources required by this FileUnit. It either generates a stream for the list of names for the "names" resource entry, or a stream for the actual contents of this file unit.

Parameters:
type - The type of resource to resolve. This can be "Class", "Image", "Audio" or any other description.
name - The name of the resource to resolve.
extData - Extra data to be associated with the resource. For FileUnit, the extra data contains the file permissions.
 o toString
 public String toString()
Represent this object as a string.

Returns:
A description of this object.
Overrides:
toString in class InstallComponent
 o addRuntimeResources
 public void addRuntimeResources(Vector resourceVector)
Add the runtime resources required by this class.

Parameters:
resourceVector - The vector containing all of the required resources for this class
Overrides:
addRuntimeResources in class InstallLeaf

All Packages  Class Hierarchy  This Package  Previous  Next  Index