Architecture
The Liberty profile is a highly composable and dynamic runtime environment. OSGi services are used to manage component lifecycles, and the injection of dependencies and configuration. The server process comprises a single JVM, the Liberty kernel, and any number of optional features. The feature code and most of the kernel code runs as OSGi bundles within an OSGi framework. Features provide the programming models and services required by applications.
The kernel launcher bootstraps the system and starts the OSGi framework. The configuration is parsed, and then the configured features are loaded by the feature manager. The kernel extensively uses OSGi services to provide a highly dynamic runtime environment. The OSGi Configuration Admin service manages system configuration, and an OSGi Declarative Services component manages the lifecycle of system services. The file monitor service detects application and configuration file changes, and the logging service writes messages and debug information to the local file system.
Features are specified in the system configuration files that are server.xml and any other included files. The server configuration files populate the OSGi Configuration Admin service, which injects the feature configuration into the feature manager service. The feature manager maps each feature name to a list of bundles that provide the feature. The bundles are installed into the OSGi framework and started. The feature manager responds to configuration changes by dynamically adding and removing features while the server is running.
Runtime services provide configuration default settings. The configuration specified is kept to a minimum. We specify the features we need, along with any additions or overrides to the system default settings, in a server.xml file. We might choose to structure the configuration into a number of separate files linked to the parent server.xml file using an "include" syntax. At server startup, or when the user configuration files are changed, the kernel configuration management parses the configuration and applies it over the system default settings. The set of configuration properties that belongs to each service is injected into the service each time the configuration is updated.
The OSGi Declarative Services component is used so that function can be decomposed into discrete services, which are activated only when needed. This behavior helps the runtime environment to be "late and lazy", keeping the footprint small and the startup fast. Declared services are added to the OSGi service registry, and dependencies between services can be resolved without loading implementation classes. Service activation can be delayed until a service is used: when the service reference is resolved. Configuration for each service is injected as the service is activated, and is reinjected if the configuration is later modified.
Subtopics
Parent topic: WebSphere Application Server Liberty Core: Overview