This document discusses Jahia's transition from using the embedded Apache Felix OSGi framework to using the embedded Apache Karaf framework. It provides a chronology of Jahia's use of OSGi frameworks and describes some key advantages of Karaf such as improved shell functionality, features for provisioning bundles, and integration with other Apache projects. The document compares Felix and Karaf, demonstrates how to create Karaf features for Jahia modules, and discusses Jahia DX integration plans. It also briefly introduces related Karaf sub-projects like Cellar for clustering and Decanter for monitoring.
3. Bye Bye Felix, Hello Karaf I #jahiaXDC
Chronology
Jahia Digital Experience Manager (DX) 7.0
• Introduces OSGi for modules
• Implemented using the embedded Apache Felix OSGi
framework implementation
Jahia Digital Experience Manager (DX) 7.1
• No major change in the OSGi framework
Jahia Digital Experience Manager (DX) 7.2 (upcoming)
• Replaces the embedded Felix Framework with Apache
Karaf (embedded)
Apache Unomi
• Part of Jahia Marketing Factory
• Built on top of a standalone Apache Karaf runtime
4. Bye Bye Felix, Hello Karaf I #jahiaXDC 4
- Open Source OSGi Framework implementation
- Implements part of the OSGi Compendium such as :
- HTTP Service
- Shell Service (Gogo Shell)
- Configuration Admin Service
- Event Service
- Provides additional tools such as:
- Web Console
- iPOJO
- uPNP support
5. Bye Bye Felix, Hello Karaf I #jahiaXDC 5
• “The Tomcat for OSGI”, basically all you will need for a minimal
server OSGi runtime (where Felix is not necessarily focused at
servers)
• Uses Apache Felix or Eclipse Equinox as the OSGi Framework
implementation
• Provides a lot of additional services such as :
- Serious logging (Felix is really basic), backed by Log4J
- Provisioning (Features)
- Advanced remote SSH Shell
- Two-way data binding configuration files
- JMX support
- Diagnostic and developer commands
- JAAS support
Karaf
APACHE
7. Bye Bye Felix, Hello Karaf I #jahiaXDC 7
Quick comparison
Felix Karaf
OSGi Specification Version
supported
R4 R6 (adds enterprise
technologies)
Embedded Felix Framework
Version
4.2.1 5.4.0
Remote Shell technology Telnet (insecure), deactivated
by default
SSH (secure), activated by
default
Shell autocompletion no yes
Shell help no yes
Shell history no yes
8. Bye Bye Felix, Hello Karaf I #jahiaXDC 8
Quick comparison, continued
Supports regions (OSGi subsystems) no yes
Karaf Cellar (clustering) no yes
Karaf Decanter (monitoring) no yes
Karaf Cave (repository) no yes
Karaf Features (bundle packages) (provisioning) no yes
Two-way OSGi configuration sync (file to memory and back) no yes
9. Bye Bye Felix, Hello Karaf I #jahiaXDC 9
Quick comparison, continued
Deploy bundle/features directly from Maven repository (or
Karaf Cave)
no yes
Built-in support from JAR wrapping (dynamic generation of
OSGi bundle from non-OSGi jar)
no yes
Built-in features (Spring, Blueprint, Hibernate) no yes
Diagnostic, JMX features no yes
Developer features (bundle:watch) no yes
10. Bye Bye Felix, Hello Karaf I #jahiaXDC 10
Quick comparison, continued
Paves the way to a standalone
runtime
no yes
Enterprise features (JNDI,
JDBC, JPA, JTA, CDI, ...)
no yes
Security support (encryption,
RBAC, JAAS, …)
no yes
Linux Comparison Similar to Linux Kernel Similar to “Lightweight” Linux
Distribution (Debian)
13. Bye Bye Felix, Hello Karaf I #jahiaXDC 13
Apache Karaf Provisioning
Features
A feature describes an application as:
• a name
• a version
• a optional description (eventually with a long description)
• a set of bundles
• optionally a set configurations or configuration files
• optionally a set of dependency features
14. Bye Bye Felix, Hello Karaf I #jahiaXDC 14
Apache Karaf Features, continued
Karaf Shell
- “feature:install feature1” will install all defined bundles for the feature name
“feature1”
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0">
<feature name="feature1" version="1.0.0">
<bundle>...</bundle>
<bundle>...</bundle>
</feature>
<feature name="feature2" version="1.1.0">
<feature>feature1</feature>
<bundle>...</bundle>
</feature>
</features>
15. Bye Bye Felix, Hello Karaf I #jahiaXDC 15
Apache Features, continued
Dependent features
means that when you install the “my-project” feature, the “other” feature will
also get installed if it is not already there.
<feature name="my-project" version="1.0.0">
<feature>other</feature>
<bundle start-level="80" start="false">mvn:com.mycompany.myproject/myproject-dao</bundle>
<bundle start-level="85" start="false">mvn:com.mycompany.myproject/myproject-service</bundle>
</feature>
17. Bye Bye Felix, Hello Karaf I #jahiaXDC 17
Building your own feature
mvn clean install
karaf> feature:repo-add mvn:org.jahia.modules/jahia-watcher-backend-karaf-
feature/1.0-SNAPSHOT/xml/features
karaf> feature:install jahia-watcher-backend-karaf-feature
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="jahia-watcher-backend-karaf-feature">
<feature name="jahia-watcher-backend-karaf-feature" description="Jahia Watcher DX module Apache Karaf Feature" version="1.0.0.SNAPSHOT">
<details>This project packages the backend for the Jahia Watcher mobile application as a Karaf Feature to be deployed in Jahia DX</details>
<bundle>mvn:org.jahia.modules/spam-filtering/2.0.1-SNAPSHOT</bundle>
<bundle>mvn:org.jahia.modules/jahia-watcher-backend/1.0-SNAPSHOT</bundle>
</feature>
</features>
18. Bye Bye Felix, Hello Karaf I #jahiaXDC 18
Apache Features, continued
Features can do a lot more:
- Provide embedded configuration properties
- Provide configuration files directly
- Features repositories (i.e. a <features> XML file) URLs can be added or
removed at any time
- Features may specify requirements (using OSGi capabilities)
- Features may also be controlled through JMX
- Features may be upgraded (by simply installing a new version)
- Features also work with Karaf Cellar, making it possible to install features
over a cluster
20. Bye Bye Felix, Hello Karaf I #jahiaXDC 20
Features for Jahia Modules
• Features provide a more powerful way to package collection of bundles than
our existing (<7.2) MegaJAR technology
• Dependency on other features makes it easier to install more complex
applications
• Cluster compatibility (through Karaf Cellar) will also make installation complex
installations on a cluster easier
• At Jahia we will probably deprecate MegaJARs at some point once customer
have shifted to Features
• Jahia’s other applications (Marketing Factory, Form Factory, Commerce
Factory, Workspace Factory), will probably be all delivered as features over
time
21. Bye Bye Felix, Hello Karaf I #jahiaXDC 21
Jahia DX Integration
Migration
• For most users, should be transparent, no change needed to modules or
configuration
• If you performed modifications to the default felix-framework.properties file
those changes will need to be moved to another file (or removed)
Limitations
• Existing features that depends on “web”, “pax-web” or “spring” features will
not work out of the box (because these technologies are exposed by DX’s
core)
23. Bye Bye Felix, Hello Karaf I #jahiaXDC 23
Karaf Cellar
• Brings bundle clustering to Karaf
instances
• Karaf itself provides HA (lock)
• Karaf Cellar brings cluster:sync
provisioning between Karaf instances
• Leverages Hazelcast
• Easy to install and use
• No single point of failure
• Provide DOSGi support
(kind of RMI)
Karaf Node CELLAR
Karaf Node CELLAR
Karaf Node CELLAR
24. Bye Bye Felix, Hello Karaf I #jahiaXDC 24
Karaf Decanter
• Apache Karaf Decanter, complete
monitoring platform for Karaf and
related (Camel, ActiveMQ, ...)
• Collectors (JMX, log messages, ...)
• Dispatched by OSGi EventAdmin
• Appenders (Elasticsearch, log,
JDBC, ...)
• Dashboards (Kibana) and SLA
25. Bye Bye Felix, Hello Karaf I #jahiaXDC 25
Other interesting Karaf projects
Karaf Cave
• OSGi Repository implementation
Karaf Boot
• Get started quickly with a Karaf project, similar to Spring Boot but for OSGi
projects
• Very early stages
Karaf Maven Plugin
• Helps built feature or KAR packages
• Generates help for shell commands
• Custom Karaf Distributions (for example Apache Unomi)