is osgi ready for the enterprise
play

Is OSGi Ready for the Enterprise? Ian Robinson IBM Distinguished - PowerPoint PPT Presentation

Is OSGi Ready for the Enterprise? Ian Robinson IBM Distinguished Engineer The Questions Why should we care? Does Enterprise Java need OSGi? Does OSGi need Enterprise Java? March12, 2010 QCon London 2010 Ian Robinson


  1. Is OSGi Ready for the Enterprise? Ian Robinson IBM Distinguished Engineer

  2. The Questions Why should we care? • Does Enterprise Java need OSGi? • Does OSGi need Enterprise Java? March12, 2010 QCon London 2010 Ian Robinson 2

  3. Direct dependency Java EE Web technologies Indirect (soft) dependency Optional dependencies Web Container Servlet JSP Web Services WS Metadata Management JAX-RPC HTTP/SSL JavaMail JAX-WS JAX-RS CDI & DI JASPIC JACC JAXR EJB JMS JTA JPA JSTL JSF Annotations Common StAX JCA Debug SAAJ JAXB JAF IDL JDBC JNDI JAXP JAAS JMX RMI-IIOP Enterprise APIs in Java SE (Required for Java EE) March12, 2010 QCon London 2010 Ian Robinson 3

  4. (capability == bloat)? Direct dependency Java EE Web technologies Indirect (soft) dependency Optional dependencies Web Container Servlet JSP Service Metada ement JACC JAXR Manag CDI & JavaM EJB JASPI HTTP/ RPC Web JMS JAX- JAX- JAX- WS WS JTA JPA JSTL JSF RS SSL ail ta s DI C StAX JCA mon Anno tation Com JAF Deb SAA JAX s ug J B IDL JDBC JNDI JAXP JAAS JMX RMI-IIOP Enterprise APIs in Java SE (Required for Java EE) User Registries Event Mgmt HTTP Session Replication Connection Management Persistence Providers Admin Console Logging and Tracing DataSources Messaging Engines Security MBean Server and scripting HTTP Serving High Availability Transaction Logging Transport Channels Workload Management and routing Management and Recovery Policy and SLA Thread management Classloading Provisioning Monitoring Configuration mgmt … March12, 2010 QCon London 2010 Ian Robinson 4

  5. Beyond Java EE… Direct dependency Java EE Web technologies Indirect (soft) dependency Optional dependencies Dynamic Batch Telephony Web Container BPM Servlet JSP Scripting Web Services WS Metadata Management JavaMail JAX-RS JAX-RPC JAX-WS JACC JAXR JASPIC HTTP/SSL CDI & DI JMS JTA JPA EJB JSTL JSF Business Complex Event SCA Rules Processing Common Annotations JCA StAX Debug SAAJ JAF JAXB IDL JDBC JNDI JAXP JAAS JMX RMI-IIOP … Enterprise APIs in Java SE (Required for Java EE) User Registries Event Mgmt HTTP Session Replication Connection Management Persistence Providers Admin Console Logging and Tracing DataSources Messaging Engines Security MBean Server and scripting HTTP Serving High Availability Transaction Logging Transport Channels Workload Management and routing Management and Recovery Policy and SLA Thread management Classloading Provisioning Monitoring Configuration mgmt … March12, 2010 QCon London 2010 Ian Robinson 5

  6. Modularity inside Enterprise platforms The major AppServer and Integration vendors and Open Source communities have all embraced OSGi for their own internal architecture • IBM WebSphere, Oracle WebLogic, Red Hat JBoss, Sun GlassFish, SpringSource dm Server, Paremus Service Fabric, Eclipse Platform, Apache Geronimo, (non-exhaustive list) http://www.osgi.org/wiki/uploads/News/2008_09_16_worldwide_market.pdf � These complex engineering projects required a modular approach to development as they evolved and grew • Breaking the problem into well-defined coherent modules enables development teams to focus on their area of concern. • OSGi not only enables but enforces modularity Does the Enterprise runtime need OSGi? The vendors answered with a resounding Yes . March12, 2010 QCon London 2010 Ian Robinson 6

  7. What about the Applications? The enterprise landscape until recently has been OSGi on the inside only. Why? Primarily because: • Java EE defines an enterprise application programming model and container contracts to honour it • OSGi has typically defined platform specifications and services for those platforms. � It hasn’t had much to say on application concerns such as � What's the component model? � Whets the persistence architecture? � How are qualities of service configured? � Remoting This has changed in OSGi v4.2. March12, 2010 QCon London 2010 Ian Robinson 7

  8. What’s the Problem? http://www.gutenberg.org March12, 2010 QCon London 2010 Ian Robinson 8

  9. Problems with JARs Java Platform Modularity • Classes encapsulate data Jar Jar • Packages contain classes • Jars contain packages Package Package Class visibility: Class Class • private, package private, protected, Class Class Class Class public Package Package No “jar scoped” access modifiers. No means for a jar to declare its Class Class Class Class dependencies. Class Class No versioning. Package Package Jars have no modularization Class Class characteristics Class Class Class Class • At runtime there is just a collection of classes on a global classpath March12, 2010 QCon London 2010 Ian Robinson 9 9 9

  10. The Global Classpath Java VM party common resolver axis xerces rt assetmaint catalina mail ezmorph xmlapis Begin Begin jce hhfacility base jenks servlets xmlrpc Here Here jsse pos. datafile jakarta jetty xmlgraphics plugin content entity log4j looks sunjce_prov. manufact. widget httpunit jdbm dnsns product … mx4j bsf Class .. bi rome batik bsh Not Found marketing workflow jpos18 fop velocity Exception workeffort ecommerce jcl tomcat ws-commons ebay oagis barcode4j poi geronimo minerva … freemarker lucene .. minilang googlebase serializer jdom json accounting order naming commons xalan guiapp ofbiz jython derby wsdl4j March12, 2010 QCon London 2010 Ian Robinson 10

  11. Problems with EARs/WARs webA.war webA.war WEB-INF/classes/servletA.class WEB-INF/classes/servletA.class Enterprise Apps have isolated WEB-INF/lib/spring.jar WEB-INF/lib/spring.jar WEB-INF/lib/commons-logging.jar WEB-INF/lib/commons-logging.jar classpaths but… WEB-INF/lib/junit.jar … WEB-INF/lib/junit.jar … webB.war webB.war WEB-INF/classes/servletB.class Across apps - each archive typically WEB-INF/classes/servletB.class WEB-INF/lib/spring.jar WEB-INF/lib/spring.jar contains all the libraries required by the WEB-INF/lib/commons-logging.jar WEB-INF/lib/commons-logging.jar WEB-INF/lib/junit.jar … WEB-INF/lib/junit.jar … webC.war application webC.war WEB-INF/classes/servletC.class WEB-INF/classes/servletC.class WEB-INF/lib/spring.jar WEB-INF/lib/spring.jar • Common libraries/frameworks get WEB-INF/lib/commons-logging.jar WEB-INF/lib/commons-logging.jar WEB-INF/lib/junit.jar … installed with each application WEB-INF/lib/junit.jar … • Multiple copies of libraries in memory Within apps - 3 rd party libraries plankton.v1 consume other 3 rd party libraries leading to version conflicts plankton.v2 March12, 2010 QCon London 2010 Ian Robinson 11

  12. OSGi – The Dynamic Module System for Java The OSGi Service Platform specifies a modular architecture for dynamic component based systems • Execution Environment • Module Layer • Life Cycle Layer • Service Layer Runs on a variety of standard Java profiles. Introduces Bundles as modules March12, 2010 QCon London 2010 Ian Robinson 12

  13. Bundle Metadata META-INF/MANIFEST.MF Manifest-Version: 1.0 The higher-level module is the “bundle” Bundle-ManifestVersion: 2 Bundle-Name: MyService bundle which is a normal jar containing: Bundle-SymbolicName: com.sample.myservice •Classes Bundle-Version : 1.0.0 Bundle-Activator: com.sample.myservice.Activator •Resources Import-Package: org.apache.commons.logging;version="1.0.4" •Manifest Export-Package: com.sample.myservice.api;version="1.0.0" OSGi headers in the manifest include: •Bundle-Version: Multiple versions of bundles can be active concurrently. •Import-Package: Explicitly declares the (package) dependencies on other bundles. Used by the OSGi f/w for bundle resolution. � Can explicitly define the required version or version range for each package. •Export-Package: Declares package visibility outside the bundle. Other packages are encapsulated by the bundle. •Bundle-Activator (used to notify the bundle of lifecycle changes) Eclipse tooling provides convenient editors for the manifest March12, 2010 QCon London 2010 Ian Robinson 13

  14. OSGi Class Loading No global, flat classpath to search. Each bundle has its own classloader / classpath. More efficient for large systems. Class sharing and visibility is based on declarative dependencies • Not constrained by hierarchical class loader trees built up at runtime. • OSGi f/w takes care of working out the dependencies. Multiple versions of bundles supported concurrently. March12, 2010 QCon London 2010 Ian Robinson 14

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend