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

osgi and java ee 6
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

OSGi and Java EE 6

Yes you can with GlassFish V3

Jerome Dochez Oracle Corposration

slide-2
SLIDE 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.

slide-3
SLIDE 3

Agenda

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

slide-4
SLIDE 4

Some History and Context

Tomcat

Jasper Catalina JSTL Struts Crimson XSLTC Xalan Xerces JAXB JAX-RPC JSF

June 2005 May 2006 GlassFish Launch

v2

GlassFish v1 (Java EE 5) GlassFish v3 (Java EE 6, OSGi Sept. 2007 Dec. 2009

v2.1

Jan 2008

v2.1.1

Nov. 2009

(you are here)

slide-5
SLIDE 5

GlassFish

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

a

slide-6
SLIDE 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

slide-7
SLIDE 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
slide-8
SLIDE 8

OSGi + Java EE in GlassFish

``

slide-9
SLIDE 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.”

slide-10
SLIDE 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

slide-11
SLIDE 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)

slide-12
SLIDE 12

Hybrid Application Life Cycle

http://weblogs.java.net/blog/2009/06/14/developing-hybrid-osgi-java-ee-applications-glassfish

slide-13
SLIDE 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.

slide-14
SLIDE 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

slide-15
SLIDE 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 2nd level cache

slide-16
SLIDE 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

slide-17
SLIDE 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

slide-18
SLIDE 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!!!

slide-19
SLIDE 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

slide-20
SLIDE 20

Jerome Dochez Oracle Corporation jerome.dochez@oracle.com