Your SlideShare is downloading. ×
0
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

OSGi & Java EE in GlassFish

15,468

Published on

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.

Published in: Technology
0 Comments
14 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
15,468
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
0
Comments
0
Likes
14
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1.     ` OSGi & Java EE In  GlassFish Sanjeeb Sahoo Sun Microsystems, India
  • 2.     Agenda ● Introduction ● OSGi in GlassFish ● Demo ● OSGi + Java EE in GlassFish ● Hybrid Applications ● Enterprise OSGi API ● Demo ● Q &A
  • 3.     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)
  • 4.     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
  • 5.     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
  • 6.      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
  • 7.     DEMO ­ I ● GlassFish in existing OSGi runtime ● GlassFish OSGi Administration Console ● DataSource as Service
  • 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.     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
  • 11.     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....
  • 12.     Why Hybrid Apps? Best of both the worlds!!! Why do you want to restrict to one?
  • 13.     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
  • 14.     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)
  • 15.     Hybrid Application Life Cycle http://weblogs.java.net/blog/2009/06/14/developing­hybrid­osgi­java­ee­applications­glassfish
  • 16.     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.
  • 17.     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
  • 18.     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
  • 19.     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
  • 20.     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
  • 21.     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!!!
  • 22.     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 
  • 23.     DEMO – II (Invoke EE  Components from OSGi) ● WAB ● JPA­ LAZY loading ● EJB as Service ● Deployment Order  Independence ● Context propagation
  • 24.     More Detailed Information 24 From the Aquarium:  http://blogs.sun.com/theaquarium/   From my blog:  http://www.java.net/blogs/ss141213/
  • 25.     Q & A Sahoo@Sun.COM http://www.java.net/blogs/ss141213/

×