OSGi Service Platform Release 4 Overview - BJ Hargrave, IBM & Peter Kriens, aQute
1.
2. OSGi Service Platform
Release 4 Overview
BJ HargraveBJ Hargrave
OSGi Alliance Fellow & CTOOSGi Alliance Fellow & CTO
IBM Senior Technical Staff MemberIBM Senior Technical Staff Member
3. The Past to The PresentThe Past to The Present
•• Work began as anWork began as an ad hocad hoc group called thegroup called the
Connected AllianceConnected Alliance in 1998in 1998
•• The OSGi Alliance was founded in March, 1999The OSGi Alliance was founded in March, 1999
–– As an independent, worldwide, nonAs an independent, worldwide, non--profit organizationprofit organization
with open membershipwith open membership
•• JSRJSR--008 was withdrawn and technical work moved008 was withdrawn and technical work moved
to the OSGi Allianceto the OSGi Alliance
•• OSGi Service Gateway Release 1.0 was publishedOSGi Service Gateway Release 1.0 was published
in May 2000in May 2000……
4. Service Platform ReleasesService Platform Releases
2000 2001 2003 2005
R1
R2
R3
Framework
Http
Log
Device Access
Package Admin
Configuration Admin
Permission Admin
User Admin
Preferences
MetaType
Service Tracker
R4
UPnP
Initial Provisioning
Name Space
Jini
Start Level
IO Connector
Wire Admin
XML Parser
Measurement & State
Position
Execution Environments
URL Handler
Core
• Framework Layering
• Conditional Permission Admin
• Declarative Services
• Event Admin
Mobile
• DMT Admin
• Deployment Admin
• Foreign Applications
• Mobile Management Tree
Vehicle
• Power Management
• Metatype 2
• Diagnostic
• Vehicle API
5. Who created the Releases?Who created the Releases?
The OSGi Expert GroupsThe OSGi Expert Groups
•• Core Platform Expert Group (CPEG)Core Platform Expert Group (CPEG)
–– Responsible for the Framework and core services asResponsible for the Framework and core services as
well as overall architecturewell as overall architecture
•• Vehicle Expert Group (VEG)Vehicle Expert Group (VEG)
–– Responsible for vehicle related requirements andResponsible for vehicle related requirements and
designsdesigns
•• Mobile Expert Group (MEG)Mobile Expert Group (MEG)
–– Responsible for mobile device related requirementsResponsible for mobile device related requirements
and designsand designs
6. Mobile
Service Compendium
Service
Core Specification
R4 Documentation PlanR4 Documentation Plan
Framework
Implementer’s
spec
Bundle
Programmer’s
guide
Normative
Informative
EE
Service
Service
Service
Ref Arch
/ Guide
Service
Service
Service
Vehicle Other
…
} } }
Ref Arch
/ Guide
Ref Arch
/ Guide
Document
Service
Service
Service
Service
Service
Service
Constraints Constraints Constraints
7. R4 Release PlanR4 Release Plan
•• Core Specification and Service Compendium published 11Core Specification and Service Compendium published 11
OctoberOctober
•• Mobile Specification is being developed in cooperationMobile Specification is being developed in cooperation
with JSRwith JSR--232232
–– JSRJSR--232 went to Early Draft Review (EDR) on 7 October232 went to Early Draft Review (EDR) on 7 October
–– Completion of the Mobile Specification will be coordinated withCompletion of the Mobile Specification will be coordinated with
JSRJSR--232232
•• Vehicle Specification is under developmentVehicle Specification is under development
–– Receiving contributions from AMIReceiving contributions from AMI--CC
–– Current outlook for completion is 1Q2006Current outlook for completion is 1Q2006
•• All specification companion code now released under anAll specification companion code now released under an
open source licenseopen source license
Today!
9. Framework FeaturesFramework Features
Runs multiple applications and servicesRuns multiple applications and services
•• Single VM instanceSingle VM instance
•• Separate class loader per bundleSeparate class loader per bundle
––Class loader networkClass loader network
––Independent namespacesIndependent namespaces
––Class sharing at the Java package levelClass sharing at the Java package level
•• Lifecycle management of bundlesLifecycle management of bundles
•• Intra VM publish/find/bind service modelIntra VM publish/find/bind service model
•• Java Permissions to secure frameworkJava Permissions to secure framework
10. Framework LayeringFramework Layering
CDC
CDC
Execution
Environment
L0 -
•OSGi Minimum Execution Environment
•CDC/Foundation
•J2SE
MODULE
L1 - Creates the concept of modules (aka. bundles)
that use classes from each other in a controlled way
according to system and bundle constraints
LIFECYCLE
L2 - Manages the lifecycle of bundle in a bundle
repository without requiring the VM be restarted
SERVICE MODEL
L3 – Provides a publish/find/bind service model to
decouple bundles
11. Module LayerModule Layer
•• Provides a generic and standardized solution for JavaProvides a generic and standardized solution for Java
modularizationmodularization
•• BundleBundle is the unit of modularizationis the unit of modularization
–– Contains Java classes and other resourcesContains Java classes and other resources
–– Typically a JAR fileTypically a JAR file
•• Bundles can share Java packages in a wellBundles can share Java packages in a well--defined waydefined way
–– Export a packageExport a package
–– Import a packageImport a package
•• Bundle manifest contains metadata to declare modularityBundle manifest contains metadata to declare modularity
constraintsconstraints
12. Class Loading ArchitectureClass Loading Architecture
•• Bundles can hide packages and classes from other bundles, as welBundles can hide packages and classes from other bundles, as welll
as share packages with other bundles.as share packages with other bundles.
•• The key mechanism to hide and share packages is the Java classThe key mechanism to hide and share packages is the Java class
loaderloader
–– Loads classes from a subset of the bundle space using wellLoads classes from a subset of the bundle space using well--defined rules.defined rules.
•• Each bundle has a single class loaderEach bundle has a single class loader
–– Forms a class loading delegation network with other bundlesForms a class loading delegation network with other bundles
•• Bundle class loader can load classes and resources from:Bundle class loader can load classes and resources from:
–– Boot class pathBoot class path –– The boot class path contains the java.* packages and theirThe boot class path contains the java.* packages and their
implementation packages.implementation packages.
–– Framework (System Bundle) class pathFramework (System Bundle) class path –– The Framework usually has aThe Framework usually has a
separate class loader for the Framework implementation classes aseparate class loader for the Framework implementation classes as well ass well as
key service interface classes.key service interface classes.
–– Bundle SpaceBundle Space –– The bundle space consists of the JAR file that is associatedThe bundle space consists of the JAR file that is associated
with the bundle, plus any additional JAR that are closely tied twith the bundle, plus any additional JAR that are closely tied to the bundle,o the bundle,
like fragmentslike fragments
13. Class SpaceClass Space
•• Defined to be all classes reachable from a given bundleDefined to be all classes reachable from a given bundle’’ss
class loader.class loader.
•• Contains classes from:Contains classes from:
–– The parent class loader (normally java.* packages from the bootThe parent class loader (normally java.* packages from the boot
class path)class path)
–– Imported packagesImported packages
–– Required bundlesRequired bundles
–– The bundle's class path (private packages)The bundle's class path (private packages)
–– Attached fragmentsAttached fragments
•• A class space must be consistentA class space must be consistent
–– It never contains two classes with the same fully qualified nameIt never contains two classes with the same fully qualified name
–– Modularity layer supports a model where multiple versions of theModularity layer supports a model where multiple versions of the
same class are loaded in the same VM in different class spacessame class are loaded in the same VM in different class spaces
15. Resolving BundlesResolving Bundles
•• Resolving is the process where importers are wiredResolving is the process where importers are wired
to exporters once specified constraints are satisfiedto exporters once specified constraints are satisfied
––A bundle must be resolved before any code from aA bundle must be resolved before any code from a
bundle can be loaded or executedbundle can be loaded or executed
•• AA wirewire is an actual connection between an exporteris an actual connection between an exporter
and an importer for a given packageand an importer for a given package
––Associated with a number of constraints that are definedAssociated with a number of constraints that are defined
by its importerby its importer’’s and exporters and exporter’’s manifest headerss manifest headers
16. Bundle Manifest Version 2Bundle Manifest Version 2
•• Change in the module layer for R4 required semanticChange in the module layer for R4 required semantic
changes in some of the existing manifest headerschanges in some of the existing manifest headers
•• To distinguish between preTo distinguish between pre--R4 and R4 semantics, aR4 and R4 semantics, a
bundle manifest version header is definedbundle manifest version header is defined
•• Manifest headerManifest header
BundleBundle--ManifestVersionManifestVersion ::= number::= number
•• Version 2 is R4 semanticsVersion 2 is R4 semantics
•• If the manifest header is not specified then preIf the manifest header is not specified then pre--R4R4
semantics are assumedsemantics are assumed
•• ExampleExample
BundleBundle--ManifestVersionManifestVersion: 2: 2
19. Bundle Class PathBundle Class Path
•• Manifest headerManifest header
BundleBundle--ClasspathClasspath::= entry (::= entry ( ’’,,’’ entry )*entry )*
entry ::= target (entry ::= target ( ’’;;’’ target )* (target )* ( ’’;;’’ parameter ) *parameter ) *
target ::= path |target ::= path | ’’..’’
•• Defines theDefines the ““innerinner”” class path of a bundleclass path of a bundle
••pathpath can refer to a directory in the bundle or acan refer to a directory in the bundle or a
contained JARcontained JAR
––/WEB/WEB--INF/classesINF/classes
––util.jarutil.jar
•• ExampleExample
BundleBundle--ClasspathClasspath:: util.jarutil.jar,/classes,/classes
20. DynamicImportDynamicImport--PackagePackage
•• Manifest headerManifest header
DynamicImportDynamicImport--Package ::= dynamicPackage ::= dynamic--description ( ',' dynamicdescription ( ',' dynamic--
description )*description )*
dynamicdynamic--description::= wildcarddescription::= wildcard--names ( ';' parameter )*names ( ';' parameter )*
wildcardwildcard--names ::= wildcardnames ::= wildcard--name ( ';' wildcardname ( ';' wildcard--name )*name )*
wildcardwildcard--name ::= packagename ::= package--name| ( packagename| ( package--name '.*' ) | '*'name '.*' ) | '*'
•• Dynamic imports are matched to export definitions (to formDynamic imports are matched to export definitions (to form
package wirings) during class loadingpackage wirings) during class loading
–– Does not affect module resolutionDoes not affect module resolution
–– Apply only to packages for which no wire has been establishedApply only to packages for which no wire has been established
and no definition could be found in any other wayand no definition could be found in any other way
–– Dynamic import is used as last resortDynamic import is used as last resort
•• Used forUsed for Class.forNameClass.forName idiomidiom
•• ExampleExample
DynamicImportDynamicImport--Package:Package: org.osgiorg.osgi.*.*
21. RequireRequire--BundleBundle
•• Manifest headerManifest header
RequireRequire--Bundle ::= bundleBundle ::= bundle--description ( ',' bundledescription ( ',' bundle--description )*description )*
bundlebundle--description ::= symbolicdescription ::= symbolic--name (';' parameter )*name (';' parameter )*
•• DirectiveDirective
–– resolution := mandatory | optionalresolution := mandatory | optional
–– Visibility := private |Visibility := private | reexportreexport
•• Mechanism where bundles can be directly wired to theMechanism where bundles can be directly wired to the
exported packages of other bundles without specifying theexported packages of other bundles without specifying the
specific packagesspecific packages
•• Used by EclipseUsed by Eclipse pluginsplugins as a convenienceas a convenience
•• Has several drawbacks but is seen as very convenient byHas several drawbacks but is seen as very convenient by
developersdevelopers
•• ExampleExample
RequireRequire--Bundle:Bundle: org.osgi.foobundleorg.osgi.foobundle; bundle; bundle--
version=version=““[1.2,2.0)[1.2,2.0)””
22. FragmentsFragments
•• Manifest headerManifest header
FragmentFragment--Host ::= bundleHost ::= bundle--descriptiondescription
bundlebundle--descriptiondescription ::= symbolic::= symbolic--name (';' parameter ) *name (';' parameter ) *
•• DirectiveDirective
–– extension := framework |extension := framework | bootclasspathbootclasspath
•• Fragments are bundles that are attached to a hostFragments are bundles that are attached to a host
bundle as part of resolvingbundle as part of resolving
––Treated as part of the host bundleTreated as part of the host bundle
––Must not have their own class loader.Must not have their own class loader.
•• Localization is key use caseLocalization is key use case
•• ExampleExample
FragmentFragment--Host:Host: org.osgi.foobundleorg.osgi.foobundle; bundle; bundle--version=version=““[1.2,2.0)[1.2,2.0)””
23. Extension BundlesExtension Bundles
•• Framework ExtensionFramework Extension
––Loaded by framework class loaderLoaded by framework class loader
––Used to extend the framework implementationUsed to extend the framework implementation
•• Boot Class Path ExtensionBoot Class Path Extension
––Loaded by the boot class loaderLoaded by the boot class loader
––Used to supply JRE extensionsUsed to supply JRE extensions
•• Declared as fragments of System BundleDeclared as fragments of System Bundle
•• ExampleExample
FragmentFragment--Host:Host: system.bundlesystem.bundle; extension:=; extension:=bootclasspathbootclasspath
24. Module Layer: Best PracticesModule Layer: Best Practices
•• Partition public and nonPartition public and non--public classes intopublic classes into
separate packagesseparate packages
––Packages with public classes can be exportedPackages with public classes can be exported
––Packages with nonPackages with non--public classes are not exportedpublic classes are not exported
•• Use ImportUse Import--Package rather than RequirePackage rather than Require--BundleBundle
––Allows more substitutability of package providersAllows more substitutability of package providers
•• Limit fragment useLimit fragment use
•• DonDon’’t uset use DynamicImportDynamicImport--PackagePackage
––Unless there is no other wayUnless there is no other way
25. Lifecycle LayerLifecycle Layer
•• Provides APIs to control the life cycle of bundlesProvides APIs to control the life cycle of bundles
––Install/Update/UninstallInstall/Update/Uninstall
––Start/StopStart/Stop
––NotificationsNotifications
•• Provides API to inspect state of module layerProvides API to inspect state of module layer
•• Builds upon the module layerBuilds upon the module layer
•• Supports dynamic management of bundles inSupports dynamic management of bundles in
running VMrunning VM
•• Localization of bundle manifest informationLocalization of bundle manifest information
•• No major changes for R4No major changes for R4
––Just API additions for module layer enhancementsJust API additions for module layer enhancements
26. Bundle IdentifiersBundle Identifiers
•• Bundle idBundle id –– Locally unique long value assigned by Framework during installaLocally unique long value assigned by Framework during installationtion
–– Does not change as bundle is updatedDoes not change as bundle is updated
–– Never reusedNever reused
–– Assigned in ascending orderAssigned in ascending order
•• Bundle locationBundle location –– Locally unique name assigned to bundle by installer duringLocally unique name assigned to bundle by installer during
installationinstallation
–– Normally a URL to bundleNormally a URL to bundle
–– Does not change as bundle is updatedDoes not change as bundle is updated
–– May be reusedMay be reused
•• Bundle Symbolic NameBundle Symbolic Name –– A unique name assigned to bundle by the developerA unique name assigned to bundle by the developer
–– The combination of Bundle Version and Bundle Symbolic Name is aThe combination of Bundle Version and Bundle Symbolic Name is a globallyglobally
unique identifier for a bundleunique identifier for a bundle
–– When BundleWhen Bundle--SymbolicNameSymbolicName manifest header ismanifest header is specifedspecifed, then Bundle, then Bundle--VersionVersion
manifest header value must be a valid versionmanifest header value must be a valid version
–– Multiple bundles may have same symbolic name as long as versionsMultiple bundles may have same symbolic name as long as versions are distinctare distinct
27. Service LayerService Layer
•• Defines a publish/find/bind service modelDefines a publish/find/bind service model
–– Fully dynamicFully dynamic
–– Intra VMIntra VM
–– NonNon--durable service registrydurable service registry
•• A service is a normal Java object published under one orA service is a normal Java object published under one or
more Java interfaces with additional metadatamore Java interfaces with additional metadata
•• Find mechanism support searching on both interface nameFind mechanism support searching on both interface name
and metadata valuesand metadata values
•• Service lifecycle event notificationsService lifecycle event notifications
•• No major changes for R4No major changes for R4
–– Just API additions for module layer enhancementsJust API additions for module layer enhancements
–– But Declarative Services is a new mode of using the service layeBut Declarative Services is a new mode of using the service layerr
28. New Framework APINew Framework API
•• New typesNew types
–– AllServiceListenerAllServiceListener
•• In support of multiple exported package versionsIn support of multiple exported package versions
–– BundlePermissionBundlePermission
•• New permission for modularity featuresNew permission for modularity features
–– FrameworkUtilFrameworkUtil
•• Static means of creating Filter objectsStatic means of creating Filter objects
–– VersionVersion
•• Standardized version classStandardized version class
•• ComparableComparable
30. New Framework APINew Framework API
•• New fieldsNew fields
–– AdminPermissionAdminPermission actionsactions
•• CLASS, EXECUTE, EXTENSIONLIFECYCLE, LIFECYCLE,CLASS, EXECUTE, EXTENSIONLIFECYCLE, LIFECYCLE,
LISTENER, METADATA, RESOLVE, RESOURCE,LISTENER, METADATA, RESOLVE, RESOURCE,
STARTLEVELSTARTLEVEL
–– BundleEventBundleEvent typestypes
•• RESOLVED, UNRESOLVED, STARTING, STOPPINGRESOLVED, UNRESOLVED, STARTING, STOPPING
–– ConstantsConstants
•• Too many new constants to listToo many new constants to list
–– FrameworkEventFrameworkEvent typestypes
•• WARNING, INFOWARNING, INFO
31. Package Admin UpdatePackage Admin Update
•• Package Admin has been updated to support the new features ofPackage Admin has been updated to support the new features of
the module layerthe module layer
•• New typeNew type
–– RequiredBundleRequiredBundle
•• New methodsNew methods
–– ExportedPackageExportedPackage
•• VersionVersion getVersiongetVersion()()
–– PackageAdminPackageAdmin
•• ExportedPackageExportedPackage[][] getExportedPackages(StringgetExportedPackages(String))
•• BooleanBoolean resolveBundles(BundleresolveBundles(Bundle[])[])
•• RequiredBundleRequiredBundle[][] getRequiredBundles(StringgetRequiredBundles(String))
•• Bundle[]Bundle[] getBundles(String,StringgetBundles(String,String))
•• Bundle[]Bundle[] getFragments(BundlegetFragments(Bundle))
•• Bundle[]Bundle[] getHosts(BundlegetHosts(Bundle))
•• BundleBundle getBundle(ClassgetBundle(Class))
•• intint getBundleType(BundlegetBundleType(Bundle))
•• New fieldNew field
–– PackageAdminPackageAdmin: BUNDLE_TYPE_FRAGMENT: BUNDLE_TYPE_FRAGMENT
32. Conditional Permission AdminConditional Permission Admin
•• New model of permission management based uponNew model of permission management based upon
conditionsconditions
–– If a condition evaluates to true, then the permissionsIf a condition evaluates to true, then the permissions ““guardedguarded””
by the condition are evaluated as part of the bundleby the condition are evaluated as part of the bundle’’s Protections Protection
DomainDomain
•• Conditions can beConditions can be
–– Mutable: the results of an evaluation of the condition must notMutable: the results of an evaluation of the condition must not
be cached and may changebe cached and may change
–– Postponed: evaluating the condition must be postponed to thePostponed: evaluating the condition must be postponed to the
end of theend of the checkPermissioncheckPermission actionaction
•• Can be used instead of Permission Admin or in addition toCan be used instead of Permission Admin or in addition to
–– Permission Admin will be deprecated in the futurePermission Admin will be deprecated in the future
33. Specified ConditionsSpecified Conditions
•• BundleLocationConditionBundleLocationCondition
–– Guards a set of permission based upon a bundleGuards a set of permission based upon a bundle
location patternlocation pattern
–– [[BundleLocationConditionBundleLocationCondition ““http://http://www.osgi.orgwww.osgi.org/*/*””]]
•• BundleSignerConditionBundleSignerCondition
–– Guards a set of permissions based upon the signer ofGuards a set of permissions based upon the signer of
a bundle using DN chain matchinga bundle using DN chain matching
–– [[BundleSignerConditionBundleSignerCondition ““*, o=OSGi Alliance, c=US*, o=OSGi Alliance, c=US””]]
•• Mobile Specification will also define additionalMobile Specification will also define additional
mobile specific conditionsmobile specific conditions
34. Permission Admin UpdatePermission Admin Update
• Permission Info was updated to allow white space
in the encoded format.
• The Package Admin methods which change the
permissions now require the caller to have
AllPermission
35. Service CompendiumService Compendium
•• Log ServiceLog Service
•• Http ServiceHttp Service
•• Device AccessDevice Access
•• Configuration AdminConfiguration Admin
•• Preferences ServicePreferences Service
•• MetatypeMetatype
•• Wire AdminWire Admin
•• User AdminUser Admin
•• IO ConnectorIO Connector
•• Initial ProvisioningInitial Provisioning
•• UPnP DeviceUPnP Device
•• Declarative ServicesDeclarative Services
•• Event AdminEvent Admin
•• Service TrackerService Tracker
•• XML ParserXML Parser
•• PositionPosition
•• Measurement and StateMeasurement and State
•• Execution EnvironmentsExecution Environments
Defines the compendium of OSGi defined servicesDefines the compendium of OSGi defined services
•• Will be updated from time to time as newWill be updated from time to time as new servicesservices
are finalizedare finalized
New
Updated
Updated
Updated
Updated
Updated
New
Updated
Updated
Updated
36. Log Service UpdateLog Service Update
• New FrameworkEvent type strings are defined
• New BundleEvent type strings are defined
37. Http Service UpdateHttp Service Update
• NamespaceException has been updated to add
getCause method
• AdminPermission references were updated to
specify the new RESOURCE action
38. Configuration Admin UpdateConfiguration Admin Update
• Added a ConfigurationListener service that
receives ConfigurationEvent objects when
Configuration Admin events occur
• Added a new ConfigurationPermission class which
replaces the use of AdminPermission
• ConfigurationException has been updated to add
getCause method
39. Preferences Service UpdatePreferences Service Update
• Root nodes can be removed with
Preferences.removeNode
– This allows a user root node to be removed when a
user has been removed
• BackingStoreException has been updated to add
getCause method
40. MetatypeMetatype UpdateUpdate
• Significantly expanded and now provides a service.
• MetaTypeService provides MetaTypeInformation
from
– Bundles containing an XML entry
– MetaTypeProvider interface based on ManagedService
and ManagedServiceFactory services
• A standardized XML schema to define Metatypes
as well as related instances
41. UPnP Device UpdateUPnP Device Update
• Added a UPnPLocalStateVariable interface that
represents a State Variable that is implemented
locally
• Added a UnPException class
– Conveys the UPnP Forum, work groups, and vendor
defined errors
42. Declarative ServicesDeclarative Services
•• New declarative programming model for servicesNew declarative programming model for services
–– Defines service metadataDefines service metadata
–– Addresses performance concernsAddresses performance concerns
–– Simplifies programming model for using servicesSimplifies programming model for using services
•• Fully integrates with existing procedural modelFully integrates with existing procedural model
New
43. Service MetadataService Metadata
•• The procedural model provides no metadata withinThe procedural model provides no metadata within
a bundle which describes the services it cana bundle which describes the services it can
provide and the services it will consumeprovide and the services it will consume
–– So the framework or a management system does notSo the framework or a management system does not
know what services, if any, a bundle may provide orknow what services, if any, a bundle may provide or
consume until the bundle executes and calls theconsume until the bundle executes and calls the
frameworkframework
44. PerformancePerformance
•• The procedural model requires that bundles mustThe procedural model requires that bundles must
be started and execute in order to publish a servicebe started and execute in order to publish a service
–– This means the bundle must have a class loader,This means the bundle must have a class loader,
classes must be loaded and objects instantiated andclasses must be loaded and objects instantiated and
some code executed which will explicitly publish thesome code executed which will explicitly publish the
serviceservice
–– From a performance view, this is undesirable. We wouldFrom a performance view, this is undesirable. We would
rather be able to declaratively specify that a bundle willrather be able to declaratively specify that a bundle will
publish a service and thus delay creating class loaders,publish a service and thus delay creating class loaders,
loading classes and instantiating objects until someloading classes and instantiating objects until some
other bundle actually desires to consume the service.other bundle actually desires to consume the service.
45. Simplify Service Programming ModelSimplify Service Programming Model
•• The procedural model requires that programmers be OSGiThe procedural model requires that programmers be OSGi
literateliterate
–– As the OSGi service model API is specific to OSGi, it isAs the OSGi service model API is specific to OSGi, it is
problematic to entice programmers to use it.problematic to entice programmers to use it.
–– Furthermore, the OSGi environment can be a very dynamicFurthermore, the OSGi environment can be a very dynamic
environment. Services and bundles can come and go duringenvironment. Services and bundles can come and go during
the lifetime of the VM. Many programmers are not prepared tothe lifetime of the VM. Many programmers are not prepared to
deal with such dynamism.deal with such dynamism.
•• So we provide a simplification of the programming modelSo we provide a simplification of the programming model
for using services in OSGi so that new programmers canfor using services in OSGi so that new programmers can
declare their service relationships and then have themdeclare their service relationships and then have them
managed by the runtime rather than having to write codemanaged by the runtime rather than having to write code
to call OSGi API.to call OSGi API.
46. Service ComponentsService Components
•• Contained within aContained within a bundlebundle
•• TheirTheir lifecyclelifecycle is contained within their bundleis contained within their bundle’’s lifecycles lifecycle
•• Identified by anIdentified by an implementationimplementation classclass
•• OptionallyOptionally providesprovides a service which is registered as ana service which is registered as an
OSGi serviceOSGi service
•• OptionallyOptionally referencesreferences other OSGi services (which may beother OSGi services (which may be
provided by other components)provided by other components)
•• OptionallyOptionally configuredconfigured
•• Can beCan be lazily activatedlazily activated
–– This means the creation and activation of a component can beThis means the creation and activation of a component can be
delayed until the component is actually used.delayed until the component is actually used.
•• Described by anDescribed by an XMLXML documentdocument
48. Event AdminEvent Admin
•• Provides an intraProvides an intra--VM, interVM, inter--bundle communicationbundle communication
mechanismmechanism
–– Based on the publish/subscribe model, popular inBased on the publish/subscribe model, popular in
many message based systemsmany message based systems
•• Provides for nonProvides for non--durable connections betweendurable connections between
publisher and subscriber for exactly once deliverypublisher and subscriber for exactly once delivery
of a messageof a message
–– Either blocking (synchronous) or nonEither blocking (synchronous) or non--blockingblocking
(asynchronous) delivery(asynchronous) delivery
New
49. Event AdminEvent Admin
•• Event publishers are bundles which call EventEvent publishers are bundles which call Event
Admin service to publish their eventAdmin service to publish their event
––These bundles can proxy other event publishers such asThese bundles can proxy other event publishers such as
native code or other processes/systemsnative code or other processes/systems
•• Event subscribers are bundles which register EventEvent subscribers are bundles which register Event
Handler services to receive eventsHandler services to receive events
––These bundles can proxy other event subscribers suchThese bundles can proxy other event subscribers such
as native code or other processes/systemsas native code or other processes/systems
•• Events are objects passed by reference fromEvents are objects passed by reference from
publisher to subscriber using the Event Admin as apublisher to subscriber using the Event Admin as a
brokerbroker
50. Service Tracker UpdateService Tracker Update
• The open(boolean) method was added
– In support of module and service layer support for
multiple versions of a package concurrently exported
– Normal use is open(false) which tracks services whose
packages are wired to the context bundle
– Using open(true) will track all matching services even if
they cannot be cast to the types accessible by the
context bundle
54. Core Specification and Service CompendiumCore Specification and Service Compendium
•• This wraps up a quickThis wraps up a quick ☺☺ overview of the Coreoverview of the Core
Specification and the Service CompendiumSpecification and the Service Compendium
•• PeterPeter KriensKriens will now provide an overview of thewill now provide an overview of the
forthcoming Mobile Specification and Vehicleforthcoming Mobile Specification and Vehicle
SpecificationSpecification
56. ContentsContents
•• Why a Mobile Specification?Why a Mobile Specification?
•• Overall ArchitectureOverall Architecture
•• ProfileProfile
•• DeploymentDeployment
•• Device ManagementDevice Management
•• Application ModelApplication Model
•• Foreign ApplicationsForeign Applications
•• PowerPower ManagementManagement
•• Relation to JCPRelation to JCP
•• Road AheadRoad Ahead
57. Why a Mobile Specification?Why a Mobile Specification?
•• MIDP is very successful for mobile devicesMIDP is very successful for mobile devices
–– Over 200 million devices soldOver 200 million devices sold
–– Multi billion dollar marketMulti billion dollar market
–– Highly ProfitableHighly Profitable
•• So who needs anSo who needs an OSGiOSGi handy?handy?
58. Why a Mobile Specification?Why a Mobile Specification?
•• Mobile Devices are becoming very powerfulMobile Devices are becoming very powerful
–– 200200 MhzMhz+ Processors+ Processors
–– Flash has become very cheapFlash has become very cheap
•• End user street prices1End user street prices1 GbGb $68, 128 Mb $13$68, 128 Mb $13
–– Displays become bigger and more usefulDisplays become bigger and more useful
–– NetworkedNetworked
•• WifiWifi, GPRS, 3GT, UMTS, GPRS, 3GT, UMTS
•• Are gamesAre games thethe market for such powerful devices?market for such powerful devices?
59. Why a Mobile Specification?Why a Mobile Specification?
•• The next generation of mobile devices brings EnterpriseThe next generation of mobile devices brings Enterprise
Applications into rangeApplications into range
–– Sales Support, Expert Systems, Administrative, DataSales Support, Expert Systems, Administrative, Data
Acquisition,Acquisition, ……
•• Enterprise ApplicationsEnterprise Applications
–– Are exponentially more complex than gamesAre exponentially more complex than games
–– Require high security for all facetsRequire high security for all facets
–– Require collaboration between different applicationsRequire collaboration between different applications
–– Will connect to a myriad of devicesWill connect to a myriad of devices
–– Require lots of middlewareRequire lots of middleware
•• Is MIDP up to this?Is MIDP up to this?
60. Why a Mobile Specification?Why a Mobile Specification?
•• Additionally there is a silent software crisis atAdditionally there is a silent software crisis at
device manufacturersdevice manufacturers
•• Operators require their devices to be heavilyOperators require their devices to be heavily
customizedcustomized
•• Managing all these configurations is a tremendousManaging all these configurations is a tremendous
task that negatively influences:task that negatively influences:
–– Product development costProduct development cost
–– Technical supportTechnical support
–– Developing new featuresDeveloping new features
•• Is MIDP really the solution here?Is MIDP really the solution here?
62. Over ArchitectureOver Architecture
•• What are the required features for a MobileWhat are the required features for a Mobile
Software Platform?Software Platform?
•• Very High SecurityVery High Security
–– Protects against virusesProtects against viruses
–– Allows mixing and matching applications from differentAllows mixing and matching applications from different
sourcessources
•• Strong modularity supportStrong modularity support
–– Applications from different sources can coexistApplications from different sources can coexist
–– Share libraries in a controlled wayShare libraries in a controlled way
63. Why a Mobile Specification?Why a Mobile Specification?
•• Collaboration ModelCollaboration Model
–– Smaller components: easier to developSmaller components: easier to develop
–– Mix and match: more flexible procurementMix and match: more flexible procurement
–– PluginPlugin model widens the scope of devicesmodel widens the scope of devices
•• Remote ManagementRemote Management
–– Maintain quality of serviceMaintain quality of service
–– After sales applicationsAfter sales applications
–– Low maintenance costLow maintenance cost
•• Management by EnterprisesManagement by Enterprises
–– Allow Enterprise to manage part of the deviceAllow Enterprise to manage part of the device
66. What Was Missing In OSGi R3What Was Missing In OSGi R3
•• EndEnd--toto--end Deploymentend Deployment
•• Device ManagementDevice Management
•• Device MonitoringDevice Monitoring
•• Application ModelApplication Model
•• Foreign Application supportForeign Application support
•• Security Policy Model based on mobile conditionsSecurity Policy Model based on mobile conditions
–– Subscriber (IMSI)Subscriber (IMSI)
–– Device Type (IMEI)Device Type (IMEI)
67. SecuritySecurity
Java 2 PermissionsJava 2 Permissions
Per Bundle PermissionsPer Bundle Permissions
Each Bundle carries its own permissionsEach Bundle carries its own permissions
This set of permissions can never be exceededThis set of permissions can never be exceeded
Bundle Signing is completely specifiedBundle Signing is completely specified
Authentication of bundlesAuthentication of bundles
Permission Management via:Permission Management via:
SignersSigners
Location of originLocation of origin
Custom conditionCustom condition
R4 Core Security is equipped to handle MEGR4 Core Security is equipped to handle MEG
RequirementsRequirements
68. SecuritySecurity
•• Provide a flexible policyProvide a flexible policy
management for a delegatedmanagement for a delegated
management modelmanagement model
•• An Operator must be able toAn Operator must be able to
sell a device to an Enterprisesell a device to an Enterprise
and be assured the enterpriseand be assured the enterprise
can not do anything thecan not do anything the
Operator does not wantOperator does not want
•• The Enterprise administratorThe Enterprise administrator
must be able to give the devicemust be able to give the device
to a person and restrict theto a person and restrict the
possibilities furtherpossibilities further
•• Bundles must be restricted toBundles must be restricted to
only the permissions they needonly the permissions they need
Operator
Enterprise
Sales
Management domain
Bundle
69. Security LayerSecurity Layer
•• Signing based on Public KeySigning based on Public Key
CryptographyCryptography
–– Operator signs signing certificateOperator signs signing certificate
ofof DeployerDeployer
•• Developer adds a local permissionsDeveloper adds a local permissions
file to the bundlefile to the bundle
–– Easy to readEasy to read
•• The local permissions are audited byThe local permissions are audited by
thethe DeployerDeployer
•• DeployerDeployer signs the bundlesigns the bundle
•• The bundle gets deployed on aThe bundle gets deployed on a
Service PlatformService Platform
•• The permissions of the bundle areThe permissions of the bundle are
the intersection of:the intersection of:
–– Local permissionsLocal permissions
–– System permissions for thatSystem permissions for that
signersigner
•• Operator remains in full control at allOperator remains in full control at all
timestimes
Bundle
A
controls
local
permissions
signature
OSGi Service Platform
system
permissions
S
Enterprise
Developer
Operator
70. Security LayerSecurity Layer
•• Permissions can be assigned basedPermissions can be assigned based
on:on:
–– SignerSigner
–– Location (Channel)Location (Channel)
–– Custom ConditionCustom Condition
•• Multiple signers are possibleMultiple signers are possible
–– Bundle gets union of signerBundle gets union of signer
permissionspermissions
•• No partial signing, all signers mustNo partial signing, all signers must
sign all contentsign all content
•• Flexible management API forFlexible management API for
permissionspermissions
•• DynamicDynamic
–– changes take effect immediatelychanges take effect immediately
•• Compatible with standard Java 2Compatible with standard Java 2
VMsVMs
–– Take advantage of optimizationsTake advantage of optimizations
OSGi Service Platform
system
permissions
&local
permissions
Bundle
A
Location, signer, custom
71. Security LayerSecurity Layer
•• Signer requires coarse grained to beSigner requires coarse grained to be
feasiblefeasible
•• Bundle can use very fine grainedBundle can use very fine grained
•• Standard PermissionsStandard Permissions
–– FilePermissionFilePermission
–– RuntimePermissionRuntimePermission
–– SocketPermissionSocketPermission
–– ……
•• Framework permissionsFramework permissions
–– AdminPermissionAdminPermission
–– ServicePermissionServicePermission
–– PackagePermissionPackagePermission
–– BundlePermissionBundlePermission
•• Service PermissionsService Permissions
–– ConfigurationPermissionConfigurationPermission
–– EventPermissionEventPermission
–– ApplicationPermissionApplicationPermission
Fine grained local permissions
Coarse grained system permissions
72. Deployment AdminDeployment Admin
•• Deployment AdminDeployment Admin
–– Adds new deployment artifact: Deployment Package (DP)Adds new deployment artifact: Deployment Package (DP)
–– Groups bundles, resources and other artifacts FlexibleGroups bundles, resources and other artifacts Flexible
Deployment format forDeployment format for
–– BundlesBundles
–– MegletsMeglets
–– Configuration dataConfiguration data
–– Custom types withCustom types with Resource ProcessorsResource Processors
•• SignedSigned
–– Tamper proofTamper proof
–– SecuritySecurity
73. Deployment AdminDeployment Admin
•• Run custom code at installation, updated, andRun custom code at installation, updated, and
uninstallationuninstallation
–– Database conversionDatabase conversion
–– Installation scriptsInstallation scripts
•• Fix Packs, a delta formatFix Packs, a delta format
–– Reduce download timeReduce download time
•• Deployment Packages are first class citizensDeployment Packages are first class citizens
•• Extensive information is available to troubleshootExtensive information is available to troubleshoot
74. Deployment Admin ServiceDeployment Admin Service
•• Deployment Admin provides theDeployment Admin provides the
possibility to install and updatepossibility to install and update
Deployment PackagesDeployment Packages
•• Deployment Packages areDeployment Packages are
–– A set of bundles with associatedA set of bundles with associated
Resource ProcessorResource Processor
–– TransactionalTransactional
–– No sharing with other DeploymentNo sharing with other Deployment
PackagesPackages
•• Resource Processors provide theResource Processors provide the
semantics for thesemantics for the bitsbitsofof the resourcesthe resources
in the JAR filein the JAR file
–– Process (install)Process (install)
–– Drop (uninstall)Drop (uninstall)
•• Security based on the permissionsSecurity based on the permissions
associated with the signer of theassociated with the signer of the
Deployment PackageDeployment Package
Depl.
Admin
Resource
Processor
DeploymentAdmin
Rrsrc.
Proc.
DmtDataPlugin
EventAdmin
Autoconf
75. Deployment Admin ServiceDeployment Admin Service
•• Deployment PackageDeployment Package
–– Based on JAR FormatBased on JAR Format
•• Manifest describes theManifest describes the
resources and associatesresources and associates
them with a Resourcethem with a Resource
ProcessorProcessor
•• Fix PackagesFix Packages
–– Provide only updatedProvide only updated
contentscontents
manifest.mf
signer.sf
signer.rsa
bundle-A.jar
bundle-B.jar
autoconf.xml
certificates.cer
Global section
Name: bundle-A.jar
SHA1-Digest: RTasy&yasi987iasj=
Bundle-SymbolicName: com.acme.a
Bundle-Version: 2.1
Name: certificates.cr
SHA1-Digest: lkMjUasm87asj&jasloe
DP-ResourceProcessor: com.acme.c509
Certificate
Processor
Resource
Processor
76. Deployment Admin ServiceDeployment Admin Service
•• CustomizersCustomizers
•• A Deployment Package canA Deployment Package can
contain its own Resourcecontain its own Resource
Processor bundleProcessor bundle
•• ThisThis customizercustomizer is installed andis installed and
started before other bundles instarted before other bundles in
the Deployment Packagethe Deployment Package
•• It registers a ResourceIt registers a Resource
Processor serviceProcessor service
•• The Deployment Admin willThe Deployment Admin will
only allow contents from theonly allow contents from the
correct DP to be processed bycorrect DP to be processed by
thethe customizercustomizer
•• TheThe customizercustomizer gets access togets access to
the private data area of itsthe private data area of its
related bundlesrelated bundles
DP
Customizer
Depl.
Admin
bundle
A
77. Device ManagementDevice Management
•• The basic OSGi architecture is managementThe basic OSGi architecture is management
protocol agnosticprotocol agnostic
–– Provides a model where many parties can participateProvides a model where many parties can participate
•• What is missing is an abstraction to manage aWhat is missing is an abstraction to manage a
device in detaildevice in detail
•• The OMA DM protocol is dominant in the mobileThe OMA DM protocol is dominant in the mobile
device marketdevice market
–– Will be supported by a wide range of devicesWill be supported by a wide range of devices
•• The MEG therefore supports the OMA DMThe MEG therefore supports the OMA DM
management model with themanagement model with the DmtDmt Admin ServiceAdmin Service
78. DmtDmt AdminAdmin
•• Generic API to manipulateGeneric API to manipulate
thethe Device ManagementDevice Management
TreeTree
–– Single consistent API forSingle consistent API for
applications to interact withapplications to interact with
the configuration of thethe configuration of the
devicedevice
•• Seamless interaction withSeamless interaction with
the management of thethe management of the
native devicenative device
–– Tree can be partlyTree can be partly
implemented in the nativeimplemented in the native
device, partly in Javadevice, partly in Java
.
Device
Battery
Level
OSGi
log
query1
query2
cfg
Log
Config
Admin
Native
code
79. DmtDmt AdminAdmin
•• Implementation of the tree nodes can be providedImplementation of the tree nodes can be provided
by downloadable servicesby downloadable services
–– Useful for extensions, accessories, optionsUseful for extensions, accessories, options
•• Extensive Meta modelExtensive Meta model
–– Provide rich GUIs with very little effortProvide rich GUIs with very little effort
–– Validation and this reliabilityValidation and this reliability
•• TransactionalTransactional
–– ReliabilityReliability
–– Partly implementation specificPartly implementation specific
•• API based on OMA DMAPI based on OMA DM
–– Supports other protocolsSupports other protocols
80. MonitoringMonitoring
•• Light weight solution forLight weight solution for
bundles to provide statusbundles to provide status
variables to the managementvariables to the management
systemsystem
–– Free space, thread usage,Free space, thread usage,
database usagedatabase usage
•• Status Variables are mappedStatus Variables are mapped
to the DMTto the DMT
–– Provides unified access by theProvides unified access by the
management systemmanagement system
•• A schedule can be created toA schedule can be created to
query the variables at a regularquery the variables at a regular
intervalinterval
–– DebuggingDebugging
–– Performance tuningPerformance tuning
–– OptimizingOptimizing
Monitorable
Monitor
Admin
Monitor
Admin
Data Plugin
Any Bundle …
81. Generic Application ModelGeneric Application Model
•• A generic model that isA generic model that is
intended to abstract differentintended to abstract different
application models so they canapplication models so they can
be treated as onebe treated as one
–– Provides for third party screenProvides for third party screen
managersmanagers
•• Provides for rich GUIsProvides for rich GUIs
–– Icons, help, etc.Icons, help, etc.
–– Can monitor the state ofCan monitor the state of
running instancesrunning instances
•• Applications can be scheduledApplications can be scheduled
for execution when a specificfor execution when a specific
event arrivesevent arrives
–– Calendar notificationCalendar notification
•• Interacts with JSR 211 ContentInteracts with JSR 211 Content
HandlersHandlers
Application
Model
Symbian
Screen
Manager
MIDP 1.0 MIDP 2.0
82. Foreign ApplicationsForeign Applications
•• MIDP, BREW,MIDP, BREW, SymbianSymbian, DOJO,, DOJO,
XLetXLet, Applet,, Applet, ……
•• An OSGi Mobile Device isAn OSGi Mobile Device is
required to provide applicationrequired to provide application
containers for differentcontainers for different
application models.application models.
•• The Application ModelThe Application Model
manages these applicationsmanages these applications
•• Some models use JavaSome models use Java
–– Why not provide access toWhy not provide access to
OSGi functionalityOSGi functionality
•• The Foreign Application ModelThe Foreign Application Model
defines how nondefines how non--OSGiOSGi
Applications can access andApplications can access and
provide servicesprovide services
–– Header usageHeader usage
–– Access to Framework classAccess to Framework class
MIDP 2.0
org.osgi.applicationorg.osgi.application
FrameworkFramework
MIDP 1.0 XLet
84. OSGi Vehicle ArchitectureOSGi Vehicle Architecture
•• The OSGi Vehicle Profile shares its architectureThe OSGi Vehicle Profile shares its architecture
with the Mobile Profilewith the Mobile Profile
•• The Vehicle Profile provides specific vehicleThe Vehicle Profile provides specific vehicle
oriented servicesoriented services
•• The Vehicle Profile uses many more of the CoreThe Vehicle Profile uses many more of the Core
Compendium Services because it is more matureCompendium Services because it is more mature
•• It is likely the vertical profiles will come closer in theIt is likely the vertical profiles will come closer in the
futurefuture
85. Vehicle ProfileVehicle Profile
•• Start Level ServiceStart Level Service
•• URL HandlersURL Handlers
•• Package Admin ServicePackage Admin Service
•• Permission Admin ServicePermission Admin Service
•• Log ServiceLog Service
•• Http ServiceHttp Service
•• Device AccessDevice Access
•• Configuration Admin ServiceConfiguration Admin Service
•• Metatype(2) ServiceMetatype(2) Service
•• Preference ServicePreference Service
•• User Admin ServiceUser Admin Service
•• Wire Admin ServiceWire Admin Service
•• IO Connector ServiceIO Connector Service
•• Declarative ServicesDeclarative Services
•• Event Admin ServiceEvent Admin Service
•• Power Management ServicePower Management Service
•• Diagnostic ServiceDiagnostic Service
•• Service Tracker UtilityService Tracker Utility
•• XML Parser UtilityXML Parser Utility
•• Position UtilityPosition Utility
•• Measurement and State UtilityMeasurement and State Utility
86. Power ManagementPower Management
•• The power management serviceThe power management service
makes power management pluggablemakes power management pluggable
•• The system power state can be setThe system power state can be set
externallyexternally
–– Full PowerFull Power
–– PM ActivePM Active
–– SuspendSuspend
–– SleepSleep
–– Power offPower off
•• is mapped to different device poweris mapped to different device power
statestate
–– D0D0--D3 power statesD3 power states
•• Power manager can take devicePower manager can take device
specific capabilities in considerationspecific capabilities in consideration
•• An observer bundle can follow theAn observer bundle can follow the
transitions in the system and devicetransitions in the system and device
power statepower state
Device Power
State
Power
Manager
System Power State
Listener
Observer
Device Power
Impl
System
Power
System Power
Device Power
State Listener
87. •• And now for something completely differentAnd now for something completely different ……
88. Relation to JCPRelation to JCP
•• The relation to the JCP isThe relation to the JCP is
troublesometroublesome
•• SeveralSeveral JSRsJSRs overlap with JSRoverlap with JSR
232232
•• JSR 277 ModularizationJSR 277 Modularization
–– However, long way off fromHowever, long way off from
J2MEJ2ME
•• JSR 271 MIDP 3.0JSR 271 MIDP 3.0
–– Is addressing some of theIs addressing some of the
solutions that MEG providessolutions that MEG provides
•• JSR 246 OMA DM AccessJSR 246 OMA DM Access
–– Based on JSR 232Based on JSR 232 DmtDmt Admin,Admin,
but slightly differentbut slightly different
–– Needs to be mergedNeeds to be merged
•• JSR 249/248 MSA CDC/CLDCJSR 249/248 MSA CDC/CLDC
–– Must select JSR 232 to makeMust select JSR 232 to make
MEG viableMEG viable
JSR 232
OSGi MEG
JSR 277
Modules
JSR 246
OMA DM
JSR 271
MIDP 3.0
JSR 248/249
MSA
CDC/CLDC
89. ConclusionConclusion
•• The Mobile and Vehicle Profiles are taking advantage ofThe Mobile and Vehicle Profiles are taking advantage of
the powerful OSGi R4 Service Platformthe powerful OSGi R4 Service Platform
•• The Mobile Platform focuses on deployment and deviceThe Mobile Platform focuses on deployment and device
managementmanagement
–– Applications will be foreign applicationsApplications will be foreign applications
–– Mobile APIs will be derived from JCPMobile APIs will be derived from JCP JSRsJSRs
•• The Vehicle Platform provides a more extensiveThe Vehicle Platform provides a more extensive
application environmentapplication environment
•• Both platforms provide share more than they differBoth platforms provide share more than they differ
•• The OSGi Service Platform provides therefore manyThe OSGi Service Platform provides therefore many
opportunities for applications that can live in both markets.opportunities for applications that can live in both markets.