![Page 1: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/1.jpg)
<Insert Picture Here>
OSGi & Java EE in GlassFish
Arun Gupta, Java EE & GlassFish Guyblogs.sun.com/arungupta, @arungupta
![Page 2: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/2.jpg)
2
The following/preceding 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.
![Page 3: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/3.jpg)
3
![Page 4: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/4.jpg)
4
![Page 5: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/5.jpg)
5
![Page 6: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/6.jpg)
6
• 13 assembly missions• 16 pressurized modules• 35k cubic feet• 400 metric tons ~ 400K kg ~ 882K lbs• 173 – 286 miles above Earth• Average speed: 17,227 mph• 15.7 orbits/day• Estimated cost: $157 billion
Generally complex ...
![Page 7: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/7.jpg)
7
![Page 8: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/8.jpg)
8
The OSGi Alliance is a worldwideconsortium of technology innovators that advances a proven and mature process to assure interoperability of applications and services based on its component integration platform.
![Page 9: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/9.jpg)
9
OSGi Alliance provides ...
• Specifications• Reference Implementation• Test Suites• Certifications
![Page 10: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/10.jpg)
10
What is OSGi Specification ?
• Delivered by OSGi Alliance• Originally for embedded devices, set top boxes, network
• Architecture for modular application development in Java• Breaks applications into “modules” or “bundles”
• Can install, uninstall, start, and stop each bundle dynamically without restarting container• Multiple versions are supported
• Dependencies explicitly defined with clear boundaries
![Page 11: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/11.jpg)
11
“JAR Hell”
• JAR is a build-time and deploy-time concept, not run-time• Based on the ZIP file format
• No metadata to indicate dependencies• Multiple versions of JARs cannot be
loaded• All “public” classes are public
• Access modifiers are for packages, not JAR
![Page 12: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/12.jpg)
12
OSGi Layers
Execution Environment
Module
Life Cycle
Service
![Page 13: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/13.jpg)
13
OSGi Bundle – Just a JAR File!
Java Classes, Static Files, …(bundle private)
META-INF/MANIFEST.MF
OSGI-OPT(docs, source code, ...)
Export-Package
Import-Package
Bundle-ClassPath
. . .
Persistent
Atomic
![Page 14: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/14.jpg)
14
Bundle is identified by ...
• Bundle Identifier• Unique for the lifetime• getBundleId()
• Bundle Location• Unique location of the bundle• getLocation()
• Bundle Symbolic Name and Version• Globally unique identifier• getSymbolicName(), getVersion()
![Page 15: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/15.jpg)
15
Java Classes, Static Files, ...
META-INF/MANIFEST.MF
Export-Package. . .
. . .
Java Classes, Static Files, ...
META-INF/MANIFEST.MF
Import-Package. . .
. . .
Service
Client
![Page 16: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/16.jpg)
16
Interaction between layers
EE
Module
Life Cycle
ServiceB
und
leB
und
le
manage
install uninstall
register / unregisterget / unget
start / stop
execute
classload
![Page 17: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/17.jpg)
17
Bundle State Diagram
INSTALLED
RESOLVED
install
STARTING
ACTIVE
STOPPING
start
updaterefresh
updaterefresh
uninstall stop
resolve
Each bundle installation is new
![Page 18: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/18.jpg)
18
OSGi Containers
http://stackoverflow.com/questions/560794/what-osgi-container-do-you-recommend
![Page 19: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/19.jpg)
19
What is GlassFish ?
• GlassFish is an open source community• Delivers Java EE Reference Implementation
• GlassFish Server Open Source Edition - glassfish.org• Oracle GlassFish Server - oracle.com/goto/glassfish
• Tooling: NetBeans, Eclipse, IntelliJ • GlassFish 3.1 – currently developed
• Modular, Embeddable, Extensible• High Availability, Clustering, Centralized Administration
![Page 20: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/20.jpg)
20
GlassFish DistributionsDistribution License Features
GlassFish Open Source Edition 3.0
CDDL & GPLv2
• Java EE 6 Compatibility• No Clustering• Clustering planned in 3.1• mod_jk for load balancing
GlassFish Open Source Edition 2.1.1
CDDL & GPLv2
• Java EE 5 Compatibility• In memory replication• mod_loadbalancer
Oracle GlassFish Server 3.0 Commercial • GlassFish Open Source Edition 3.0• GlassFish Server Control• Clustering planned in 3.1
Oracle GlassFish Server 2.1.1
Commercial • GlassFish Open Source Edition 2.1.1• Enterprise Manager • HADB
Clustering Coming Soon!
![Page 21: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/21.jpg)
21
GlassFish Roadmap Detail
©2010 Oracle Corporation
![Page 22: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/22.jpg)
22
OSGi in GlassFish
• GlassFish runs on top of OSGi• Felix is default, also runs on Equinox &
Knopflerfish• Runs in an existing shell• 200+ bundles in v3
• All GlassFish modules are OSGi bundles• No OSGi APIs are used in GlassFish
• HK2 provides abstraction layer
http://blogs.sun.com/arungupta/entry/totd_103_glassfish_v3_withhttp://blogs.sun.com/arungupta/entry/totd_127_embedding_glassfish_in
![Page 23: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/23.jpg)
23
GlassFish: Modular Platform
NamingService
TransactionService
InjectionManager
SecurityService
Configuration
Deployment
Monitoring/Serviceability/
Logging
Clustering
Java SE
GlassFish V3 Core(Module Subsystem)
Grizzly Framework
Application Container
Config Deploy Security Monitor Cluster
Management Console Management CLIUpdate Center
OSGi
RESTWeb Services
ScriptingWebSpace Server
PortalOpenMQ
JMSOpenESB OpenSSO
WebContainer
JSFConnection
Pooling (JCA)Java
Persistence EJB ContainerWeb Services
Interop
![Page 24: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/24.jpg)
24
GlassFish v3 Runtime with OSGi
GlassFish V3 modules(OSGi + extra metadata)
HK2 Service layerOSGi
Service Layer
OSGi Bundle Management
Random OSGi Bundle
ServiceMapper
![Page 25: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/25.jpg)
25
Benefits of OSGi for GlassFish
• Demands and enforces stronger modularity• Enables custom tailored App server• Lazy loading based on usage patterns• Open for all JVM based technologies
• Native deployment of JRuby-on-Rails application
• Successfully maintained quick startup• Available to GlassFish developers and
users
![Page 26: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/26.jpg)
26
Create an OSGi Bundle – Maven
• Create a Maven project• Implement “BundleActivator”• Update “pom.xml”
• Change packaging to “bundle”• Add dependencies on OSGI APIs• Use “maven-bundle-plugin” to package
• Build the bundle
http://blogs.sun.com/arungupta/entry/totd_36_deploy_osgi_bundles
![Page 27: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/27.jpg)
27
Create an OSGi bundle – NetBeans
http://blogs.sun.com/arungupta/entry/totd_125_creating_an_osgi
![Page 28: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/28.jpg)
28
Create an OSGi bundle – NetBeans
http://blogs.sun.com/arungupta/entry/totd_125_creating_an_osgi
![Page 29: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/29.jpg)
29
Create an OSGi bundle – Eclipse
http://blogs.sun.com/arungupta/entry/totd_126_creating_an_osgi
![Page 30: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/30.jpg)
30
OSGi Bundles in GlassFish
• asadmin deploy –type osgi
http://blogs.sun.com/arungupta/entry/totd_118_managing_osgi_bundles
• “cp”/“rm” glassfish/domains/domain1/autodeploy/bundles
• telnet localhost 6666• Apache Felix Web Console• REST Console bundle• Perl-based shell (Osgish)
• Supports OBR• Discover and deploy dependencies together
• VisualVM OSGi Plugin
![Page 31: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/31.jpg)
31
![Page 32: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/32.jpg)
32
Dynamic Discovery of OSGi service
API
Impl
Client
OSGiServiceRegistry
http://blogs.sun.com/arungupta/entry/totd_131_dynamic_osgi_services
ServiceTrackerasdsadasdsd
Export-Package
Import-Package
Import-Package
Bundle-Activator
Bundle-ActivatorService Tracker
Filters
![Page 33: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/33.jpg)
33
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• Observable bundle life cycle• Service Tracking• Criteria-based service selection
![Page 34: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/34.jpg)
34
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 ...
![Page 35: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/35.jpg)
35
![Page 36: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/36.jpg)
36
OSGi Enterprise Expert Group
The OSGi Enterprise Expert Group (EEG) is chartered to define the
technical requirements and specifications to tailor and extend the
OSGi Service Platform to address information technology software infrastructure use cases found in enterprise business scenarios.
http://www.osgi.org/EEG/HomePage
![Page 37: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/37.jpg)
37
Current Status
• Released OSGi Service Platform Enterprise Specification 4.2 in 2010
• Open Source Efforts• GlassFish• Project Aries• Eclipse Gemini
![Page 38: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/38.jpg)
38
Hybrid Applications
“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.”
![Page 39: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/39.jpg)
39
Role of GlassFish
• Provides a runtime for Hybrid Applications• Implements Java EE related OSGi services
and standards• Don't have to assemble the bits• OSGi is no longer under the cover
• Raises visibility from GlassFish developers to users
![Page 40: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/40.jpg)
40
OSGi EEG Focus
• Scaling, including multi-container and multi-process environments
• Distributed and/or federated service model for • Multiple Service Platforms • External, heterogeneous systems
• Requirements for extensions to the OSGi publish/fi nd/bind service model
• Enterprise-class life cycle and confi guration management
• Integration of established Java EE technology into OSGi
![Page 41: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/41.jpg)
41
Why Hybrid Apps ?
Best of both worlds!!!Why do you want to learn new APIs ?
![Page 42: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/42.jpg)
42
Role of GlassFish
• Provides a runtime for Hybrid Applications• Implements Java EE related OSGi services
and standards• Don't have to assemble the bits• OSGi is no longer under the cover
• Raises visibility from GlassFish developers to users
![Page 43: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/43.jpg)
43
OSGi Compendium Specs in GlassFish
• OSGi/Web Application (rfc #66)• OSGi/JPA (rfc #143)• OSGi/JDBC (rfc #122)• OSGi/JTA (rfc #98)• OSGi/JNDI (rfc #142)• OSGi/HTTP Service
![Page 44: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/44.jpg)
44
OSGi/Web Application (rfc #66)
• Web Application Bundle (WAB)• WAR + OSGi + Web-ContextPath Header• Can use all enterprise APIs include JPA with lazy loading• Sample manifest:
ManifestVersion: 1.0
ImportPackage: javax.servlet.http; javax.persistence
BundleClassPath: WEBINF/classes/,WEBINF/lib/entities.jar
BundleVersion: 1.0
BundleManifestVersion: 2
WebContextPath: /hello
BundleSymbolicName: test.hellowab
• Wrapped WAR Support• webbundle: URL scheme
![Page 45: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/45.jpg)
45
OSGi Declarative Services
• Complications of Publish/Find/Bind• Long startup time• Memory footprint• Complex service programming model
• OSGi services in Java EE @Resource(mappedName=”osgiName”) SomeOSGiService osgiService;• JNDI Lookup• Portable, no OSGi dependencies in application
• Exported APIs visible to Java EE apps
![Page 46: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/46.jpg)
46
<scr:component enabled="true" name="hello-service"> <implementation class="org.glassfish.samples.osgi.helloservice.impl.HelloImpl"/> <service servicefactory="false"> <provide interface="org.glassfish.samples.osgi.helloservice.api.HelloService"/> </service> <property name="service.pid" value="hello-service"/></scr:component>
OSGi Declarative Service
HelloImpl
HowdyImpl
APIExport-Package
OSGI-INF/serviceComponents.xml
. . .import org.glassfish.samples.osgi.helloservice.api.HelloService;
@WebServlet(urlPatterns={"/HelloClient"})public class HelloClient extends HttpServlet {
@Resource(mappedName="hello-service") HelloService helloService;
@Resource(mappedName="howdy-service") HelloService howdyService;
. . .
Servlet Client
http://blogs.sun.com/arungupta/entry/totd_124_osgi_declarative_services
![Page 47: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/47.jpg)
47
maven-scr-
plugin
import org.apache.felix.scr.annotations.Component;import org.apache.felix.scr.annotations.Service;import org.glassfish.samples.osgi.helloservice.api.HelloService;
@Component(name="hello-service")@Servicepublic class HelloImpl implements HelloService { public String sayHello(String name) { return "Hello " + name; }}
OSGi Declarative Services
http://blogs.sun.com/arungupta/entry/totd_124_osgi_declarative_services
maven-bundle-plugin
![Page 48: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/48.jpg)
48
JAX-WS & OSGi
JAX-WSEndpointJAX-WS
Client
WSDLArtifacts
BusinessMethod
![Page 49: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/49.jpg)
49
JAX-WS & OSGi
JAX-WSEndpointJAX-WS
Client
WSDLArtifacts
OSGiBundle
OSGiServiceRegistry
BusinessMethod
Delegate
RegisterService
QueryRegistry
BusinessMethod
http://blogs.sun.com/arungupta/entry/totd_130_invoking_a_osgi
![Page 50: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/50.jpg)
50
OSGi & EJB
• Export EJB as OSGi services• Pure OSGi component can discover/invoke
the service• Advantages
• Declarative security, Transaction, Context dependency, Injection, … are available to non-EE components
• TX context from pure OSGi bundle propagates to invoked EJB• Ditto for security and persistence context
![Page 51: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/51.jpg)
51
Impl
LoadData
APIExport-Package
Export-EJB
login
register
Container-managedJPA
Client OSGi Service Registry
http://weblogs.java.net/blog/ss141213/archive/2010/03/30/ejb-osgi-service-demo-eclipsecon
OSGi & EJB
![Page 52: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/52.jpg)
52
JavaOne 2010 Hands-on Lab (S313522)
OSGi ServiceOSGi Client
EJBWAB
http://blogs.sun.com/arungupta/entry/screencast_32_osgi_enabled_java
![Page 53: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/53.jpg)
53
OSGi & JMS
Consumer
Producer
Export-EJB: None
OSGi Config Admin
http://www.java.net/blog/ss141213/archive/2010/04/21/osgijmsmdb-example
BundleActivator
DestinationConnectionFactory
Messages#
![Page 54: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/54.jpg)
54
Extending GlassFish v3Using Spring dm Container
• Simple Spring bean implementing the service
• Invoke the service from a servlet using standard @Resource injection
• Single runtime for both Spring and full Java EE
http://blogs.sun.com/dochez/entry/glassfish_v3_extensions_part_4
![Page 55: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/55.jpg)
55
UpcomingOSGi & Java EE Integration in 3.1
• With JPA• Entities + persistence.xml bundled as OSGi bundle
• EE resources like JDBC, JavaMail, or JMS resource available in OSGi service registry
• With CDI& JAX-RS
![Page 56: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/56.jpg)
56
UpcomingOSGi & Java EE Integration in 3.1
• GlassFish can be embedded in OSGi and non-OSGi runtime
• OSGi Administration• Apache Gogo Shell – Scripting environment (RFC #147)
• Scripting, Piping, Variables, ...• Closures, Dynamic method invocations, ...
• OSGi Web Console – Web-front end
• OBR Integration – Deployment can resolve dependencies via OBR
http://wiki.glassfish.java.net/attach/V3FunctionalSpecs/GFv3.1-OSGi-onepager-v0.2.txt
![Page 57: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/57.jpg)
57
References
• glassfish.org• blogs.sun.com/theaquarium• oracle.com/goto/glassfish• glassfish.org/roadmap• Follow @glassfish• OSGi/GlassFish Dashboard:
wikis.sun.com/display/GlassFish/OSGI
![Page 58: OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010](https://reader034.vdocuments.site/reader034/viewer/2022042700/554f4faeb4c905423f8b513c/html5/thumbnails/58.jpg)
<Insert Picture Here>
OSGi & Java EE in GlassFish
Arun Gupta, Java EE & GlassFish Guyblogs.sun.com/arungupta, @arungupta