Developing a Liberty feature for Liberty
A Liberty feature consists of a feature manifest file and one or more OSGi bundles. The OSGi bundles contain classes and services that provide a particular capability when the feature is installed onto a Liberty server.
About this task
You can develop a Liberty feature in either of the following ways:
- Develop the feature manually; see Developing a Liberty feature manually.
- Use the WebSphere® Application Server Developer Tools; see Creating a Liberty feature by using developer tools.
For full details on developing Liberty features, see the following subtopics:
Subtopics
- Developing a Liberty feature manually
You can create a Liberty feature manually and install it to Liberty. - Creating a Liberty feature by using developer tools
You can use the WebSphere Application Server Developer Tools to write your own features and install them into an existing Liberty server, or to package them for delivery to your users. - Developing an OSGi bundle with simple activation
The most straightforward way to control the lifecycle of your OSGi bundle code is to implement the org.osgi.framework.BundleActivator interface in one of the classes within your bundle. When the server starts and stops the bundle, the start and stop methods of the BundleActivator interface are called. - Composing advanced features by using OSGi Declarative Services
Simple features can be controlled by using bundle activator classes and direct implementation of interfaces such as ManagedService and ServiceTracker. As relationships between bundles become more complex, it can be better to use facilities such as OSGi Declarative Services (DS) to decompose a feature into individual services. DS (sometimes known as the Service Component Runtime, or SCR) provides lifecycle and injection management of OSGi services. - Advanced Configuration
Advanced configuration includes information about providing descriptions and the default values for configuration and OSGi Metatype Service Extensions. - Providing an application endpoint
You can make a Liberty feature available as web applications by including one or more web application bundles (WABs) in the feature. A WAB is an OSGi bundle with a Web-ContextPath manifest header. - Liberty SPI utilities
Liberty provides service programming interfaces (SPI) to complete various tasks. - Including protected features
Your feature can include one or more other features by listing them in the Subsystem-Content header of the feature manifest file. Any feature in the same product extension as your own feature can be included; if the included feature is in a different product extension, or in Liberty, it must have public or protected visibility. - Locating OSGi applications
You can use classes in the org.apache.aries.blueprint package to extend the OSGi application programming model; this third-party SPI is provided through the blueprint-1.0 server feature. You must access OSGi application bundles in to apply your extensions. In Liberty, OSGi applications run as Subsystems. To locate an OSGi application you can create a ServiceTracker in a user feature. - Developing with the JNDI default namespace in a Liberty feature
You can make an object available in the default Java™ Naming and Directory Interface (JNDI) namespace. To do that, you must register it in the OSGi service registry with the osgi.jndi.service.name service property. The value of osgi.jndi.service.name is the required JNDI name. Similarly, to find an object in the default JNDI namespace, you can search the OSGi service registry with the osgi.jndi.service.name service property. The value of osgi.jndi.service.name is the JNDI name. - Developing a custom TAI as a Liberty feature
You can develop a custom TAI as a Liberty feature by implementing the com.ibm.wsspi.security.tai.TrustAssociationInterceptor interface provided in the Liberty server and creating a product extension. - Dynamic content management
You typically install bundles into the runtime environment by listing them in the Subsystem-Content header of the feature manifest file. However, you can also dynamically add and remove OSGi bundles by installing a user-written bundle as part of the Subsystem-Content of a user-written feature. The user-written bundle obtains the OSGi bundle context to install and control additional bundles.
Parent topic: Extending Liberty
Related concepts:

File name: twlp_feat_develop.html