...
Lifecycle of an OSGi Bundle
OSGi bundle states
An OSGi bundle can be in one of the following states:
...
update()
is invoked.A check is done to see whether the version number of the plugin or bundle has been incremented and is higher than the currently installed version. If the version number is not correctly incremented, the update stops. If the version number is correctly incremented, the platform validity is checked.
Note If the setting
enable_wcb_development_mode
in the XperienCentral Setup Tool (/web/setup) is set to “false”, this check is skipped.- If the platform version is not valid, the update stops. If the platform is valid, the OSGi method
bundle.update
is invoked
...
Lifecycle | Purpose | |||||||
---|---|---|---|---|---|---|---|---|
onStart() | Allows a component to attach logic to a start event. For example:
Dependencies:
| |||||||
onInstall() | Allows a component to attach logic to an install event. For example:
Dependencies:
| |||||||
onStop() | Allows a component to attach logic to a stop event. For example:
Dependencies:
| |||||||
onUpdate() | Allows a component to attach logic to an update event. For example:
Dependencies:
| |||||||
onUninstall() | Allows a component to attach logic to an uninstall event. The plugin containing the component must be in an active state in order for the
Dependencies:
| |||||||
onPurge() | Allows a component to attach logic to a purge event.
Dependencies: | |||||||
onInit() | Allows a component to attach logic to an init event. For example:
Dependencies: | |||||||
onDestroy() | Allows a component to attach logic to a destroy event. For example:
Dependencies:
onDestroy() |
...
Command | Purpose | ||
---|---|---|---|
wmstart [id] | Registers services that each component within the bundle exposes if all required service dependencies are available. For each component, at the very least a component service is registered | ||
wmstop | Stops all services registered by the component. | ||
wmupdate | Updates the plugin to a newer version. If a problem is encountered during the update, the plugin is automatically rolled back to the existing version. The following describes a typical plugin update scenario:
| ||
wmpurge | Removes all content that was created during and after the installation of the component. | ||
wmuninstall | Removes all content that was created during the installation of the component.
|
...
The exact classes in which the services are injected and the way they are injected depends on the component that defines the dependency. There are two ways the service might be injected into the component’s classes:
- By Using Felix , by accessing the field directly. Felix injects the service in the class marked as implementation class (
ComponentDefinitionImpl.setImplementationClassName
) by manipulating a class member of which the type is the same as the one defined by the service dependency. Even if this field is private, Felix will still assign the service to this private field. - By Using XperienCentral , using a setter for the field in the class marked as instance class in the component definition (
ComponentDefinitionImpl.setInstanceClassName
). XperienCentral will try to find a setter for the field in this class with the same type as the service. If the setter exists, it will invoke that setter with the service.
...