osgi and java ee 6
play

OSGi and Java EE 6 Yes you can with GlassFish V3 Jerome Dochez - PowerPoint PPT Presentation

OSGi and Java EE 6 Yes you can with GlassFish V3 Jerome Dochez Oracle Corposration The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any


  1. OSGi and Java EE 6 Yes you can with GlassFish V3 Jerome Dochez Oracle Corposration

  2. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

  3. Agenda Introduction OSGi in GlassFish > Demo OSGi + Java EE in GlassFish > Hybrid Applications > Enterprise OSGi API > Demo Q &A

  4. Some History and Context Tomcat GlassFish v3 Jasper GlassFish v1 (Java EE 6, OSGi Catalina (Java EE 5) JSTL GlassFish v2 Struts v2.1 Launch v2.1.1 Crimson XSLTC Xalan Xerces JAXB Jan June May Sept. Nov. Dec. JAX-RPC 2008 2005 2006 2007 2009 2009 JSF (you are here)

  5. GlassFish A Community > Users, Partners, Testers, Developers > Started in 2005 on java.net Application Server > Enterprise Quality and Open Source a > Java EE 5 / 6 Reference Implementation > Full Commercial Support from Sun/Oracle > Tools Bundle for NetBeans & Eclipse

  6. OSGi in GlassFish GlassFish runs on top of OSGi - default is Felix Runs unmodified on Equinox as well Can be embedded in existing OSGi runtime Highly modular runtime > Implemented as 200+ bundles > Customizable distribution Supports deployment of OSGi bundles

  7. OSGi Bundle Deployment ● Pure OSGi bundles can be deployed ● Drop it in domain1/autodeploy/bundles/ ● asadmin -- type osgi <bundle path> ● OSGi administration console ● (telnet console, web console, etc...) ● Supports OBR : ● Discover and deploy dependencies together

  8. OSGi + Java EE in GlassFish ``

  9. OSGi + Java EE = Hybrid Application “A hybrid application is an OSGi bundle as well as a Java EE archive and hence has both an OSGi bundle context and Java EE context at runtime and can leverage capabilities of both the platforms.”

  10. Role of GlassFish... Provides a runtime for Hybrid Applications Implements Java EE related OSGi Services and Standards You don't have to assemble the bits. OSGi no longer under the cover > Raises visibility from GlassFish developers to GlassFish users

  11. Differentiators Runtime + OSGi glue layer Migration path for Java EE to hybrid apps Java EE 6 support Supports Java EE component model (e.g. EJB as OSGi service) And extensible (blueprint component model, declarative services, iPOJO)

  12. Hybrid Application Life Cycle http://weblogs.java.net/blog/2009/06/14/developing-hybrid-osgi-java-ee-applications-glassfish

  13. Enterprise OSGi API in GlassFish OSGi/HTTP Service OSGi/Web Application (rfc #66) OSGi/EJB OSGi/JDBC (rfc #122) OSGi/JPA OSGi/JTA (rfc #98) * Work In Progress - in trunk. Some of it already in v3 release.

  14. OSGi/HTTP Service Thin API – contains only two interfaces > HttpService – registerResource, registerServlet, unregister > HttpContext – Provides a context to a collection of servlets. GlassFish OSGi Administration Console > Based on Apache Felix Web Console http://www.osgi.org/javadoc/r4v42/org/osgi/service/http/package-summary.html

  15. OSGi/JPA JPA supported in hybrid applications Enhancement at runtime > Works in all OSGi runtime Same packaging rules as JPA You can also deploy entities.jar as a bundle Shared persistence unit – so shared 2 nd level cache

  16. OSGi/JDBC JDBC Driver as DataSourceFactory Dynamic discovery of driver details Multiple versions of same driver Wrap non-OSGi driver jars -> Bundles JDBC resource exported as OSGi Service

  17. OSGi/Web Application (rfc #66) Web Application Bundle (WAB) > WAR + OSGi Metadata + Web-ContextPath header > Can use all enterprise APIs Including JPA with lazy loading > Sample manifest: Manifest-Version: 1.0 Import-Package: javax.servlet.http; javax.persistence Bundle-ClassPath: WEB-INF/classes/,WEB-INF/lib/entities.jar Bundle-Version: 1.0 Bundle-ManifestVersion: 2 Web-ContextPath: /hello Bundle-SymbolicName: test.hellowab Wrapped WAR Support > webbundle: URL scheme

  18. OSGi/EJB (GlassFish feature) EJB Jar as OSGi bundle EJB artifacts + OSGi Metadata + Export-EJB header Export-EJB: List of EJBs to be exported as OSGi services. > Special values: NONE, ALL > Support for Stateless & Singleton EJBs with Local Views Same life cycle as WAB Local EJB can cross application boundary!!!

  19. Invoke OSGi from pure Java EE OSGi service exported by some bundle Invoke the service from a EE component using standard @Resource injection Never use a GlassFish API ! Step by step: http://blogs.sun.com/dochez/entry/glassfish_v3_extensions_part_4

  20. Jerome Dochez Oracle Corporation jerome.dochez@oracle.com

Recommend


More recommend