All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.install.products.PatchUnit
java.lang.Object
|
+----com.sun.install.products.InstallComponent
|
+----com.sun.install.products.InstallLeaf
|
+----com.sun.install.products.PatchUnit
- public class PatchUnit
- extends InstallLeaf
PatchUnit is the logical representation of a Solaris "Patch"
It can be used to apply a patch onto a system. The underlying
methods are based on the Solaris patchadd command. See
the patchadd(1M) man page for more information on the
usage. See the Solaris Tutorial
for a complete example of using PatchUnit to install an example product
using packages.
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 is has been tasked to. When
a PatchUnit is encountered in the tree, it will run
patchadd with the options that are provided in the
constructor.
The PatchUnit class should be used in a builder class (one that is a
subclass of com.sun.wizards.builder.ArchiveWriter).
When PatchUnit installs its underlying package, the only option to
change is the relative path to the patch, since the patch does not
actually exist inside the archive itself.
-
BUILD_TIME
- Indicates we should do some preprocessing when this class is used in a builder
-
logOutput
- Flag indicating whether we should collect output from
patchadd for the log.
Deprecated.
-
RUN_TIME
- Indicates we should *not* do some preprocessing at buildtime.
-
PatchUnit()
- Create a Solaris patch unit
-
PatchUnit(String, String)
- Create a Solaris patch unit with patch location specified
by the given relative path and revision level.
-
PatchUnit(String, String, boolean)
- Create a Solaris patch unit with patch location specified
by the given relative path, revision level, and whether or not to collect output.
-
PatchUnit(String, String, boolean, Hashtable)
- Create a Solaris patch unit with patch location specified
by the given relative path, the patch version, whether or not to collect output, and the given size information.
-
PatchUnit(String, String, boolean, int)
- Create a Solaris patch unit with patch location specified
by the given relative path, the patch version, whether or not to collect output, and the given size information.
-
addRuntimeResources(Vector)
- Add the runtime resources required by this class.
-
initialize(WizardState)
-
Initialize this patch unit.
-
install(WizardState)
- Install the patch.
-
isInstallable(WizardState)
- Determine if this patch is installable.
-
isUninstallable(WizardState)
- Determine if this patch is uninstallable.
-
toString()
- Represent this object as a string.
-
uninstall(WizardState)
- Uninstall the patch.
BUILD_TIME
public static final int BUILD_TIME
- Indicates we should do some preprocessing when this class is used in a builder
RUN_TIME
public static final int RUN_TIME
- Indicates we should *not* do some preprocessing at buildtime.
logOutput
protected boolean logOutput
- Note: logOutput is deprecated.
- Flag indicating whether we should collect output from
patchadd for the log. Sun bugid 4174602: No patch
log mode is needed for patches such as two SDS patches that start
a permanent daemon that doesn't redirect or close its standard
output. If these PatchUnit's were to use log mode, they would
wait forever on the daemon's open output file descriptor.
PatchUnit
public PatchUnit()
- Create a Solaris patch unit
PatchUnit
public PatchUnit(String relativePath,
String revision)
- Create a Solaris patch unit with patch location specified
by the given relative path and revision level.
- Parameters:
- relativePath - The path (relative to the install
archive) where the package can be found.
- revision - The patch number+revision, for example "102712-02"
PatchUnit
public PatchUnit(String relativePath,
String revision,
boolean logOutput)
- Create a Solaris patch unit with patch location specified
by the given relative path, revision level, and whether or not to collect output.
- Parameters:
- relativePath - The path (relative to the install
archive) where the package can be found.
- revision - The patch number+revision, for example "102712-02"
- logOutput - Log the patch output (true/false)
PatchUnit
public PatchUnit(String relativePath,
String revision,
boolean logOutput,
int sizeCheck)
- Create a Solaris patch unit with patch location specified
by the given relative path, the patch version, whether or not to collect output, and the given size information.
- Parameters:
- relativePath - The path (relative to the install
archive) where the package can be found.
- revision - The patch number+revision, for example "102712-02"
- logOutput - Log the patch output (true/false)
- destinationTable - A table of the directories and sizes for this patch.
- sizeCheck - When to calculate the size of this package.
PatchUnit
public PatchUnit(String relativePath,
String revision,
boolean log,
Hashtable destinationTable)
- Create a Solaris patch unit with patch location specified
by the given relative path, the patch version, whether or not to collect output, and the given size information.
- Parameters:
- relativePath - The path (relative to the install
archive) where the package can be found.
- revision - The patch number+revision, for example "102712-02"
- log - Log the patch output (true/false)
- destinationTable - A table of the directories and sizes for this patch.
initialize
public boolean initialize(WizardState state)
- Initialize this patch unit. Read the meta files.
This method reads in the meta-files for the first package in this patch (to determine locale/architecture)
- Parameters:
- wizardState - The wizardstate this component belongs to
- Returns:
- true, if this PatchUnit was able to parse its meta files (pkginfo, response, admin), false otherwise.
- Overrides:
- initialize in class InstallComponent
install
public boolean install(WizardState state)
- Install the patch. This is the most important method this
class overrides from InstallLeaf. This actually does the
install, and reports the progress by using a ProgressTimer. It
runs
/usr/sbin/patchadd with no arguments, unless patchadd
(for Solaris 2.5.1 systems, or pre-2.5.1). If patchadd does not
exist, then the code falls back to using the installpatch script in
the patch.
If patchadd returns a will not be installed status, the install methods
status is still returns a passing status since patches are self checking
for current enviornment and multiple patch may be added to normal installs
with only some expected to match particular environments. I.E. patches
will not be installed if they are already on the system, or if the
architecture, OS version, or some other system environment does not match
the patch's requirements. The output goes into the system log, if one is
being written.
- Parameters:
- state - The runtime wizard state this object belongs to. Passed
in from the ProductTask that is driving the install.
- Returns:
- true, always. Even if the patchadd fails, the install will
continue.
- Overrides:
- install in class InstallComponent
uninstall
public boolean uninstall(WizardState state)
- Uninstall the patch. Checks first to make sure the patch has been applied, then
attempts to remove it using
patchrm without any arguments other than the
patch number.
- Parameters:
- state - The runtime wizard state this object belongs to. Passed
in from the ProductTask that is driving the install.
- Returns:
- true, always. Even if the patchrm fails, the install will
continue.
- Overrides:
- uninstall in class InstallComponent
isInstallable
public boolean isInstallable(WizardState state)
- Determine if this patch is installable. This does several sanity checks:
- Checks for the existence of the
installpatch file if this is
a Solaris 2.6 or previous patch.
- Checks for a compatible runtime platform.
- Parameters:
- state - The wizard state this component belongs to
- Returns:
- true, if this is a valid, installable SVR4 package, false otherwise.
isUninstallable
public boolean isUninstallable(WizardState state)
- Determine if this patch is uninstallable.
Checks to make sure this patch has already been applied and whose information is in
/var/sadm/patch/{revision}.
If it is, this method returns true (i.e. the patch is uninstallable).
- Parameters:
- state - The wizard state this component belongs to
- Returns:
- true, if this component is able to be removed, false otherwise
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
toString
public String toString()
- Represent this object as a string.
- Overrides:
- toString in class InstallComponent
All Packages Class Hierarchy This Package Previous Next Index