All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.install.products.CmdUnit
java.lang.Object
|
+----com.sun.install.products.InstallComponent
|
+----com.sun.install.products.InstallLeaf
|
+----com.sun.install.products.CmdUnit
- public class CmdUnit
- extends InstallLeaf
CmdUnit is a logical representation of a command script to be run at
install time as part of an installation sequence.
A CmdUnit can be
constructed in one of two modes: archived or non-archived.
If constructed in archived mode, CmdUnit stores content of the script
in the archive at build time, then recreates and runs the script
on the install host at install time.
In non-archived mode, only the path to the script
is stored in the archive, CmdUnit uses this path to locate and run
the desired script on the install host at install time. The specified
path can be relative or absolute. If it is a relative path, at
install time CmdUnit will prepend the path with the Wizard constant
InstallConstants.currentInstallDirectory to construct
the absolute path to the script file.
An object of this type is designed to fit into the product
tree. The product tree is a tree-based representation of a
product. The tree is traversed during the install and each leaf
installs the piece of the product that it has been tasked to. When
a CmdUnit is encountered in the tree, it will run a script whose
name is provided in the constructor.
The CmdUnit class should be used in a builder class (one that is a
subclass of com.sun.wizards.builder.ArchiveWriter).
Important: if the archive option is used, after instantiating or adding
files to CmdUnit, the builder must call getCollection to retrieve the
resource collection hold by CmdUnit, then add the collection to the
wizard (via addCollection). For similar usage, see SolarisExampleBuilder
or FileUnit.
-
CmdUnit(Vector)
- Create a CmdUnit.
-
CmdUnit(Vector, boolean)
- Create a CmdUnit
-
CmdUnit(Vector, Vector, boolean)
- Create a CmdUnit
-
addFile(String, String, Hashtable)
- Adds the specified file or directory to the list of files to be installed
-
addRuntimeResources(Vector)
- Add the runtime resources required by this class.
-
getCollection()
- Retrieves the set of files this unit will write into the archive, along
with each file's attributes.
-
initialize(WizardState)
- Initialize this unit.
-
install(WizardState)
- Install (i.e.
-
refresh(Vector)
-
Update this file.
-
toString()
- Represent this object as a string.
-
uninstall(WizardState)
- Uninstall this Leaf.
CmdUnit
public CmdUnit(Vector installCmds)
- Create a CmdUnit. The install scripts will not be stored in the
archive.
- Parameters:
- installCmds - A vector containing pathnames of install scripts.
CmdUnit
public CmdUnit(Vector installCmds,
boolean archiveCmd)
- Create a CmdUnit
- Parameters:
- installCmds - A vector containing pathnames of install scripts.
- archiveCmd - If true, the install scripts will
be stored in the archive. If false, store only the paths.
CmdUnit
public CmdUnit(Vector installCmds,
Vector uninstallCmds,
boolean archiveCmd)
- Create a CmdUnit
- Parameters:
- installCmds - A vector containing pathnames of install scripts.
If null, skip the install.
- uninstallCmd - A vector containing pathnames of the uninstall
scripts. If null, skip the uninstall.
- archiveCmd - If true, the install and uninstall scripts will
be stored in the archive. If false, store only the paths.
refresh
public boolean refresh(Vector targets)
- Update this file.
- Parameters:
- targets - The target properties (set via
setProperty())
to update.
- Returns:
-
true if the refresh was sucessful, false
otherwise.
initialize
public boolean initialize(WizardState state)
- Initialize this unit.
- Parameters:
- wizardState - The WizardState this component belongs to.
- Returns:
- true, if scripts identified to be included in the archive were
successfully archived; false otherwise.
- Overrides:
- initialize in class InstallComponent
getCollection
public ResourceCollection getCollection()
- Retrieves the set of files this unit will write into the archive, along
with each file's attributes.
- Returns:
- The ResourceCollection object representing the files this
CmdUnit requires in the archive. All scripts associated
with this CmdUnit that were specified as archived will
be returned in the ResourceCollection object.
install
public boolean install(WizardState state)
- Install (i.e. run) the scripts specified as install scripts.
- Parameters:
- state - The wizard state.
- Returns:
- Whether the install was successful or not.
- Overrides:
- install in class InstallComponent
uninstall
public boolean uninstall(WizardState state)
- Uninstall this Leaf. This is run by the uninstaller at uninstall
time. This results in the scripts specified as uninstall scripts
being executed.
- Parameters:
- state - The wizard state.
- Returns:
- Whether the uninstall was sucessful or not.
- Overrides:
- uninstall in class InstallComponent
addFile
public void addFile(String path,
String fileName,
Hashtable forcedPermissions)
- Adds the specified file or directory to the list of files to be installed
- Parameters:
- path - The path to the desired file(s) to be added.
This can be a file or a directory. If it 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. The
pathargument will not be
remembered.
- filename - The relative path to the desired file to be added.
This can be a file or a directory. If it is a directory, this
method will recursively add all files in that directory.
The filenames should be specified relative
the the supplied path parameter.
- forcedPermissions - A hashtable consisting of filenames and
the desired permissions or
null if no forced
permissions should be applied.. These permissions will
override any other permissions for this file at
install-time.
toString
public String toString()
- Represent this object as a string.
- Returns:
- A description of this object.
- Overrides:
- toString in class InstallComponent
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