SlideShare a Scribd company logo
1 of 25
Download to read offline
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

More Related Content

What's hot

"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 ApplicationsJelastic 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 18CodeOps Technologies LLP
 
Spring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShiftSpring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShiftKamesh Sampath
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeBen 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 KarafIoan 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 EASYRed 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 3Vishal Biyani
 
Cloud native fundamentals
Cloud native fundamentalsCloud native fundamentals
Cloud native fundamentalsVictor 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 ProxyMaki 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 Cosicmfrancis
 
Setting up Kubernetes with tectonic
Setting up Kubernetes with tectonicSetting up Kubernetes with tectonic
Setting up Kubernetes with tectonicVishal Biyani
 
Monitoring and Tuning GlassFish
Monitoring and Tuning GlassFishMonitoring and Tuning GlassFish
Monitoring and Tuning GlassFishC2B2 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 appopsKubeAcademy
 
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 scriptingRed 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 enhancementsSaiyam Pathak
 

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...
 
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
 
GraalVm and Quarkus
GraalVm and QuarkusGraalVm and Quarkus
GraalVm and Quarkus
 
Auto Retweets Using AWS Lambda
Auto Retweets Using AWS LambdaAuto Retweets Using AWS Lambda
Auto Retweets Using AWS Lambda
 
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
 
Spring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShiftSpring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShift
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud Native
 
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
 
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
 
RUNNING AWS LOCALLY
RUNNING AWS LOCALLY RUNNING AWS LOCALLY
RUNNING AWS LOCALLY
 
Serverless Pune meetup 3
Serverless Pune meetup 3Serverless Pune meetup 3
Serverless Pune meetup 3
 
Cloud native fundamentals
Cloud native fundamentalsCloud native fundamentals
Cloud native fundamentals
 
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
 
Kubernetes extensibility: crd & operators
Kubernetes extensibility: crd & operators Kubernetes extensibility: crd & operators
Kubernetes extensibility: crd & operators
 
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
 
Setting up Kubernetes with tectonic
Setting up Kubernetes with tectonicSetting up Kubernetes with tectonic
Setting up Kubernetes with tectonic
 
Monitoring and Tuning GlassFish
Monitoring and Tuning GlassFishMonitoring and Tuning GlassFish
Monitoring and Tuning GlassFish
 
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
 
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
 
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
 

Similar to Using OSGi for script deployment in Apache Sling

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 IndiaArun 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 LivyAnant 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 SlingKoen 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 SlingRadu 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 DevicesJan 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 RunSaiyam 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 versionBertrand Delacretaz
 
Web Apps atop a Content Repository
Web Apps atop a Content RepositoryWeb Apps atop a Content Repository
Web Apps atop a Content RepositoryGabriel Walt
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to KubernetesPaul Czarkowski
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and SlingLo Ki
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and SlingLokesh BS
 
CRX Best practices
CRX Best practicesCRX Best practices
CRX Best practiceslisui0807
 
Java @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SPJava @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SPIlan Salviano
 
Cloud-native legacy applications
Cloud-native legacy applicationsCloud-native legacy applications
Cloud-native legacy applicationsRobert 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
 

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
 
CQ5 and Sling overview
CQ5 and Sling overviewCQ5 and Sling overview
CQ5 and Sling overview
 
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
 
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
 
.NET RDF APIs
.NET RDF APIs.NET RDF APIs
.NET RDF APIs
 
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
 
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
 
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)
 
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
 
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
 
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
 
Web Apps atop a Content Repository
Web Apps atop a Content RepositoryWeb Apps atop a Content Repository
Web Apps atop a Content Repository
 
A DevOps guide to Kubernetes
A DevOps guide to KubernetesA DevOps guide to Kubernetes
A DevOps guide to Kubernetes
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
 
CRX Best practices
CRX Best practicesCRX Best practices
CRX Best practices
 
Java @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SPJava @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SP
 
Cloud-native legacy applications
Cloud-native legacy applicationsCloud-native legacy applications
Cloud-native legacy applications
 
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...
 
Osgi
OsgiOsgi
Osgi
 

Recently uploaded

Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 

Recently uploaded (20)

Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 

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