2. Presenting today… OSGi Open Services Gateway initiative, since 1999 Initially targeted embedded devices OSGi containers: Felix, Equinox, Knoperfish, Concierge Most known use is Eclipse IDE Apache Karaf Apache OSGi runtime runs on any OSGi container Born inside Service Mix, now is Top level project Standard runtime for Geronimo, Service Mix, Sling Ecosystem for deploying OSGi/EE applications
4. Introduction to OSGi Problem Solution Architecture Tools OSGi in the Enterprise Questions & Answers
5. The problemaspects Dependency management Version Hell Conflicting dependencies Class loading issues Dynamic behavior Difficulties to control component lifecycle Lack of a pure modularity solution
6. The problemsDependency management Large number of transitive dependencies Conflicts among among dependencies Class loading issues Boot class loader JTA System class loader JTA war war
7. The problemsDynamic Behavior Components & Services need come and go Components need to get updated / replaced Components need to started / stopped Real life examples Eclipse IDE Adding/Removing “plugins” Ebay Multiple version of the same component
8. The problemsModularity The JVM does not address need for modularity The class path paradox The jar is a “black box” No dependencies & No version The pastitsioexample The “WORA” promise was repeatedly failed JavaBeans EJBs Has the quest for modularity failed ? Project Jigsaw will be shipped with JDK 8 OSGi is already here
9. The OSGi SolutionOverview A Layer … A deployment infrastructure Bundles = class + metadata (import/exports) Bundles have a lifecycle Bundles have their own Class loader Class loading delegation between dependant bundles A service platform Defines a Service Registry Bundles provide or request services The service can “come and go”
11. Architecture Execution Environment The Runtime where the bundles live A bundle can bound to an Execution Environment JRE-1.5 J JRE-1.3 OSGi/Minimum-1.0
12. Architecture Module Layer Bundles import, export or have private packages Each package can be assigned version range A bundle (fragment)can be attached to a bundle (host) Export Package javax.transaction 1.01B Import Package javax.transaction [1.0,1.1) Export Package javax.transaction 1.1 Bundle Name: JMS API Import Package: javax.transaction Export Package: javax.jms Bundle-RequiredExecutionEnvironment: J2SE-1.5
15. Architecture Service Layer Each bundle can register or lookup a Service Each service corresponds to one or more interfaces Each service can be assigned and queried using properties Service Registry register lookup ServiceProvider Service Consumer
16. OSGi Tools working with services Managing Services programmatically Using the OSGi blueprint Spring Dynamic Modules Apache Aries Felix i-Pojo
17. OSGi Tools creating bundles Manually providing the MANIFEST.MF Bnd command line tool Maven Bundle Plug-in Spring’s Bundlor Maven plug-in flavor Command line flavor
18. OSGi Tools OSGi Bundle Repository Simplifies the provisioning of bundles The “apt-get install” for the OSGi Integrates with public repositories Eclipse Orbit Spring’s Enterprise Bundle Repository
21. Apache Karafagenda Overview Shell Console Deployer Features Concept Security Logging Service Demo Questions and Answers
22. Apache KarafOverview Born as Service Mix Kernel project Grown inside Apache Felix project Become a Top Level Apache project last year
23. Apache KarafShell Console Extensible Auto complete & coloring support Rich command set, covers most OSGi concepts/services Special commands for the development phase
24. Apache KarafDeployer File Scanner War Transformer Configuration Bundles Transformation Spring Transformer Blueprint Transformer Configuration Admin URL Handler Maven Handler HTTP Handler Hot deployment Large number of supported artifacts Large number of installation mediums OBR Handler
25. Apache KarafFeatures Concept A Karaf feature is a descriptor which defines… A set of bundles A set of configurations A set of other features Allows provisioning of applications Maven integration OBR integration
27. Apache KarafSecurity JAAS based security Multiple login module implementations Property Login Module JDBC Login Module LDAP Login Module Command line support Provisioning of any JASS realm Add users roles etc
28. Apache KarafLogging Service Centralized Logging configuration Supports most logging APIs Log4J Slf4j Commons Logging Command line support clear, display, tail change threshold etc. OSGi integration per bundle appender, osgi specific attributes