SlideShare a Scribd company logo
1 of 35
Download to read offline
Scripting Languages in
OSGi
Frank Lyaruu
CTO Dexels
Project lead Navajo Framework
Amsterdam
www.dexels.com
Twitter: @lyaruu
Navajo Framework
• TSL
• XML based script language
• Compiled to Java
• Recently ported to OSGi
Scripting languages in
OSGi
• The combination has a pretty bad
reputation
• Different approach to dynamism
Scripting languages in
OSGi
• Use any (?) scripting language
• Dynamically add, modify and remove scripts
• Expose it as an OSGi service
• Can declaratively depend on other services
• No external depedencies
• Behave like any other bundle
Advantages of scripting
languages
• Dynamic. Changing code at runtime is
completely normal
• No complex builds necessary
• Effective languages available for certain
problems
Disadvantages of scripting
languages
• Errors might reveal themselves only at
runtime
• Limited modularity
• Performance can be a problem
Calling a script from
Java
JSR-223 Scripting API
• More or less language independent
• Many supporting languages
• Some have a proprietary API
• Some have both
Define a java interface
In the simplest case:
Using scripts in plain
Java
Scripting languages in
OSGi
• Use any (?) scripting language Use JSR-223
• Dynamically add, modify and remove scripts
Expose it as an OSGi service
• Can declaratively depend on other services
• No external depedencies
• Behave like any other bundle
Generating bundles
• Make up symbolic name
• Make up a version
• Determine Java dependencies
Generate an
implementation class
• We need an actual implementation class
in the generated bundle.
• Usually it can be pretty simple
Generated java file:
Base class*
*The actual implementation is a bit
messier
Generate a MANIFEST
Scripting languages in
OSGi
• Use any (?) scripting language Use JSR-223
• Dynamically add, modify and remove scripts
(Generate bundles)
• Expose it as an OSGi service
• Can declaratively depend on other services
• No external depedencies (Generate bundles)
Expose a service to
OSGi
• Register manually from an activator
• Use a dependency injection framework
Declarative Services
• Easier to generate XML than Java code
• Tooling (Felix WebConsole)
• Dependency management for free
Generate DS file
Scripting languages in
OSGi
• Use any (?) scripting language Use JSR-223
• Dynamically add, modify and remove scripts
(Generate bundles)
• Expose it as an OSGi service (DS)
• Can declaratively depend on other services
(DS)
• No external depedencies (Generate bundles)
Finding dependencies
• The scripting language supports this :-)
(TSL/Navajo)
• Annotate script :-|
• Use a descriptor file :-(
Declarative Services
(DS)
• Determine service dependencies
• Generate a Declarative Service descriptor
• Service will only be activated and exposed
when all dependencies are met.
• Generate bind/unbind methods for component
class
Compiling Java in OSGi
• JSR 199 Compiler API
Compiling Java in OSGi
• What is the classpath?
Compiling Java in OSGi
• Create a custom
javax.tools.JavaFileManager
• Use the OSGi Bundle Wiring API to
locate exported packages
• Listen to bundle events
Compiling Java in OSGi
• Record all requested packages during
compilation
• We’ve found our package dependencies.. Sort
of..
• Only works for scripts that are compiled :-(
• Use Dynamic-ImportPackage if all else fails.
Manage changes
• Manual
• Monitor file system (Felix FileInstall
ArtifactTransformer)
• On demand (For example git hooks)
DEMO
• JRuby
Generated Java
Generated DS
Current limitations
• Try a language with a byte code
compiler (like Scala)
• Class.forName / ThreadContext
classloaders call still cause trouble
• Determining dependencies (both code
depedencies and service dependencies)
is really script dependent
• Split packages will probably fail
Conclusions
• Different views on dynamic code
• Creating bundles on the fly is possible and
not that hard*
• Navajo runs at high volume with about
5000 bundles
• ‘Intelligent’ configuration files
Frank Lyaruu
frank@dexels.com
Twitter: @lyaruu
Demo code:
github.com/Dexels/apachecon
Navajo code:
github.com/Dexels/navajo
Questions?

More Related Content

What's hot

What's hot (18)

Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya
Actors and Microservices - Can two walk together? - Rotem Hermon, GigyaActors and Microservices - Can two walk together? - Rotem Hermon, Gigya
Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya
 
Swarms: introduction
Swarms: introductionSwarms: introduction
Swarms: introduction
 
TDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDBTDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDB
 
Orchestrator for QlikView: add-on product description
Orchestrator for QlikView: add-on product descriptionOrchestrator for QlikView: add-on product description
Orchestrator for QlikView: add-on product description
 
SGCE 2015 REST APIs
SGCE 2015 REST APIsSGCE 2015 REST APIs
SGCE 2015 REST APIs
 
Developing Serverless Microservice in Rust
Developing Serverless Microservice in RustDeveloping Serverless Microservice in Rust
Developing Serverless Microservice in Rust
 
Planidoo & Zotonic
Planidoo & ZotonicPlanidoo & Zotonic
Planidoo & Zotonic
 
Project FiFo - Architecture
Project FiFo - ArchitectureProject FiFo - Architecture
Project FiFo - Architecture
 
Software architecture : From project management to deployment
Software architecture : From project management to deploymentSoftware architecture : From project management to deployment
Software architecture : From project management to deployment
 
CFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful CodeCFWheels - Pragmatic, Beautiful Code
CFWheels - Pragmatic, Beautiful Code
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NET
 
SOA Latam 2015
SOA Latam 2015SOA Latam 2015
SOA Latam 2015
 
What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0
 
The future of cloud programming
The future of cloud programmingThe future of cloud programming
The future of cloud programming
 
Developing Cross-Platform Web Apps with ASP.NET Core1.0
Developing Cross-Platform Web Apps with ASP.NET Core1.0Developing Cross-Platform Web Apps with ASP.NET Core1.0
Developing Cross-Platform Web Apps with ASP.NET Core1.0
 
Mean machine
Mean machineMean machine
Mean machine
 
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
 
AWS Lambda + AWS Cloudformation
AWS Lambda + AWS CloudformationAWS Lambda + AWS Cloudformation
AWS Lambda + AWS Cloudformation
 

Similar to Scripting Languages in OSGi

Modified.net overview
Modified.net overviewModified.net overview
Modified.net overview
Faisal Aziz
 
.Net overview
.Net overview.Net overview
.Net overview
madydud
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
Howard Greenberg
 
Language Engineering in the Cloud
Language Engineering in the CloudLanguage Engineering in the Cloud
Language Engineering in the Cloud
lennartkats
 

Similar to Scripting Languages in OSGi (20)

The Architect Way
The Architect WayThe Architect Way
The Architect Way
 
[EclipseCon France 2017] Language Server Protocol in action
[EclipseCon France 2017] Language Server Protocol in action[EclipseCon France 2017] Language Server Protocol in action
[EclipseCon France 2017] Language Server Protocol in action
 
Modified.net overview
Modified.net overviewModified.net overview
Modified.net overview
 
.Net overview
.Net overview.Net overview
.Net overview
 
C# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform developmentC# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform development
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
Net overview
Net overviewNet overview
Net overview
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
 
Top 10 programming languages
Top 10 programming languagesTop 10 programming languages
Top 10 programming languages
 
.Net overview by cetpa
.Net overview by cetpa.Net overview by cetpa
.Net overview by cetpa
 
Net Framework overview
Net Framework overviewNet Framework overview
Net Framework overview
 
DOT Net overview
DOT Net overviewDOT Net overview
DOT Net overview
 
Overview of Coding Languages
Overview of Coding LanguagesOverview of Coding Languages
Overview of Coding Languages
 
Language Engineering in the Cloud
Language Engineering in the CloudLanguage Engineering in the Cloud
Language Engineering in the Cloud
 
Net overview
Net overviewNet overview
Net overview
 
MJ Berends talk - Women & Non-Binary Focused Intro to AWS
 MJ Berends talk - Women & Non-Binary Focused Intro to AWS MJ Berends talk - Women & Non-Binary Focused Intro to AWS
MJ Berends talk - Women & Non-Binary Focused Intro to AWS
 
Introduction_to_NET.ppt
Introduction_to_NET.pptIntroduction_to_NET.ppt
Introduction_to_NET.ppt
 
Native App Development for iOS, Android, and Windows with Visual Studio
Native App Development for iOS, Android, and Windows with Visual StudioNative App Development for iOS, Android, and Windows with Visual Studio
Native App Development for iOS, Android, and Windows with Visual Studio
 
sl slides-unit-1.pptx
sl slides-unit-1.pptxsl slides-unit-1.pptx
sl slides-unit-1.pptx
 
OSS at Microsoft
OSS at MicrosoftOSS at Microsoft
OSS at Microsoft
 

More from Frank Lyaruu

More from Frank Lyaruu (6)

Too young to quit, too old to change
Too young to quit, too old to changeToo young to quit, too old to change
Too young to quit, too old to change
 
Embracing Database Diversity with Kafka and Debezium
Embracing Database Diversity with Kafka and DebeziumEmbracing Database Diversity with Kafka and Debezium
Embracing Database Diversity with Kafka and Debezium
 
Non Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJavaNon Blocking I/O for Everyone with RxJava
Non Blocking I/O for Everyone with RxJava
 
The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016The Road To Reactive with RxJava JEEConf 2016
The Road To Reactive with RxJava JEEConf 2016
 
Developing Like There's No Tomorrow
Developing Like There's No TomorrowDeveloping Like There's No Tomorrow
Developing Like There's No Tomorrow
 
Deploying OSGi on an Army of CubieTrucksSendrato powerpoint
Deploying OSGi on an Army of CubieTrucksSendrato powerpointDeploying OSGi on an Army of CubieTrucksSendrato powerpoint
Deploying OSGi on an Army of CubieTrucksSendrato powerpoint
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 

Scripting Languages in OSGi