osgi specification evolution - bj hargrave

Post on 18-Jul-2015

53 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

OSGi Specification Evolution

BJ HargraveOSGi FellowCore Platform Expert Group Chair hargrave@us.ibm.com

©1999-2002 OSGi, All Rights Reserved

OSGi Service Gateway Release 1 May 2000

Devi

ce M

anag

er

Http

Ser

vice

Log

Serv

ice

Framework

©1999-2002 OSGi, All Rights Reserved

Framework

Package Admin Permission Admin

Devic

e M

anag

er

User

Adm

in

Serv

ice

Trac

ker

Conf

igur

atio

n Ad

min

Pref

eren

ces

Serv

ice

Log

Serv

ice

Http

Ser

vice

OSGi Service Platform Release 2 Oct 2001

©1999-2002 OSGi, All Rights Reserved

Framework

PackageAdmin Start LevelPermissionAdmin URL handler support

Devic

e M

anag

er

User

Adm

in

Serv

ice T

rack

er

Conf

igur

atio

n Ad

min

Pref

eren

ces

Serv

ice

Log

Serv

ice

Http

Ser

vice

IO C

onne

ctor

Ser

vice

Posi

tion

XML

Pars

er S

ervi

ce

UPnP

Ser

vice

Jini

Serv

ice

Wire

Adm

in

Mea

sure

men

t

Planned Content

OSGi Service Platform Release 3 1Q 2003

Execution Environment

©1999-2002 OSGi, All Rights Reserved

R3 Document Sections

• Reference section– Not normative– Intended to be illustrative, define common terminology and suggest how OSGi might be

used

• Specifications section– Normative– Future updates to these specifications will be made backward compatible

• Proposed Specifications section– Normative– A proposed specification has resolved known design choices, is believed to be well

understood, has received significant review and appears to enjoy enough interest to be of considerable value

– However, these specifications lack real life experience by multiple companies which makes it difficult to guarantee full backward compatibility in the future.

– Implementing the proposed specifications is recommended but implementers should consider the effects of future changes to the specification that, in worst case, will not be backward compatible

– Deploying implementations of such standards into a disruption-sensitive environment is not recommended

©1999-2002 OSGi, All Rights Reserved

Framework Enhancements

• Dynamic Import Package– Package may be imported after bundle resolution– Useful for Class.forName idiom

• Automatic import of java.* packages

• Improved native code selection algorithm• Different default FilePermissions for

bundle data area• Additional FrameworkEvent types

©1999-2002 OSGi, All Rights Reserved

Execution Environments

• Two execution environments are specified

• OSGi/Minimum-1.0– Minimum execution environment that supports OSGi Framework and

basic services implementations

• CDC-1.0/Foundation-1.0– J2ME Foundation Profile– Proper superset of OSGi/Minimum-1.0

• Bundles written to OSGi/Minimum-1.0 will also run on CDC-1.0/Foundation-1.0 and J2SE

©1999-2002 OSGi, All Rights Reserved

EE Comparison

J2SE

CDC-1.0/Foundation-1.0

OSGi/Minimum-1.0

©1999-2002 OSGi, All Rights Reserved

Start Level Service

• Allows a management agent to order the startup sequence and shutdown sequence of bundles.

• Supports a virtually unlimited number of levels.

• The model for start levels is compatible with the Service Platform Release 2 specifications.

©1999-2002 OSGi, All Rights Reserved

Start Level ServiceClass Diagram

managementbundle

event listener

<<interface>>FrameworkListener

StartLevel

0..*

FrameworkImplementation

Framework impl.

FrameworkEvent

is notified by1

0..*

start levelgets changed

0..*

©1999-2002 OSGi, All Rights Reserved

URL Stream and Content Handlers

• Multiple bundles are allowed to register ContentHandler objects and URLStreamHandlerobjects

• Existing schemes in an OSGi Service Platform cannot be overridden

• The life cycle of bundles is supported• Scheme handlers and content type handlers

become unavailable when the registering bundle is stopped

• Minimal effort is required for a bundle to provide a new URL scheme or content type handler

©1999-2002 OSGi, All Rights Reserved

URL Stream and Content Handlers Class Diagram

java.net.URL

java.net.URLStreamHandler

java.net.URLStreamHandlerFactory

java.net.URLConnection

java.net.ContentHandler

java.net.ContentHandlerFactor

URLStreamHandlerService

URLConnectionsubclass impl.

URL Stream Handler Proxy impl.

Content Handler Proxy impl.

Stream Handler implement.

Content Handler implement.

URL Stream Handler Fact. impl.

URL Content handler Fact. implement.

1

0,1gets URLStreamHandlers from

0..*

1

gets content via1

0,1

1 0..*

0..*

0,1

<<interface>>URLStreamHandlerSetter

<<class>>AbstractURLStream

creates connections of

isby

is found in registryy (keyed by m

ime)

is called by

setURL

tracked

b

©1999-2002 OSGi, All Rights Reserved

Wire Admin

• Provides a comprehensive mechanism to link data producing components with data consuming components in an OSGi environment

• Contains configuration data in order to allow either party to adapt to the special needs of the wire

• Facilitates the negotiation of the data type to be used for data transfer between producers of data and consumers of data– Consumers and producers must be able to handle multiple data types for data exchanges

using a preferred order

• Separates connected parties from each other. Neither party is required to hold the service object of the other party

• The interfaces are designed so that both parties, the Producer and the Consumer services, should be easy to implement

©1999-2002 OSGi, All Rights Reserved

Wire AdminClass Diagram

0,1

0..*<<interface>>Wire

<<service>>WireAdmin

<<service>>Consumer

1

update/polled

maintains

<<service>>Producer

WireAdminEvent

<<service>>WireAdminListener

Wire Admin impl.

Producer impl.Consumer impl.

WireAdminListener impl.

Wire impl(persistent)

0..*

Administrating UI

0,10..*

administers

updated

polllistens to0..*

1sends out events

©1999-2002 OSGi, All Rights Reserved

XML Parser Service

• Leverages existing standards in Java based XML parsing: JAXP, SAX and DOM

• Runs unmodified JAXP code• Easy to provide a SAX or DOM parser as well as

easy to find a matching parser• Possible to have multiple implementations of

parsers available• Parsers are likely to be extended in the future with

more functionality

©1999-2002 OSGi, All Rights Reserved

XML Parser ServiceClass Diagram

<<class>>SAXParserFactory

<<class>>DocumentBuilderFactory

XMLParserActivator

SAXParseruser

DocumentBuilder user

Subclass impl.

<<class>>SAXParser

<<class>>DocumentBuilder

Document Builder impl.

SAXParserimpl.

parses with

registered by

instantiates

reads bundle META-INFParser ImplementationBundle

getsgets

0..*

0..*0..*

0..*

0..*0..*

0,1 0,1

0,10,1

0..* 1 0..*1

parses with

0..* 0..*instant. by

registered by

©1999-2002 OSGi, All Rights Reserved

Measurement

• A utility class that provides a consistent way of handling a diverse range of measurements

• Simplifies measurements calculations

• Handles unit conflict resolution

• Handles unit coercion

• Consistent handling of error calculation and unit types

• Uses SI units

©1999-2002 OSGi, All Rights Reserved

MeasurementClass Diagram

is of unitUnitMeasurement

0..n 1

State

©1999-2002 OSGi, All Rights Reserved

Position

• Utility class that provides an information object that has well defined semantics for a position

• Uses the World Geodetic System 84 as the datum

• Provides speed and track information

• Position information may have errors or may not be measurable

• Uses SI units for all measurements

• Works within the Wire Admin service

©1999-2002 OSGi, All Rights Reserved

PositionClass Diagram

latitude

<<class>>Position

<<class>>Measurement

1 1

longitude1

1 1 1

1 altitude 1

1 track 1

speed

©1999-2002 OSGi, All Rights Reserved

IO Connector Service

• Provides an intermediate layer that abstracts the actual protocol and devices from the using bundle

• Allows third-party bundles to extend the system with new protocols and devices

• Allows a protocol to be layered on top of lower layer protocols or devices

• Allows the selection of actual protocol/device by means of configuration data

• Compatible with existing standards

©1999-2002 OSGi, All Rights Reserved

IO Connector ServiceClass Diagram

Connector

<<interface>>Connection

<<interface>>InputConnection

<<interface>>OutputConnection

<<interface>>StreamConnection

<<interface>>ContentConnection

<<interface>>HttpConnection

<<interface>>DatagramConnection

<<interface>>StreamConnec-tionNotifier

Connector Service impl.

Impl. of scheme providers

Impl. of IO user

provides io scheme 0..*1

0..*

uses Impl. of Connection

10..*

1

0,1

<<service>>ConnectorService

<<service>>ConnectionFactory

connections factory0,1

used as default

©1999-2002 OSGi, All Rights Reserved

Jini Service

• Jini services are usable as OSGi services and vice versa

• Jini services should not compromise OSGiService Platform security

• A bundle can export an OSGi service as a Jini service

• A bundle can use an OSGi service that represents a Jini service

©1999-2002 OSGi, All Rights Reserved

Jini ServiceClass Diagram

JiniDriver

Importer impl.

JiniDriver impl.

Exporter impl.

some service tagged with EXPORT

ServiceRegistrar

Some imported Jini service

Some importable JiniService

ServiceRegistrar

Some exportable Jiniservice

exportedto

gets0..*

0..*

0..*

0..*

registered

Jini Community

Jini DriverBundle

proxy object Service Registrar proxy object

0..*

1

0..*

1

0..* 0..*

sets Jini templates for requested Jini services

gets

0..* 0..*

proxy for proxy for

©1999-2002 OSGi, All Rights Reserved

UPnP Service

• Limited to device control of UPnP– Aspects concerning the TCP/IP layer are not addressed

• OSGi services can be transparently made available to UPnP networks

• Possible to restrict the use of UPnP to a selection of the possible networks

• Bundles can listen to UPnP events• Bundles can make a service available to UPnP

controllers• Bundles can control UPnP devices

©1999-2002 OSGi, All Rights Reserved

UPnP ServiceClass Diagram

<<interface>>UPnPService

a listener

<<interface>>UPnPAction

<<interface>>UPnPStateVariable

<<interface>>UPnPEventListener

<<interface>>UPnPIcon

A UPnP device implementer

A UPnP control point

A UPnP device implementation

out parm

has

1

0..n 0..n

1

10..n

11..n

UPnP Base Driver Implementation

associatedw

ith

has

registers getsregisters

list ensto

0..n

1 1 0..n

has

1..n

1

0..n

1

10..n

<<service>>UPnPDevice 0..n

0,1child

has

in parameter

©1999-2002 OSGi, All Rights Reserved

Availability

• OSGi Service Platform Release 3– Specification on track to be publicly available in 1Q 2003

Backup

©1999-2002 OSGi, All Rights Reserved

Framework

• Foundation of OSGi specification• Allows applications to share a single Java VM• Manages applications

– Life cycle, Java Packages, Security, Dependencies between applications

• Service registry for collaboration• Extensive notification mechanism• Policy free

©1999-2002 OSGi, All Rights Reserved

Log Service

• Simple and small Log service for operator

• 4 Levels– INFO, DEBUG, WARNING, ERROR

• Automatically logs framework events in a defined way

• Other bundles can access log history– Management bundle– History size implementation dependent

©1999-2002 OSGi, All Rights Reserved

Log ServiceClass Diagram

a log usera log user a log readera log reader

LogServiceLogService

a log service impl.

a log service impl.

A log entryimpl.

A log entryimpl.

A log readerimpl.

A log readerimpl.

Log Service Impl. bundle

Store a message for retrieval and broadcast

Message log

Send new log entry

A loguser bundle

A logreaderusing bundle

Log a message Retrieve log

LogReaderServiceServi

LogReaderLogEntryLogEntry LogListenerLogListener ce

©1999-2002 OSGi, All Rights Reserved

Http Service

• Provides web access to bundles

• A powerful servlet runner– Supports Servlet Version 2.1

• Very simple to export static pages and files (like images)

• Automatically unregisters servlets when bundle is stopped

©1999-2002 OSGi, All Rights Reserved

Http ServiceClass Diagram

HttpServiceHttpService

Default impl.HttpContext

Default impl.HttpContext

Resourceregistration

Resourceregistration

Servletregistration

Servletregistration

NameSpacealias

NameSpacealias

An Http Serviceimpl.

An Http Serviceimpl.

Impl. Of Httpcontext

Impl. Of Httpcontext

Impl. Of servlet

Impl. Of servlet

Bundles main code

Bundles main code

javax.servlet.ServletServlet

javax.servlet.

NameSpaceExceptionException

NameSpaceHttpContextHttpContext

javax.servlet.Request/Response

javax.servlet.Request/Response

©1999-2002 OSGi, All Rights Reserved

Device Access

• Dynamic device driver download model

• Plug & Play– Plugged in devices identify themselves– Device Manager will download appropriate bundle

• Matching process for best driver

• Extendable– Driver locator

©1999-2002 OSGi, All Rights Reserved

Device AccessClass Diagram

References to install

Locatorbundle

Locatorbundle A deviceA deviceselector

bundleselectorbundle DriverDriver

attachselects

DeviceManager

DeviceManager

DeviceDeviceDriverLocator

DriverLocator

DriverSelector

DriverSelector

©1999-2002 OSGi, All Rights Reserved

Device Access

DriverLocator

DriverLocator

7. attach

4. find bundle location

5. Install bundle

2. register

Camera1. Insert camera

9. Select camera

8. Register camera

3. Select device

DeviceManager

SonyCCD654

Driver 6. register

TVbundle

Camera

Device

IEEE1394B

NetworkbundleInterface

10. Show camera on TV

TV

©1999-2002 OSGi, All Rights Reserved

Package Admin

• Policy interface to Framework for package administration

• Uninstalling a bundle will not withdraw exported packages– anymore (this was optional in Release 1)

• Inspect current state of package sharing

• Cleanup stale exported packages by refreshing the minimum set of bundles

©1999-2002 OSGi, All Rights Reserved

Permission Admin

• Policy interface to Framework for permission administration

• Permissions associated with bundle location– Allows setting before bundle is downloaded

• Synchronous Bundle Listener added– A management agent can set the permissions Just In Time

• (Simple) Serializable format for permissions

©1999-2002 OSGi, All Rights Reserved

Service Tracker

• Services register and unregister all the time

• Onus on the programmer to only use services that are registered

• ServiceTracker simplifies this task:– Maintains a list of active services– Events can be overridden in subclass

• Used in almost every bundle

©1999-2002 OSGi, All Rights Reserved

Configuration Admin

• Configures bundles– At startup, or any later moment

• Maintains a repository of configurations– Local– Management system

• Configurations are key/value pairs– Can be typed with Meta Types

• Can be extended with plugins

©1999-2002 OSGi, All Rights Reserved

Configuration AdminClass Diagram

clientbundle

clientbundle

ConfigurationAdmin impl

ConfigurationAdmin impl

Configurationbundle

Configurationbundle

clientbundle

clientbundle

ManagedServiceFactory

ManagedServiceFactory

ConfigurationConfiguration1

0..n

Plugin implPlugin impl

ConfigurationException

ConfigurationException

ConfigurationAdmin

ConfigurationAdmin

ManagedService

ManagedService

ConfigurationPlugin

ConfigurationPlugin

1

1

©1999-2002 OSGi, All Rights Reserved

Meta Typing

• Data Descriptors for generic editors– Configurations, Properties

• Supports– Basic types like String, Integer, Byte, Short …– Arrays and Vectors

• Uses LDAP Objectclass, attribute model

• Can be localized for different languages

• General validation support

©1999-2002 OSGi, All Rights Reserved

Meta TypingClass Diagram

MetaTypeProvider

MetaTypeProvider

ObjectClassDefinition

ObjectClass1 1..n

Definition

AttributeDefinition

AttributeDefinition

LocalePID

1

1..n

©1999-2002 OSGi, All Rights Reserved

Preferences Service

• Simple hierarchical model like Windows Registry

• Uses simple hierarchical names– /bundle/121/httpport=81

• Different trees– Multiple named trees per bundle– One system tree per bundle

• Implementation can store locally or on management system

©1999-2002 OSGi, All Rights Reserved

Preferences ServiceClass Diagram

BackingStoreException a bundlea bundle

PreferencesPreferences0..n

10..n

1

1

1

Root user nodes

Root system node

User name

BackingStoreException

PreferencesService

PreferencesService

Bundlepreferences

Bundlepreferences

Service impl.Service impl.

Preference Node impl.

Preference Node impl.

nodes0..n 1

©1999-2002 OSGi, All Rights Reserved

Preferences Service

Named or Systemroot

c2

d1

c1

foo=8bar=9lex=‘acme’

d2

d1

d1

d2

/c2

/c1/d2

properties /c1/d2

/c1/d2/d1/d2

foo=8bar=9lex=‘acme’

properties /c1/d2/d1/d2

©1999-2002 OSGi, All Rights Reserved

User Admin

• Repository of users

• Maintains data for authentication and other purposes– Private keys, passwords, bio-profile, User Preferences

• Powerful role based authorization model– Users, group of users, and groups of groups

• Administrative functions

©1999-2002 OSGi, All Rights Reserved

User Admin ClassDiagram

RequestAuthenticator

RequestAuthenticator

User Listenerimpl.

User Listenerimpl.

User admin impl

User admin impl

UserAdminUserAdminRoleRole

UserUser

GroupGroup

Role implRole impl

User implUser impl

Group implGroup impl

AuthorizationAuthorization

Has roles

Send event

Basic member

Requiredmember

Action implAction implPerform action

Consult for authorization

authenticateUserAdminEventEvent

UserAdmin Receiveevents

UserAdminListenerListener

UserAdmin

User name

UserAdminPermission

UserAdminPermission

top related