osgi community event 2010 - enterprise osgi in websphere and apache aries

33
axe 2010 LONDON 0 6 0•05G Community Event 2010 Enterprise OSGi in WebSphere and Apache Aries Ian Robinson, IBM

Upload: mfrancis

Post on 10-May-2015

1.357 views

Category:

Technology


1 download

DESCRIPTION

OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries (Ian Robinson - IBM)

TRANSCRIPT

Page 1: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

axe 2010 LONDON

060•05G Community Event 2010

Enterprise OSGi in WebSphere and Apache Aries

Ian Robinson, IBM

Page 2: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

129 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Agenda

OSGi and Java Enterprise – who needs who?

The Culture Clash

Apache Aries

What’s Next in Aries and Enterprise OSGi?

Aries and WebSphere Application Sever

Page 3: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

A jpt.

229 Sep 2010

Ian Robinson (c) IBM Corp, 2010

IDL JDBC JNDI JAXP JAAS JMX RMI-IIOP

Enterprise APIs in Java SE (Required for Java EE)

Servlet JSP Web Container

Java

Mai

l JA

F

JAX

-R

PC

JAX

-W

S

Web

S

ervi

ces WS

M

etad

ata

JMS

JTA

JAC

C

JAXR

Man

agem

ent

JPA

EJB

SAA J

HTT

P/

SSL

Direct dependencyOptional dependencies

JSTL

JSF

JAX B

JCA

Deb ugCom mon

A

nno

tatio

ns

Java EE Web technologies

StA

X

Indirect (soft) dependency

JAX

-R

S

JASP

IC

CD

I &

DI

OSGi and Java Enterprise – who needs who?

HTTP Session Replication Connection Management Persistence Providers User Registries Event Mgmt

Logging and Tracing MBean Server Admin Consoleand scripting

DataSources Messaging Engines Security

Transport Channels Workload Management HTTP Servingand routing

High AvailabilityManagement

Transaction Loggingand Recovery

Thread management Classloading Provisioning Monitoring Policy and SLAmgmt Configuration

Page 4: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

05G1 kwo

Applications (bundles) Services

Life Cycle

Module

Java Execution Env

OS + Hardware

329 Sep 2010

Ian Robinson (c) IBM Corp, 2010

OSGi and Java Enterprise – who needs who?

IDL JDBC JNDI JAXP JAAS JMX RMI-IIOP

Enterprise APIs in Java SE (Required for Java EE)

Servlet JSP Web Container

Ja va M ail

J A F

JA X- R P C

JA X- W S W eb

Se rvi

ce s W S M et ad at a J M S JT A JA C C

JA X R M an ag e m en t JP A EJ B

S A A J

H T T P/ S SL

Direct dependency

Optional dependencies

JS TL JS F

J A X B

J C A D e b u gC o m m o n A n n o t a t i o n s

Java EE Web technologies

S t A X

Indirect (soft) dependency

JA X- R S J A S PI C C DI & DI

HTTP Session ReplicationConnection ManagementPersistence ProvidersUser Registries Event Mgmt

Logging and TracingMBean ServerAdmin Consoleand scripting

DataSourcesMessaging Engines Security

Transport ChannelsWorkload ManagementHTTP Servingand routing

High AvailabilityManagement

Transaction Loggingand Recovery

Thread managementClassloading Provisioning Monitoring Policy and SLAmgmt Configuration

Java EE App Server

ApplicationsEnterpriseServicesMetadata and

enterprise service-enablement

Three ways of looking at Enterprise OSGi technologies

1

23

Page 5: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

12' 05G. Community Bowl 1010

429 Sep 2010

Ian Robinson (c) IBM Corp, 2010

The Culture Clash

Java EE OSGiAn application is a collection of wars/jar modules scoped by an EAR

There is no multi-bundle “application” scope other than an OSGi framework

Applications are isolated from one another in a server

Bundle exports are visible throughout the framework

Container-centric. Distinct contracts for containers and applications

All bundles are created equal.

Defines complete enterprise programming model (JTA, JPA, Web, JMX, Web, EJB, JAX-WS…)

OSGi Enterprise Specification V4.2 defines services-based access to Java EE technologies

Page 6: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

529 Sep 2010

Ian Robinson (c) IBM Corp, 2010

OSGi Enterprise Specification

Released 22 March 2010– The product of the OSGi Enterprise Expert Group (EEG)

Brings Enterprise technologies and OSGi togetherUsing existing Java SE/EE specifications:– JTA, JPA, JNDI, JMX, WebApps…

Plus Spring-derived Blueprint component model and DI container

Java EE provides the core enterprise application programming modelDeploying modules as OSGi bundles simplifies reuse between applications, provides versioning, encourages (and enforces) modular design and enables dynamic module updates.

Page 7: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi- Ezn

Apache

ARIES

629 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Enterprise OSGi in Apache Aries

Apache Aries Project started in Sep 2009http://incubator.apache.org/aries/– Delivering a set of pluggable Java components enabling an enterprise

OSGi application programming model. – Implementations and extensions of application-focused

specifications defined by the OSGi Alliance Enterprise Expert Group (EEG) and an assembly format for multi-bundle applications, for deployment to a variety of OSGi based runtimes.

– to build a broad development community to encourage implementation and adoption of EEG specs

Just delivered 2nd (incubator) release. – OSGi Compliance Tests published

for each release.

Aries componentry supporting an enterprise OSGi programming model has been integrated into both Geronimo and WebSphere Application Server.– As well as Apache Felix Karaf, JBossOSGi and others

Project was 1 year old last week

Page 8: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

729 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Aries projects include…

JMXJTA integrationBlueprint containerJPA integrationJNDI integrationApplication assembly and deploymentSamples, documentation, integrator’s guide

http://svn.apache.org/repos/asf/incubator/aries/trunk/

Page 9: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

O MBean Serve

O

«MBean>> Bundle State MBean

1111111111111111111111111111111111111111111111111

.1111111111111111111111111111111111111111111111111111111111111111111

"""""""". """""""""""""""""""""""". «MBean» Package St ate

MBean Immimmimmimmimmimmimmimmimmim

'1111111111111111

«M3ean>> Fram ework MBean

1111111111111111111111111111111111111111111111111111111111111111111

«M3ean>> Service St ate

MBean 11111111111111111111111111111111111111111111111111111111111111111111

111AV /—NC

!VIC 1 ICI 661

um

ll

ummummummummummummummum

<4V1Bean» D.rrn:e

91111111111111111111111111111111111111111111111111111111111111111111

W III 1151. PL./ 11

Ad min MBean "I11111111111111111111111111111111111111111111111111111111111111111111

11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,1111..........

«MBean» Provisi onin g ServiceM Bean

"mmimmimmimmimmimmimmimmimmimm

«MBean» User Adm in

MBean "111111111111111111111111111111111111111111111111111111111111111111111 \..... 1

jax,.., 8 29 Sep 2010

6'605G Community Event 1:10

Aries )MX Integration

Implementation of OSGi JMX specification. o Aries JMX bundle automatically registers the JMX

MBeans into any javax.management.MBeanServer service in the OSGi Service Registry.

PermissionAdrnin

Cnnficriratinn Admin

Provisioning Service

User Adrrin

Ian Robinson (c) IBM Corp, 2010

829 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Aries JMX IntegrationImplementation of OSGi JMX specification.Aries JMX bundle automatically registers the JMX MBeans into any javax.management.MBeanServer service in the OSGi Service Registry.

JMX OSGi Manager

<<MBean>>Fram eworkMB ean

<<MBean>>Bund le StateMB ean

<<MBean>>Service St ateMB ean

<<MBean>>Package St ateMB ean

<<MBean>>Co nfiguratio n Ad min MB ean

<<MBean>>Permis sion Ad min MB ean

<<MBean>>Provisi onin g ServiceMBean

<<MBean>>User Adm in MB ean

PermissionAdmin

Configur ation Admin

Provisioning Service

User Admin

MBean Server

<<MBean>>Blue printMB eanFramework MBeans

Compendium MBeans

Additional Aries MBeans

Page 10: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

XA Protocol 7

[TA Provider

Transaction Synchroni: ation Registry

((interface» XAResource

an aged Application Imp!

Application Container Impl

-source onager Impl

XA Resource Imp!

User Transaction

Transaction Manager

62605Gi Community Ewen! 2010

.7\* a resource specific service

929 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Aries JTA integration

Apache Aries integrates the OSGi Transaction Service Ref Impl from Apache Geronimo.

This spec is a good example of the OSGi/Java EE culture clash:– Different services

for application and container

Page 11: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Carrfflnunity Bowl 1010

bond e

service

bund:e

jax,.. 1029 Sep 2010

Ian Robinson (c) IBM Corp, 2010

OSGi Services – No Java EE analog

Services registered in Service Registry. Services are dynamicClients (bundle B) need to cope with them going awayThere is no analog for dynamic services in Java EE.

S

Page 12: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

12' 05G. Community Bowl 1010

1129 Sep 2010

Ian Robinson (c) IBM Corp, 2010September 8th 2010

Using Services can be hardprivate BundleContext ctx;

private AtomicReference<LogService> ls = new AtomicReference<LogService>();private AtomicReference<ServiceReference> lr = new AtomicReference<ServiceReference>();

public void start(BundleContext ctx) throws InvalidSyntaxException{

this.ctx = ctx;ctx.addServiceListener(this, "(objectClass=org.osgi.service.log.LogService)");ServiceReference ref = ctx.getServiceReference(LogService.class.getName());if (ref != null) {

ls.set((LogService) ctx.getService(ref));lr.set(ref);

}}

@Overridepublic void serviceChanged(ServiceEvent event) {

ServiceReference ref = event.getServiceReference();

if (ls.get() == null && event.getType() == ServiceEvent.REGISTERED) {ls.set((LogService) ctx.getService(ref));

} else if (ls.get() != null && event.getType() == ServiceEvent.UNREGISTERING &&ref == lr.get()) {

ref = ctx.getServiceReference(LogService.class.getName());if (ref != null) {

ls.set((LogService) ctx.getService(ref));lr.set(ref);

}}

}

Page 13: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605G1 •_

Carrfflnunity Bowl 1010

1229 Sep 2010

Ian Robinson (c) IBM Corp, 2010September 8th 2010

Blueprint Simplification

public class Bean {

private LogService log;void setLog(LogService logService) {

log = logService;}

void process(Order o) {log.log(LOG_INFO, “processing: “ + o);}

}

<blueprint><bean id=”shop” class=”org.example.ecomm.Bean”><property name=”log”><reference interface=”org.osgi.service.log.LogService”/>

</property></bean>

</blueprint>

Page 14: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

1329 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Aries Blueprint ContainerXML Blueprint definition describes component configuration and scope– Optionally publish and consume components to/from OSGi service

registry.Simplifies unit test outside either Java EE or OSGi r/t.

The Aries BP container implementation is highly extensible:– Namespace handlers supported to

extend the Blueprint definitions– Bean interceptors can be

registered by handlersOther Aries components contribute handlers – “jpa” and “jta” handlers.

dependencies injectedconsumes

servicepublishesservice

A static assembly and configuration of components

(POJOs)

Blueprint bundle

OSGI-INF/blueprint/blueprint.xml

Page 15: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

1429 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Container managed JPA support integrated with Aries Blueprint container:– @PersistenceUnit or @PersistenceContext (managed)– or <jpa:unit>, <jpa:context> bean property injection– Familiar development experience for JPA developers– Load-time enhancement of Entity classes (WebSphere)

Same container managed transaction attributes as EJBs:– Required, RequiresNew, Mandatory, NotSupported,

Supports, Never

<blueprint><bean id=”shop” class=”org.example.ecomm.ShopImpl”>

<jpa:context property="em" unitname="myUnit"/><tx:transaction method="*" value="Required"/>

</bean></blueprint>

Aries Blueprint Extensions

Page 16: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

jax

1529 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Aries JNDI integrationProvides JNDI-based access to OSGi Service Registry

<blueprint xmlns=...><bean id="bloggingServiceComponent"

class="org.apache.aries.BloggingServiceImpl"></bean><service ref="bloggingServiceComponent"

interface="org.apache.aries.samples.blog.api.BloggingService"/>...

</blueprint>

registerService

InitialContext ic = new InitialContext();BloggingService blog= ic.lookup("osgi:services/"

+ BloggingService.class.getName());

getService

A way for a Web component to access a Blueprint componentOSGi

Service Registry

JNDI Context

Page 17: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

1629 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Application-level Metadata and Archive

Apache Aries defines the notion of an “enterprise bundle archive” (EBA) to represent a multi-bundle application.Constituent bundles may be contained (“by-value”) or referenced from a bundle repository.Config by exception - absence of APPLICATION.MF metadata means:

• application content is the set of bundles contained by-value plus any repository-hosted dependencies identified during deployment.

Application

EntitiesEntities

BlueprintBlueprint

Web componentsWeb components

<web.xml />

<persistence.xml/>

<blueprint.xml/>

APPLICATION.MF

Page 18: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

1729 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Aries Application Assembly and Deploy“application” project: resolve and deploy .eba archives– bundle converter extn point e.g for war to wab

conversion– application resolver extn point for different type of

repository e.g Felix OBR– application context extn point for runtime specific

installation and management of bundles

Manifest-Version: 1.0Application-ManifestVersion: 1.0Application-Name: Blog ApplicationApplication-SymbolicName: aries.sample.blogApplication-Version: 1.0Application-Content: aries.sample.blog; version=1.0.0,aries.sample.blog-api; version=1.0.0,aries.sample.blog-persistence; version=1.0.0,aries.sample.blog-servlet; version=1.0.0

Uses APPLICATION.MF metadata

Metadata can be generated from POM configuration or authored

Eclipse-based tools for authoring

Page 19: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

I

62605Gi- Ezn

1829 Sep 2010

Ian Robinson (c) IBM Corp, 2010

RAD V8OSGi App Devt Tool

WAS v7 OSGi FeP Test EnvironmentWAS v7 OSGi FeP Test Environment

EclipseWTP 3.6WTP 3.6 PDEPDE

Graphical Application Editor

Graphical Application Editor

Developer Productivity(e.g. content assist, validation, re-factoring)

Developer Productivity(e.g. content assist, validation, re-factoring)

Graphical Creation Wizards

Graphical Creation Wizards

Creation / Import / Export Tools

Creation / Import / Export Tools

Tutorials and DocumentationTutorials and

Documentation

Publish and Run

WAS v7 Server Support

WAS v7 Server Support

Free Eclipse Plugin for OSGi ApplicationsGraphical tools to develop OSGi applications and

bundlesIncludes features that increase developer productivityCreates OSGi Applications for any Aries-based server

runtime.Eclipse WTP 3.6 (Helios) required

http://marketplace.eclipse.org/content/ibm-rational-development-tools-osgi-applications

OSGi Application Development Tools

Blueprint GraphicalEditor

Blueprint GraphicalEditor

Bundle ExplorerBundle Explorer

SCA / OSGi Integration

SCA / OSGi Integration

OSGi Application Support in RAD V8Provide integrated development and test of

OSGi Applications on the WebSphere platform

Integrated with Web Tools, JEE productivity tools, and other capabilities in RAD

Supports deployment to WAS v7 OSGi FeP and includes the FeP in the WAS Test Environment

SCA support for OSGi ApplicationsAdditional OSGi tools:

Graphical and wiring editor for BlueprintBundle ExplorerTools for WAS OSGi extensions / Value-add

http://www-01.ibm.com/software/awdtools/developer/application/index.html

Page 20: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

ibm.vo.ehe.example.blog.app

1.0

Aries Slag

Gen era I Information

Spedfies the general information for this application,

Symbolic Name (ID):

Version:

Name:

e005Gi Community Ewen! 2010

--■-- 20 Import DR'. OSGi Application Import r

Import an OSGi application into the workspace.

EBA file: DS \ COM . ibm.ws.eba.example.blag.eba v Browse...

Project name: com.ibm.ws.eba.example.blog.app

Target runtime: <None> E [ New... 1

Bundles do indude:

MI iii. com.ibm.ws.eba.exampk.blog.ap (1.0.0)

El 4:r com.ibm.ws.eba.exampk.blog.persistence (1.0.0)

Select All

Clear All MI * com.ibm.ws.eba.exampk.blog.web (1.0.0)

El * com.ibm.ws.eba.exampk.blog (1.0.0)

< Back 1 Next > I Finish [ Cancel

[ILI Project Explorer E-.3-'"\__

'Workspace]

com.ibm.json.java

▪ com.ibm.ws.eba.example.blog

▪ com.ibm.ws.eba.example.blog.api

▪ 1=, com.ibm.ws.eba.example.blog.app

4. Manifest: Aries Slog

8-2? META-INF

APPLICATION,MF

permissions.perm

..ibm.ws.eba.example.blog.

OSGi Application Manifest

Contained Bundles

Spedfies the OSGi bundles induded in this appliption.

o

, f0 com.ibm.ws.eba.example.blog.persistence

O com.ibm.ws.eba.example.blog.web

Add...

[ Remove

Properties...

[ New...

[ Up

■ Explicitly Sha red Bundles

Spedfies the OSGi bundles induded from the shared runtime area. (Use-bundle header)

• bm.json.java 1.0.0 Add...

Overview APPLICATION.MF

• COM. ibm.os.eba.example.blog.api

com.ibm.ws.eba.example.blog.persisi

com.ibm.ws.eba.example.blog.web 1

com. ws. eba. example . blog 1.0.0

L.5_1

1929 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Development Support for EBAsOSGi App Dev Tool supports import, creation, and export of applicationsForm-based editor for application manifestValidation of manifest syntax and properties

Page 21: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

OSGi Bundle Project

Create a sthndalone OSGi bundle project or add it to a new or existing applimtion.

Project name NewBundle

trdl We default loustion

Location: Browse... C: 'yedipse 36Vorkspace',NewBundle

New Si Bundle Project _ _

Project lomtion

Target runtime L New Runtime.,,

rConfiguration

OSGi Web Configuration

<None>

Modify...

< Back. Next > Finish Cancel

<custom> Default Configuration JavaServer Faces v1.1 Project JavaServer Faces v1.2 Project JavaServer Faces v2.0 Project Minimal Configuration OSGi PA Configuration OSGi Web Configuration

65005Gi Community Bowl 2310

YJ

YJ

2029 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Development Support for Web and JPA Bundles

Create OSGi bundle projects with Web or JPA configurations

Can convert existing JEE Web or JPA projects into bundles:– Creates or updates a valid bundle manifest– Adds a Web-ContextPath or Meta-Persistence header– Adds package imports based on current

module contents

Graphical manifest editor for OSGi metadata. Project build paths respect OSGi visibility rules– Supports and enforces modular characteristics

from design through to execution

Plus in RAD: Comprehensive support for Web and JPA. These tools can continue to be used as-is in OSGi projects, including:– New wizards (Servlet, JSP, etc.)– Page designer and other web editors– Persistence.xml editor

Page 22: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

Details

ID:

Class:

1E1 [17 bloggingServiceComponent

com.ibm.ws.eba.example.blog.BloggingServiceImpl Browse...

Activation:

Scope:

Description:

1:1

1

ilefgrepc.5gttingj

0 Method references

1Nr. Blueprint

blogAuthorManager (Bean)

blogCommentManager (Bean)

blogEniryManager (Bean)

;FE, bloggingServiceComponent (Beal,

blogAuthorManager (Property)

blogCommentManager (Property.

blogEntryManager (Property)

com.ibm .ws .eba e xample b log . api.B

commentPersistenceService (Refere

persistenceManager (Reference)

1 <1

blueprint. xr721

e.. Blueprint XML Editor

Overview

type filter text

3

[ Add...

[ Remove

r

I Down

Design Scum

Community Ewen! 2010

62605Gi 2129 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Development Support for Blueprint BundlesBlueprint creation wizard– Supports extension schema including JPA and transactions

A blueprint editor, including:– Source page with syntax highlighting, content assist– Form-based editing similar to Java EE deployment

descriptors (RAD)– Syntax and reference validation– Hyperlinking to impl

classes– Refactoring support

Page 23: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

Community Bowl 1010

62605Gi 2229 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Aries Innovation

Blueprint Bean Interceptors – RFP 137Blueprint Transactions – RFP 138Message Driven Services – RFP 131Subsystem Metadata and Lifecycle – RFP 121Container-managed JPA - RFP 115– RFP 136 (Classpath scanning)– RFP 139 (Bytecode weaving)

META-INF/services RFP 128(Blueprint annotations, no RFP yet)

Page 24: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

Apache

AR1 ES

62605Gi Carrfflnunity Bowl 1010

2329 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Application exploitation of OSGi in WebSphere

OSGi has been used internally in WAS since V6.1 and in Eclipse since R3.

Application-level exploitation is introduced in the WebSphere Application Server V7 Feature Pack for OSGi Applications and JPA 2.0http://www.ibm.com/websphere/was/osgi– Generally available since May 2010– Early Program available since Nov 2009

Tools support in RAD V8:http://www.ibm.com/software/awdtools/developer/application/

Page 25: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

Community Ewen! 2010

1

1

I I

62605Gi 2429 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Modular DeploymentCommon bundles factored out of the applications and used at specific

versions

webA.jar

WEB-INF/classes/servletA.class

WEB-INF/web.xml

META-INF/MANIFEST.MF

webA.jar

WEB-INF/classes/servletA.class

WEB-INF/web.xml

META-INF/MANIFEST.MF

webA.jar

WEB-INF/classes/servletA.class

WEB-INF/web.xml

META-INF/MANIFEST.MF

webA.jar

WEB-INF/classes/servletA.class

WEB-INF/web.xml

META-INF/MANIFEST.MF

webA.jar

WEB-INF/classes/servletA.class

WEB-INF/web.xml

META-INF/MANIFEST.MF

webA.jar

WEB-INF/classes/servletA.class

WEB-INF/web.xml

META-INF/MANIFEST.MF

Bundle RepositoryBundle Repository

Import-Package

webA.jar

WEB-INF/classes/servletA.class

WEB-INF/web.xml

META-INF/MANIFEST.MF

webA.jar

WEB-INF/classes/servletA.class

WEB-INF/web.xml

META-INF/MANIFEST.MF

webA.war

WEB-INF/classes/servletA.class

WEB-INF/web.xml

WEB-INF/lib/…

webA.war

WEB-INF/classes/servletA.class

WEB-INF/web.xml

WEB-INF/lib/…

logging f/w jar

persistence f/w jar

MVC f/w jar

DI f/w jar

webA.war

WEB-INF/classes/servletA.class

WEB-INF/web.xml

WEB-INF/lib/…

webA.war

WEB-INF/classes/servletA.class

WEB-INF/web.xml

WEB-INF/lib/…

logging f/w jar

persistence f/w jar

MVC f/w jar

DI f/w jar

webA.war

WEB-INF/classes/servletA.class

WEB-INF/web.xml

WEB-INF/lib/…

webA.war

WEB-INF/classes/servletA.class

WEB-INF/web.xml

WEB-INF/lib/…

logging f/w jar

persistence f/w jar

MVC f/w jar

DI f/w jar

webA.war

WEB-INF/classes/servletA.class

WEB-INF/web.xml

WEB-INF/lib/…

webA.war

WEB-INF/classes/servletA.class

WEB-INF/web.xml

WEB-INF/lib/…

logging f/w jar

persistence f/w jar

MVC f/w jar

DI f/w jar

logging f/w jar

persistence f/w jar

MVC f/w jar

DI f/w jar

• Manage multiple versions of libraries across an enterprise• Isolate application dependencies from the server runtime• Centralized location to deliver critical fixes• Flexibility to update to new versions one app at a time

Page 26: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

ID Troubleshooting

['Service integration

I=1 UDDI

62605Gi Community Ewing 2010

Integrated Solutions Console Welcome Help I Logout

Cell=irobinsNodeOlCell, Profile=AppSni01 View: I All tasks

Close page

■ Welcome

E l Guided Activities

E+ Servers

['Applications

I=1 Services

E l Resources

E+ Security

El Environment

Internal bundle repository

Internal bundle repository > comibmjson.java

The internal bundle repository is used to store bundles that are referenced by OSGi applications running in WebSphere Application Server. When an OSGi application is imported as an assetr the provisioner attempts to satisfy all its dependencies by using the contents of the asset, the contents of the internal bundle repository, and the contents of any available external bundle repositories.

Configuration

Exported packages

com.ibm.json.javawersion=“1.0.0"

Virtual hosts

Update global Web server plu

configuration

■ WebSphere variables

■ Shared libraries

■ Replication domains

E Naming

OSGi bundle repositories

■ ■ Internal bundle repository

E System a M FIIT3Dam.rri

ID Users and Groups

I=1 Monitoring and Tuning,

General Properties

Bundle symbolic name

CO.T. I bm.json jays

Bundle version

1.0.0

Bundle name

JSCIN4J

Bundle description

Imported packages

2529 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Modular Deployment in WAS

Page 27: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

___-------

___---- -

_ — -

bundle 6

Bundle C

Bundle

__-------

d'uOSGi Even, 1010

2629 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Details: Isolated and Shared BundlesIn Java EE, modules are isolated within an application and applications are isolated from one another.– Makes sharing modules difficult

OSGi 4.2 all bundles have shared visibility to the externals of all others bundles within an OSGi framework (JVM)– Makes isolating applications difficult

Java EE App Server

Everything isolated Everything shared

EAR 1

Module A

Module B

Module C

EAR 2

Module A

Module G

Module C

OSGi v4.2 Framework

Isolation

Sharing

Page 28: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

J

62605Gi Community Bowl 1010

2729 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Details: Isolated and Shared BundlesEquinox 3.5 “nested framework” support enables “composite bundles” to run in isolated child frameworks– WebSphere installs each OSGi Application into an isolated

child framework.– Shared bundles are installed into the (single) parent

framework.

Everything isolated Everything shared

OSGi v4.2 FrameworkJava EE App Server

EAR 1

Module A

Module B

Module C

EAR 2

Module A

Module B

Module C

Java EE App Server

EAR 1

Module A

Module B

Module C

EAR 1

Module A

Module B

Module C

EAR 2

Module A

Module B

Module C

EAR 2

Module A

Module B

Module C

WAS V7 OSGi App FeP

EBA 1

Bundle A

Bundle B

Bundle C

EBA 2

Bundle A

Bundle G

Isolated framework

Isolated framework

Shared framework

Page 29: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

tt. own.ibm.ws.eba.example.bloghapp

Manifest-Version: 1.0

Application-ManifestVersion: 2.0 Application-Name: Aries Blog Application-SymbolicName: com.ibm.ws.eba.example.blog.app

Application-Version: 1.0 44

Application-Content: com.ibm.ws.eba.example.blog.apivrtersion=1.0.0,

com.ibm.ws.eba.example.blog.persistence:7ersion=1.0.0, com.ibm.ws.eba.example.blog.webvriersior=1.0.0,

com.ibm.ws.eba.example.blog:version=2.0.0 Use-Bundle: com.ibm.json.java;version=1.0.0

i<1

Overview APPLICATION.MF

r

0 -0- O

62605Gi Community Bowl 1010

2829 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Example “Blog” Application

BloggingService Blog

PersistenceService

blog-servlet

Web application bundle

META-INF/persistence.xml

WEB-INF/

web.xml OSGI-INF/blueprint/blueprint.xml

OSGI-INF/blueprint/blueprint.xml

JNDI EM

blog.ebablog

blog-persistence

blog-api

isolated content

shared content

Page 30: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

ID 0 1 1 wsadmin>list()

Framework Version Node Server SharedBundles 7.0.0 irobinsNode01 serverl com.ibm.ws.eba.example.blog.app 1.0.0 irobinsNode01 serverl

wsa•min connec u CWSAJ0035I: Connecting to framework SharedBundles_7.0.0 on node irobinsNode01 an

cprvpr qprup.r1

401WSAJ0036I: Successfully connected to framework SharedBundles_7.0.0. wsadmin>ss() ID State Bundle 0 ACTIVE org.eclipse.osgi_3.5.2.R35x_v20100126 1 ACTIVE shared.bundle.framework_0.0.0 2 ACTIVE com.ibm.json.java_1.0.0

ACTIVE com.ibm.ws.eba.example.blog.app_1.0.0 ./ wsadmin>connect(1) CWSAJ0035I: Connecting to framework com.ibm.ws.eba.example.blog.app_1.0.0 on e innhinANnHt.01 And Apbrypq- Ap.mit.r1

ASAJ0036I: Successfully connected to framework com.ibm.ws.eba.example.blog.ap 1.0.0. wsadmin>ss() ID State Bundle 0 ACTIVE org.eclipse.osgi_3.5.2.R35x_v20100126 1 ACTIVE com.ibm.ws.eba.example.blog.app_1.0.0 2 ACTIVE com.ibm.ws.eba.example.blog_1.0.0 3 ACTIVE com.ibm.ws.eba.example.blog.web_1.0.0 4 ACTIVE com.ibm.ws.eba.example.blog.persistence_1.0.0

Indmin> ACTIVE com.ibm.ws.eba.example.blog.api_1.0.0

2929 Sep 2010

Ian Robinson (c) IBM Corp, 2010

JMX and Isolated Frameworks in Action

Page 31: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

12' 05G. Community Bowl 1010

3029 Sep 2010

Ian Robinson (c) IBM Corp, 2010

OSGi Application

BundleBundle

BundlePOJO

POJOs assembled using a Blueprint context and scoped by an OSGi Bundle.

OSGi Bundles assembled in an OSGi Application and integrated through services in the OSGi service registry

SCA Composite assembled from heterogeneous components including an

OSGi Application component, and integrated through SCA services with

configurable bindings (JMS, web services…).

POJO

POJO

OSGi Applications and SCA: the assembly food chain

SCA Composite

Component

EARPOJO

Page 32: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

3129 Sep 2010

Ian Robinson (c) IBM Corp, 2010

Summary

Java EE and OSGi are good for each other.– Java EE defines standard enterprise technologies with

contracts for applications and runtimes– OSGi encourages and enforces modular design and

enables modular deploymentThe Apache Aries project delivers enterprise OSGi technologies that have been integrated into a number of runtimes.– As well as experimental implementation of new EEG

RFPs to inform the specs.WAS V7 and RAD integration of Aries provides complete develop-test-deploy-manage environment for modular enterprise applications.

Page 33: OSGi Community Event 2010 - Enterprise OSGi in WebSphere and Apache Aries

62605Gi Community Bowl 1010

3229 Sep 2010

Ian Robinson (c) IBM Corp, 2010

References

Apache Arieshttp://incubator.apache.org/aries/

Apache Geronimo v3.0-M1:http://geronimo.apache.org/

WAS V7 Feature Pack for OSGi Applications and JPA 2.0http://www.ibm.com/websphere/was/osgi

OSGi Application Development Plugin:http://marketplace.eclipse.org/content/ibm-rational-development-tools-osgi-applications

Rational Application Developer V8:http://www.ibm.com/software/awdtools/developer/application/