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

Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainAbdul Ahad
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 

Recently uploaded (20)

Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software Domain
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 

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