Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tales from the OSGi trenches (2012 short form edition)
1. Ta l e s f r o m t h e
OSGi
t r e n c h e s
Adobe CQ5: a real-life OSGi case study
Bertrand Delacrétaz
Senior Developer, R&D, Adobe Digital Marketing Systems
Apache Software Foundation Member and (current) Director
http://grep.codeconsult.ch - @bdelacretaz - bdelacretaz@apache.org
OSGi Alliance Community Event, Ludwigsburg, October 2012
slides revision: 2012-10-22
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
2. What?
Share our experience using OSGi
(Apache Felix) as the foundation
of Adobe CQ5.
More than five years working with OSGi, very
high impact on developers, customers, service
people, mostly in a positive way.
OSGi is no silver bullet either.
silve
r
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
3. What?
the
GOOD the
BAD Just my own,
the
personal
UGLY opinion as a
software
developer...
symbols by ppdigital , o0o0xmods0o0oon and clarita, on morguefile.com
Tales from the OSGitrenches OSGi Alliance Community Event 2012
Bertrand Delacrétaz
4. job BTW
s-b ...w
Trenches? ase e a
l@a re h
do irin
Web Content Management be g!
and Digital Marketing system. .co
Includes its own JCR content store. m
About 200 OSGi bundles.
Install instructions fit in a tweet.
www.adobe.com/products/cq.html Built on Apache Sling, Apache
http://jackrabbit.apache.org Felix and Apache Jackrabbit
http://felix.apache.org
http://sling.apache.org
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
5. What we use from OSGi
Bundles (using Maven plugins)
Lifecycle, Service Tracker
Configurations and Felix Web Console
Declarative Services (using Maven plugins)
Sling’s installer module (like fileinstall, using JCR)
Log, HTTP, Event services, JMX
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
6. Famous quotes
the short version
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
7. Famous Quotes, #2
“Each (OSGi) bundle can serve as a micro
application, having it's own lifecycle,
having it's own citizens and each bundle
can carefully decide which objects to
expose to the outside world”
Peter Rietzler
http://peterrietzler.blogspot.com/2008/12/is-osgi-going-
to-become-next-ejb-bubble.html
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
8. Famous Quotes, #4
“The lifecycle model of OSGi makes life
complicated. Actually, tracking services
and managing all the aspects of what to
do when services come and go is nasty”
Peter Rietzler
http://peterrietzler.blogspot.com/2008/12/is-osgi-going-
to-become-next-ejb-bubble.html
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
9. Famous Quotes, #6
“OSGi makes "impossible" things easy:
hot deploy/upgrade, service discovery, ...
and trivial things hard: hibernate, tag
libraries, even deploying a simple war!”
But, for the first time in my
career, I see software reusability
that works: service reusability.
Filippo Diotalevi
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
10. The Good
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
11. Modularity
OSGi bundle
Classloading
distinct from Public packages
class visibility. Metadata
Private packages
OSGi bundles as reusable components.
Dynamic setup and updates that work.
At last! Matchless picture: Alvimann on morguefile.com
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
12. Declarative Services
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
13. Clean OSGi APIs
Just a few
basic examples...
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
14. Dynamic load/unload
Just copy bundle jar
to Sling’s JCR
repository (WebDAV)
Bundle activated
and started.
(using Sling’s installer module)
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
15. Plugins for everything
Content editors based on
Servlets JCR node properties
Mime-type based handlers
Debugging/monitoring tools
Content renderers and decorators
Legacy integration gateways
Mail and messaging services
etc, etc...
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
16. The Bad
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
17. Granularity?
How many bundles? Services?
CQ5: about 200 bundles, 1000 services
How to handle “implementation
details” libraries.
Extra bundles or private packages?
Strict version management required.
Are we there yet?
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
18. Integration testing...
V4.22
V1.03 V3.21
V3.22
V4.2
V5.11 V5.3 V2.13
V6.54
V1.05
In-system V1.03
V1.11 V6.4
testing? V3.4
V3.2
V6.4
V3.2 V5.43
V2.4
V5.6
but when done!
Tales from theOSGitrenches OSGi Alliance Community Event 2012
Bertrand Delacrétaz
19. Testing options
Unit testing In-framework Integration
testing testing
JUnit, Pax Exam,
TestNG, Sling testing tools, Start application
Mocks, etc. and test it “from
etc.. the outside”.
See Apache Sling’s
launchpad/testing
module
Necessary Relatively new
but usually tools, can Much slower
not sufficient. be slow but ok for actual
Mocks can integration testing
be painful
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
20. I want my...
Spring Guice
App Server
J2EE do you really need it?
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
21. The Ugly
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
22. Asynchronicity...
7 14
V3.2111 17
V4.22 V4.5 V7.4
1V1.03 15
V3.22
11 V4.2 3
V5.11
19 V5.3 2 V2.13 10
V6.54
5 Threading 16
V1.05
“unpredictable” 6
V1.11 V6.4 18
V1.03
13 issues?
startup order V3.4 8
V6.4
12 V3.2
4
19 V3.2 9
V5.43
V2.4
Is the system ready now?
20
V5.6
Mostly from Declarative Services, not OSGi itself.
Tales from the OSGitrenches OSGi Alliance Community Event 2012
Bertrand Delacrétaz
24. The Summary
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
25. My vision back in 2009...
√Developers got used to it (and
read the book).
√Frameworks and tools improved.
Distributed OSGi? Maybe.
√Customers understand OSGi and like it..
√Apache Sling paved the way.
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz
26. job BTW
s-b ...w
Conclusions ase e a
l@a re h
do irin
be g!
.co
Modularity. modularity. modularity. m
OSGi fosters better structured code
Dynamic services and plugins FTW!
Tooling ... getting better all the time
OSGi is often unfamiliar / unusual
Asynchronous behavior can be
problematic (declarative services)
OSGitrenches
Tales from the
OSGi Alliance Community Event 2012
Bertrand Delacrétaz