The <uninstallSteps> element is a child of the <uninstallList> element. This element lists the sequence of steps to be executed to uninstall the component. When an <uninstall> step causes this component to be uninstalled, the steps listed in this element are executed in order. The <uninstallSteps> element of a simple component is permitted to include an <undeployResource> step, though it is not required. The <uninstallSteps> element of a composite component is permitted include one or more <uninstall> steps to uninstall the referenced components, though these steps are not required.
The <uninstallSteps> element children consist of an optional <paramList> element followed by a body. The body consists of an optional local <varList> element that is followed by an optional <dependantCleanup> block, which is followed by zero or more “shared” or “component uninstall-only” steps. The body is not included if the uninstall block is declared abstract.
The following example shows the contents of a sample <uninstallSteps> element. Everything after </paramList> defines the body.
<uninstallSteps name="default"> <paramList> <param name="param1"/> </paramList> <varList> <var name="var1" default="my var 1"/> </varList> <dependantCleanup> <uninstall blockName="default"> <allDependants name="child2parent"/> </unisntall> </dependantCleanup> <undeployResource/> </uninstallSteps>
By default, a derived component inherits all of the accessible uninstall blocks of its base component. Semantics for overriding an uninstall block are the same as those for overriding an install block.
The <uninstallSteps> element has the following attributes:
access – An optional attribute of type accessEnum, which specifies the accessibility of the uninstall block. The following values are permitted:
PUBLIC – Access is unrestricted, which is the default.
PROTECTED – Access is limited to derived components and entities that are in the same path.
PATH – Access is limited to entities that are in the same path.
PRIVATE – Access is limited to this component.
Only PUBLIC blocks can be run directly from the component.
modifier – An optional attribute of type modifierEnum, which specifies the override requirements for the uninstall block. The following values are permitted:
ABSTRACT – The block cannot include a body because it must be specified by nonabstract derived components. Uninstall blocks can only be declared abstract if the component is also declared abstract. Abstract blocks cannot be private. Nonabstract blocks must declare a body.
FINAL – The uninstall block cannot be overridden by derived components.
If this attribute is omitted, derived components can choose whether to override the block.
name – A required attribute of type entityName, which is the name of the uninstall block. The name must be unique among all uninstall blocks in the containing <uninstallList>.
description – An optional attribute, which is a string that describes the uninstall block. This attribute is useful for documentation purposes.
The <dependantCleanup> element is a child of the <uninstallSteps> element. The <dependantCleanup> element specifies a set of steps to be executed to remove components that currently depend on the calling component. This element has no attributes and can include any number of steps that are permitted within the scope of the containing uninstall block.
When included, this element causes the check for dependent components to be deferred until after the contents of the block have been executed. If dependent components still remain after the block has been executed, the uninstall fails and the component remains installed. If no dependent components remain, the uninstall proceeds with the remaining steps.
If the containing component is targetable, the block can be used to remove components that are installed on its associated component targeting host. If installed components remain on the associated host after this block completes, the uninstall fails.
If a <dependantCleanup> block is not included in an uninstall block, the block fails immediately if dependent components exist.
The <dependantCleanup> block is often used in conjunction with the <allDependants> targeter to uninstall all dependent components at one time.