+

Search Tips   |   Advanced Search

Liberty feature manifest files

A Liberty feature consists of a feature manifest file and a collection of one or more OSGi bundles that provide classes and services corresponding to a particular capability in the Liberty profile runtime environment. We can find the introduction of the format of a feature manifest and the meaning of each header in the manifest file.

The feature manifest file in the Liberty profile uses the Subsystem Service metadata format in the OSGi Enterprise R5 specification. A feature is defined by a feature manifest file (.mf file) that is stored in the lib/features directory, and must use a custom type of Subsystem: osgi.subsystem.feature. For more information on OSGi manifest syntax, see section 1.3.2 of the OSGi core specification.

In the feature manifest file, the attributes take the form name=value, but directives take the form name:=value.

The following headers are defined:

Header Description Required?
Subsystem-ManifestVersion The version format for the feature manifest file. Must be set to 1. No
Subsystem-SymbolicName The symbolic name of the feature and any attributes or directives. Yes
Subsystem-Version The version of the feature. See the OSGi core specification section 3.2.5 for the details of how this is defined. No
Subsystem-Type The subsystem type for the feature. All features are currently of the same subsystem type: osgi.subsystem.feature. Yes
Subsystem-Content The subsystem content of the feature. This is a comma separated list of bundles and subsystems required to run this feature. To allow the auto feature to be configured in server.xml, have the capability header containing the required features, and also have them defined in the subsystem content. Yes
Subsytem-Localization The location of the localization files for the feature. No
Subsystem-Name A short, human readable name for the feature. This value can be localized. No
Subsystem-Description A description of the feature. This value can be localized. No
IBM-Feature-Version The version of this subsystem type. Must be set to 2. Yes
IBM-Provision-Capability The capability header that describes whether a feature can be provisioned automatically. No
IBM-API-Package The API packages exposed to applications by this feature, features in other product extensions, and the Liberty kernel. No
IBM-API-Service The OSGi services exposed to OSGi applications by this feature. No
IBM-SPI-Package The SPI packages exposed by this feature to features in other product extensions, and the Liberty kernel. No
IBM-ShortName The short name of the feature. No
IBM-AppliesTo The Liberty version that this feature applies to. No
Subsystem-License The license type for this feature. No
IBM-License-Agreement The prefix of the location of the license agreement files. No
IBM-License-Information The prefix of the location of the license information files. No
IBM-App-ForceRestart That applications are to be restarted when the feature is installed to, or uninstalled from, a running server. No


Subsystem-SymbolicName

The syntax for this header matches the Bundle-SymbolicName syntax for a bundle. It has a symbolic name that follows the package names style syntax, and can optionally take a set of attributes and directives.

The following attributes are supported:

The following directive is supported:

For example:

If a feature name in the superseded-by list is surrounded by brackets, [], this feature has been separated from the superseding feature. In the following example, feature appSecurity-1.0, which contains features servlet-3.0 and ldapRegistry-3.0, is superseded by feature appSecurity-2.0, which does not contain servlet-3.0 and ldapRegistry-3.0 features:

See Separated features.

Best practise: If the developer tools must show the feature, it must be public. If the feature is available only to trusted parties, it must be protected. If the feature is internal and subject to change at any time, it must be private.


Subsystem-Content

Content of the feature, both for run time and install. It follows the same header syntax as the Subsystem specification with the following syntax:

See OSGi core spec section 1.3.2.

The unique-name uses the form of the Bundle-SymbolicName or Subsystem-SymbolicName headers. The following attributes are supported:

The following directives are supported:

For example:

The following directive is supported in version 8.5.5.4 and later:


Subsytem-Localization

Location of the localization files for the feature.

For example:


Subsystem-Name

Use this header to supply a short, human readable name for the feature. We can specify either a literal string or a property name. If you a specify a property name, the value can be localized.

For example

where the value of name is defined in a properties file at the location specified by the Subsytem-Localization header (loc.properties in the previous example), in the following format:


Subsystem-Description

Use this header to supply a description for the feature. We can specify either a literal string or a property name. If you a specify a property name, the value can be localized.

For example

where the value of desc is defined in a properties file at the location specified by the Subsytem-Localization header (loc.properties in the previous example), in the following format:


IBM-Provision-Capability

Automatically provisioned features are features that have the IBM-Provision-Capability header in the manifest. This header describes other features that must be provisioned for this feature to be automatically provisioned. When listing the other features, use the Subsystem-SymbolicName header of the feature. When any features are configured in server.xml, the runtime checks to see whether any automatically provisioned features have had their capabilities satisfied, and if any have, they are automatically provisioned.

The format of the IBM-Provision-Capability header uses standard OSGi LDAP filters.


IBM-API-Package

Which API packages are visible to applications. It matches the Export-Package header syntax. This means it is a comma separated list of API packages, but each API package can have some attributes.

The following attribute is supported:

For example:


IBM-API-Service

Which services from the feature are visible to OSGi applications. The feature must also register the service in the OSGi service registry.

It has the following syntax

The service-name is the Java class or interface name of the service. The attributes are interpreted as the service properties for the services.

For example:

If an OSGi application want to use the services provided by the IBM-API-Service header, the application must include a blueprint reference to the service in order for the service to be provisioned into the application.

For example:

In order for a service to be usable by a bundle in an OSGi application, the interface package must be available to that bundle, which means the interface package must be specified by an Import-Package header in the manifest file of the consuming bundle. The interface package must also be specified by an Export-Package header in a feature bundle and specified in the IBM-API-Package header of the feature manifest file. The service provided by a feature must be registered in the OSGi service registry using the OSGi BundleContext interface or any other mechanism such as Declarative Services or Blueprint.

See Develop an OSGi bundle with simple activation and Composing advanced features using OSGi Declarative Services.


IBM-SPI-Package

When we create our own Liberty feature, you install it into the user product extension. All the packages in the feature can be accessed by any other feature installed into the user product extension. However, if we want a package in the feature to be accessed by a feature installed into another product extension, we must list the package name in the IBM-SPI-Package header.

Any package listed in the IBM-SPI-Package header must be exported by a bundle in the Liberty feature, by being listed in the Export-Package header of the bundle manifest file.


IBM-ShortName

Short name for a feature we can leverage to specify a feature in server.xml. If there is no IBM-ShortName header in the manifest file, then the Subsystem-SymbolicName is used by default. The IBM-ShortName header is only valid for public features.


IBM-AppliesTo

Liberty version that this feature applies to. Supply a comma separated list of items, each in the following form:

If you supply more than one item, the value of product_id must be different for each one.

The value of product_editions can be either a single edition or a comma-separated list of editions enclosed in quotation marks.

For example:


Subsystem-License

License type for this feature. If you supply a value for the Subsystem-License header, and do not supply values for the IBM-License-Agreement and IBM-License-Information headers, then the Subsystem-License header value is displayed to the user for acceptance during installation.

If there is a feature already installed with the same Subsystem-License header value, then the license is not displayed, and license approval is not sought, during the installation. If dependencies in the Subsystem-Content header mean that there are two or more features being installed that have the same Subsystem-License header value, the user has only to accept the license once during installation.

For example:


IBM-License-Agreement

Prefix of the location of the license agreement files. Supply the file path in the subsystem archive to the LA_language files, up to, but not including, the "_" character (the language code is appended by the installation tool). If this license has not been accepted, the user must accept the license when installing the feature. The license files are copied to the Liberty installation directory.

For example:


IBM-License-Information

Prefix of the location of the license information files. Supply the file path in the subsystem archive to the LI_language files, up to, but not including, the "_" character (the language code is appended by the installation tool). If this license has not been accepted, the user must accept the license when installing the feature. The license files are copied to the Liberty installation directory.

For example:


IBM-App-ForceRestart

Causes applications to be restarted when the feature is installed to, or removed from, a running server. This header can take one of the following values:


Example feature manifest file

The following example shows the definition for the example-1.0 feature. The public visibility attribute allows this feature to be directly specified in server configuration (server.xml) files; it will also be included in the drop down list of features that are displayed in Server Configuration view of the developer tools and will be available for inclusion in features that are in other product extensions. If this feature is installed into the usr product extension of a runtime install, it can be configured into a server by including the following code in server.xml:

Configuration of this feature in a server will result in the specified bundle, com.ibm.example.bundle1, being installed and started in the OSGi framework of the server runtime environment. The single API package, com.ibm.example.publicapi, will be visible to all applications in that server, except for Java EE applications configured to not have visibility to the api package type. OSGi applications must explicitly import the package if they wish to use it. The two SPI packages, com.ibm.example.spi.utils and com.acme.spi.spiservices, will be visible to all feature code in the server, as will the API package.


Parent topic: Develop a Liberty feature manually

Tasks:
Develop a custom TAI as a Liberty profile feature
Auto-provisioning a feature
Develop a custom user registry
Develop a custom thread identity service