• Save

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

OSGi & Java EE in GlassFish

on

  • 18,350 views

In this presentation, we will discuss the benefits of hybrid applications and demonstrate how such applications can be built and deployed. A hybrid application is both an OSGi bundle as well as a Java ...

In this presentation, we will discuss the benefits of hybrid applications and demonstrate how such applications can be built and deployed. A hybrid application is both an OSGi bundle as well as a Java EE application. GlassFish is a natural container of choice for such applications.

Statistics

Views

Total Views
18,350
Views on SlideShare
17,440
Embed Views
910

Actions

Likes
14
Downloads
0
Comments
0

8 Embeds 910

http://www.eclipsecon.org 815
http://www.slideshare.net 83
http://eclipsecon.org 6
https://www.linkedin.com 2
http://translate.googleusercontent.com 1
http://web.archive.org 1
http://oracle.sociview.com 1
http://192.168.6.52:8080 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

OSGi & Java EE in GlassFish OSGi & Java EE in GlassFish Presentation Transcript

  • ` OSGi & Java EE In  GlassFish Sanjeeb Sahoo Sun Microsystems, India    
  • Agenda ● Introduction ● OSGi in GlassFish ● Demo ● OSGi + Java EE in GlassFish ● Hybrid Applications ● Enterprise OSGi API ● Demo ● Q &A    
  • Some History and Context Tomcat Jasper GlassFish v1 GlassFish v3 Catalina (Java EE 5) (Java EE 6, OSGi) JSTL GlassFish Struts v2 v2.1 Crimson Launch v2.1.1 XSLTC Xalan Xerces JAXB Jan June May Sept. Nov. Dec. JAX­RPC JSF 2005 2006 2007 2008 2009 2009 (you are here)    
  • 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 – http://www.eclipsecon.org/2010/sessions/?page=sessions&id=1226    
  • 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  
  •  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    
  • DEMO ­ I ● GlassFish in existing OSGi runtime ● GlassFish OSGi Administration Console ● DataSource as Service    
  • OSGi + Java EE in GlassFish ``    
  • 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.”    
  • Why OSGi in Enterprise Apps? ● Improved Modularity ● Reusable bundles ● Dependencies are more visible ● Better Isolation / Cleaner Class Loading Model ● Better version control ● Faster deployment cycle ● Better tools for deployment (e.g., OBR)  ● Observable bundle life cycle ● Service Tracking     ● Criteria Based Service Selection
  • Why Java EE in Enterprise Apps? ● Better API (JPA, JTA, JAXB, JNDI) ● Better component model (Servlet, EJB, JAX­RS) ● Better frameworks (JSF, CDI) ● Ease of Use (Annotations, Convention over  configuration) ● Platform provided integrated infrastructure  services (Transaction, Security, Persistence,  Remoting) ● Many more reasons....    
  • Why Hybrid Apps? Best of both the worlds!!! Why do you want to restrict to one?    
  • 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    
  • 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)  
  • Hybrid Application Life Cycle http://weblogs.java.net/blog/2009/06/14/developing­hybrid­osgi­java­ee­applications­glassfish    
  • 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.
  • 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
  • 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    
  • 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    
  • 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
  • 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!!!  
  • 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 
  • DEMO – II (Invoke EE  Components from OSGi) ● WAB ● JPA­ LAZY loading ● EJB as Service ● Deployment Order  Independence ● Context propagation    
  • More Detailed Information From the Aquarium:  http://blogs.sun.com/theaquarium/   From my blog:  http://www.java.net/blogs/ss141213/     24
  • Q & A Sahoo@Sun.COM http://www.java.net/blogs/ss141213/