OSGiWhat is OSGi?Slide 3Services GatewaySlide 5OSGi Java APIFrameworkFramework - ServicesFramework - BundlesBundles - Bundle ContextHow Services Are DeliveredDevice AccessDevice Access ManagerExample Of The Device Access ArchitectureWays Bundles Are Used Within the FrameworkPermission And PolicyLog ServiceHTTP ServiceConfiguration Admin ServicePersistent Data ServicePackage Admin ServiceMetatypePreferences ServiceUser Admin Service And Client Access ServiceConclusionReferencesOSGiHenry LauEric ChimDecember 4, 2001What is OSGi?Open Service Gateway InitiativeA SpecificationA standard for connecting devices to the InternetDefine a set of Java APIs and a service gateway architecture implementationDelivers services from service providers through broadband networks to local networksServices GatewayA gateway between the external networks and the local networks and local devicesA platform for communication-based servicesManages and operates these servicesMultiple instances can be provided for receiving services from multiple service providerswww.osgi.orgOSGi Java API Run on any computer operating system platformDynamic code-loading capabilityLife cycle managementInter-service dependenciesDevice managementData managementClient accessSecurityResource managementFrameworkConsistent programming modelSeparates specification of a service from its implementation in order to develop and use these servicesThe same service interface can have numerous implementationsAllows developers to provide its own code for the service interface and not care for the service implementationExample: logging serviceA logging service stores its messages on a hard drive for a high-end device, while for a disk-less device, it stores its messages on a remote drive. The implementations of the two logging services implement the same interface, but the developers that are going to use the service can write code against the service interface.Framework - ServicesSelf-contained and accessed through a service interfaceJava classes that perform a certain functionalityThe mappings of the services to their implementations is maintained by the Framework, and the Framework manages the dependency between these servicesLDAP (Lightweight Directory Access Protocol) based syntax is the query mechanism used to allow installed services to request and use other available servicesA service is defined by the developer and is provided with its implementations, then it is registered/published into the FrameworkWhen registered, the service is given a set of attributes so that LDAP made be used for retrieval of the service laterThe service registered can also be found through a search filter so that other services made use it by passing a reference to the implementing object along to the ServiceReference of another bundleFramework - BundlesSmall components partitioned from an applicationSelf-installable, and can be downloaded on commandThe basic unit for delivering services, packaged as JAR filesEach JAR file contains resources that implements zero or more servicesResources may be Java class files or any other data like HTML help filesA Manifest file with headers is included to allow correct installation and usage of this bundleParameters in these files include what Java Packages it contains, what packages it needs, how to find the bundle activator, etc.Services it contains can be registered by other bundles for useBundles allow for future expansion, such that new bundles can be installed for added features or to fix bugs without destroying the systemEach bundle has an associated Bundle object that provides information about its class namespace so that there are no class-name conflictsBundles - Bundle ContextHow bundles and the Framework is interrelatedAn execution environment within the Framework where the bundles are activated; created at the instance of activation by the FrameworkWhat it does?Install new bundles into the FrameworkRegister services into the registry of the FrameworkGet references to other registered servicesSubscribe or unsubscribe to events that are transmitted by the FrameworkFind information about other bundles that are in the FrameworkProvide continuous ample supply to the bundle installedHow Services Are DeliveredDevice AccessDevice ManagerAttaches driver services to device servicesWorks with driver locator to download driversDriver LocatorMechanism that dynamically downloads new drivers to an OSGi deviceDriversDriver ServicesDevice ServicesDevice Access ManagerNetwork independenceDevice independenceAutomatic discovery/Plug and playLegacy supportSupport for older network technology that do not support automatic discoverySupport for non-OSGi specific devicesNetwork bundle and device bundleExample Of The Device Access ArchitectureWays Bundles Are Used Within the FrameworkPermission And PolicyThe security of the Framework is based on the security specification of Java 2 (The security specification is available online at: http://java.sun.com/products/jdk/1.2/docs/guide/security/spec/security-specTOC.fm.html)The Framework must provide Java Security API required for Java 2 Security; but if it does not support security, then permission classes may be left outThree types of permission defined by the Framework:AdminPermissionServicePermissionPackagePermissionThe system policy of the gateway must be configured in such a way that bundles running in the gateway are given the appropriate permissions to run correctlyLog ServiceThe only OSGi service requiredDefines a service API to let Java-based OSGi services to read and write entries to a logUseful for operators and developers to pinpoint and resolve problems within the service gatewayThe log service can be implemented in various ways, such as transferring to a central management agent or spooling to a local log fileGeneral capabilities and features:Records current system time, security level, text message, optional Java Throwable object, and the identity of the Java program in the Framework that created the log entryLog entries representing Framework events, and notify listeners of log entries as entries are being createdHTTP ServiceUsing servlets and resources, HTTP service will allow the use of services from the internet and other networks
View Full Document