SlideShare a Scribd company logo

Server-side OSGi with
Apache Sling
Felix Meschberger
Day Management AG
124
2

About Felix Meschberger
> Senior Developer, Day Management AG
> fmeschbe@day.com
> http://blog.meschberger.ch
> VP Apache Sling
> Apache Felix
> Apache Jackrabbit
3

Agenda
> Apache Sling
> Why OSGi ?
> What parts of OSGi ?
> Advantages and Problems
> Demo
4

Apache Sling
> REST based web framework
> Content-driven (JCR, JSR-170/283)
> Powered by OSGi
> Scripting inside (Java Scripting, JSR-223)
> Apache Open Source Projekt (http://sling.apache.org)
5

Sling Architecture
OSGi Framework
Felix
Web Console
WebDAV
Server
browserfilesystemdebuggerHTTP
JSR-170/283 API
JCR
repository
resource
resolution
servlet
resolution
standard
servlets
custom
servlets
JSR223
Scripting
JSP
javascript
etc.
6

Sling URL Decomposition
/content/cars/audi/s4.details.html
7

Sling is RESTful
> URLs map to Resources
– Items in the JCR Repository
– Files in the Filesystem
– Content of Bundles
> HTTP Methods map to Script Names
– e.g. cars/POST.jsp
– GET for reading only
– Dilution: POST allowed for any changes (Create, Update, Delete)
> Content Negotiation
– Request URL extension
– Accept request header currently ignored
8

Sling is Object Oriented Web
> Resources are the Object
> Resources maintained in Resource Tree
> Resources accessed by path in the Resource Tree
> Request Method, Extension and Selectors define „Method“ to call
> Resources are typed:
– Resource Type
– Resource Super Type
– „Root Type“: sling/servlet/default
9

Functionality Out-Of-the-Box
> Default Implementations for GET
– Plain Text
– JSON
– XML
> Default Implementation for POST
– Create, Update, Modify content
– Extensible
10

Sling in Action
> Day Communiqué 5 (http://www.day.com/cq5)
> Sakai 3 (http://www.sakaiproject.org)
> Tuberculosis Project
> Idium Web (http://www.idium.no/no/idium_web)
http://cwiki.apache.org/SLING/who-is-using-sling-.html
11

Agenda
> Apache Sling
> Why OSGi ?
> What parts of OSGi ?
> Advantages and Problems
> Demo
12

Requirements for Sling
> Modular and Extensible System
> Declared Dependencies
> Intermodule Communication
> Lightweight Framework
13

Variants
> Do It Yourself
– Well, don't we have other problems to solve ? ;-)
> Spring (before Spring DM)
– First Favourite due to declarative nature
– Systems not really dynamic
– Static application descriptor
> OSGi
– Perfect match to all requirements
14

Agenda
> Apache Sling
> Why OSGi ?
> What parts of OSGi ?
> Advantages and Problems
> Demo
15

OSGi Elements Used
> Framework
> Configuration Admin Service
> Meta Type Service
> Declarative Services
> Event Admin Service
> Log Service
> HTTP Service
16

Launching Sling
> Standalone or Web Application
> Small Footprint Launcher (~30K)
> Framework in its own ClassLoader
> Restart of Framework
> Update of Framework
> Application is Container Agnostic
– Interaction only within the OSGi Framework
– Http Service implementation is the key
17

Configuration Admin Service
> Provides an API to manage Configurations
> Provides functionality to pass configuration to consumers
> Hides persistance problems
> Uses in Sling
– Web Console configuraition editor
– JCR Install updates through repository
18

Metatype Service
> Descriptor to generate GUI for Configuration Management
> Use in Sling
– Descriptor generated by Maven SCR Plugin
– Configuration Admin GUI in Web Console supports Metatype Service
descriptors
19

Declarative Services
> Replace boiler-plate code by descriptors
– Service Registration
– Configuration support
– Service Access
> Dependency Injection
> One of many OSGi Core Extensions:
– Apache Felix Dependency Manager (Predecessor)
– Apache Felix iPOJO (Successor)
– Blueprint (OSGi Compendium Specification R 4.2)
– Peaberry
20

Event Admin Service
> Whiteboard Pattern oriented eventing
> Support for synchronous and asynchronous events
> Uses in Sling
– Base Mechnism to implement Job Scheduling
– Extended to allow for event distribution in Cluster
21

Log Service
> Sling's own implementation
> Based on SLF4J API
> Provides
– OSGi LogService
– SLF4J Logging
– Commons Logging
– Log4F Logging
> Dynamically Configurable (by Configuration Admin Service)
> Log Levels and Log Format per Logger
> Multiple Log Files with size and time rotation
22

Http Service
> Registering Servlets (and Resources) dynamically
> Real Implementation
– Includes Servlet Container
> Bridged Implementation
– Used for Web Application Launcher
– Bridges Servlet Container to OSGi
> Implementation transparent to registered Servlets
23

Extensions
> Apache Felix Web Console
– Extensible Web Based Management
– Jquery UI Based (as of Version 3.0)
> Maven SCR Plugin
– Generates
 Declarative Services Descriptors
 Metatype Service Descriptors
– Supports
 JavaDoc Tags (@scr.component, etc.)
 Java 5 Annotations (@Component, etc.)
> JCR Install
– Deploy Bundles via JCR Repository
– Deploy Configuration Admin configurations via JCR Repository
24

Agenda
> Apache Sling
> Why OSGi ?
> What parts of OSGi ?
> Advantages and Problems
> Demo
25

Advantages
> Declared Dependencies
> Better Isolution through explicit exports and private classes
> Classloader Isolation
> Extensibility built-in, not built-atop
> Dynamism
26

Problems
> Steep Learning Curve
– OSGi Specifications Themselves
– Modularization vs. Monolithic
> Uptime vs. Startup Time
> Legacy Specs und ClassLoader
– JDBC, XML, etc.
> Scripting und ClassLoader
– BundleClassLoaderProxy approach
> Application Packaging
– CRX Content Packages (Day proprietary)
– Karaf features (Sling provides feature.xml)
27

Agenda
> Apache Sling
> Why OSGi ?
> What parts of OSGi ?
> Advantages and Problems
> Demo
29

Links
> Apache Sling – The JCR (Web) Application Framework
http://sling.apache.org
> Apache Felix – OSGi Framework and Compendium Service implementations
http://felix.apache.org
> Apache Jackrabbit – The JCR (JSR-170/283) Reference Implementation
http://jackrabbit.apache.org
> Day Developer's Home
http://dev.day.com
30

Questions
31

Thank you very much !

Felix Meschberger http://www.day.com
Day Management AG fmeschbe@day.com

More Related Content

KEY
Apache Felix Web Console
ODP
Managing an OSGi Framework with Apache Felix Web Console
ODP
Declarative Services - Dependency Injection OSGi Style
PDF
Tales from the OSGi trenches
ODP
Server-side OSGi with Apache Sling
PDF
Oracle API Gateway Installation
PDF
Spring Boot - Microservice Metrics Monitoring
PDF
Groovy Component With Mule ESB
Apache Felix Web Console
Managing an OSGi Framework with Apache Felix Web Console
Declarative Services - Dependency Injection OSGi Style
Tales from the OSGi trenches
Server-side OSGi with Apache Sling
Oracle API Gateway Installation
Spring Boot - Microservice Metrics Monitoring
Groovy Component With Mule ESB

What's hot (20)

PPTX
플랫폼 통합을 위한 Client Module 개발 & 배포
PDF
This is how we REST
PPTX
Introduction to Wildfly 8 - Marchioni
PDF
점진적인 레거시 웹 애플리케이션 개선 과정
PDF
ESIGate dev meeting #4 21-11-2013
PPTX
ColdFusion Fw1 (FrameWork1) introduction
PDF
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
PDF
Asp.Net Core MVC , Razor page , Entity Framework Core
PPTX
Introduction to OWIN
PPTX
.NET,ASP .NET, Angular Js,LinQ
PPTX
Spring Boot Update
PPTX
OWIN and Katana Project - Not Only IIS - NoIIS
PDF
Introduction in the play framework
PPTX
Unpacking .NET Core | EastBanc Technologies
PPTX
Owin from spec to application
PPTX
ASP.NET: Present and future
PPT
Os Mcmahan
DOCX
Instruction on creating a cluster on jboss eap environment
PPT
OWIN (Open Web Interface for .NET)
PDF
Fuse technology-2015
플랫폼 통합을 위한 Client Module 개발 & 배포
This is how we REST
Introduction to Wildfly 8 - Marchioni
점진적인 레거시 웹 애플리케이션 개선 과정
ESIGate dev meeting #4 21-11-2013
ColdFusion Fw1 (FrameWork1) introduction
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
Asp.Net Core MVC , Razor page , Entity Framework Core
Introduction to OWIN
.NET,ASP .NET, Angular Js,LinQ
Spring Boot Update
OWIN and Katana Project - Not Only IIS - NoIIS
Introduction in the play framework
Unpacking .NET Core | EastBanc Technologies
Owin from spec to application
ASP.NET: Present and future
Os Mcmahan
Instruction on creating a cluster on jboss eap environment
OWIN (Open Web Interface for .NET)
Fuse technology-2015
Ad

Similar to Server-side OSGi with Apache Sling (Jazoon 2010) (20)

ODP
Server-side OSGi with Apache Sling (OSGiDevCon 2011)
PDF
Oracle API Gateway
PPTX
Spring_Boot_Microservices-5_Day_Session.pptx
PPT
Material - Oracle Forms Whats New and Whats Next.ppt
PDF
Microservices Technology Stack
PDF
Serverless API with Azure Functions
KEY
Using Apache as an Application Server
PPTX
ASP MVC asderfewerwrwerwrefeewwfdewfewfdsfsd
PDF
Apache Stratos Hangout VI
PDF
Cloud APIs Overview Tucker
PPT
The Emergence of Choice in the .NET Ecosystem
PPTX
StrongLoop Overview
ODP
Sun Web Server Brief
PDF
Nanoservices and Microservices with Java
PDF
"Wie passen Serverless & Autonomous zusammen?"
PPTX
JSS build and deployment
PDF
A Tour of Google Cloud Platform
PDF
Clojure Web Development
PPT
SoftLayer-Extending Plesk Functionality
ODP
Sun Web Server Brief
Server-side OSGi with Apache Sling (OSGiDevCon 2011)
Oracle API Gateway
Spring_Boot_Microservices-5_Day_Session.pptx
Material - Oracle Forms Whats New and Whats Next.ppt
Microservices Technology Stack
Serverless API with Azure Functions
Using Apache as an Application Server
ASP MVC asderfewerwrwerwrefeewwfdewfewfdsfsd
Apache Stratos Hangout VI
Cloud APIs Overview Tucker
The Emergence of Choice in the .NET Ecosystem
StrongLoop Overview
Sun Web Server Brief
Nanoservices and Microservices with Java
"Wie passen Serverless & Autonomous zusammen?"
JSS build and deployment
A Tour of Google Cloud Platform
Clojure Web Development
SoftLayer-Extending Plesk Functionality
Sun Web Server Brief
Ad

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation theory and applications.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Big Data Technologies - Introduction.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Machine learning based COVID-19 study performance prediction
PDF
Electronic commerce courselecture one. Pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
Teaching material agriculture food technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
sap open course for s4hana steps from ECC to s4
Encapsulation_ Review paper, used for researhc scholars
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation theory and applications.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Advanced methodologies resolving dimensionality complications for autism neur...
Review of recent advances in non-invasive hemoglobin estimation
Big Data Technologies - Introduction.pptx
Network Security Unit 5.pdf for BCA BBA.
Machine learning based COVID-19 study performance prediction
Electronic commerce courselecture one. Pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Teaching material agriculture food technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Server-side OSGi with Apache Sling (Jazoon 2010)

  • 1.  Server-side OSGi with Apache Sling Felix Meschberger Day Management AG 124
  • 2. 2  About Felix Meschberger > Senior Developer, Day Management AG > fmeschbe@day.com > http://blog.meschberger.ch > VP Apache Sling > Apache Felix > Apache Jackrabbit
  • 3. 3  Agenda > Apache Sling > Why OSGi ? > What parts of OSGi ? > Advantages and Problems > Demo
  • 4. 4  Apache Sling > REST based web framework > Content-driven (JCR, JSR-170/283) > Powered by OSGi > Scripting inside (Java Scripting, JSR-223) > Apache Open Source Projekt (http://sling.apache.org)
  • 5. 5  Sling Architecture OSGi Framework Felix Web Console WebDAV Server browserfilesystemdebuggerHTTP JSR-170/283 API JCR repository resource resolution servlet resolution standard servlets custom servlets JSR223 Scripting JSP javascript etc.
  • 7. 7  Sling is RESTful > URLs map to Resources – Items in the JCR Repository – Files in the Filesystem – Content of Bundles > HTTP Methods map to Script Names – e.g. cars/POST.jsp – GET for reading only – Dilution: POST allowed for any changes (Create, Update, Delete) > Content Negotiation – Request URL extension – Accept request header currently ignored
  • 8. 8  Sling is Object Oriented Web > Resources are the Object > Resources maintained in Resource Tree > Resources accessed by path in the Resource Tree > Request Method, Extension and Selectors define „Method“ to call > Resources are typed: – Resource Type – Resource Super Type – „Root Type“: sling/servlet/default
  • 9. 9  Functionality Out-Of-the-Box > Default Implementations for GET – Plain Text – JSON – XML > Default Implementation for POST – Create, Update, Modify content – Extensible
  • 10. 10  Sling in Action > Day Communiqué 5 (http://www.day.com/cq5) > Sakai 3 (http://www.sakaiproject.org) > Tuberculosis Project > Idium Web (http://www.idium.no/no/idium_web) http://cwiki.apache.org/SLING/who-is-using-sling-.html
  • 11. 11  Agenda > Apache Sling > Why OSGi ? > What parts of OSGi ? > Advantages and Problems > Demo
  • 12. 12  Requirements for Sling > Modular and Extensible System > Declared Dependencies > Intermodule Communication > Lightweight Framework
  • 13. 13  Variants > Do It Yourself – Well, don't we have other problems to solve ? ;-) > Spring (before Spring DM) – First Favourite due to declarative nature – Systems not really dynamic – Static application descriptor > OSGi – Perfect match to all requirements
  • 14. 14  Agenda > Apache Sling > Why OSGi ? > What parts of OSGi ? > Advantages and Problems > Demo
  • 15. 15  OSGi Elements Used > Framework > Configuration Admin Service > Meta Type Service > Declarative Services > Event Admin Service > Log Service > HTTP Service
  • 16. 16  Launching Sling > Standalone or Web Application > Small Footprint Launcher (~30K) > Framework in its own ClassLoader > Restart of Framework > Update of Framework > Application is Container Agnostic – Interaction only within the OSGi Framework – Http Service implementation is the key
  • 17. 17  Configuration Admin Service > Provides an API to manage Configurations > Provides functionality to pass configuration to consumers > Hides persistance problems > Uses in Sling – Web Console configuraition editor – JCR Install updates through repository
  • 18. 18  Metatype Service > Descriptor to generate GUI for Configuration Management > Use in Sling – Descriptor generated by Maven SCR Plugin – Configuration Admin GUI in Web Console supports Metatype Service descriptors
  • 19. 19  Declarative Services > Replace boiler-plate code by descriptors – Service Registration – Configuration support – Service Access > Dependency Injection > One of many OSGi Core Extensions: – Apache Felix Dependency Manager (Predecessor) – Apache Felix iPOJO (Successor) – Blueprint (OSGi Compendium Specification R 4.2) – Peaberry
  • 20. 20  Event Admin Service > Whiteboard Pattern oriented eventing > Support for synchronous and asynchronous events > Uses in Sling – Base Mechnism to implement Job Scheduling – Extended to allow for event distribution in Cluster
  • 21. 21  Log Service > Sling's own implementation > Based on SLF4J API > Provides – OSGi LogService – SLF4J Logging – Commons Logging – Log4F Logging > Dynamically Configurable (by Configuration Admin Service) > Log Levels and Log Format per Logger > Multiple Log Files with size and time rotation
  • 22. 22  Http Service > Registering Servlets (and Resources) dynamically > Real Implementation – Includes Servlet Container > Bridged Implementation – Used for Web Application Launcher – Bridges Servlet Container to OSGi > Implementation transparent to registered Servlets
  • 23. 23  Extensions > Apache Felix Web Console – Extensible Web Based Management – Jquery UI Based (as of Version 3.0) > Maven SCR Plugin – Generates  Declarative Services Descriptors  Metatype Service Descriptors – Supports  JavaDoc Tags (@scr.component, etc.)  Java 5 Annotations (@Component, etc.) > JCR Install – Deploy Bundles via JCR Repository – Deploy Configuration Admin configurations via JCR Repository
  • 24. 24  Agenda > Apache Sling > Why OSGi ? > What parts of OSGi ? > Advantages and Problems > Demo
  • 25. 25  Advantages > Declared Dependencies > Better Isolution through explicit exports and private classes > Classloader Isolation > Extensibility built-in, not built-atop > Dynamism
  • 26. 26  Problems > Steep Learning Curve – OSGi Specifications Themselves – Modularization vs. Monolithic > Uptime vs. Startup Time > Legacy Specs und ClassLoader – JDBC, XML, etc. > Scripting und ClassLoader – BundleClassLoaderProxy approach > Application Packaging – CRX Content Packages (Day proprietary) – Karaf features (Sling provides feature.xml)
  • 27. 27  Agenda > Apache Sling > Why OSGi ? > What parts of OSGi ? > Advantages and Problems > Demo
  • 28. 29  Links > Apache Sling – The JCR (Web) Application Framework http://sling.apache.org > Apache Felix – OSGi Framework and Compendium Service implementations http://felix.apache.org > Apache Jackrabbit – The JCR (JSR-170/283) Reference Implementation http://jackrabbit.apache.org > Day Developer's Home http://dev.day.com