此内容没有您所选择的语言版本。
Chapter 5. Introduction to OSGi
Abstract
The OSGi specification supports modular application development by defining a runtime framework that simplifies building, deploying, and managing complex applications.
5.1. Red Hat JBoss Fuse
Overview
Red Hat JBoss Fuse has the following layered architecture:
- Technology layer—includes technologies such as JAX-WS, JAX-RS, JMS, Spring, and JEE
- the section called “Red Hat JBoss Fuse” —a wrapper layer around the OSGi container implementation, which provides support for deploying the OSGi container as a runtime server. Runtime features provided by the JBoss Fuse include hot deployment, management, and administration features.
- OSGi framework —implements OSGi functionality, including managing dependencies and bundle lifecycles
Red Hat JBoss Fuse
Figure 5.1 shows the architecture of JBoss Fuse.
Figure 5.1. Red Hat JBoss Fuse Architecture
JBoss Fuse is based on Apache Karaf, a powerful, lightweight, OSGi-based runtime container for deploying and managing bundles to facilitate componentization of applications. JBoss Fuse also provides native OS integration and can be integrated into the operating system as a service so that the lifecycle is bound to the operating system.
As shown in Figure 5.1, JBoss Fuse extends the OSGi layers with:
- Console— an extensible Gogo console manages services, installs and manages applications and libraries, and interacts with the JBoss Fuse runtime. It provides console commands to administer instances of JBoss Fuse. See the "Console Reference".
- Logging—a powerful, unified logging subsystem provides console commands to display, view and change log levels. See "Configuring and Running JBoss Fuse".
- Deployment—supports both manual deployment of OSGi bundles using the
osgi:install
andosgi:start
commands and hot deployment of applications. When a JAR file, WAR file, or OSGi bundle is copied into the hot deployment folder InstallDir/deploy
, it's automatically installed on-the-fly inside the Red Hat JBoss Fuse runtime. When you update or delete these files or bundles, the changes are made automatically (but only while the container is running!). See Section 7.1, “Hot Deployment”. - Provisioning—provides multiple mechanisms for installing applications and libraries. See Chapter 8, Deploying Features.
- Configuration—the properties files stored in the InstallDir
/etc
folder are continuously monitored, and changes to them are automatically propagated to the relevant services at configurable intervals. - Spring DM—simplifies building Spring applications that run in an OSGi framework. When a Spring configuration file is copied to the hot deployment folder, Red Hat JBoss Fuse generates an OSGi bundle on-the-fly and instantiates the Spring application context.
- Blueprint—is essentially a standardized version of Spring DM. It is a dependency injection framework that simplifies interaction with the OSGi container—for example, providing standard XML elements to import and export OSGi services. When a Blueprint configuration file is copied to the hot deployment folder, Red Hat JBoss Fuse generates an OSGi bundle on-the-fly and instantiates the Blueprint context.