Date post: | 22-Jan-2018 |
Category: |
Software |
Upload: | jahia-solutions-group |
View: | 179 times |
Download: | 1 times |
2
Jahia Meetups
● Once per month● Short presentation (about 30 minutes)● Q & A● Networking around drinks & food (usually pizza)
Your chance to talk directly to the people building the products!
3Title of Presentation I Date of Presentation 3
A (quick) look back…
4
Chronology
Jahia 6.1 • Introduced templates for sites
Jahia 6.5 • Introduced completely new UI using GWT/GXT• Modules were introduced to provide not only templates
but new back-end functionality. Modules can only be installed at startup and not that easy to remove
Jahia 6.6• Modules were expended, possibly to remove modules
cleanly but only while server is shutdown• Added UI to edit mobile sites using live preview
5
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• 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
6
OSGi
• Most mature Java “plug-in” technology
• Allows hot deployment/un-deployment
• Manages dependencies between plug-ins (aka OSGi bundles)
• Offers (optional) additional services (HTTP, configuration,
etc...)
77
• “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
APACHE
8Title of Presentation I Date of Presentation 8
What’s New
99
Apache Karaf Shell
1010
Apache Karaf ProvisioningFeatures
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
1111
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>
12Title of Presentation I Date of Presentation 12
Karaf Feature Demo & Live Coding !
1313
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
14Title of Presentation I Date of Presentation 14
Jahia DX Integration
15
Karaf DX integration
Web Application Container (Tomcat)
DX Web Application
Apache Karaf
Karaf Features
Bundles or DX ModulesBundles or DX Modules
1616
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
17Title of Presentation I Date of Presentation 17
Karaf Sub-Projects
1818
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 NodeCELLAR
Karaf NodeCELLAR
Karaf NodeCELLAR
1919
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
2020
Other interesting Karaf projects
Karaf Cave• OSGi Repository implementationKaraf Boot• Get started quickly with a Karaf project, similar to Spring Boot but for OSGi
projects• Very early stagesKaraf Maven Plugin• Helps built feature or KAR packages• Generates help for shell commands• Custom Karaf Distributions (for example Apache Unomi)
21Title of Presentation I Date of Presentation 21
Q & A
22Title of Presentation I Date of Presentation 22
Thank you !
2323
Resources & Next Meetups
Jahia Digital Experience Managerhttp://www.jahia.com
Apache Karafhttp://karaf.apache.org
Jahia DX Karaf Example Project:https://github.com/Jahia/dx-karaf-feature-sample
Reach me at : [email protected], @sergehuber
Next Switzerland Meetups
April 13th ?Keep Calm & Open the Tools
May 11thExternal data provider
24
• Basically a JAR with:
–Additional stuff in it’s manifest file
–A class called an activator to register services
–Your code and resources
–(Optionally)Other JARs for legacy (migration) purposes
JAR
MANIFEST.MFBundle-Name: Hello World
Bundle-SymbolicName: org.example.helloworld
Bundle-Description: A Hello World bundle
Bundle-ManifestVersion: 2
Bundle-Version: 1.0.0
Bundle-Activator: org.example.Activator
Export-Package: org.example.helloworld;version="1.0.0"
Import-Package: org.osgi.framework;version="1.3.0"
Classesorg.example.Activator...
(Optional) JARslegacy-1.0.jar...
What is an OSGi bundle ?
25
Logging
Configuration Admin
Device Access
User Admin
IO Connector
Preferences
Component Runtime
Deployment Admin
Event Admin
Application Admin
HTTP Service
UPnP Device Service
Wire Admin
XML Parser
Measurement and State
My Service 1
My Service 2
Services are all implemented using one or more OSGi bundles
OSGi Services
26
Java 9 vs OSGi
Java 9 OSGi
Metadata module-info.java META-INF/MANIFEST.MF
Classpath separation export/requires Export-Package/Import-Package
Dependencies Module level Package level
Classloader hierarchy ClassLoader Strict, per bundle
Service layer Static Dynamic
Services None Registry + standard services
Versioning Not really Yes
2727
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>
2828
Building your own feature
<project xmlns=“http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=“http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>
…
<packaging>feature</packaging>
<dependencies>
<dependency>
<groupId>org.jahia.modules</groupId>
<artifactId>spam-filtering</artifactId>
<version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jahia.modules</groupId>
<artifactId>jahia-watcher-backend</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>4.0.3</version>
<extensions>true</extensions>
<configuration>
<includeTransitiveDependency>false</includeTransitiveDependency>
</configuration>
</plugin>
</plugins>
</build>
</project>
2929
Building your own feature
mvn clean install
karaf> feature:repo-add mvn:org.jahia.modules/jahia-watcher-backend-karaf-feature/1.0-SNAPSHOT/xml/featureskaraf> 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>