Configure auto-provisioned features
We can enable features to be automatically provisioned when other features or sets of features are provisioned.
An auto-provisioned feature is a feature that has dependencies on other features. Because of the dependencies, the lifecycle of the auto-provisioned feature is as follows:
- The feature is provisioned automatically when all required features are provisioned.
- The feature is de-provisioned automatically when any of the required features are de-provisioned.
To configure a feature to be auto-provisioned, follow these steps:
- Determine which features must be provisioned before the runtime automatically provisions this feature.
- Add the IBM-Provision-Capability to the manifest header. The format of the IBM-Provision-Capability header uses standard OSGi LDAP filters.
- Deploy the feature to the server.
Automatic installation of auto-provisioned features
In the following example, if features requiredFeature1-1.0 and requiredFeature2-1.0 are provisioned, this feature is automatically provisioned. If either of these required features are removed from the server.xml file, this feature is automatically de-provisioned.IBM-Provision-Capability: osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=requiredFeature1-1.0))", osgi.identity; filter:="(&(type=osgi.subsystem.feature)(osgi.identity=requiredFeature2-1.0))"
If all the required features are also installed, auto-provisioned features can be installed automatically. To configure a feature to be auto-installed, the IBM-Install-Policy header must be added to the feature manifest. The header is optional. If the IBM-Install-Policy header is specified, the following values are valid:
- manual: The feature is not auto-installed.
- when-satisfied: If all required features are installed, the feature is auto-installed.
If the header is not set, then the feature is not auto-installed, which is equivalent to setting the IBM-Install-Policy header to manual.