SlideShare a Scribd company logo
Using OSGi for script deployment in Apache Sling
Radu Cotescu, Karl Pauls - Adobe
2
3
‣ Computer Scientist @ Adobe, Basel,
Switzerland
‣ Member of the Apache Software
Foundation
‣ Apache Sling PMC member
‣ Maintainer of HTL for Apache Sling
4
‣ Computer Scientist @ Adobe, Basel,
Switzerland
‣ Member of the Apache Software
Foundation
‣ Apache Sling and Apache Felix PMC (VP)
member
‣ Co-Author of OSGi in Action
5
Do you have a minute to talk about Apache Sling[0]?
6
‣ REST-centric web framework,
based on an extensible
content tree
‣ JCR for persistence (Apache
Jackrabbit Oak)
‣ Collection of OSGi modules,
deployed in Apache Felix
‣ Powers Adobe Experience
Manager
From URLs to Scripts - a simplified view
7
Scripts and Servlets are equal
8
@Component(service = Servlet.class,
name="org.apache.sling.servlets.get.DefaultGetServlet",
property = {
"service.description=Default GET Servlet",
"service.vendor=The Apache Software Foundation",
// Use this as a default servlet for Sling
"sling.servlet.resourceTypes=sling/servlet/default",
"sling.servlet.prefix:Integer=-1",
// Generic handler for all get requests
"sling.servlet.methods=GET",
"sling.servlet.methods=HEAD"
})
@Designate(ocd=DefaultGetServlet.Config.class)
public class DefaultGetServlet extends SlingSafeMethodsServlet {
}
Versioning and dependencies
9
‣ There is no standard way of defining either.
‣ An option would be to use resource type versioning through
path conventions.
‣ Dependencies can only be checked at runtime (but not
enforced).
‣ What happens if your evil colleagues delete a script you were
delegating to? Or worse, if they change the whole markup?
Performance
10
‣ Each script requires two trips to the
persistence layer when first compiled,
only to read the script.
‣ Sling needs to maintain some caches to
keep things snappy.
Performance
11
“There are only two hard things in Computer Science: cache
invalidation and naming things.” -- Phil Karlton
Reality check
12
1. What are scripts actually: content or
code?
2. Are scripts authored or developed?
3. Can scripts be used freely or do they
have constraints?
4. If scripts are code, then why do we treat
them differently?
Reality check
Code:
1. provides or implements an API (HTTP in our case)
2. evolves semantically
3. is bundled into a cohesive unit, managed by one or more
developers
13
But what if we…
14
1. pack scripts into OSGi bundles
2. define the resource types as versioned capabilities, with
versioned requirements (Java APIs, other resource types to
which scripts delegate or which scripts extend)
3. allow the platform to do what it’s made to: wire things
Let’s quickly consult the OSGi specification
15
Capability - Describing a feature or function of the Resource when
installed in the Environment. A capability has attributes and directives.
Requirement - An assertion on the availability of a capability in the
Environment. A requirement has attributes and directives.
The filter directive contains the filter to assert the attributes of the
capability in the same Namespace.
https://osgi.org/specification/osgi.core/7.0.0/framework.module.html#framework.module.dependencies
How? Use the Apache Sling Scripting Bundle Tracker[1]
16
What:
1. add-on module to which bundles that provide scripts have to
be wired explicitly
2. reuses the already established mechanisms for registering
servlets in Apache Sling
3. allows building light-weight instances that can be thrown into
production with very little warm-up, when using precompiled
scripts
How? Use the Apache Sling Scripting Bundle Tracker[1]
17
4. provides the mechanism for deploying truly versionable
scripts, with explicit dependencies, by relying on the OSGi
framework
5. removes the need of a separate ScriptCache
6. removes additional pressure on the persistence layer
7. simplifies instance and application upgrades
8. there’s also a Maven plugin for generating requirements and
capabilities
So what’s different?
18
Option 1: scripts packed as bundle entries
So what’s different?
19
Option 2: precompiled scripts
How does it work in practice?
20
Sure, but how?
21
1 Provide-Capability / Script -> 1 Servlet / Script
Provide-Capability
sling.resourceType=“latte-art-maker”;
sling.servlet.methods:List<String>=“GET”;
version:Version=“1.0.0”
Demo* * or how we can embarrass ourselves if things don’t work
22
Where does all this lead?
23
OSGi RFP 196[2]
‣ Provides a way to use an OSGi framework with custom
classloaders (a.k.a. OSGi Connect/PojoSR)
Graal/Substrate VM
‣ Ahead-of-Time (AOT) Java code compilation
Together with the precompiled bundled scripts it should be
possible to perform an AOT compilation of a Sling application as a
native image[3].
Resources
24
[0] - https://sling.apache.org
[1] - https://github.com/apache/sling-org-apache-sling-scripting-bundle-tracker
[2] - https://github.com/osgi/design/blob/master/rfps/rfp-0196-OSGiConnect.pdf
[3] - https://adapt.to/2019/en/schedule/from-0-to-hero-in-under-10-seconds.html
Assets licensed from https://stock.adobe.com
Our diagrams were designed with https://whimsical.co/flowcharts
Demo available at https://github.com/raducotescu/eclipsecon-demo
25
Ad

More Related Content

What's hot (20)

"Using Automation Tools To Deploy And Operate Applications In Real World Scen...
"Using Automation Tools To Deploy And Operate Applications In Real World Scen..."Using Automation Tools To Deploy And Operate Applications In Real World Scen...
"Using Automation Tools To Deploy And Operate Applications In Real World Scen...
ConSol Consulting & Solutions Software GmbH
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE Applications
Jelastic Multi-Cloud PaaS
 
GraalVm and Quarkus
GraalVm and QuarkusGraalVm and Quarkus
GraalVm and Quarkus
Sascha Rodekamp
 
Auto Retweets Using AWS Lambda
Auto Retweets Using AWS LambdaAuto Retweets Using AWS Lambda
Auto Retweets Using AWS Lambda
CodeOps Technologies LLP
 
Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18
Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18
Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18
CodeOps Technologies LLP
 
Spring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShiftSpring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShift
Kamesh Sampath
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud Native
Ben Hall
 
Modular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache KarafModular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache Karaf
Ioan Eugen Stan
 
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASY
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASYKUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASY
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASY
Red Hat Developers
 
RUNNING AWS LOCALLY
RUNNING AWS LOCALLY RUNNING AWS LOCALLY
RUNNING AWS LOCALLY
AWSCOMSUM
 
Serverless Pune meetup 3
Serverless Pune meetup 3Serverless Pune meetup 3
Serverless Pune meetup 3
Vishal Biyani
 
Cloud native fundamentals
Cloud native fundamentalsCloud native fundamentals
Cloud native fundamentals
Victor Morales
 
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the ProxyCloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Maki Toshio
 
Kubernetes extensibility: crd & operators
Kubernetes extensibility: crd & operators Kubernetes extensibility: crd & operators
Kubernetes extensibility: crd & operators
Giacomo Tirabassi
 
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj CosicTaming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
mfrancis
 
Setting up Kubernetes with tectonic
Setting up Kubernetes with tectonicSetting up Kubernetes with tectonic
Setting up Kubernetes with tectonic
Vishal Biyani
 
Monitoring and Tuning GlassFish
Monitoring and Tuning GlassFishMonitoring and Tuning GlassFish
Monitoring and Tuning GlassFish
C2B2 Consulting
 
KubeCon EU 2016: A lightweight deployment system for appops
KubeCon EU 2016: A lightweight deployment system for appopsKubeCon EU 2016: A lightweight deployment system for appops
KubeCon EU 2016: A lightweight deployment system for appops
KubeAcademy
 
jbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scriptingjbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scripting
Red Hat Developers
 
Kubernetes 1.16 and rancher 2.3 enhancements
Kubernetes 1.16 and rancher 2.3 enhancementsKubernetes 1.16 and rancher 2.3 enhancements
Kubernetes 1.16 and rancher 2.3 enhancements
Saiyam Pathak
 
"Using Automation Tools To Deploy And Operate Applications In Real World Scen...
"Using Automation Tools To Deploy And Operate Applications In Real World Scen..."Using Automation Tools To Deploy And Operate Applications In Real World Scen...
"Using Automation Tools To Deploy And Operate Applications In Real World Scen...
ConSol Consulting & Solutions Software GmbH
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE Applications
Jelastic Multi-Cloud PaaS
 
Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18
Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18
Securing Containers - Sathyajit Bhat - Adobe - Container Conference 18
CodeOps Technologies LLP
 
Spring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShiftSpring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShift
Kamesh Sampath
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud Native
Ben Hall
 
Modular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache KarafModular Java applications with OSGi on Apache Karaf
Modular Java applications with OSGi on Apache Karaf
Ioan Eugen Stan
 
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASY
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASYKUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASY
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASY
Red Hat Developers
 
RUNNING AWS LOCALLY
RUNNING AWS LOCALLY RUNNING AWS LOCALLY
RUNNING AWS LOCALLY
AWSCOMSUM
 
Serverless Pune meetup 3
Serverless Pune meetup 3Serverless Pune meetup 3
Serverless Pune meetup 3
Vishal Biyani
 
Cloud native fundamentals
Cloud native fundamentalsCloud native fundamentals
Cloud native fundamentals
Victor Morales
 
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the ProxyCloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Cloud Foundry Day in Tokyo Lightning Talk - Cloud Foundry over the Proxy
Maki Toshio
 
Kubernetes extensibility: crd & operators
Kubernetes extensibility: crd & operators Kubernetes extensibility: crd & operators
Kubernetes extensibility: crd & operators
Giacomo Tirabassi
 
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj CosicTaming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
mfrancis
 
Setting up Kubernetes with tectonic
Setting up Kubernetes with tectonicSetting up Kubernetes with tectonic
Setting up Kubernetes with tectonic
Vishal Biyani
 
Monitoring and Tuning GlassFish
Monitoring and Tuning GlassFishMonitoring and Tuning GlassFish
Monitoring and Tuning GlassFish
C2B2 Consulting
 
KubeCon EU 2016: A lightweight deployment system for appops
KubeCon EU 2016: A lightweight deployment system for appopsKubeCon EU 2016: A lightweight deployment system for appops
KubeCon EU 2016: A lightweight deployment system for appops
KubeAcademy
 
jbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scriptingjbang: Unleash the power of Java for shell scripting
jbang: Unleash the power of Java for shell scripting
Red Hat Developers
 
Kubernetes 1.16 and rancher 2.3 enhancements
Kubernetes 1.16 and rancher 2.3 enhancementsKubernetes 1.16 and rancher 2.3 enhancements
Kubernetes 1.16 and rancher 2.3 enhancements
Saiyam Pathak
 

Similar to Using OSGi for script deployment in Apache Sling (20)

Function as a Service
Function as a ServiceFunction as a Service
Function as a Service
rich fernandez
 
CQ5 and Sling overview
CQ5 and Sling overviewCQ5 and Sling overview
CQ5 and Sling overview
Bertrand Delacretaz
 
OSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 IndiaOSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 India
Arun Gupta
 
Data Engineer’s Lunch #45: Apache Livy
Data Engineer’s Lunch #45: Apache LivyData Engineer’s Lunch #45: Apache Livy
Data Engineer’s Lunch #45: Apache Livy
Anant Corporation
 
.NET RDF APIs
.NET RDF APIs.NET RDF APIs
.NET RDF APIs
Andrei Iacob
 
Content-Centric Web Development with Apache Sling
Content-Centric Web Development with Apache SlingContent-Centric Web Development with Apache Sling
Content-Centric Web Development with Apache Sling
Koen Van Eeghem
 
Paving the way to a native Sling
Paving the way to a native SlingPaving the way to a native Sling
Paving the way to a native Sling
Radu Cotescu
 
OpenSCAP Overview(security scanning for docker image and container)
OpenSCAP Overview(security scanning for docker image and container)OpenSCAP Overview(security scanning for docker image and container)
OpenSCAP Overview(security scanning for docker image and container)
Jooho Lee
 
Concierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded DevicesConcierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded Devices
Jan S. Rellermeyer
 
Introduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunIntroduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud Run
Saiyam Pathak
 
RESTful web apps with Apache Sling - 2013 version
RESTful web apps with Apache Sling - 2013 versionRESTful web apps with Apache Sling - 2013 version
RESTful web apps with Apache Sling - 2013 version
Bertrand Delacretaz
 
Web Apps atop a Content Repository
Web Apps atop a Content RepositoryWeb Apps atop a Content Repository
Web Apps atop a Content Repository
Gabriel Walt
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to Kubernetes
Paul Czarkowski
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
Lokesh BS
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
Lo Ki
 
CRX Best practices
CRX Best practicesCRX Best practices
CRX Best practices
lisui0807
 
Java @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SPJava @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SP
Ilan Salviano
 
Cloud-native legacy applications
Cloud-native legacy applicationsCloud-native legacy applications
Cloud-native legacy applications
Robert Munteanu
 
Why and how to leverage apache camel integration framework in your io t archi...
Why and how to leverage apache camel integration framework in your io t archi...Why and how to leverage apache camel integration framework in your io t archi...
Why and how to leverage apache camel integration framework in your io t archi...
Aurélien Pupier
 
Osgi
OsgiOsgi
Osgi
Heena Madan
 
OSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 IndiaOSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 India
Arun Gupta
 
Data Engineer’s Lunch #45: Apache Livy
Data Engineer’s Lunch #45: Apache LivyData Engineer’s Lunch #45: Apache Livy
Data Engineer’s Lunch #45: Apache Livy
Anant Corporation
 
Content-Centric Web Development with Apache Sling
Content-Centric Web Development with Apache SlingContent-Centric Web Development with Apache Sling
Content-Centric Web Development with Apache Sling
Koen Van Eeghem
 
Paving the way to a native Sling
Paving the way to a native SlingPaving the way to a native Sling
Paving the way to a native Sling
Radu Cotescu
 
OpenSCAP Overview(security scanning for docker image and container)
OpenSCAP Overview(security scanning for docker image and container)OpenSCAP Overview(security scanning for docker image and container)
OpenSCAP Overview(security scanning for docker image and container)
Jooho Lee
 
Concierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded DevicesConcierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded Devices
Jan S. Rellermeyer
 
Introduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunIntroduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud Run
Saiyam Pathak
 
RESTful web apps with Apache Sling - 2013 version
RESTful web apps with Apache Sling - 2013 versionRESTful web apps with Apache Sling - 2013 version
RESTful web apps with Apache Sling - 2013 version
Bertrand Delacretaz
 
Web Apps atop a Content Repository
Web Apps atop a Content RepositoryWeb Apps atop a Content Repository
Web Apps atop a Content Repository
Gabriel Walt
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to Kubernetes
Paul Czarkowski
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
Lokesh BS
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
Lo Ki
 
CRX Best practices
CRX Best practicesCRX Best practices
CRX Best practices
lisui0807
 
Java @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SPJava @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SP
Ilan Salviano
 
Cloud-native legacy applications
Cloud-native legacy applicationsCloud-native legacy applications
Cloud-native legacy applications
Robert Munteanu
 
Why and how to leverage apache camel integration framework in your io t archi...
Why and how to leverage apache camel integration framework in your io t archi...Why and how to leverage apache camel integration framework in your io t archi...
Why and how to leverage apache camel integration framework in your io t archi...
Aurélien Pupier
 
Ad

Recently uploaded (20)

Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Full Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest VersionFull Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest Version
jonesmichealj2
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
saimabibi60507
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game DevelopmentBest Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Juego Studios
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Tools of the Trade: Linux and SQL - Google Certificate
Tools of the Trade: Linux and SQL - Google CertificateTools of the Trade: Linux and SQL - Google Certificate
Tools of the Trade: Linux and SQL - Google Certificate
VICTOR MAESTRE RAMIREZ
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
DVDFab Crack FREE Download Latest Version 2025
DVDFab Crack FREE Download Latest Version 2025DVDFab Crack FREE Download Latest Version 2025
DVDFab Crack FREE Download Latest Version 2025
younisnoman75
 
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Lionel Briand
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Full Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest VersionFull Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest Version
jonesmichealj2
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
saimabibi60507
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game DevelopmentBest Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Juego Studios
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Tools of the Trade: Linux and SQL - Google Certificate
Tools of the Trade: Linux and SQL - Google CertificateTools of the Trade: Linux and SQL - Google Certificate
Tools of the Trade: Linux and SQL - Google Certificate
VICTOR MAESTRE RAMIREZ
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
DVDFab Crack FREE Download Latest Version 2025
DVDFab Crack FREE Download Latest Version 2025DVDFab Crack FREE Download Latest Version 2025
DVDFab Crack FREE Download Latest Version 2025
younisnoman75
 
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Lionel Briand
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Ad

Using OSGi for script deployment in Apache Sling

  • 1. Using OSGi for script deployment in Apache Sling Radu Cotescu, Karl Pauls - Adobe
  • 2. 2
  • 3. 3 ‣ Computer Scientist @ Adobe, Basel, Switzerland ‣ Member of the Apache Software Foundation ‣ Apache Sling PMC member ‣ Maintainer of HTL for Apache Sling
  • 4. 4 ‣ Computer Scientist @ Adobe, Basel, Switzerland ‣ Member of the Apache Software Foundation ‣ Apache Sling and Apache Felix PMC (VP) member ‣ Co-Author of OSGi in Action
  • 5. 5
  • 6. Do you have a minute to talk about Apache Sling[0]? 6 ‣ REST-centric web framework, based on an extensible content tree ‣ JCR for persistence (Apache Jackrabbit Oak) ‣ Collection of OSGi modules, deployed in Apache Felix ‣ Powers Adobe Experience Manager
  • 7. From URLs to Scripts - a simplified view 7
  • 8. Scripts and Servlets are equal 8 @Component(service = Servlet.class, name="org.apache.sling.servlets.get.DefaultGetServlet", property = { "service.description=Default GET Servlet", "service.vendor=The Apache Software Foundation", // Use this as a default servlet for Sling "sling.servlet.resourceTypes=sling/servlet/default", "sling.servlet.prefix:Integer=-1", // Generic handler for all get requests "sling.servlet.methods=GET", "sling.servlet.methods=HEAD" }) @Designate(ocd=DefaultGetServlet.Config.class) public class DefaultGetServlet extends SlingSafeMethodsServlet { }
  • 9. Versioning and dependencies 9 ‣ There is no standard way of defining either. ‣ An option would be to use resource type versioning through path conventions. ‣ Dependencies can only be checked at runtime (but not enforced). ‣ What happens if your evil colleagues delete a script you were delegating to? Or worse, if they change the whole markup?
  • 10. Performance 10 ‣ Each script requires two trips to the persistence layer when first compiled, only to read the script. ‣ Sling needs to maintain some caches to keep things snappy.
  • 11. Performance 11 “There are only two hard things in Computer Science: cache invalidation and naming things.” -- Phil Karlton
  • 12. Reality check 12 1. What are scripts actually: content or code? 2. Are scripts authored or developed? 3. Can scripts be used freely or do they have constraints? 4. If scripts are code, then why do we treat them differently?
  • 13. Reality check Code: 1. provides or implements an API (HTTP in our case) 2. evolves semantically 3. is bundled into a cohesive unit, managed by one or more developers 13
  • 14. But what if we… 14 1. pack scripts into OSGi bundles 2. define the resource types as versioned capabilities, with versioned requirements (Java APIs, other resource types to which scripts delegate or which scripts extend) 3. allow the platform to do what it’s made to: wire things
  • 15. Let’s quickly consult the OSGi specification 15 Capability - Describing a feature or function of the Resource when installed in the Environment. A capability has attributes and directives. Requirement - An assertion on the availability of a capability in the Environment. A requirement has attributes and directives. The filter directive contains the filter to assert the attributes of the capability in the same Namespace. https://osgi.org/specification/osgi.core/7.0.0/framework.module.html#framework.module.dependencies
  • 16. How? Use the Apache Sling Scripting Bundle Tracker[1] 16 What: 1. add-on module to which bundles that provide scripts have to be wired explicitly 2. reuses the already established mechanisms for registering servlets in Apache Sling 3. allows building light-weight instances that can be thrown into production with very little warm-up, when using precompiled scripts
  • 17. How? Use the Apache Sling Scripting Bundle Tracker[1] 17 4. provides the mechanism for deploying truly versionable scripts, with explicit dependencies, by relying on the OSGi framework 5. removes the need of a separate ScriptCache 6. removes additional pressure on the persistence layer 7. simplifies instance and application upgrades 8. there’s also a Maven plugin for generating requirements and capabilities
  • 18. So what’s different? 18 Option 1: scripts packed as bundle entries
  • 19. So what’s different? 19 Option 2: precompiled scripts
  • 20. How does it work in practice? 20
  • 21. Sure, but how? 21 1 Provide-Capability / Script -> 1 Servlet / Script Provide-Capability sling.resourceType=“latte-art-maker”; sling.servlet.methods:List<String>=“GET”; version:Version=“1.0.0”
  • 22. Demo* * or how we can embarrass ourselves if things don’t work 22
  • 23. Where does all this lead? 23 OSGi RFP 196[2] ‣ Provides a way to use an OSGi framework with custom classloaders (a.k.a. OSGi Connect/PojoSR) Graal/Substrate VM ‣ Ahead-of-Time (AOT) Java code compilation Together with the precompiled bundled scripts it should be possible to perform an AOT compilation of a Sling application as a native image[3].
  • 24. Resources 24 [0] - https://sling.apache.org [1] - https://github.com/apache/sling-org-apache-sling-scripting-bundle-tracker [2] - https://github.com/osgi/design/blob/master/rfps/rfp-0196-OSGiConnect.pdf [3] - https://adapt.to/2019/en/schedule/from-0-to-hero-in-under-10-seconds.html Assets licensed from https://stock.adobe.com Our diagrams were designed with https://whimsical.co/flowcharts Demo available at https://github.com/raducotescu/eclipsecon-demo
  • 25. 25