GlassFish OSGi - A Modular Runtime for Hybrid Applications

Slides:



Advertisements
Similar presentations
When Applications can Roam Freely OSGi Service Platform R4 Peter Kriens Technical Director OSGi
Advertisements

Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1.
Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene.
Introduce OSGi BlueDavy
Blueprint Advanced Features –Lin Sun –Apache Aries and Geronimo committer and PMC member –OSGi Enterprise Expert Group (EEG) member –Software Engineer.
Spring, Hibernate and Web Services 13 th September 2014.
Component Models and Technologies Case Study: OSGI.
A Java Architecture for the Internet of Things Noel Poore, Architect Pete St. Pierre, Product Manager Java Platform Group, Internet of Things September.
1 Dive into Apache Geronimo 3.0 Xu Haihong Apache Geronimo PMC
DEV392: Extending SharePoint Products And Technologies Through Web Parts And ASP.NET Clint Covington, Program Manager Data And Developer Services - Office.
OSGi as a Framework for Building a Product Line: Experience and Best Practices Ruwan Linton & Afkham Azeez
Why OSGi matters for Enterprise Java Infrastructures
© 2005, Cornell University. Rapid Application Development using the Kuali Architecture (Struts, Spring and OJB) A Case Study Bryan Hutchinson
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
Spring Dynamic Modules. Startlocation: Documentation: /1.2.1/reference/html/
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
An Introduction to OSGi: Creating Highly Modular Java Systems Simon Archer, IBM 15 November 2010.
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
Introduction to the JBoss Presented by: Hao Shi. Agenda Application Servers What is JBoss JBoss features Architecture of JBoss Installation and running.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
OSGi.
Gemini – Shaping the Future of Enterprise Java Mike Keith Glyn Normington
Introduction to the Atlas Platform Mobile & Pervasive Computing Laboratory Department of Computer and Information Sciences and Engineering University of.
Oracle Application Express 3.0 Joel R. Kallman Software Development Manager.
Adaptability for flexible mobile service provision in 3G and beyond Nikos Houssos
© 2007 by «Author»; made available under the EPL v1.0 | Date | Other Information, if necessary Eclipse SOA Tools Platform Project Eric Newcomer IONA Technologies.
Enterprise Java v120131Intro to JavaEE1 Java EE 5 TM Introduction.
Opus College - overview. OpusCollege - background First project: ICT Capacity Building Mozambican Higher Education Institutions Partners: RUG Groningen,
Comparing JavaBeans and OSGi Towards an Integration of Two Complementary Component Models HUMBERTO CERVANTES JEAN-MARIE FAVRE 09/02.
Deployment with Karaf and ACE
Webservice versioning using osgi Allard Buijze, Jettro Coenradie.
Open Service Gateway Initiative (OSGi) Reporter : 林學灝 侯承育 1.
1 Apache TomEE // JavaEE Web Profile on Tomcat Jonathan #TomEE.
ICT Strategy Intelligent Highways: Endpoint Adapters.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
Slide 1 ApacheCon 2011 > Doreen Seider> Using OSGi to Build Better Software > Using OSGi to Build Better Software Lessons from a Telemedicine.
Workforce Scheduling Release 5.0 for Windows Implementation Overview OWS Development Team.
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
RESTful Microservices In Java With Jersey Jakub Podlešák Software Engineer Oracle, Application Server Group September 29, 2014 Copyright © 2014, Oracle.
Jonathan Gallimore | Tomitribe Cluster your application with JCache and CDI.
JAVA EE 6 Best Practices for Migrating Spring to WTF ?!?
Impala A dynamic module framework for Java web development Phil Zoio Realsolve Solutions Devoxx 12 December, 2008.
Introduction to OSGi +ActorFrame Surya Bahadur Kathayat
Project Cumulus Overview March 15, End Goal Unified Public & Private PaaS for GlassFish/Java EE Simplify deployment of Java EE Apps on top of.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
Slide 1. What's New in NetBeans IDE 7.1 Name Title.
Presentation Title Up to Three Lines Long Arial 28pt Name, 26pt Speaker Company, 18pt Misc. Info, 16pt Speaker logo centered below photo.
Oracle Java Cloud Service Oracle Develop July 2013.
Joe Bohn Apache Aries and IBM Original slides created by Graham Charters for OSGi DevCon US 2010, March 22, 2010 with minor updates by Joe Bohn for BarCampRDU.
Graham Charters Apache Aries and IBM Apache Aries An Open Source project for Enterprise OSGi Applications.
The Holmes Platform and Applications
J2EE Lecture 10: EJB 3.0 Overview
J2EE Lecture 6: Spring – IoC and Dependency Injection
Web Programming Developing Web Applications including Servlets, and Web Services using NetBeans 6.5 with GlassFish.V3.
Open Source distributed document DB for an enterprise
Overall Architecture and Component Model
Introduction to J2EE Architecture
Confidential – Oracle Internal/Restricted/Highly Restricted
Services-based Systems Architecture, Design and Implementation
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Introduction to Web Services
Component Technology Bina Ramamurthy 2/25/2019 B.Ramamurthy.
Developing and testing enterprise Java applications
Distributed System using Web Services
Enterprise Java Beans.
Distributed System using Web Services
Plug-In Architecture Pattern
Presentation transcript:

GlassFish OSGi - A Modular Runtime for Hybrid Applications Peter Doschkinow Senior Java Architect

The following is intended to outline our general product direction 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. 2

Agenda OSGi basics OSGi meets Java EE Hybrid applications GlassFish v3 architecture GlassFish and OSGi Demos

What is OSGi Set of specifications delivered by the OSGi Alliance Originally for embedded devices, set top boxes, network Service oriented dynamic module system for Java Breaks applications into modules(“bundles”) Bundles can be managed dynamically without restarting the container Multiple versions are supported Dependencies explicitly defined with clear boundaries

Execution Environment OSGi Layers Service publish/find/bind intra-VM model Life Cycle bundle lifecycle in OBR Module consistent class loading rules Execution Environment CDC, Java SE Security

Module Layer Bundle – a unit of modularity in OSGi Encapsulation Lifecycle independent of the JVM Versionable Packaged as a JAR classes + Manifest with OSGi metadata Very explicit dependency specification Well defined dependency resolution rules

OSGi Metadata Bundle-SymbolicName: com.acme.hello.startup Bundle-Name: Hello World OSGi Sample Bundle-Version: 1.0.1 Bundle-ManifestVersion: 2 Bundle-Activator: com.acme.hello.startup.MyActivator Export-Package: com.acme.hello.startup;version=1.0.0 Import-Package: org.osgi.framework;version=1.3

Lifecycle Layer Provides API to manage bundles BundleActivator BundleListener Listens to BundleEvents

Service Layer In-VM SOA Service Registry Register Unregister Service is a POJO Service Dynamism Service tracking Service Discovery LDAP filter based queries

OSGi Advantages Summary Solves most problems that result from the insufficient Java support for modularity and dynamism Defines a module system Explicit code sharing through import/export of packages Supports versioning and evolution Lifecycle management Dynamic deployment and configuration Ease of deployment and management Automatic management of code dependencies Enforces sophisticated consistency rules for class loading Bundle deployment order is not relevant

Java EE Platform of choice for enterprise applications Widely used infrastructure APIs JPA, JTA, JAXB, JNDI, JAX-WS, JAX-RS, JCA Component Models (Servlet, EJB, JAX-RS) Frameworks (JSF, CDI) Ease of Use Annotations, Convention over Configuration Tools (IDE, Management, Monitoring) Ubiquitous deployment platform for enterprise applications

Hybrid Applications use advantages from both worlds OSGi + Java EE = Hybrid application Hybrid application An OSGi bundle And a Java EE Archive Leverage the capabilities of both the platforms Enterprise applications can be built as modular OSGi bundles use OBR, Config Admin, service tracking, etc. OSGi bundles can use Java EE services like JTA, JPA Require a runtime that supports both standards Current State • OSGi Enterprise Expert Group (EEG) – Relased OSGi Service Platform Enterprise Specification 4.2 in 2010 • Open source efforts – Project GlassFish – Project Aries – Eclipse Gemini

OSGi Enterprise Specifications OSGi Declarative Services Declarative model to simplify the work with OSGi services OSGi Blueprint Container IoC and DI framework, derived from Spring DM project OSGi/JPA OSGi/JDBC OSGi/JTA OSGi/JNDI OSGi/HTTP Service OSGi/Web Application Web Application Bundles (WAB)

OSGi Enterprise Specifications OSGi/JPA Makes Persistence Units/Provider availabe in OSGi Enhancement of JPA entities at runtime Same packaging rules as JPA and also deploy entities as a bundle Shared Persistence Unit and thereby shared second level cache OSGi/JDBC JDBC driver as DataSourceFactory Dynamic discovery of driver details Multiple versions of same driver OSGi/JTA JTA artifacts available as OSGi Services

Web Application Bundle (WAB) OSGi/Web Application WAR + OSGi bundle configuration 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 Lifecycle now can be driven by OSGi Wrapped WAR Support webbundle:file:///myWebApp.war?Web- ContextPath=/hello

Strong community and developer adoption Project Glassfish Java EE RI Java EE 5.0, Java EE 6.0 Open Source Strong community and developer adoption Sources, bug DBs, discussions at Java.Net Roadmaps, Architecture Documents Production Quality GlassFish 3.1 – currently developed Clustering, HA, centralized administration Technology refresh, better OSGi support Moving beyond GlassFish v2, work has already begun on GlassFish V3. The GlassFish community is acting in a very transparent manner. Public roadmap and requirements document (with community input). Roadmap, dates and features are subject to change. http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3Requirements http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3Schedule At the core of GlassFish V3 is a microkernel architecture. Only the necessary modules are loaded during runtime (with no pre-configuration required). The application server core starts in less that one second and consumes a minimal amount of memory. As applications are deployed, only the required modules are loaded. If a web application is deployed, only the web container is started. If a Jruby application is deployed, then the Jruby container is started. Improved enterprise feature: Security: Role-based access control in management console Scale management: Manage over 100 instances from a single console Improved application versioning - Rollback to prior version of an application. - Goal (no commit): Multiple versions of an app running simultaneously. Improved developer support: Added features will not compromise ease-of-use Dynamic language support (JRuby, Groovy, Jython, others) GlassFish V3 is the delivery vehicle for Java EE 6 and its support of profiles. Work has just begun and progress can be followed at http://glassfish.java.net

GlassFish v3 Architecture Hundred Kilobyte Kernel

GlassFish v3 Modularization and Extensibility Based on OSGi Extensible Extensive APIs to replace or extend features OSGi also provides extensions capabilities SOA based architecture Services implement different types of interfaces Java SE style with a META-INF/services file HK2 OSGi style Lazy loading based on usage patterns Makes it easier to provide support for new container types

GlassFish v3 Runtime GlassFish v3 HK2 Module System Felix, Equinox binding static binding OSGi Runtime JDK 6

HK2 Module System Abstraction to the module subsystem No OSGi dependency above HK2 layer Created to support better GlassFish use cases Better lazy loading/resolving compared to OSGi Activator/Extender pattern that often require immediate resolution of modules Service Based Architecture with IoC Services are injected and injectable Services annotated with @Service, interfaces with @Contract Configuration handling Binding to XML files Transactional access Support validation APIs and MBeans/REST

GlassFish and OSGi Runs on top of OSGi (Felix by default) Also runs unmodified on Knopflerfish and Equinox Can be installed in an existing OSGi runtime GlassFish ships with 200+ bundles in v3 Can run without OSGi (Static mode, thanks to HK2) Can use OSGi management tools (CLI or Web) All GlassFish modules are OSGi bundles No OSGi APIs are used in GlassFish HK2 provides abstraction layer

GlassFish and OSGi OSGi visibility extended from GlassFish developers to GlassFish users OSGi services can be easily used in any Java EE application @Resource(mappedName=”checkOsgiService”) CheckService checkService; Client code portable, does not use any OSGi specific API Restriction: OSGi dynamism does not work Converged applications needed Implementation of OSGi Enterprise specifications HTTP Service, Web Container, JPA, JTA, JDBC

Extending GlassFish v3 with OSGi http://blogs. sun Extend GlassFish with an unmodified Spring dm container Simple Spring bean implementing the service Invoke the service from a servlet using standard @Resource injection Still no use of a GlassFish API Single runtime for both Spring and full Java EE

Managing OSGi Bundles in GlassFish http://blogs. sun GlassFish CLI asadmin deploy –type osgi File system operations cp/rm to/from glassfish/domains/domain1/autodeploy/bundles Felix remote shell/gogo shell telnet localhost 6666 Felix remote shell (GlassFish v3) Gogo shell(GlassFish 3.1) provides a scripting environment for administration Apache Felix web console

WAB Lifecycle and Deployments in GlassFish Java EE deployment on RESOLVED → STARTING Java EE undeployment on STOPPING → RESOLVED Alternative WAB Deployments With OSGi manifest asadmin deploy --type osgi hybridapp.war cp hybridapp.war glassfish/modules/autostart cp hybridapp.war domains/domain1/autodeploy/bundles Plain WAR file install webbundle:file://work/webapp/target/hybridapp.war?Web- ContextPath=/hello

OSGi/EJB GlassFish feature Allow EJBs to run within OSGi context Easily discovered/accessed by other OSGi bundles Can use container managed JPA TX, security, persistence contexts propagated Automatic enlistment of EJBs as OSGi services Local beans only (SFSB, SLSB, Singleton) Manifest entry Export-EJB: ALL|NONE Can split client & service into separate bundles OSGi ServiceTracker listens for EJB service availability, making deployment order irrelevant

OSGi JMS Producer public class JMSActivator1 implements BundleActivator { public void start ( BundleContext context ) { context.registerService ( ManagedService.class.getName(), new ManagedService() { public void updated ( Dictionary properties ) { sendMessage(); } }, props ); private void sendMessage() { ... Destination dest = (Destination) ctx.lookup("jms/osgi.Topic1"); session.createProducer(dest).send(...); ....}}

OSGi MDB consumer @MessageDriven(mappedName = "jms/osgi.Topic1") public class MyMDB implements MessageListener { public void onMessage(Message message) { ... }

CDI Extenstion for OSGi in GlassFish @Inject @OSGiService MyOsgiService svc; Eliminates boilerplate code in OSGi service clients For finding, binding and tracking OSGi service references Typesafe, in contrast to XML based Blueprint Service Available attributes for @OSGiService Service discovery criteria in standard OSGi Filter syntax Wait timeout Dynamic binding for service dynamism through container injected proxy Applicable in WAB Since BundleContext is needed

All interaction scenarios WAB, EJB module as OSGi service GlassFish OSGi Demos JavaOne 2010 Hands-on Lab All interaction scenarios WAB, EJB module as OSGi service http://blogs.sun.com/arungupta/entry/screencast_32_osgi_enabled_java OSGi declarative services example No boilerplate code, automatic OSGi service registration Maven SCR plugin for OSGi metadata generation http://blogs.sun.com/arungupta/entry/totd_124_osgi_declarative_services OSGi CDI example CDI extension for OSGi in GlassFish, applied to a WAB http://blogs.sun.com/sivakumart/entry/typesafe_injection_of_dynamic_osgi

Summary GlassFish is modular & extensible (HK2/OSGi) OSGi Declarative Services & CDI OSGi extension No OSGi API, no GlassFish API, Integration Nirvana! Hybrid applications bring OSGi benefits to JavaEE (and vice-versa) Reusable bundles Independent life-cycles Standard component models GlassFish covers all your Java EE and OSGi needs

Links OSGi Service Platform Core and Enterprise Specification 4.2 http://www.osgi.org GlassFish http://glassfish.org http://blogs.sun.com/theaquarium http://www.youtube.com/user/GlassFishVideos http://wikis.sun.com/display/GlassFish/OsgiDashboard http://wikis.sun.com/display/GlassFish/3.1OSGi Hybrid application samples http://wikis.sun.com/display/GlassFish/BlogsGfOsgi

GlassFish OSGi - A Modular Runtime for Hybrid Applications Peter Doschkinow Senior Java Architect