SlideShare a Scribd company logo
Third-Party Libraries and OSGi
a complicated relationship
Senior Solution Architect
6 years of WCMS experience
Loves working with Java
(script)
Sascha Brinkmann
Hobbies: Biking, Hiking, Travelling
Contact: sb@eggs.de @sasusu
About Me
About Us
About Us
1984 Foundation year
2004 Adobe Business Partner
2005 Adobe Authorized Training Center
2010 Winner of Siemens top+ Award
2014 100% Adobe focussed for 10 years
Employees: 45
Located: Munich, Germany
Happy Adobe customers: +40
➢ Motivation
➢ Challenge
➢ Analysis Possible Strategies
➢ Tips & Tricks
➢ Conclusion
➢ OSGi Basics
Table of Content
Integration of AEM into a heterogeneous IT systems landscape
with interfaces to various subsystems.
AEM
LDAP / Active Directory
Microsoft SharePoint
Microsoft Enterprise Search (FAST)
IBM Lotus Notes Domino
SAP / Hybris
SQL Database
Rest- and Webservices
Amazon S3
Facbook
Twitter
YouTube
Brightcove
Email
FTP
Google Search Appliance
Motivation
InternalExternal
Our work is all about solving business problems. Solutions for
almost every technical challenge are provided by third party
libraries from the central maven repository.
Motivation
How can I use various types of third party libraries
and frameworks within my projects?
Challenge
OSGi Basics
Allrightsreserved
Gosainkunda, Nepal
OSGi Basics - Apache Felix
Apache Felix is a fundamental element of the technology stack of
the Adobe Experience Manager (AEM). It provides the
environment for all Java written components.
Java Content Repository (CRX)
Apache Sling
Adobe Experience Manager (WCMS)
OSGi Runtime (Apache Felix)
one Classloader for the
whole Java application
one Classloader per OSGi bundle
Bundle B
Bundle A
Bundle C
Bundle D
Library A
Library C
Library B
Library D
OSGi Basics - Classloading
Key difference between traditional Java Applications and
Applications running within OSGi.
Bundle
Manifest
Consumes Provides
OSGi Basics - Bundle Structure
Bundle Identifier
Packages provided to other bundles
Packages Consumed from other bundles
OSGi Basics - Bundle Manifest
The manifest file is a set of OSGi specific headers. It defines how
to deploy and run the OSGi bundle.
Apache Felix
Bundle Plugin
Dependency to
other Bundle
OSGi Basics - Maven POM Config
The Apache Felix Bundle Plugin for Maven enhances artifacts
with the bundle manifest.
Strategies to use third party libraries
First Option
Embedding Libraries
Second Option
Libraries as Bundles
First Option Embedding Libraries
Allrightsreserved
Nanuku, Fiji
Bundle
Manifest
First Option - Embedding Libraries
Same classloader for external libraries and bundle classes.
Libraries embedded
within the bundle
First Option - Embedding Libraries
Bundle Manifest
Dependency to be embedded
with implicit scope ‘compile’
Instruction to embed all
dependencies with scope
compile & runtime
First Option - Embedding Libraries
Maven POM snippet
Apache Felix needs to resolve all dependencies prior to
start the bundle.
First Option - Embedding Libraries
Transitive dependencies
are not embedded
automatically!
First Option - Embedding Libraries
Maven Artifact Dependency Tree
A large number of embedded
libraries within your OSGi bundle ...
… can cause an even larger
number of unresolveable
packages.
First Option - Embedding Libraries
Additional dependencies to
resolve the missing packages.
Instruction containing a list of
packages which should be
ignored by Apache Felix.
Instruction to embed
transitive dependencies
First Option - Embedding Libraries
Further configuration parameters to adjust the generated manifest.
First Option - Embedding Libraries
The result has to be that the bundle is deployed with no unresolved
packages and activated successfully
Bundle is activated and ready
for operation.
Advantages
➢ Easy to archive
➢ Usage is encapsulated
➢ Same classloader between class-files and library
Disadvantages
➢ Usage is limited to bundle
➢ No separation of concerns
➢ Multiple usage in different bundles increase the memory
consumption and the probability of conflicts when sharing
references
First Option - Embedding Libraries
Second Option
Libraries as Bundle
Allrightsreserved
Hollywood, USA
Transformation or encapsulation of Java libraries to turn them
into OSGi bundles
Searching for existing OSGi bundles
End of availability after September 2014 Just kicked off
Successor
Commandline Tool Bundle Plugin
Second Option - Libraries as Bundle
Second Option - Libraries as Bundle
Advantages
➢ Functionality can be shared across multiple bundles
➢ Separation of concerns
➢ Bundles can be updated independently
➢ Class reference conflicts can be avoided, as there is only one
shared source
Disadvantages
➢ Most libraries are not available as OSGi bundles
➢ Dynamic class resolving via Class.forName() or reflection is
difficult
OSGi Basics - Bundles vs. Fragments
the bundle where the fragment is attached to
Bundle
Fragment
Has its own classloader
and lifecycle. Can be
referenced by other
bundles.
Is part of another Bundle
and utilizes its classloader.
Extends the imports and
exports of the host bundle.
Fragment Manifest
Hibernate ORM is an object-relational mapping library for the Java
language, providing a framework for mapping an object-oriented domain
model to a traditional relational database.
Entities
and DAO
JDBC
DriverHibernate
Core Bundle
Consumes
Entity
Bridge Consumes
Extends
Extends
OSGi
Fragment
OSGi
Bundle
Second Option - Libraries as Bundle
The system bundle is a special bundle that represents the OSGi
framework itself, from within that framework.
Characteristics
➢ Bundle ID 0
➢ It exports packages from the JRE
➢ Only packages which are available in any JVM are provided. All
java* packages for example javax.swing, org.w3c.com etc. are
excluded
➢ Exports the OSGi framework packages such as org.osgi.framework
OSGi Basics - System Bundle
Apache Axis2 is a Web Services / SOAP / WSDL engine
and the successor to the widely used Apache Axis SOAP
stack.
System
Bundle
Axis 2
FragmentExtends
Entities
and DAO
Consumes
Second Option - Libraries as Bundle
OSGi
Fragment
OSGi
Bundle
Some third party libraries make us of the current thread classloader that definitely runs
within another context than the bundle class loader. To allow the third party library to
access bundle resources, the current thread classloader has to be replaced for this action.
Dealing with Class Loader Issues
➢ There is no best practice. Each framework needs its individual
solution!
➢ Working with third party libraries is like a box of chocolates -
you never know what you're gonna get.
➢ You know it’s working when you see it’s working!
➢ Most frameworks don’t support OSGi or are not properly
tested with Apache Felix.
➢ It needs a community with support from Adobe sharing
experiences and best practices including the use of third party
libraries.
Conclusion
Your chance for
remarks and questions!
All rights reserved Los Angeles, USA
The End
Allrightsreserved
Nadi, Fiji
Presentation
http://www.eggs.de/connectwebex2014
The Author
Sascha Brinkmann - sb@eggs.de
Sales Representative
Martin Brösamle - mb@eggs.de
Get in Touch
Terms of Use
This work is licensed under a
Creative Commons Attribution-NoDerivatives
4.0 International License
All photos copyright © Sascha Brinkmann,
all rights reserved.

More Related Content

What's hot

Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
Simplilearn
 
Accelerating Shuffle: A Tailor-Made RDMA Solution for Apache Spark with Yuval...
Accelerating Shuffle: A Tailor-Made RDMA Solution for Apache Spark with Yuval...Accelerating Shuffle: A Tailor-Made RDMA Solution for Apache Spark with Yuval...
Accelerating Shuffle: A Tailor-Made RDMA Solution for Apache Spark with Yuval...
Spark Summit
 
[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide
[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide
[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide
Ji-Woong Choi
 
Ceph Introduction 2017
Ceph Introduction 2017  Ceph Introduction 2017
Ceph Introduction 2017
Karan Singh
 
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
Mirantis
 
Apache NiFi in the Hadoop Ecosystem
Apache NiFi in the Hadoop Ecosystem Apache NiFi in the Hadoop Ecosystem
Apache NiFi in the Hadoop Ecosystem
DataWorks Summit/Hadoop Summit
 
Api design best practice
Api design best practiceApi design best practice
Api design best practice
Red Hat
 
Azure Web Jobs
Azure Web JobsAzure Web Jobs
Azure Web Jobs
BizTalk360
 
OpenStack 개요 및 활용 사례 @ Community Open Camp with Microsoft
OpenStack 개요 및 활용 사례 @ Community Open Camp with MicrosoftOpenStack 개요 및 활용 사례 @ Community Open Camp with Microsoft
OpenStack 개요 및 활용 사례 @ Community Open Camp with Microsoft
Ian Choi
 
Room 1 - 2 - Nguyễn Văn Thắng & Dzung Nguyen - Proxmox VE và ZFS over iscsi
Room 1 - 2 - Nguyễn Văn Thắng & Dzung Nguyen - Proxmox VE và ZFS over iscsiRoom 1 - 2 - Nguyễn Văn Thắng & Dzung Nguyen - Proxmox VE và ZFS over iscsi
Room 1 - 2 - Nguyễn Văn Thắng & Dzung Nguyen - Proxmox VE và ZFS over iscsi
Vietnam Open Infrastructure User Group
 
Service Function Chaining in Openstack Neutron
Service Function Chaining in Openstack NeutronService Function Chaining in Openstack Neutron
Service Function Chaining in Openstack Neutron
Michelle Holley
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
Jeevesh Pandey
 
Real-Time Data Flows with Apache NiFi
Real-Time Data Flows with Apache NiFiReal-Time Data Flows with Apache NiFi
Real-Time Data Flows with Apache NiFi
Manish Gupta
 
Lenovo HPC Strategy Update
Lenovo HPC Strategy UpdateLenovo HPC Strategy Update
Lenovo HPC Strategy Update
inside-BigData.com
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
Mindfire Solutions
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
Ajeet Singh Raina
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debate
Restlet
 
[기술 트렌드] Gartner 선정 10대 전략 기술
[기술 트렌드] Gartner 선정 10대 전략 기술[기술 트렌드] Gartner 선정 10대 전략 기술
[기술 트렌드] Gartner 선정 10대 전략 기술
Open Source Consulting
 
Deploying and Managing Hadoop Clusters with AMBARI
Deploying and Managing Hadoop Clusters with AMBARIDeploying and Managing Hadoop Clusters with AMBARI
Deploying and Managing Hadoop Clusters with AMBARI
DataWorks Summit
 
Kubeflow Pipelines (with Tekton)
Kubeflow Pipelines (with Tekton)Kubeflow Pipelines (with Tekton)
Kubeflow Pipelines (with Tekton)
Animesh Singh
 

What's hot (20)

Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
 
Accelerating Shuffle: A Tailor-Made RDMA Solution for Apache Spark with Yuval...
Accelerating Shuffle: A Tailor-Made RDMA Solution for Apache Spark with Yuval...Accelerating Shuffle: A Tailor-Made RDMA Solution for Apache Spark with Yuval...
Accelerating Shuffle: A Tailor-Made RDMA Solution for Apache Spark with Yuval...
 
[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide
[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide
[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide
 
Ceph Introduction 2017
Ceph Introduction 2017  Ceph Introduction 2017
Ceph Introduction 2017
 
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
2 Day Bootcamp for OpenStack--Cloud Training by Mirantis (Preview)
 
Apache NiFi in the Hadoop Ecosystem
Apache NiFi in the Hadoop Ecosystem Apache NiFi in the Hadoop Ecosystem
Apache NiFi in the Hadoop Ecosystem
 
Api design best practice
Api design best practiceApi design best practice
Api design best practice
 
Azure Web Jobs
Azure Web JobsAzure Web Jobs
Azure Web Jobs
 
OpenStack 개요 및 활용 사례 @ Community Open Camp with Microsoft
OpenStack 개요 및 활용 사례 @ Community Open Camp with MicrosoftOpenStack 개요 및 활용 사례 @ Community Open Camp with Microsoft
OpenStack 개요 및 활용 사례 @ Community Open Camp with Microsoft
 
Room 1 - 2 - Nguyễn Văn Thắng & Dzung Nguyen - Proxmox VE và ZFS over iscsi
Room 1 - 2 - Nguyễn Văn Thắng & Dzung Nguyen - Proxmox VE và ZFS over iscsiRoom 1 - 2 - Nguyễn Văn Thắng & Dzung Nguyen - Proxmox VE và ZFS over iscsi
Room 1 - 2 - Nguyễn Văn Thắng & Dzung Nguyen - Proxmox VE và ZFS over iscsi
 
Service Function Chaining in Openstack Neutron
Service Function Chaining in Openstack NeutronService Function Chaining in Openstack Neutron
Service Function Chaining in Openstack Neutron
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Real-Time Data Flows with Apache NiFi
Real-Time Data Flows with Apache NiFiReal-Time Data Flows with Apache NiFi
Real-Time Data Flows with Apache NiFi
 
Lenovo HPC Strategy Update
Lenovo HPC Strategy UpdateLenovo HPC Strategy Update
Lenovo HPC Strategy Update
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debate
 
[기술 트렌드] Gartner 선정 10대 전략 기술
[기술 트렌드] Gartner 선정 10대 전략 기술[기술 트렌드] Gartner 선정 10대 전략 기술
[기술 트렌드] Gartner 선정 10대 전략 기술
 
Deploying and Managing Hadoop Clusters with AMBARI
Deploying and Managing Hadoop Clusters with AMBARIDeploying and Managing Hadoop Clusters with AMBARI
Deploying and Managing Hadoop Clusters with AMBARI
 
Kubeflow Pipelines (with Tekton)
Kubeflow Pipelines (with Tekton)Kubeflow Pipelines (with Tekton)
Kubeflow Pipelines (with Tekton)
 

Viewers also liked

Embracing Collaborative Design
Embracing Collaborative DesignEmbracing Collaborative Design
Embracing Collaborative Design
Memi Beltrame
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
Ashlimarie
 
CMS as a Marketing Tool - Drupal
CMS as a Marketing Tool - DrupalCMS as a Marketing Tool - Drupal
CMS as a Marketing Tool - Drupal
Elias Dabbas
 
UX development – Drupaljam 2015
UX development – Drupaljam 2015UX development – Drupaljam 2015
UX development – Drupaljam 2015
Wunderkraut
 
The six key steps to AEM architecture
The six key steps to AEM architectureThe six key steps to AEM architecture
The six key steps to AEM architecture
Ashokkumar T A
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component Development
Gabriel Walt
 

Viewers also liked (6)

Embracing Collaborative Design
Embracing Collaborative DesignEmbracing Collaborative Design
Embracing Collaborative Design
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
CMS as a Marketing Tool - Drupal
CMS as a Marketing Tool - DrupalCMS as a Marketing Tool - Drupal
CMS as a Marketing Tool - Drupal
 
UX development – Drupaljam 2015
UX development – Drupaljam 2015UX development – Drupaljam 2015
UX development – Drupaljam 2015
 
The six key steps to AEM architecture
The six key steps to AEM architectureThe six key steps to AEM architecture
The six key steps to AEM architecture
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component Development
 

Similar to Third party libraries and OSGi - a complicated relationship

Introduction to OSGi
Introduction to OSGiIntroduction to OSGi
Introduction to OSGi
pradeepfn
 
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-librariesIcsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
ICS User Group
 
Eclipse_Building_Blocks
Eclipse_Building_BlocksEclipse_Building_Blocks
Eclipse_Building_Blocks
Rahul Shukla
 
Introduction to OSGi - Part-1
Introduction to OSGi - Part-1Introduction to OSGi - Part-1
Introduction to OSGi - Part-1
kshanth2101
 
Fantastic four machine_learning_java_libraries
Fantastic four machine_learning_java_librariesFantastic four machine_learning_java_libraries
Fantastic four machine_learning_java_libraries
Aegis Software Canada
 
Modularity problems
Modularity  problemsModularity  problems
Modularity problems
Юлия Коваленко
 
Top 10 Libraries of Java.pptx
Top 10 Libraries of Java.pptxTop 10 Libraries of Java.pptx
Top 10 Libraries of Java.pptx
SudhanshiBakre1
 
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
JAX London
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
njbartlett
 
Frc java5-8andeclipse
Frc java5-8andeclipseFrc java5-8andeclipse
Frc java5-8andeclipse
Jeanne Boyarsky
 
Javascript And CSS Libraries
Javascript And CSS LibrariesJavascript And CSS Libraries
Javascript And CSS Libraries
ProdigyView
 
composer_talk_20160209
composer_talk_20160209composer_talk_20160209
composer_talk_20160209
Bradley Wogsland
 
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
Deepak Chandani
 
OSGi & Blueprint
OSGi & BlueprintOSGi & Blueprint
OSGi & Blueprint
Kara Satish Kumar
 
OSGi Enablement For Apache Tuscany
OSGi Enablement For Apache TuscanyOSGi Enablement For Apache Tuscany
OSGi Enablement For Apache Tuscany
Raymond Feng
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi Webinar
WSO2
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
mfrancis
 
Monoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is ModularityMonoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is Modularity
Graham Charters
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVA
KUNAL GADHIA
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
vmadan89
 

Similar to Third party libraries and OSGi - a complicated relationship (20)

Introduction to OSGi
Introduction to OSGiIntroduction to OSGi
Introduction to OSGi
 
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-librariesIcsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
Icsug conf 14_dev02_xpages-coffe-from-a-friend-using-third-party-java-libraries
 
Eclipse_Building_Blocks
Eclipse_Building_BlocksEclipse_Building_Blocks
Eclipse_Building_Blocks
 
Introduction to OSGi - Part-1
Introduction to OSGi - Part-1Introduction to OSGi - Part-1
Introduction to OSGi - Part-1
 
Fantastic four machine_learning_java_libraries
Fantastic four machine_learning_java_librariesFantastic four machine_learning_java_libraries
Fantastic four machine_learning_java_libraries
 
Modularity problems
Modularity  problemsModularity  problems
Modularity problems
 
Top 10 Libraries of Java.pptx
Top 10 Libraries of Java.pptxTop 10 Libraries of Java.pptx
Top 10 Libraries of Java.pptx
 
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
 
Frc java5-8andeclipse
Frc java5-8andeclipseFrc java5-8andeclipse
Frc java5-8andeclipse
 
Javascript And CSS Libraries
Javascript And CSS LibrariesJavascript And CSS Libraries
Javascript And CSS Libraries
 
composer_talk_20160209
composer_talk_20160209composer_talk_20160209
composer_talk_20160209
 
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
 
OSGi & Blueprint
OSGi & BlueprintOSGi & Blueprint
OSGi & Blueprint
 
OSGi Enablement For Apache Tuscany
OSGi Enablement For Apache TuscanyOSGi Enablement For Apache Tuscany
OSGi Enablement For Apache Tuscany
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi Webinar
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
 
Monoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is ModularityMonoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is Modularity
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVA
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 

Recently uploaded

Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
k4ncd0z
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
Tarandeep Singh
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
APNIC
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
APNIC
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
thezot
 

Recently uploaded (12)

Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
 

Third party libraries and OSGi - a complicated relationship

  • 1. Third-Party Libraries and OSGi a complicated relationship
  • 2. Senior Solution Architect 6 years of WCMS experience Loves working with Java (script) Sascha Brinkmann Hobbies: Biking, Hiking, Travelling Contact: sb@eggs.de @sasusu About Me
  • 4. About Us 1984 Foundation year 2004 Adobe Business Partner 2005 Adobe Authorized Training Center 2010 Winner of Siemens top+ Award 2014 100% Adobe focussed for 10 years Employees: 45 Located: Munich, Germany Happy Adobe customers: +40
  • 5. ➢ Motivation ➢ Challenge ➢ Analysis Possible Strategies ➢ Tips & Tricks ➢ Conclusion ➢ OSGi Basics Table of Content
  • 6. Integration of AEM into a heterogeneous IT systems landscape with interfaces to various subsystems. AEM LDAP / Active Directory Microsoft SharePoint Microsoft Enterprise Search (FAST) IBM Lotus Notes Domino SAP / Hybris SQL Database Rest- and Webservices Amazon S3 Facbook Twitter YouTube Brightcove Email FTP Google Search Appliance Motivation InternalExternal
  • 7. Our work is all about solving business problems. Solutions for almost every technical challenge are provided by third party libraries from the central maven repository. Motivation
  • 8. How can I use various types of third party libraries and frameworks within my projects? Challenge
  • 10. OSGi Basics - Apache Felix Apache Felix is a fundamental element of the technology stack of the Adobe Experience Manager (AEM). It provides the environment for all Java written components. Java Content Repository (CRX) Apache Sling Adobe Experience Manager (WCMS) OSGi Runtime (Apache Felix)
  • 11. one Classloader for the whole Java application one Classloader per OSGi bundle Bundle B Bundle A Bundle C Bundle D Library A Library C Library B Library D OSGi Basics - Classloading Key difference between traditional Java Applications and Applications running within OSGi.
  • 13. Bundle Identifier Packages provided to other bundles Packages Consumed from other bundles OSGi Basics - Bundle Manifest The manifest file is a set of OSGi specific headers. It defines how to deploy and run the OSGi bundle.
  • 14. Apache Felix Bundle Plugin Dependency to other Bundle OSGi Basics - Maven POM Config The Apache Felix Bundle Plugin for Maven enhances artifacts with the bundle manifest.
  • 15. Strategies to use third party libraries First Option Embedding Libraries Second Option Libraries as Bundles
  • 16. First Option Embedding Libraries Allrightsreserved Nanuku, Fiji
  • 17. Bundle Manifest First Option - Embedding Libraries Same classloader for external libraries and bundle classes.
  • 18. Libraries embedded within the bundle First Option - Embedding Libraries Bundle Manifest
  • 19. Dependency to be embedded with implicit scope ‘compile’ Instruction to embed all dependencies with scope compile & runtime First Option - Embedding Libraries Maven POM snippet
  • 20. Apache Felix needs to resolve all dependencies prior to start the bundle. First Option - Embedding Libraries
  • 21. Transitive dependencies are not embedded automatically! First Option - Embedding Libraries Maven Artifact Dependency Tree
  • 22. A large number of embedded libraries within your OSGi bundle ... … can cause an even larger number of unresolveable packages. First Option - Embedding Libraries
  • 23. Additional dependencies to resolve the missing packages. Instruction containing a list of packages which should be ignored by Apache Felix. Instruction to embed transitive dependencies First Option - Embedding Libraries Further configuration parameters to adjust the generated manifest.
  • 24. First Option - Embedding Libraries The result has to be that the bundle is deployed with no unresolved packages and activated successfully Bundle is activated and ready for operation.
  • 25. Advantages ➢ Easy to archive ➢ Usage is encapsulated ➢ Same classloader between class-files and library Disadvantages ➢ Usage is limited to bundle ➢ No separation of concerns ➢ Multiple usage in different bundles increase the memory consumption and the probability of conflicts when sharing references First Option - Embedding Libraries
  • 26. Second Option Libraries as Bundle Allrightsreserved Hollywood, USA
  • 27. Transformation or encapsulation of Java libraries to turn them into OSGi bundles Searching for existing OSGi bundles End of availability after September 2014 Just kicked off Successor Commandline Tool Bundle Plugin Second Option - Libraries as Bundle
  • 28. Second Option - Libraries as Bundle Advantages ➢ Functionality can be shared across multiple bundles ➢ Separation of concerns ➢ Bundles can be updated independently ➢ Class reference conflicts can be avoided, as there is only one shared source Disadvantages ➢ Most libraries are not available as OSGi bundles ➢ Dynamic class resolving via Class.forName() or reflection is difficult
  • 29. OSGi Basics - Bundles vs. Fragments the bundle where the fragment is attached to Bundle Fragment Has its own classloader and lifecycle. Can be referenced by other bundles. Is part of another Bundle and utilizes its classloader. Extends the imports and exports of the host bundle. Fragment Manifest
  • 30. Hibernate ORM is an object-relational mapping library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Entities and DAO JDBC DriverHibernate Core Bundle Consumes Entity Bridge Consumes Extends Extends OSGi Fragment OSGi Bundle Second Option - Libraries as Bundle
  • 31. The system bundle is a special bundle that represents the OSGi framework itself, from within that framework. Characteristics ➢ Bundle ID 0 ➢ It exports packages from the JRE ➢ Only packages which are available in any JVM are provided. All java* packages for example javax.swing, org.w3c.com etc. are excluded ➢ Exports the OSGi framework packages such as org.osgi.framework OSGi Basics - System Bundle
  • 32. Apache Axis2 is a Web Services / SOAP / WSDL engine and the successor to the widely used Apache Axis SOAP stack. System Bundle Axis 2 FragmentExtends Entities and DAO Consumes Second Option - Libraries as Bundle OSGi Fragment OSGi Bundle
  • 33. Some third party libraries make us of the current thread classloader that definitely runs within another context than the bundle class loader. To allow the third party library to access bundle resources, the current thread classloader has to be replaced for this action. Dealing with Class Loader Issues
  • 34. ➢ There is no best practice. Each framework needs its individual solution! ➢ Working with third party libraries is like a box of chocolates - you never know what you're gonna get. ➢ You know it’s working when you see it’s working! ➢ Most frameworks don’t support OSGi or are not properly tested with Apache Felix. ➢ It needs a community with support from Adobe sharing experiences and best practices including the use of third party libraries. Conclusion
  • 35. Your chance for remarks and questions! All rights reserved Los Angeles, USA
  • 37. Presentation http://www.eggs.de/connectwebex2014 The Author Sascha Brinkmann - sb@eggs.de Sales Representative Martin Brösamle - mb@eggs.de Get in Touch
  • 38. Terms of Use This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License All photos copyright © Sascha Brinkmann, all rights reserved.