OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune, India]


Published on

Session Presented at 5th IndicThreads.com Conference On Java held on 10-11 December 2010 in Pune, India
WEB: http://J10.IndicThreads.com

Session Abstract

OSGi continues to take over the landscape of Java-based infrastructure products ranging from Integrated Development Environment (like Eclipse), Application servers to enterprise Java systems and now setting horizons at Cloud infrastructures.

In this talk we will see how and why OSGi matters for enterprise Java systems. As a dynamic module system, the session will show how OSGi allows developers to modularize applications to create truly reusable components for enterprise scale. Features like strong modularity, versioning support, declarative services, the run-time ability to add, remove & update modules to build server-side enterprise applications will be discussed.

The session will deep dive into what’s new in OSGi enterprise specifications and how persistence, transaction and dependency injection support like Blueprint Container services addresses Enterprise use cases. The session will illustrate how OSGi Remote Services coupled with SCA configuration services enables creation of distributed, federated service model for heterogeneous systems. Along with above enterprise specifications, specific implementations like Apache Aries will also be highlighted.

The talk will also brief how OSGi is poised to one of key technology for Cloud computing where software components and services can be deployed, managed, dynamically provisioned with enterprise security within cloud based computing infrastructures.
Takeaways for the Audience In this session, audience will learn about:
(a) An overall understanding to view OSGi as THE module system for Java.
(b) How OSGi is poised to be key enabler for enterprise applications whether on servers, or on the cloud.
(c) How OSGi Enterprise specifications can be used in enterprise business applications.
(d) A better understanding of how OSGI will be key technology in Cloud infrastructures

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Lets take a vote.. How many people have heard of OSGi, Used OSGi
  • OSGi For Java Infrastructures [5th IndicThreads Conference On Java 2010, Pune, India]

    1. 1. Why OSGi matters for Enterprise Java Infrastructures Santosh Kumar
    2. 2. Agenda <ul><li>Introduction to OSGi </li></ul><ul><li>Why is OSGi technology important </li></ul><ul><li>How OSGi matters for Infrastructure </li></ul><ul><li>OSGi Enterprise spec </li></ul><ul><li>OSGi in Cloud </li></ul><ul><li>Q&A </li></ul>
    3. 3. Take away from this session <ul><li>Overall understanding to view OSGi as THE module system for Java </li></ul><ul><li>Understanding of what this OSGi Enterprise spec is all about </li></ul><ul><li>Should be able to start experimenting with it themselves using one of the available implementations </li></ul>OSGi Key for Infrastructure
    4. 4. What is OSGi <ul><li>OSGi - Open Services Gateway initiative </li></ul><ul><ul><li>Technology is the dynamic module system for Java™. </li></ul></ul><ul><ul><li>Provides a service-oriented, component-based environment for developers </li></ul></ul><ul><ul><li>Offers standardized ways to manage the software lifecycle. </li></ul></ul><ul><ul><li>Support for building modular dynamic and extensible systems </li></ul></ul>OSGi Consider as Universal Middleware
    5. 5. Lets put things in perspective… <ul><li>The Complexity & Scale of Software requires: </li></ul><ul><ul><li>1. Service Oriented </li></ul></ul>As complexity and size increases Need for higher level of abstract programming
    6. 6. Why OSGi? <ul><ul><li>2. Modularity </li></ul></ul><ul><ul><ul><li>Java Platform Modularity </li></ul></ul></ul><ul><ul><ul><ul><li>Classes encapsulate data </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Packages contain classes </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Jars contain packages </li></ul></ul></ul></ul><ul><ul><ul><li>Class visibility: </li></ul></ul></ul><ul><ul><ul><ul><li>private, package private, protected,public </li></ul></ul></ul></ul><ul><ul><ul><li>No “jar scoped” access modifiers. </li></ul></ul></ul><ul><ul><ul><li>No means for a jar to declare its dependencies. </li></ul></ul></ul><ul><ul><ul><li>No versioning. </li></ul></ul></ul><ul><ul><ul><li>Jars have no modularization characteristics </li></ul></ul></ul><ul><ul><ul><ul><li>At runtime, global classpath to search </li></ul></ul></ul></ul>Jar as unit does not have modularity
    7. 7. Why OSGi? <ul><li>3. Versioning </li></ul><ul><ul><li>Enterprise Apps have isolated classpaths but… </li></ul></ul><ul><ul><li>Across apps - each archive typically contains all the libraries required by the application </li></ul></ul><ul><ul><ul><ul><li>Common libraries/frameworks get installed with each application </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Multiple copies of libraries in memory </li></ul></ul></ul></ul><ul><ul><li>Within apps - 3rd party libraries consume other libraries leading to version conflicts </li></ul></ul>
    8. 8. Overall Architecture = service Hardware Driver Driver Driver OSGi as module system Operating System Java OSGi Framework Module (Bundle)
    9. 9. OSGi –The Dynamic Module System for Java <ul><li>OSGi specifies a modular architecture for dynamic component based systems </li></ul><ul><li>• Execution Environment </li></ul><ul><li>• Module Layer </li></ul><ul><li>• Life Cycle Layer </li></ul><ul><li>• Service Layer </li></ul>OSGi introduces Bundles as modules
    10. 10. Module layer <ul><li>Bundle - unit of module </li></ul><ul><li>Packaged as JAR - classes + manifest + resources </li></ul><ul><li>- Versioning support </li></ul><ul><li> - Dependency specification </li></ul><ul><li>- JAR with MIME type : application/vnd.osgi.bundle </li></ul><ul><li>OSGi enforces modularity in bundles </li></ul>Bundle as module represents separation of concerns
    11. 11. OSGi ClassLoading <ul><li>Each bundle has its own classloader / classpath. More efficient for large systems </li></ul><ul><li>Multiple versions of bundles supported concurrently </li></ul>
    12. 12. Service Layer <ul><li>Defines a publish/find/bind service model </li></ul><ul><ul><li>Fully dynamic </li></ul></ul><ul><ul><li>Intra VM </li></ul></ul><ul><ul><li>service registry </li></ul></ul><ul><li>A service is a normal Java object published under one or more Java interfaces with additional metadata with the service registry </li></ul><ul><li>Bundles can register services, search for them, or receive notifications when their registration state changes. </li></ul><ul><li>Service lifecycle is highly dynamic </li></ul><ul><ul><li>Service may be published or unpublished at any time </li></ul></ul>
    13. 13. Service Orientation Service Provider Service Registry Service Consumer Service Description publish find interact OSGi intrinsically supports SOA
    14. 14. Life Cycle <ul><li>API to control the security and life cycle operations of bundles </li></ul><ul><li>Install, uninstall, start, stop bundles dynamic without restarting applications </li></ul>
    15. 15. What does the OSGi Framework provide? <ul><li>Horizontal Software Integration Platform </li></ul><ul><li>Component Oriented Architecture </li></ul><ul><ul><li>Module (Bundles) </li></ul></ul><ul><ul><li>Package sharing and version management </li></ul></ul><ul><ul><li>Life-cycle management and notification (events) </li></ul></ul><ul><li>Service Oriented Architecture </li></ul><ul><ul><li>Publish/find/bind intra-VM service model </li></ul></ul><ul><ul><li>Life-cycle notification (events) </li></ul></ul>
    16. 16. Framework Features <ul><li>Runs multiple applications and services </li></ul><ul><li>Single VM instance </li></ul><ul><li>Separate class loader per bundle </li></ul><ul><ul><li>Class loader network </li></ul></ul><ul><ul><li>Independent namespaces </li></ul></ul><ul><ul><li>Class sharing at the Java package level </li></ul></ul><ul><li>Lifecycle management of bundles </li></ul><ul><li>Intra VM publish/find/bind service model </li></ul><ul><li>Java Permissions to secure framework </li></ul>
    17. 17. Where OSGi is used <ul><li>Equinox </li></ul><ul><ul><li>Reference implementation of core framework and various services </li></ul></ul><ul><ul><li>Base runtime for all of Eclipse (rich client, server side and embedded) </li></ul></ul><ul><li>Felix - Ships with GlassFish </li></ul><ul><li>Application servers : Websphere, JBoss etc </li></ul><ul><li>SOA Virtualization Platform : TIBCO Active Matrix </li></ul><ul><ul><li>widespread use in desktop and servers </li></ul></ul>
    18. 18. Does Enterprise Java need OSGi? <ul><li>Current challenges </li></ul><ul><ul><li>Lots of Libraries To Manage </li></ul></ul><ul><ul><li>Designed for Extensibility </li></ul></ul><ul><ul><li>Dynamic Deployment, Uptime </li></ul></ul><ul><ul><li>Well-defined coherent modules </li></ul></ul><ul><ul><li>Simplify unit of reuse </li></ul></ul>
    19. 19. OSGI in Enterprise <ul><li>Integration of established Java Enterprise Edition technologies into an OSGi Environment </li></ul><ul><li>Multiple, interoperable, dependency injection based component models </li></ul><ul><li>Distributed service model for multiple service platforms and external heterogeneous systems </li></ul><ul><li>Database persistence support </li></ul><ul><li>Enterprise-class life cycle and configuration management </li></ul>
    20. 20. OSGi Enterprise Spec V4.2 <ul><li>Brings Enterprise technologies and OSGi together - OSGi Enterprise Expert Group (EEG) </li></ul><ul><li>Using existing Java SE/EE specifications: </li></ul><ul><ul><li>JTA, JPA, JNDI, JMX, WebApps, SCA </li></ul></ul><ul><ul><li>Framework integrates with the Java EE programming model </li></ul></ul><ul><li>Adds Spring-derived component model and dependency injection container – Blueprint Container </li></ul>Embeded Desktop Enterprise
    21. 21. What’s happening with OSGi EE <ul><li>Apache “Aries” - new Apache incubator project </li></ul><ul><ul><li>deliver set of pluggable Java components enabling an enterprise OSGi application programming model. </li></ul></ul><ul><li>Eclipse Enterprise Modules (“Gemini”) </li></ul><ul><ul><li>collection of subprojects, each of which is an implementation or integration of an enterprise-level technology </li></ul></ul><ul><li>Virgo - Dynamic Enterprise Application Platform </li></ul><ul><ul><li>provide a runtime platform for development of server-side enterprise applications </li></ul></ul>
    22. 22. Blueprint Components and Service <ul><li>Specifies a Dependency Injection container, standardizing established Spring conventions </li></ul><ul><li>Specifies components can be wired together within a bundle </li></ul><ul><li>Components can be published as services to the service registry </li></ul><ul><li>Components configuration and dependencies injected them Blueprint component container ( part of the runtime environment) </li></ul><ul><li>Configuration and dependencies declared in XML “module blueprint” </li></ul>
    23. 23. Blueprint Components and Service <ul><li>• Extended for OSGi: publishes and consumes components as OSGi services </li></ul><ul><li>Blueprint standardizes the configuration metadata, and brings governance to the specification of the component model. </li></ul><ul><li>Simplifies unit test outside either Java EE or OSGi r/t. </li></ul><ul><li>The Blueprint DI container is a part of the server runtime (compared to Spring which is part of the application.) </li></ul>dependencies injected publishes service consumes service Blueprint managed bundle Blueprint managed bundle Blueprint Components ( POJO)
    24. 24. The Java Persistence API <ul><li>JPA is a POJO based Object Relational Mapping Framework </li></ul><ul><li>– defines an API for persisting </li></ul><ul><li>objects into a Relational Database </li></ul><ul><li>– API for retrieving Objects </li></ul><ul><li>from the database </li></ul><ul><li>JPA - rich API for mapping </li></ul><ul><li>arbitrarily complex objects to the underlying database tables </li></ul>
    25. 25. The JPA Service Specification <ul><li>An OSGi specification for making JPA work in an OSGi framework </li></ul><ul><li>Core concepts: </li></ul><ul><li>> Persistence Bundle : An OSGi bundle containing managed classes a persistence descriptor and a Meta-Persistence manifest header </li></ul><ul><li>> Meta-Persistence header : – A header that defines the locations of persistence descriptors in a bundle </li></ul><ul><li>> EntityManagerFactory service : An EntityManagerFactory available as an OSGi service </li></ul><ul><li>> Persistence Client : A bundle that makes use of an EntityManagerFactory service. </li></ul><ul><li>> EntityManagerFactory builder : A factory for incomplete persistence units </li></ul>
    26. 26. Remote Services <ul><li>Extending the OSGi framework to configure existing distributed computing software systems </li></ul><ul><li>Describes how to distribute OSGi services </li></ul><ul><li>Ability for OSGi services to invoke services running in other JVMs </li></ul><ul><li>Support enterprise application topologies for availability, reliability, and scalability </li></ul>Enables Distributed OSGi
    27. 27. Web Applications Specification <ul><li>Defines how to support the Servlet 2.5 and JavaServer Pages (JSP) 2.1 specifications in OSGi </li></ul><ul><li>Provide deployment of existing and new web applications to Servlet containers operating on the OSGi service platform </li></ul><ul><li>Specification defines the Web Application Bundle, a bundle that performs the same role as the WAR in Java EE </li></ul>
    28. 28. Web Applications Specification <ul><li>WAB uses the OSGi life cycle and class/resource loading rules instead of the standard Java EE environment </li></ul><ul><li>Details web application packaged as a WAR may be installed into an OSGi Service Platform </li></ul>
    29. 29. SCA Configuration <ul><li>Provides an assembly model for distributed applications and systems using a service oriented architecture </li></ul><ul><li>Components that are assembled can be written in different technologies for example Java EE, BPEL, C++, and scripting languages </li></ul><ul><li>Execute on different machines, and can communicate through different protocols and technologies </li></ul><ul><li>Declarative application metadata to enable reflection of an SCA component type definition </li></ul>
    30. 30. SCA Configuration <ul><li>Remote Services specification provides an extendable model for configuration types </li></ul><ul><li>SCA Configuration Type Specification defines such a configuration type </li></ul>
    31. 31. OSGi on Cloud <ul><li>Investigation underway to find possibility of using OSGi in the context of cloud computing ( RFP 133 Cloud Computing) </li></ul>IaaS Infrastructure as a Service PaaS Platform as a Service SaaS Software as a Service
    32. 32. OSGi on Cloud <ul><li>Value of OSGi : ability to address the following </li></ul><ul><li>- Dependency management </li></ul><ul><li>- Provisioning/Configuration (Remote services API) </li></ul><ul><li>- Extensible, modular system </li></ul><ul><li>- Dynamic replacement of components </li></ul>
    33. 33. Conclusion Major Java infrastructures support OSGi modular approach support apps designed & deployed as bundles
    34. 34. Summary OSGi increasingly relevant to Enterprise OSGi and Cloud Synergy having interesting possibilities OSGi Key for Infrastructure OSGi Consider as Universal Middleware Bundle as module represents separation of concerns
    35. 35. References <ul><li>http://www.eclipsezone.com/articles/extensions-vs-services/ </li></ul><ul><li>OSGi Core Spec </li></ul><ul><li>OSGi Enterprise Spec </li></ul><ul><li>http://www.osgi.org </li></ul>
    36. 36. Thank You Santosh Kumar [email_address] That’s all folks Q/A