You are on page 1of 101

OSGi™ Component Programming

Thomas Watson
IBM Lotus
Equinox Committer

Peter Kriens
OSGi Technical Director
OSGi Evangelist
CEO aQute

© 2006 by IBM, aQute & OSGi; made available under the EPL v1.0 | 2006 | OSGi Alliance & IBM
Contents

 Setup

 Introduction to OSGi

 Managing your Target Environment

 The Equinox/OSGi Development Model

 OSGi Basics

 Components

 Services

 Remoting

 Conclusion

2 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Your Infrastructure

 You need to have the following software installed on your


machine in a new workspace:
 Eclipse SDK 3.2 M5 (http://www.eclipse.org)
 The tutorial projects from CVS:
 Server: bundles.osgi.org
 Repository /cvshome/bundles
 User eclipsecon
 Password 2006
 Projects all projects under eclipsecon06.tutorial

3 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Loading the tutorial projects from CVS
 Window > Open Perspective > Other > CVS Repository Exploring

 In CVS Repository view context menu: New > Repository Location


Fill in the necessary CVS Repository information

 In CVS Repositories view, expand: HEAD/eclipsecon06.tutorial

 Select all projects under eclipsecon06.tutorial and choose Check Out

4 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Your Workspace (more or less)

5 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Section I - OSGi Background

6 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What is the OSGi service platform?

 A Java™ framework for developing remotely deployed


service applications, that require:
 Reliability
 Large scale distribution
 Wide range of devices
 Collaborative

 Created through collaboration of industry leaders

 Spec 4.0 publicly available at www.osgi.org …

 Cool!

7 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Why the OSGi Service Platform?

 What problems does the OSGi Service Platform address?

 A unified software market:

 The limited (binary) software portability problem


 The complexity of building heterogeneous software systems
 Supporting the myriad of configuration, variations, and
customizations required by today’s devices
 Managing the software life-cycle on the device

8 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Limited Binary Software Portability

 Lack of portability causes


 Market friction: No large market of reusable components
and applications
 Reduced quality

 Unnecessary constraints on hardware and software


architectures
 CPUs differ widely in cost and performance
 Linux is nice, but it is sub-optimal for smaller devices

 Benefits of the OSGi Platform


 Applications run unmodified on different hardware and
software architectures

9 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Complexity of Software

 A DVD player can contain 1 Million lines of code


 Comparison: Space Shuttle ~ 0.5 Million
 A BMW car can contain up to 50 networked
computerized devices
 Eclipse contains 2.5 million lines of code
 An average programmer writes an average of 10 lines a
day …

 Houston … we have a problem

10 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Complexity of Software

Service Oriented Programming


Productivity

Structured
Programming

Assembly

Complexity and Size

11 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Limits Object Oriented Technology

 Objects are great, but oh,


the tangled webs we
weaves …
 Coupling severely limits
reusability
 Using a generic object, can
drag in a large number of
other objects
 Creates overly large
systems after a certain
complexity is reached
 Flexibility must be built in
by the programmer
 Plug-in architectures

12 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Service Oriented Architectures

 Separate the contract from


the implementation
 Allows alternate
implementations Service Contract
provides
 Dynamically discover and Component
bind available
implementations uses

 Based on contract
(interface)
 Components are reusable
 Not coupled to
implementation details

13 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Framework

 Allows applications to
share a single Java VM Application
The Application
Application
Application
 Classloading Blue-
Application
Application
Application
Speech XML USB
tooth Application
 Isolation/Security OSGi Library
OSGi Web
JTAPI
OSGi 3D Math
OSGi Server
The Application
 Communication `& Java
Comm
Java
Collaborations between Mail Java
Ports
VM
VM Security TCP/IP
VMLibraries
applications System Class
Java
Media Distri-
Imaging Java
VM SQL
Java
FWVM buted
 Life cycle management Java
VM
Crypto- VM Direc-
Operating System GUI
UPnP
 Policy free graphy Operating System
tories
Operating System
Operating Java
System
 Policies are provided by Java
VM
VM
bundles
Operating System
Operating System
 API is fully self managed
14 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Layering

Services

Security
Applications

Life Cycle

Module

Execution Environment

15 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Execution Environment

 OSGi APIs only use a subset


of J2SE and J2ME CDC
 OSGi Minimum EE CLDC/
MIDP
 Matches most profiles
 Implementations can use
more than the OSGi
Minimum EE OSGi
Min.
 Security is not mandatory
J2SE
 CLDC is possible if class CDC/FP
loaders are added in a
device specific way

16 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Module Layer

 Packaging of applications and


libraries in Bundles
 Raw Java has significant
bundle
deployment issues
 Class Loading modularization bundle
 Raw Java provides the Class
Path as an ordered search list,
bundle
which makes it hard to control
bundle
multiple applications bundle
 Protection
 Raw Java can not protect certain
packages and classes
bundle
 Versioning bundle
 Raw Java can not handle
multiple versions of the same
package

17 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Life Cycle Layer

 System Bundle represents


the OSGi Framework
System bundle
 Provides an API for bundle M
managing bundles
 Install
 Resolve Bundle
X-v2
X
 Start
 Stop
 Refresh
Bundle
 Update Bundle B
A
 Uninstall
 Based on the module layer

18 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Life Cycle Layer

 Bundle is started by the Bundle


Activator class
 Header in Manifest refers to
this class
INSTALLED STARTING
 Interface has 2 methods
start
 Start: Initialize and return
immediate
RESOLVED ACTIVE
 Stop: Cleanup
 The Activator gets a Bundle stop
Context that provides access to
the Framework functions UNINSTALLED STOPPING

 Framework provides Start Level


service to control the start/stop
of groups of applications

19 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Service Layer
 Provides an in-VM service model
 Discover (and get notified about) services based on their
interface or properties
 Bind to one or more services by
 program control,
 default rules, or
 deployment configuration

 SOA Confusion
 Web services bind and discover over the net
 The OSGi Service Platform binds and discovers inside a
Java VM

 The OSGi Alliance provides many standardized services

20 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Evolution
Planned R4
Application Manager
MIDP Container
Signed Bundles
Declarative Services
Power Management
Device Management
eli bo M Security Policies
R3 UPnP Exporter
Diagnostics/Monitoring
UPnP Framework Layering
Initial Provisioning Initial Provisioning
Name Space
UPnP
Jini

Start Level
IO Connector
Wire Admin
XML Parser
Measurement & State
Position
Execution Env.
el ci he V

R2
Package Admin
Configuration Admin
Permission Admin
User Admin
Preferences
MetaType
R1 Service Tracker
Framework
Http
Log
ot u A e mo H

Device Access

2000 2001 2003 2005

21 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Benefits of Using the OSGi Service Platform

 Components are smaller


 Easier to make

 Components are not coupled to other components


 Gives reusability

 Excellent model for the myriad of customizations and


variation that are required of today’s devices

 Collaborative model
 Allows reuse of other components for most problems

22 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Section II – Eclipse/Equinox

23 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What is Equinox ?
 An open source community focused on OSGi Technology
 Develop OSGi specification implementations
 Prototype ideas related to OSGi

 An OSGi Framework implementation


 Core of the Eclipse runtime
 Provides the base for Eclipse plug-in collaboration
 Fully compatible with the OSGi R4 specification

 New for Eclipse 3.2 – Other specification implementations


 Device Manager, Declarative Services, Event Admin, HTTP Service,
Log Service, Metatype Service, Preferences Service, User Admin, Wire
Admin – More on the way!!

24 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Equinox Target Environment

 Eclipse makes it easy to develop for Bundle A


{}
OSGi Service Platforms

 A target platform Install

Contains a set of bundles


Bundle c
Defines runtime parameters Bundle B
{}
{}

 To Define the Target Platform, Bundled


{}

goto: Bundle F
{}

Preferences ->Plug-in Development BundleG


{}
Bundle E
{}
->Target Platform Target
Select the target project in your OSGi Framework
workspace as location (Equinox)

25 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Setting up the Target Platform

26 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What Did We Learn
 The OSGi Service Platform is kind of a Java Operating
System

 It simplifies:
 Deployment Problems
 Software composition
 Software management

 Eclipse provides a development environment for OSGi


Bundles

 Eclipse provides open source implementations of the


OSGi specifications in the Equinox project

27 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Section III - Fundamental OSGi concepts

28 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Framework Entities

OSGi Framework

Bundle A
{}
Bundle B
{}

Bundle C = service, java interface


{}

29 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Bundles

 A bundle is the deliverable application


 Like a Windows EXE file
 Content is a JAR file

 A bundle registers zero or more services


 A service is specified in a Java interface and may be
implemented by multiple bundles
 Services are bound to the bundle life-cycle

 Searches can be used to find services registered by


other bundles
 Query language

30 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What is in a Bundle?

 A Bundle contains (normally in a JAR file):


 Manifest
 Code
 Resources Bundle A
{}
 The Framework:
 Reads the bundle’s manifest
 Installs the code and resources
 Resolves dependencies

 During Runtime:
 Calls the Bundle Activator to start the bundle
 Manages java classpath
 Handles the service dependencies
 Calls the Bundle Activator to stop the bundle

31 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Create the Hello World bundle

Step1.

Createnewplug-inproject

Step2

Project name: helloworld


Step3 Step4
anOSGiframework: standard
Generateanactivator UsetheHelloOSGiBundletemplate

32 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Real code! Hello World (and Goodbye)

 The wizard has generated


the code on the left HelloWorld.java
package helloworld
public class HelloWorld
 This class implements the implements BundleActivator {
public void start(
BundleActivator so that the BundleContext context)
Framework can start/stop throws Exception{
System.out.println(
the class "Hello world!!");
}

 The activator is referenced in public void stop(


BundleContext context)
the manifest throws Exception {
System.out.println(
"Goodbye world!!");
}
}

33 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Real code! Hello World (and Goodbye)

 The Manifest (in META-


INF/MANIFEST.MF) is also META-INF/MANIFEST.MF

generated by the wizard Manifest-Version: 1.0


Bundle-ManifestVersion: 2
Bundle-Name: Helloworld Plug-in
 Eclipse provides convenient Bundle-SymbolicName: helloworld
Bundle-Version: 1.0.0
editors for the manifest Bundle-Localization: plugin
Bundle-Activator: helloworld.Activator
Import-Package:
For the source: click on org.osgi.framework;version="1.3.0"
MANIEST.MF

 Notice:
Bundle-Activator (used to notify
the bundle of lifecycle changes)
Import-Package (dependencies)

34 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Eclipse Launch Configuration

 The Launch Configuration is prepared for you


 Run -> Run … -> EclipseTutorial

 Deselect “Target Platform” checkbox


 This removes all possible bundles from the launch
configuration

 Select “Add Required Plug-ins”


 This calculates from the dependency information, which
bundles are required to run our helloworld example

 Press Run

 The Framework is a console application

35 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Equinox Launch Configuration

36 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Run the Hello World bundle

 The Framework now runs the


helloworld example
See the printed text

 It also runs a Framework


console
Equinox specific

 Type “ss” (show status)


Look at the active bundles
Notice the number for the
helloworld bundle. This is the
bundle id.

 Type “stop <symbolic-name>”

37 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Self-Hosting Bundle Projects
JAR file layout
 Normally, a bundle is packaged META-INF/MANIFEST.MF
helloworld/HelloWorld.class
in a JAR file
file:c;/…
The traditional edit-compile-
debug cycle.

 Self-Hosting Allows for quick


debugging of bundle code Target Platform
No packaging steps
No deployment steps
Just code/save/run Project Layout
META-INF/MANIFEST.MF
 Some changes require update of reference:file:C:/… .project
the bundle in the Framework .classpath
src/helloworld/HelloWorld.java
Console: bin/helloworld/HelloWorld.class

update <symbolic-name> bin dir content automatically added to root


Complied into bin directory, non java files copied

38 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Creating deployable bundles – how it works

 The build.properties file specifies the


content of the bundle jar
Specifies the source and output folders of build.properties
the different libraries
source.. = src/
source.. – The source directory of the output.. = bin/
project. Used for compilation and resources.
bin.includes = META-INF/,\
output.. – The output directory where class .
files and resources are copied to
bin.includes – What is included in the JAR
from the project directory

 Export the content of a project into a


bundle jar
Bundle jars can be installed across multiple
OSGi Framework implementations
The Deployable plug-ins and fragments
wizard can be used to generate a bundle jar
from a project.
File -> Export -> Deployable plug-ins and
fragments

39 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What Did We Learn

 The unit of deployment of an OSGi Service Platform

 The Eclipse Target Environment

 How to launch an Equinox environment with a defined


set of bundles

 How to start/stop bundles

 How the Equinox console works

 How the classpath is managed for self hosted bundles

40 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Section IV – Component interaction and collaboration

41 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Collaborative model

 OSGi is more than an Applet, MIDlet, Xlet runner

 Bundles can collaborate through:


 service objects
 package sharing

 A dynamic registry allows a bundle to find and track


service objects

 Framework fully manages this collaboration


 Dependencies, security

42 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Collaborative model

OSGi Framework

Service
registry
Bundle Bundle
packages
packages

JAVA

Operating System

Hardware

43 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Collaborative model

Java Application Manager

No management bundles
Service
Midlet, registry Midlet, No collaboration
Xlet, Xlet,
or or
Applet packages Applet
packages No package management
(versions!)

JAVA

Operating System No native code

Hardware

44 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Classpath issues

 Java applications consists of classes


placed in packages
 Java searches for a package or
class in different jar files and
directories q q-1.0
 These are usually specified in the
CLASSPATH environment variable p
r
 An OSGi Framework is a network of p
class loaders.
q q-2.0
 Parameterized by the Manifest
headers

 Any dependencies between bundles


are resolved by the Framework
 It is possible to fetch bundles on
demand Bundle Wire
Exported package Constraint
 Complicated – But an OSGi
Framework makes it painless to use Exported package

45 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
OSGi dependency resolution

Framework
org.osgi.framework
org.osgi.service.http
Bundle A
Export org.osgi.service.log A resolved
com.ibm.service.log
com.ibm.j9
Import org.osgi.service.http
javax.servlet.http

Bundle B
Export ericsson.osgi
B resolved
javax.servlet
javax.servlet.http
org.osgi.service.log
Import org.osgi.service.http

46 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Package or Bundle Dependencies?

 The OSGi Specifications supports


both Require-Bundle and Import-
Package
 Require-Bundle creates a dependency
p
on a complete bundle Import-Package
Simple to use q
Imports packages that are not used r r

 Import-Package creates a s
dependency on just a package
Creates less brittle bundles because of Require-Bundle
substitutability
More cumbersome to use (Tools!) r
 In almost all cases, Import-Package
is recommended because it eases
deployment and version migration
 The specifications detail a number of
additional problems with Require-
Bundle

47 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
discover
Service Specifics
bind register

 A service is an object registered with


the Framework by a bundle to be
used by other bundles service
 The semantics and syntax of a
package org.osgi.service.log;
service are specified in a
import
Java interface org.osgi.framework.ServiceReference;
public interface LogService {
 A bundle can register a service.
public static final intLOG_ERROR= 1;
public static final intLOG_WARNING= 2;
 A bundle can use a service (bind to)
public static final intLOG_INFO= 3;
 1..1 public static final intLOG_DEBUG= 4;
 0..1 public void log(int level,
String message);
 0..n public void log(int level,
 A service can be discovered String message, Throwable exception);
public void log(ServiceReference sr,
dynamically
int level, String message);
public void log(ServiceReference sr,
 Services can go away at any time!
int level, String message,
Throwable exception);
}

48 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Services continued

 The Framework Service Registry is available to all bundles to collaborate with


other bundles
 Different bundles (from different vendors) can implement the same interface
 Implementation is not visible to users
 Allows operator to replace implementations without disrupting service

 OSGi defines a standard set of services


 Other organizations can define more (AMI-C)

 Extensive notifications for services life cycles


 Services have a unique id
 Services require permission
 Under Operator control

 Services are associated with properties


 Query language to find appropriate service
 Bundles can update the properties

49 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Manipulating Services

 The BundleContext provides the ServiceRegistration registerService(


String clss,
methods to manipulate the Object srvc,
service registry Dictionary prprts)

 Services registrations are ServiceReference[]


getServiceReferences(
handled by ServiceRegistration String clss,
objects String fltr)
They can be used to unregister a
service or modify its properties Object getService(
ServiceReference reference)
 Service References give access
boolean ungetService(
to the service as well as to the ServiceReference rfrnc);
service’s properties
 Access to service objects is
through the getService method.
These services should be
returned with the ungetService
method

50 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What Did We Learn

 The OSGi Service Platform provides a collaboration


model that is based on
 Services
 Package sharing

 Sharing is complicated, but the well defined


specifications make it quit painless for bundle developers

 Services provide a very powerful dynamic programming


model

51 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Section V – Service Components

52 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Components Simplify Service Programming

 The dynamic nature of services make


programming more complicated META-INF/MANIFEST.MF

 The declarative service model Manifest-Version: 1.0



simplifies handling these dynamics Import-Package:
Dependencies are defined in an XML file org.osgi.framework;version="1.3.0“,
org.osgi.service.component,
 Declarative Services: org.osgi.service.log
Optionally Depend on one or more Service-Component:
services OSGI-INF/component.xml
Optionally Provide a service
Optionally lazy initialized
OSGI-INF/component.xml
Configurable
<?xml version="1.0" encoding="UTF-8"?>
 Example shows a hello world bundle <component name="hello.component.log">
<implementation
that logs Hello and Goodbye
class="hello.Component"/>
<reference name="LOG”
 First add dependencies by selecting
interface=
MANIFEST.MF, on the Dependencies "org.osgi.service.log.LogService"/>
tab </component>
Add the component and log package

53 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Import the necessary packages

Step1–AddnewImportedPackages

Step2–Select thenecessarypackages

Step3–Savethebundlemanifest

54 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Login Component Source Code
OSGI-INF/component.xml
<?xml version="1.0" encoding="UTF-8"?>
 A component can be any class <component name="hello.component.log">
<implementation
No specific interface
class="hello.Component"/>
<reference name="LOG"
 The activate and deactivate methods interface=
are called when the component is "org.osgi.service.log.LogService"/>
activated/deactivated </component>

Dependencies must be resolved: Log Component.java


Service
package hello;
import org.osgi.service.component.*;
 The ComponentContext class
import org.osgi.service.log.*;
provides access to the referenced public class Component {
services LogService log;
protected void
The locateService methods finds a
activate( ComponentContext context){
reference
log = (LogService)
context.locateService("LOG");
 The component instance can be sure
log.log(LogService.LOG_INFO,
that at any moment in time between "Hello World"); }
activate and deactivate there is a protected void deactivate(
ComponentContext context) {
valid Log Service
log.log(LogService.LOG_INFO,
"Goodbye World");}}

55 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Add Declarative Services, Log, and Component

56 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Launching

 Launch the EquinoxTutorial


launch configuration

 You can look in the log with


the log command
Last event is at bottom

 Stop the bundle


Stop <symbolic-name>

 Run log again

57 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What Did We Learn

 Programming with services is complicated

 The Declarative Services model makes service


programming much simpler

 How the component XML is constructed

 We used the Log Service

58 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Section VI – Use Case: Developing a Chat Service

59 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
A Chat Service

 We will now design a service that


simplifies Chat/Instant Messaging SWT Chat Telnet
clients Chat Service Chat
We do the clients later, this is just Output
intended to support clients. Input channel
channel
 A Chat client should be able to
Window Channel service
communicate with a user through: Chat send(from,msg)
Telnet
A window, telnet session, MSN, AOL, Connections
Skype, etc. interface.

 We base the communication between


chat clients on a Channel interface.
We register a service we receive
messages from
The registry contains other channel
services we can send messages to
Peter Thomas
A property contains the user name session sessions
 For ease of use, we use a command
based interface for login and listing Channel services
buddies

60 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Channel Service Design
Channel.java

 Create a new project to hold our package aQute.service.channel;


import java.io.*;
service interface
public interface Channel {
Call this project <myname>.chat String CH_NAME="channel.name";
This is a Plug-in Project
void send(String from, String msg)
 The Channel service is one way: throws IOException ;
We only receive through a channel }
service

 A service property is defined. This


property must be registered with the META-INF/MANIFEST.MF
service Manifest-Version: 1.0
CH_NAME – This is the name of the Bundle-ManifestVersion: 2
user, e.g. pkriens Bundle-Name: Chat Plug-in
Bundle-SymbolicName: aQute.chat
 A single method send with the
Bundle-Version: 1.0.0
following arguments Bundle-Localization: plugin
from – The user name that sends the Import-Package:
message org.osgi.framework;version="1.3.0"
msg – The message to be send Export-Package: aQute.service.channel

 Export the service channel package

61 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
White Board Approach
Bundle C Bundle B Bundle A
 The White Board approach is: {} {} {}
Register a service
Let any interested bundle use it
register
 The White Board approach was
discovered during finishing of R1 Registry

Publisher
 We were not brave enough to scrap,
that is why the Log Service and Http Events: register,
Service are not white board unregister,
modified
 It is very effective because it reduces
the number of couplings between
bundles
get
 There is a white-paper comparing a
whiteboard approach with a non
Server
whiteboard approach.
bundle

62 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Telnet Based Chat Client

 The best way to start is to design a Thread


small test program. Activated by
Declarative Services
 The easiest way to a “UI” is a telnet
server that uses the Channel service
to communicate with siblings
LogService TelnetChat
This also shows how Internet servers
should be constructed
1
 The telnet Chat server will create a For each session
*
Handler for each opened session.
The Handler is a thread that waits for User
Handler
input from the user
The Handler registers a Channel.

 The Handler is stopped when the


session closes.
This unregisters the Channel service Channel

63 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The TelnetChat Manifest and component.xml
META-INF/MANIFEST.MF
 Create a new project for a telnet chat Manifest-Version: 1.0
Bundle-ManifestVersion: 2
 Call this project <myname>.telnetchat Bundle-Name: Telnetchat Plug-in
 This is a Plug-in Project Bundle-SymbolicName: aQute.telnetchat
Bundle-Version: 1.0.0
 Define the manifest and component Bundle-Localization: plugin
Service-Component: OSGI-INF/component.xml
definition
Import-Package: aQute.chat,
aQute.service.channel,
 Add the package import dependencies org.osgi.framework;version="1.3.0",
to the manifest. Either org.osgi.service.component,
 Direct in the source code org.osgi.service.log
 Via the Dependencies tab

 Add the reference to the


component.xml OSGI-INF/component.xml
<?xml version="1.0" encoding="UTF-8"?>
 The component.xml must reside in <component name="aQute.telnetchat">
OSGI-INF <implementation class=
"aqute.telnetchat.TelnetChat"/>
 We only specify a reference to the Log <reference name="LOG" interface=
Service "org.osgi.service.log.LogService"/>
</component>

64 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The TelnetChat Component code
TelnetChat.java
 The code does not show the import protected void
activate( ComponentContext context) {
packages and field definitions
this.context = context;
 The source code is provided for you to this.log = (LogService)
further check in aQute.telnetchat context.locateService("LOG");
 Eclipse will tell you when they miss start();
}
 The activate method:
protected void deactivate(
 Remembers the context for later
ComponentContext context) throws
 Gets the log service Exception {
 Starts the thread. quit = true;
for (Iterator i =
 The deactivate method: handlers.iterator();
i.hasNext();) {
 Sets the quit flag so any loops in the Handler h = (Handler) i.next();
started Thread will finally end
try { h.close();}
 Closes all created Handlers catch (Throwable e) {
 Exceptions are ignored because we are // We are closing
closing }
 And closes the server socket object, }
this will surely quit the main socket server.close();
accept loop. }

65 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The TelnetChat run method
TelnetChat.java
 The run method creates a socket and public void run() {
accepts incoming connections. while (!quit) try {
server = new ServerSocket(2030);
 For bundles, it is crucial that this server.setSoTimeout(1000);
loop();
loop never quits, but also not
} catch (Exception e) {
overloads the system log.log(LogService.LOG_ERROR,
 There is usually no end user watching "[TelnetChat] Inner loop",
a server … e);
sleep(10000);
 The outer loop therefore catches }}
errors, sleeps and try again void loop() throws Exception {
 A lot of problems disappear over time. while (!quit) try {
For example, an Internet connection Socket socket = server.accept();
can be temporarily be down Handler handler = new Handler(
context.getBundleContext(),
 The socket has a timeout to check socket, this);
the flag regularly handlers.add(handler);
handler.start();
 The inner loop } catch (SocketTimeoutException e) {
 Wait for an incoming socket // Just for checking the quit flag
 Creates a handler // at a regular basis
}}
 And starts the handler’s thread

66 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
TelnetChat convenience methods
TelnetChat.java
void remove(Handler handler) {
 Convenience methods handlers.remove(handler);
}

void sleep(int ms) {


try {
Thread.sleep(ms);
} catch (InterruptedException e1) {}
}

67 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Handler Source Code
Handler.java

 The constructor receives the public Handler(BundleContext context,


Socket socket, TelnetChat activator)
socket for the session with the throws Exception {
end user. It initializes: this.ctxt = context;
this.socket = socket;
The fields this.parent = activator;
A Writer object to send text to writer = new PrintWriter(
new OutputStreamWriter(
the end user socket.getOutputStream()));
}
 The send method writes the public void send(String source,
message in the Write object and String msg) throws IOException {
writer.println(source + "> " + msg);
flushes it to ensure the user writer.flush();
sees it }
void close() {
try {
 The close method closes the quit = true;
different objects and quits the writer.close();
socket.close();
main loop: } catch (IOException e) {
By setting the quit flag // Ignore in close
}}
By closing the socket

68 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Handler Source Code
Handler.java

 The run() method loops as long public void run() {


writer.println("Welcome … Chat");
as there is input from the user. writer.print("Enter name: ");
It quits when the socket is writer.flush();
try {
closed or an error occurs. BufferedReader rdr =
new BufferedReader(
 Errors are only logged when the new InputStreamReader(
socket.getInputStream()));
session has not quit because while (!quit &&
there are usually socket errors (line=rdr.readLine()) != null) {
line = line.trim();
during closing process(line);
}} catch (Exception e) {
 The finally clause is used to if (!quit)
parent.log.log(
guarantee that the handler is LogService.LOG_ERROR,
removed from the parent when "reading user input", e);
} finally {
it is closed.
if ( channel != null )
channel.unregister();
 If a valid line is received, it is parent.remove(this);
send to the process method parent = null;
close();}}

69 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Handler Source Code
Handler.java

 The process method handles void process(String line) throws


IOException, Exception {
a line of input from the user if ( user == null) {
user = line;
Hashtable props = new Hashtable();
 If we did not have a login props.put(Channel.CH_NAME, user);
channel =ctxt.registerService(
name yet, we assume it is Channel.class.getName(), this,
the given line props);
send("info", "User set to: "
+ user);
 If the line starts with /quit, } else {
if (line.startsWith("/quit")) {
we quit the program writer.println("bye ");
} else dispatch(line);
 Otherwise we assume it is a }
}
line we need to send to
another user, which is
handled in the dispatch
method

70 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Handler Source Code
Handler.java
void dispatch(String line) throws
 The dispatch method parses Exception {
the destination name from String parts[] = line.split("\\W");
ServiceReference channels[] =
the input ctxt.getServiceReferences(
Channel.class.getName(),
"(" + Channel.CH_NAME + "="
 For this name , finds a + parts[0] + ")");
if (channels != null) {
Channel service Channel toChannel =
(Channel) ctxt.getService(
channels[0]);
 It then sends the remainder toChannel.send(user,
line.substring(
of the line to that service parts[0].length()));
ctxt.ungetService(channels[0]);
} else {
send("error",
"no such user: " + parts[0]);
}
}

71 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Run the Telnet Chat

 Launch the EquinoxTutorial

 Do not forget to check the launch


configuration
 The TelnetChat bundle included?
 Includes all required bundles from the
Target environment?
 Do not forget to start the bundle via
the console

 Create 2 telnet sessions:


 Open a telnet session into port 2030
 Login with your last name
 Open a second telnet session into port
2030
 Login with another name

 See if you can send messages Check


the services, and see that two
channel services are registered
 Services (objectclass=*Channel)

72 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What Did We Learn

 How services are designed


 White board approach

 Developed a simple telnet chat application


 Chat sessions use the white board approach to find
Channel services
 The Channel service is used to send messages

73 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Section VII – Service Tracking

74 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Finishing the Chat Service
Chat.java
Chat(BundleContext cntxt,Channel user)
 The TelnetChat contains code that
must be repeated between different void execute(String ln) throws IOException
clients
String[] getBuddies()
 A Chat library that captures the shared
code would be useful void close()
 As a bundle, this could run on phones, String getName()
Eclipse, etc.
void login( String user, String passwd)
 For this example, we create a Chat
class that works on a command line
basis META-INF/MANIFEST.MF
 The Chat class will be added to the Manifest-Version: 1.0
<myname>.chat bundle Bundle-ManifestVersion: 2
 /xxx are commands Bundle-Name: Chat Plug-in
Bundle-SymbolicName: aQute.chat
 This bundle will therefore act as a Bundle-Version: 1.0.0
library and exports the chat package Bundle-Localization: plugin
Import-Package:
 Not all code is shown, however, this is org.osgi.framework;version="1.3.0"
available in the aQute.chat project Export-Package: aQute.service.channel,
aQute.chat

75 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Case for the ServiceTracker

 Finding services for each message is kind of expensive.

 The ServiceTracker in org.osgi.util.tracker package is intended to


simplify this task

 A service tracker maintains a list of services based on:


 A filter
 A specific class

 It reports any existing or new services as well as any services that


become unregistered
 Object addingService
 void modifiedService
 void removedService

 The service tracker is used to track channels and store them in a Map

76 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
ServiceTracker: create

Framework Bundle
A

Bundle
B

Bundle
C

77 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
ServiceTracker: open

Framework Bundle
addServiceListener A

Bundle
B

Bundle
C
Object addingService(ServiceReference r){…}

78 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
ServiceTracker: adding

Framework Bundle
addServiceListener A

Bundle
B

Bundle
C
Object addingService(ServiceReference r){…}

79 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
ServiceTracker: removing

Framework Bundle
addServiceListener A

Bundle
B

Bundle
C
void removedService(ServiceReference r,Objecto){…}

80 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
ServiceTracker: modified

Framework Bundle
addServiceListener A

Bundle
B

Bundle
C
void modifiedService(ServiceReference r, Object o){…}

81 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Chat Library
Chat.java
public Chat(BundleContext context,
 The Constructor initializes final Channel user) {
some fields and creates the this.user = user;
this.cntxt = context;
service tracker channels = doChannelTracker(
context, user);
channels.open();
 The user is given as a }

Channel. The user of this


library must implement this
service to get a callback with
any incoming messages.

82 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Chat Library Service Tracker
Chat.java
ServiceTracker doChannelTracker(
 The Service Tracker is used BundleContext cntxt,
to track Channel services final Channel user) {
return new ServiceTracker(
cntxt,
 The addingService method Channel.class.getName(), null) {
gets the Channel and puts public Object addingService(
the Channel in a Map under ServiceReference ref) {
Channel buddy = (Channel)
the given name context.getService(ref);
if (buddy != user) {
 The removedService String name = (String)
method just cleans up the ref.getProperty(Channel.CH_NAME);
Map when a Channel service String rn = name; int n = 0;
synchronized (bdds) {
is removed while(bdds.containsKey(rn))
rn = name + "-" + n++;
bdds.put(rn, buddy);
}}return buddy;}

public void removedService(


ServiceReference ref,Object buddy){
bdds.remove( ref.getProperty(
Channel.CH_NAME)); }}; }

83 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Chat Library
Chat.java
public void login(String name,
 The login method registers a String password) throws IOException {
new Channel service if (registration != null)
registration.unregister();
registration = null;
 The password is ignored this.name = name;
Hashtable properties =
new Hashtable();
 The result is sent as a
properties.put(
message to the user Constants.SERVICE_PID,
"pid:chat[" +
InetAddress.getLocalHost()
+ "]:" + name);
properties.put(
Channel.CH_NAME, name);
registration = cntxt.registerService(
Channel.class.getName(),
user, properties);
user.send("", "Logged in as "
+ name);
}

84 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Chat Library: execute
Chat.java
public void execute(String line)
 The execute method looks at throws IOException {
the command line and scans if (!line.startsWith("/"))
send(line);
for ‘/’ characters, which are else {
String ws[]=line.split("\\s+");
commands if ("/buddies".startsWith(ws[0]))
doBuddies();
/help – Show short help else if("/help".startsWith(ws[0]))
doHelp();
/buddies – List the buddies else if("/login".startsWith(ws[0]))
login(ws[1], null);
/login – Login else {
lastTo = ws[0].substring(1);
/<buddy> to send to a buddy send(line.substring(ws[0].length()
+ 1));
}
 If no / is given the message }
is sent to the last used }

buddy

85 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Chat Library: send
Chat.java
void send(String line)
 The send method must throws IOException {
transfer the message to the if ( lastTo == null )
user.send("", "No buddy");
lastTo buddy. else {
Channel channel =
(Channel) bdds.get(lastTo);
 We maintain all the buddy if (channel != null) {
channel.send(name, line);
Channel services in the bdds user.send(name, line);
} else
Map field, so it is easy to find user.send("?", "Can't find "
+ lastTo);
them }
}

86 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Chat Library: doBuddies, getBuddies
Chat.java
void doBuddies() throws IOException {
 The doBuddies method sends StringBuffer sb = new StringBuffer();
String del = "";
the list of currently logged in for( Iterator i=
buddies to the user bdds.keySet().iterator();
i.hasNext();) {
sb.append(del);
 The getBuddies method sb.append(i.next());
del = ", ";
returns the buddies as a }
user.send("", sb.toString());
String[] }

public synchronized String[]


getBuddies() {
return (String[])
bdds.keySet().toArray(
new String[0]);
}

87 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The Chat Library: utiltities
Chat.java
void doHelp() throws IOException {
 The doHelp method sends user.send("", "…n as: " + name);
some help text to the user user.send("", "/bdds …");
user.send("", "/help …");
user.send("", "/login …");
 The getName method user.send("", "/<name> … ");
user.send("", "…");
returns the currently logged }

name public String getName() {


return name;
}
 The close method uses a
public void close() {
careful way to unregister the ServiceRegistration reg;
associated Channel service synchronized (this) {
reg = registration;
only once if (reg == null)
return;
Often it is not easy to control registration = null;
}
how many time close is called reg.unregister();
}

88 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What Did We Learn

 How to track services and react appropriately on their


arrival and departure

 How to use the Service Tracker

 The white board pattern as a solution to many dynamic


problems

89 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Section VIII – Finishing Touch

90 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Using the Chat Library META-INF/MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Swtchat Plug-in
 We now have a library bundle that is Bundle-SymbolicName: aQute.swtchat
Bundle-Version: 1.0.0
easy to use Service-Component:
OSGI-INF/component.xml
 We could adapt the Telnet Chat, but Bundle-Localization: plugin
Import-Package: aQute.chat,
that is old news
aQute.service.channel,
org.eclipse.swt,
 Lets make a small SWT program that org.eclipse.swt.events,
shows a simple chat window org.eclipse.swt.layout,
org.eclipse.swt.widgets,
 Call this project <myname>.swtchat org.osgi.framework,
org.osgi.service.component
 This is a Plug-in Project
OSGI-INF/component.xml
 Such a program is provided in the <?xml version="1.0" encoding="UTF-8"?>
aQute.swtchat bundle <component name="aQute.swtchat.component">
<implementation class=
"aqute.swtchat.ChatWindow"/>
</component>

91 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Using the Chat Library
ChatWindow.java

protected void activate(


ComponentContext context)
 The activate method creates throws Exception {
a new Chat instance and this.chat = new Chat(
context.getBundleContext(), this);
starts the thread start();
}
protected void deactivate(
 The deactivate method sets ComponentContext context)
throws Exception {
a quit flag and interrupts the quit = true; interrupt();
}
running thread so that it can public void run() {
createShell();
exit shell.open();
display = shell.getDisplay();
 The run method creates and while (!shell.isDisposed() && !quit)
try {
opens a new window if (!display.readAndDispatch())
display.sleep();
 Reads quit flag to determine } catch (Exception e) {
error(e);}
when to close the application if (!shell.isDisposed())
shell.dispose();chat.close();
}

92 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Using the Chat Library

void createShell() {
 The usual window verbosity shell = new Shell();
shell.setText("SWT Chat");
… GridLayout layout = new GridLayout();
layout.numColumns = 1;
shell.setSize(500, 300);
 The window creates: shell.setLayout(layout);
text = new Text(shell,
SWT.MULTI|SWT.BORDER|SWT.MULTI|SWT.V_SCROLL
A shell (the window itself), |SWT.READ_ONLY);
GridData spec = new GridData();
A text field that will contain spec.horizontalAlignment = GridData.FILL;
spec.grabExcessHorizontalSpace = true;
the chat output, and spec.verticalAlignment = GridData.FILL;
spec.grabExcessVerticalSpace = true;
A line field that will contain text.setLayoutData(spec);
line = new Text(shell,
the chat input SWT.MULTI|SWT.BORDER|SWT.V_SCROLL);
spec = new GridData();
spec.horizontalAlignment = GridData.FILL;
spec.grabExcessHorizontalSpace = true;
spec.verticalAlignment = GridData.FILL;
spec.grabExcessVerticalSpace = false;
spec.heightHint = 40;
line.setLayoutData(spec);
line.addKeyListener(this);
}

93 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Using the Chat Library
public void keyPressed(KeyEvent ev){}
public void keyReleased(KeyEvent ev){
 The keyReleased method switch (ev.keyCode) {
processes when the new line case SWT.CR : try {
String txt = line.getText();
is entered chat.execute(txt.trim());
line.setText("");
} catch (IOException e1) {
 The error method displays error(e1);
}
an error to the user break;}}

void error(Exception e) {
 The send method displays a if (!quit) {
text.append("error> ");
message to the user from text.append(e + "");}}
another client public void send(final String from,
final String str) {
display.asyncExec(new Runnable() {
public void run() {
text.append(from + "> " + str
+ "\r\n");
}});}

94 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Running the SWT Chat

 Run the SWT Chat in the


normal way
Verify the target bundles

95 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Remoting

 The chat is kind of boring because it public void login(String name,


only works on our own laptop. String password) throws IOException{
if (registration != null)
Missing is discovery of each other’s
registration.unregister();
bundles! Rescue is on the way … registration = null;
this.name = name;
 Enable the aQute.remoting project Hashtable properties =
This project can export services to new Hashtable();
other participating machines
properties.put(“remote”, “*” );
 The only requirement is that you properties.put(
have a property remote=* on your Constants.SERVICE_PID,
service. See code "pid:chat[“ +
InetAddress.getLocalHost()
 The aQute.remoting project will then + "]:" + name);
export this service to any properties.put(
participating machine Channel.CH_NAME, name);
registration = cntxt.registerService(
 Our Channel objects will therefore be Channel.class.getName(),
user, properties);
spread all over the place user.send("", "Logged in as "
+ name);
 Enable the aQute.remoting bundle,
}
launch, and test with your buddies.

96 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Machine B
Remoting

Machine A
Machine C

Broadcast +p2p

network

Machine E
Proxy of Channel
Machine D

Real Channel

97 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What did we learn?

 That the OSGi Service Registry is a surprisingly powerful


model for collaboration

 The decoupling that it promotes allows additional


functionality without influencing existing functions

98 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
What We Did Not Learn

 Security Architecture  UPnP

 Permission Management  User Admin

 Signed Bundles  Wire Admin

 Package Management  Application Model

 Bundle Life Cycle Management  Deployment Admin and Autoconf

 Configuration Management and  Device Management Tree


Preferences  Initial Provisioning
 Servlet Support/Web Server  Position, Measurement, State

 Device Access  MetaType

 Event Manager  And much, much, more

99 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
Conclusion

 The OSGi R4 Specifications consists of considerable more


details than elucidated in this tutorial
 There are many independent OSGi implementations on the
market, both commercial and open source
 Apache Felix, Atinav, Eclipse Equinox, Espial, IBM SMF,
Knopflerfish/Ubiserv of Gatespace, ProSyst, …

 The OSGi specification are today running on mobile phones,


PDAs, embedded computers, desktops, and mainframes
 Both in managed and unmanaged configurations

 The OSGi specifications solve real world problems

 The OSGi Alliance is working on making the OSGi specifications


the standard for portable applications. Join us!

100 OSGi Component Programming | © 2006 by IBM, aQute & OSGi; made available under the EPL v1.0
The End
Further reading:

http://www.osgi.org

http://bundles.osgi.org

http://www.eclipse.org/osgi

http://www.aqute.biz

OSGi is a trademark of the OSGi Alliance in the United States, other countries, or both.
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United
States, other countries, or both.

© 2006 by IBM, aQute & OSGi; made available under the EPL v1.0 | 2006 | OSGi Alliance & IBM

You might also like