CarbonLaunchExtension interface allows developers to write custom extensions that perform tasks that need to be executed just before launching the Carbon server. The single perform() method in the interface takes no parameters. Extended classes need to implement the perform() method with customized operations that need to be called when launching the Carbon server. All the current implementations of the interface can be found under the
Few of the existing implementations are as follows:
org.wso2.carbon.server.extensions.DefaultBundleCreator: Creates regular OSGi bundles out of regular JAR files.
org.wso2.carbon.server.extensions.DropinsBundleDeployer: Deploys bundles found inside the
org.wso2.carbon.server.extensions.PatchInstaller: Copies all the patches found in the
<PRODUCT_HOME>/repository/components/patchesdirectory to the
<PRODUCT_HOME>/repository/components/pluginsdirectory in a recursive manner.
org.wso2.carbon.server.extensions.SystemBundleExtensionCreator: Reads the extension folder and create extension bundles.
Given below is an implementation of an extension (org.wso2.carbon.server.extensions.DefaultBundleCreator) used for creating OSGi bundles during the server launch process. The main functionality goes inside the perform() method that gets executed within the Main method.
Developers can write their own implementations for the CarbonLaunchExtension interface, adding the custom operations inside the perform() method that need to be called while launching the Carbon server. Those extensions can then be called within the Main method that launches the Carbon server.
Given below is the existing implementation in Carbon where all the extensions are called before starting the OSGi framework. The perform() method of each CarbonLaunchExtension implementation is called in this process. Developers can call the perform() method of their implementation in the location given below. If you need to add a new extension to the implementation given below, you can send a pull request with the changes. Note that this is only available for developers and cannot be extended externally.