eclipse con2010 composites

100
© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license EclipseCon 2010 Isolating Applications in a Collaborative OSGi World Composite Bundles Thomas Watson

Upload: tjwats

Post on 06-May-2015

2.218 views

Category:

Technology


0 download

DESCRIPTION

A presentation on OSGi Composite Bundles.

TRANSCRIPT

Page 1: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

EclipseCon 2010

Isolating Applications in a Collaborative OSGi World

Composite Bundles

Thomas Watson

Page 2: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Warning!

Not for the faint of heart!Lots of details.

No fancy slides.

(What would you expect from a framework implementer?)

Page 3: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

OSGi R4.2 Review

● New Enterprise Specifications– Remote Services

– Blueprint

● And more on the way ...– Remote Services Admin

– JTA, JMX, JDBC, JNDI, JPA

– Web Applications

– etc.

Page 4: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Forget the High-Level Stuff!

● R4.2 Core framework changes– Service registry hooks

– Security enhancements● Ordered conditions● Fine-grained service and package permissions based on

identity of the provider

– Bundle tracker

– Standard launching and embedding

– Composite bundles (provisional spec.)

Page 5: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

What can we expect from R4.3 Core?

● Still early in the process● Early access to draft RFCs

● OSGi API update (RFC 151)– Use of generics and adaptor patterns

● Composite Bundles (RFC 138)– Much has changed since the R4.2 provisional spec.

● Generic capabilities and requirements (RFC 154)

Page 6: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

What can we expect from R4.3 Core?

● Still early in the process● Early access to draft RFCs

● OSGi API update (RFC 151)– Use of generics and adaptor patterns

● Composite Bundles (RFC 138)– Much has changed since the R4.2 provisional spec.

● Generic capabilities and requirements (RFC 154)

Page 7: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Standard Launching & Embedding

Page 8: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Implementations

● Bundles are portable● What about the framework?

– Launching and configuring

– Controlling its life cycle

– Externally interacting with bundles, services, and state

Page 9: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Standard Launching & Embedding

● Seems like a slam dunk● What does it give us?

– A standard way to create framework instances

– A standard API for controlling and interacting with framework instances

● What does this help?

Page 10: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Standard Launching & Embedding

● Seems like a slam dunk● What does it give us?

– A standard way to create framework instances

– A standard API for controlling and interacting with framework instances

● What does this help?– Portable scripts and launchers

Page 11: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Standard Interfaces

public interface FrameworkFactory { Framework newFramework(Map config);}

Page 12: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Standard Interfaces

public interface FrameworkFactory { Framework newFramework(Map config);}

public interface Framework extends Bundle { void init() throws BundleException; FrameworkEvent waitForStop(long timeout) throws InterruptedException;}

Page 13: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Standard Configuration Properties

● org.osgi.framework.bootdelegation

● org.osgi.framework.system.packages

● org.osgi.framework.system.packages.extra

● org.osgi.framework.startlevel.beginning

● org.osgi.framework.storage

● org.osgi.framework.storage.clean

● And others...

Page 14: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Out Of Scope

● Multiple framework instances– e.g., no support for sharing/collaboration among

instances or multiplexing of VM singletons

– May or may not work, but implementation dependent

Page 15: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Multiple Instances

● Pose interesting challenges● Promise potentially interesting capabilities● This use case uncovers potential framework

issues

Page 16: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Composite Bundles

Page 17: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

● Applications are either all bundles collaborating or an individual bundle● All global or completely local

● No application/subsystem concept● Isolation/protection (bundles, services, packages)● Visibility (bundles, services, packages)● Grouping (lifecycle)

Page 18: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

FrameworkWhere is theapplication?

Page 19: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

Framework

Assume thesebelong to anapplication

A1

A3

A2

Page 20: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

Framework

What if they are

subsystems?

A1

A3

A2

Page 21: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

Framework

Maybe they want private

packages

A1

A3

A2

Page 22: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

FrameworkAnd private

services

A1

A3

A2

Page 23: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

Framework

A1

A3

A2

Need subsystem

encapsulation

Page 24: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

Framework

A1

A3

A2

Private detailsare hidden

Page 25: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

Framework

A1

A3

A2

Public packages

are exposed

Page 26: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

Framework

A1

A3

A2

External packages

are imported

Page 27: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

Framework

A1

A3

A2

Public servicesare exposed

Page 28: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework Limitations

Framework

A1

A3

A2

This blob is acomposite

bundle

Page 29: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Page 30: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Composites are composed of bundles with resolved states

Page 31: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

C

Composite Bundle

exportorg.foo.b

exportorg.foo.c

A

B

Importing and Exporting Packages

Export

Page 32: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

C

Composite Bundle

exportorg.foo.b

exportorg.foo.c

importorg.foo.b

A

importorg.foo.c

B

Importing and Exporting Packages

Import

Page 33: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

B

C

A

importorg.foo.b

exportorg.foo.b

importorg.foo.c

exportorg.foo.c

Composite Bundle

Importing and Exporting Packages

Resolve

Page 34: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Composites are composed of bundles that publish and bind to

services

Page 35: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Composite Bundle

org.foo.b.BService

Publish and Consume Services

Publish

A

C

B

org.foo.c.CService

Page 36: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Composite Bundle

Publish and Consume Services

Bind

org.foo.c.CService

org.foo.b.BServiceA

B

C

Page 37: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

This looks very similar to a Framework!

Page 38: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Can this blob be anested

framework?

Page 39: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

A1

A3

A2

How are imports, exports

and serviceshandled?

Framework

Nested Framework

Page 40: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Defining a Sharing Policy

Page 41: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

A1

A3

A2

Framework

Bundle

To the outside this looks like a normal bundle

Bundle

C

Page 42: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

A1

A3

A2

A representation is needed inside for the

exports, imports and services

Framework

C

Nested Framework

Page 43: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

A surrogate bundle canprovide this representation

Framework

Composite

A1

A3

A2

Sur

roga

te B

undl

eC

Page 44: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

C

The surrogate imports packages exported

by the composite

Sur

roga

te B

undl

e

Page 45: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

Sur

roga

te B

undl

eC

The surrogate exports packages imported

by the composite

Page 46: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

Sur

roga

te B

undl

eC

The surrogate consumes services published outside

by the composite

Page 47: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

Sur

roga

te B

undl

eC

The surrogate registers services consumed by the composite from

the outside

Page 48: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

● Issues with modeling composites as real bundles with nested frameworks

Page 49: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

● Issues with modeling composites as real bundles with nested frameworks● Sharing everything through a surrogate creates

lifecycle issues

Page 50: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

Sur

roga

te B

undl

eC

What happens if the composite is

stopped – the composite

framework is shutdown

Page 51: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

Sur

roga

te B

undl

eC

What happens if the composite is

stopped – the composite

framework is shutdown

Page 52: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

Sur

roga

te B

undl

eC

But C is still resolved and

expecting to be able to load

classes from the exported package

Page 53: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

● Issues with modeling composites as real bundles with nested frameworks● Sharing everything through a surrogate creates

lifecycle issues

Page 54: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

● Issues with modeling composites as real bundles with nested frameworks● Sharing everything through a surrogate creates

lifecycle issues● Consumers and Providers loose their identity to the

composite and surrogate– No support for Require-Bundle– ServiceFactory support is limited– Introspecting system dependencies is combersome.

Page 55: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

Sur

roga

te B

undl

eC

Composite and Surrogate must proxy all shared

resources

Page 56: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

Sur

roga

te B

undl

eC

Difficulties with proxying service

factories. No way to guarantee

unique locations or bundle IDs

Page 57: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

A1

A3

A2

Composite

Sur

roga

te B

undl

eC

Exports loose the identity of their

exporting symbolic name. Require-

Bundle is not possible

Page 58: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Transparent Sharing Policy

Page 59: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Virtualizing Framework Isolation

● Model isolation in a single framework instance

Page 60: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Virtualizing Framework Isolation

● Model isolation in a single framework instance● Each composite has a virtual framework that hides

outside bundles, services, and packages.

Page 61: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Virtualizing Framework Isolation

● Model isolation in a single framework instance● Each composite has a virtual framework that hides

outside bundles, services, and packages.● A sharing policy can be declared

– What is visible to the inside from the outside (imported)– What is visible to the outside from the inside (exported)

Page 62: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

A Sharing Policy controls the

visibility of shared resources

Framework

Composite

A1

A3

A2

C

Page 63: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

Composite

A1

A3

A2

C

What is visible from the point of view of a bundle in a composite

Page 64: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Implementing Composites

Framework

Composite

A1

A3

A2

C

What is visible from the point of view of a bundle

in the parent

Page 65: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Virtualizing Framework Isolation

● Model isolation in a single framework instance● Each composite has a virtual framework that hides

outside bundles, services, and packages.● A sharing policy can be declared

– What is visible to the inside from the outside (imported)– What is visible to the outside from the inside (exported)

Page 66: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Virtualizing Framework Isolation

● Model isolation in a single framework instance● Each composite has a virtual framework that hides

outside bundles, services, and packages.● A sharing policy can be declared

– What is visible to the inside from the outside (imported)– What is visible to the outside from the inside (exported)

● Enforce rules to ensure unique bundle identification● All bundle locations and bundle IDs must be unique● Important for supporting shared service factories

Page 67: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Installing a Composite

Configure?

Page 68: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Installing a Composite

Configure?

Create?

Page 69: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Installing a Composite

Configure?

Create?Reference?

Page 70: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Configure

String location = “myComposite; composite=true”;Map config = HashMap();config.put(“...startlevel.beginning”, “25”);

Map manifest = HashMap();manifest.put(“Bundle-SymbolicName”, location);manifest.put(“Composite-PackageExportPolicy”, “b”);manifest.put(“Composite-PackageImportPolicy”, “c”);manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”);manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”);...

Page 71: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Configure

String location = “myComposite; composite=true”;Map config = HashMap();config.put(“...startlevel.beginning”, “25”);

Map manifest = HashMap();manifest.put(“Bundle-SymbolicName”, location);manifest.put(“Composite-PackageExportPolicy”, “b”);manifest.put(“Composite-PackageImportPolicy”, “c”);manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”);manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”);...

Framework launching configuration

Page 72: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Configure

String location = “myComposite; composite=true”;Map config = HashMap();config.put(“...startlevel.beginning”, “25”);

Map manifest = HashMap();manifest.put(“Bundle-SymbolicName”, location);manifest.put(“Composite-PackageExportPolicy”, “b”);manifest.put(“Composite-PackageImportPolicy”, “c”);manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”);manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”);...

Specify the package export policy

Page 73: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Configure

String location = “myComposite; composite=true”;Map config = HashMap();config.put(“...startlevel.beginning”, “25”);

Map manifest = HashMap();manifest.put(“Bundle-SymbolicName”, location);manifest.put(“Composite-PackageExportPolicy”, “b”);manifest.put(“Composite-PackageImportPolicy”, “c”);manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”);manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”);...

Specify the package import policy

Page 74: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Configure

String location = “myComposite; composite=true”;Map config = HashMap();config.put(“...startlevel.beginning”, “25”);

Map manifest = HashMap();manifest.put(“Bundle-SymbolicName”, location);manifest.put(“Composite-PackageExportPolicy”, “b”);manifest.put(“Composite-PackageImportPolicy”, “c”);manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”);manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”);...

Specify the service import policy

Page 75: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Configure

String location = “myComposite; composite=true”;Map config = HashMap();config.put(“...startlevel.beginning”, “25”);

Map manifest = HashMap();manifest.put(“Bundle-SymbolicName”, location);manifest.put(“Composite-PackageExportPolicy”, “b”);manifest.put(“Composite-PackageImportPolicy”, “c”);manifest.put(“Composite-ServiceImportPolicy”, “(objectClass=c.CService)”);manifest.put(“Composite-ServiceExportPolicy”, “(objectClass=b.BService)”);...

Specify service filters to publish

Page 76: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Reference?

String location = “myComposite”;Map config = HashMap();Map manifest = HashMap();...

Installing a Composite

Create?

Page 77: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Reference? CompositeAdmin. installCompositeBundle( location, manifest, config);

Installing a Composite

String location = “myComposite”;Map config = HashMap();Map manifest = HashMap();...

Obtained from the service registry.

Page 78: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

CompositeBundle comp

CompositeBundleextends Bundle

String location = “myComposite”;Map config = HashMap();Map manifest = HashMap();...

Installing a Composite

CompositeAdmin. installCompositeBundle( location, manifest, config);

Page 79: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework

Empty Installed Composite

Sharing Policy

Composite Bundle: myComposite

Page 80: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Managing a Composite

Access?

Page 81: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Managing a Composite

Install?Access?

Page 82: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Managing a Composite

Install?

Start?

Access?

Page 83: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Managing a Composite

Install?

Start?

BundleContext ctxt = comp.getSystemBundleContext();...

Page 84: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Managing a Composite

Start?

Bundle a = ctxt.installBundle( “file:a.jar”);Bundle b = ctxt.installBundle( “file:b.jar”);...

BundleContext ctxt = comp.getSystemBundleContext();...

Page 85: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Managing a Composite

Bundle a = ctxt.installBundle( “file:a.jar”);Bundle b = ctxt.installBundle( “file:b.jar”);...

a.start();b.start();comp.start();...

BundleContext ctxt = comp.getSystemBundleContext();...

Page 86: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework

Resolved Composite

B

A

C

Composite Bundle: myComposite

Sharing Policy

exportb

exportc

Importb

Importc

Page 87: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Framework

Active Composite

A

Composite Bundle: myComposite

Sharing Policy

c.CService

b.BService

C

B

Page 88: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Demo

Page 89: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Isolating SWT and e4 applications

Root Framework

SWT

AppConsoleWeb UI

e4PhotoDemo

e4Contacts

Demo

Each Composite contains their own stack of bundles

which are isolated from each other

Page 90: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Isolating SWT and e4 applications

Root Framework

SWT

AppConsoleWeb UI

e4PhotoDemo

e4Contacts

Demo

SWT is installed in the root

framework and shared with the

composites which require SWT

Page 91: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Isolating SWT and e4 applications

Root Framework

SWT

AppConsoleWeb UI

e4PhotoDemo

e4Contacts

Demo

Application Descriptor and

Handle services are shared with

the Web UI

Page 92: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Benefits of Composites

● Composite Bundles are persistent

– Content of composite is reified when the parent framework restarts

– Like a normal bundle, the active state is persisted

Page 93: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Benefits of Composites

● Composite Bundles are persistent

– Content of composite is reified when the parent framework restarts

– Like a normal bundle, the active state is persisted

● Bundles can be grouped together into one executable unit

– Stopping a composite stops all constituent bundles

– Starting a composite starts the constituent bundles (which are marked for start)

Page 94: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Benefits of Composites

● Composite Bundles are persistent

– Content of composite is reified when the parent framework restarts

– Like a normal bundle, the active state is persisted

● Bundles can be grouped together into one executable unit

– Stopping a composite stops all constituent bundles

– Starting a composite starts the constituent bundles (which are marked for start)

● High level of isolation

– Strict control over what is imported to and exported from the composite.

– Sharing is fine grained and transparent

Page 95: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Difficulties with Composites

● Low-level API for installing content into composites– Equivalent to managing a complete framework

Page 96: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Difficulties with Composites

● Low-level API for installing content into composites– Equivalent to managing a complete framework

● Limitations for sharing resources– Extenders do not understand composites (DS, Spring,

Blueprint, Extension Registry, iPOJO)

Page 97: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Difficulties with Composites

● Low-level API for installing content into composites– Equivalent to managing a complete framework

● Limitations for sharing resources– Extenders do not understand composites (DS, Spring,

Blueprint, Extension Registry, iPOJO)

– Transparent sharing policy● Simplifies most things

Page 98: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Difficulties with Composites

● Low-level API for installing content into composites– Equivalent to managing a complete framework

● Limitations for sharing resources– Extenders do not understand composites (DS, Spring,

Blueprint, Extension Registry, iPOJO)

– Transparent sharing policy● Simplifies most things● But violates academic notion of a composite

Page 99: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Conclusion

● OSGi R4.3 is shaping up to be a big release– Still early, but some interesting things are far along

– OSGi API Updates

– Composite Bundles

● Composite Bundles– A powerful way to establish application isolation

– Provides a basis for defining subsystems

Page 100: Eclipse Con2010 Composites

© 2010 by IBM Corp.; Licensed under the Creative Commons Att. Nc Nd 2.5 license

Legal Notices

● Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both

● Other company, product, or service names may be trademarks or service marks of others