16
OSGi toolchain from the ground up Matteo Rulli - FlairBit Do not duplicate or distribute without written permission from FlairBit S.r.l. FlairBit S.r.l. - Viale Brigate Bisagno 12/1 - 16129 Genova (GE) - ITALY

OSGi toolchain from the ground up - Matteo Rulli

Embed Size (px)

Citation preview

Page 1: OSGi toolchain from the ground up - Matteo Rulli

OSGi toolchain from the ground up

Matteo Rulli - FlairBit

Do not duplicate or distribute without written permission from FlairBit S.r.l.FlairBit S.r.l. - Viale Brigate Bisagno 12/1 - 16129 Genova (GE) - ITALY

Page 2: OSGi toolchain from the ground up - Matteo Rulli

This Presentation• OSGi and IoT• Pure maven approach• Bndtools• Integrate complex runtimes in bndtools: CXF example• Remote debugging on external runtimes: Karaf

Page 3: OSGi toolchain from the ground up - Matteo Rulli

OSGi enRoute

http://enroute.osgi.org/

Page 4: OSGi toolchain from the ground up - Matteo Rulli

OSGi and IoT• Isolated and loosely coupled services are more easily

distributable across different execution contexts• A reasonable balance between hundreds-of-

processes-μServices and old-fashioned monoliths• Services consistent versioning

• Productivity and sensible code re-use

Page 5: OSGi toolchain from the ground up - Matteo Rulli

Pure maven approach• Let’s illustrate a trivial Cassandra Key-Value store

implementation with bnd, maven and equinox…

https://github.com/mrulli/com.flairbit.eclipsecon.onesix.git

Page 6: OSGi toolchain from the ground up - Matteo Rulli

Pure maven approach: projects• The key-value implemetation: API and provider• The GOGO command• Integration test

• bndrun setting to resolve and launch

Page 7: OSGi toolchain from the ground up - Matteo Rulli

BndtoolsBndtools brings all bnd features inside the Eclipse IDE

• Bundles Resolution• TDD with JUnit• Maven and OBR repo integration• SemVer support

Page 8: OSGi toolchain from the ground up - Matteo Rulli

Apache KarafCurated OSGi runtime with

• Bundles and applications deployment• Bundles Provisioning• Powerfull remote ssh and web OSGi console• Out-of-the-box OSGi support for many technologies

(CXF, Camel, …)• Tons of other very useful features

Page 9: OSGi toolchain from the ground up - Matteo Rulli

Karaf Features in bndtools• Karaf Features:

Page 10: OSGi toolchain from the ground up - Matteo Rulli

CXF Karaf Features• Up to 110 bundles get installed automatically

… manage them with a pom? Boring…

But I want to debug my integration test in my IDE!

Page 11: OSGi toolchain from the ground up - Matteo Rulli

Karaf Features in bnd(tools)Karaf Feature Service is just an OSGi bundle with few dependencies:

karaf@root>bundle:tree-show 26Bundle org.apache.karaf.deployer.features [26] is currently ACTIVEorg.apache.karaf.deployer.features [26]+- org.apache.felix.fileinstall [4]| +- org.apache.felix.configadmin [3]| | +- org.ops4j.pax.logging.pax-logging-api [1]| | +- org.apache.karaf.services.eventadmin [6]| | +- org.apache.felix.metatype [5]| +- org.ops4j.pax.logging.pax-logging-api [1]+- org.ops4j.pax.logging.pax-logging-api [1]+- org.apache.karaf.features.core [8]

+- org.apache.karaf.services.eventadmin [6]+- org.apache.felix.configadmin [3]+- org.ops4j.pax.url.mvn [7] | +- org.apache.felix.configadmin [3]| +- org.ops4j.pax.logging.pax-logging-api [1]+- org.ops4j.pax.logging.pax-logging-api [1]

Page 12: OSGi toolchain from the ground up - Matteo Rulli

Karaf Features in bnd(tools)• So you can install Feature Service in any OSGi distro,

not only within Karaf…

…let’s see this in action.

Page 13: OSGi toolchain from the ground up - Matteo Rulli

Debug Karaf w/ bnd remote agentsRequirements in Karaf for remote debugging w/ bnd:

• mvn:biz.aQute.bnd/biz.aQute.remote.agent/3.3.0• scr feature (just because we use DS in the demo)

https://github.com/mrulli/com.flairbit.examples.karaf-debughttp://enroute.osgi.org/appnotes/bndtools-and-karaf.html

Page 14: OSGi toolchain from the ground up - Matteo Rulli

Conclusions• Toolkits revolving around OSGi are more and more

refined• Robustness of bnd and its derivative works is

enterprise-grade• Thanks to OSGi modularity, interoperability among

OSGi distros can be quite satisfactory• Thanks to OSGi enRoute initiative, OSGi is now

extensively documented

Page 15: OSGi toolchain from the ground up - Matteo Rulli
Page 16: OSGi toolchain from the ground up - Matteo Rulli

Thanks!

e-mail: [email protected]: flairbit.com