OSGi & UPnP Technology 2009 Summer Ya-Lin Huang. 2 Outline What is OSGi Technology Introduction Alliance Specifications Key Benefits OSGi Framework Service.

Slides:



Advertisements
Similar presentations
NetServ Dynamic in-network service deployment Henning Schulzrinne (Columbia University) Srinivasan Seetharaman (Georgia Tech) Volker Hilt (Bell Labs)
Advertisements

Copyright © 2002, Peter Kriens, All Rights Reserved OSGi versus UPnP??? There is no "versus" here. OSGi is fully complimentary to UPnP. No overlap. UPnP.
When Applications can Roam Freely OSGi Service Platform R4 Peter Kriens Technical Director OSGi
©2003 aQute, All Rights Reserved Tokyo, August 2003 : 1 OSGi Service Platform Tokyo August 28, 2003 Peter Kriens CEO aQute, OSGi Fellow
© OSGi, All Rights Reserved - Brussel Jan 22 Ertico/OSGi Tech Spec Overview: Introduction OSGi R3 and Remote Management Ertico/OSGi meeting Jan.
Module 3 Configuring Hardware on a Computer Running Windows XP Professional.
OSGi: Final summary and discussion. Outline Review: Origins of OSGi –Consortium –Goals Review: What is OSGi –Dynamic Modules for Java –Advanced Component.
OSGi Technology Hsin-Han Yang, Cheng-Yi Chien, Po-Cheng Huang.
Introduce OSGi BlueDavy
CPSC 875 John D. McGregor Architecture evolution.
Component Models and Technologies Case Study: OSGI.
The road to reliable, autonomous distributed systems
OSGi Remote Services with SCA using Apache Tuscany Raymond Feng
Eclipse Architecture Dwight Deugo Nesa Matic
OSGi: Open Services Gateway Initiative Richard Chapman 5 Sept
CS 501: Software Engineering Fall 2000 Lecture 16 System Architecture III Distributed Objects.
Spring Dynamic Modules. Startlocation: Documentation: /1.2.1/reference/html/
1 Chapter Overview Introduction to Windows XP Professional Printing Setting Up Network Printers Connecting to Network Printers Configuring Network Printers.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
OSGi.
1/151/15 ENT Metamodel Implementation & Applications ENT metamodel, prototype implementation Component substitutability checking, ENT based component comparison.
Introduction to the Atlas Platform Mobile & Pervasive Computing Laboratory Department of Computer and Information Sciences and Engineering University of.
Choon Oh Lee OSGi Service Platform. About OSGi Service Platform What it is, Where it is used, What features it provides are Today’s Content.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics NPRG044: OSGi framework Michal Malohlava & Pavel Parízek
Tiny Components – a collection of initial ideas copyright © 2003 Tiny Components Tiny Components A Component Model for Small, Embedded or Mobile devices.
Introduction to Android. Android as a system, is a java based operating system that runs on the Linux kernel. The system is very lightweight and full.
J2ME Presented by May Sayed & Menna Hawash. Outline Introduction “Java Technology” Introduction “What is J2ME?” J2ME Architecture J2ME Core Concepts 
Review: OSGi – a component framework for Java Bundle OSGi Framework Bundle Java Runtime Environment (JRE) Operating System (OS) Hardware “Dynamic Modules.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Comparing JavaBeans and OSGi Towards an Integration of Two Complementary Component Models HUMBERTO CERVANTES JEAN-MARIE FAVRE 09/02.
In Pieces Breaking down monolithic applications with Spring-DM and OSGi.
Migrating Desktop The graphical framework for running grid applications Bartek Palak Poznan Supercomputing and Networking Center The.
OSGi Service Platform Open Service Gateway initiative.
Webservice versioning using osgi Allard Buijze, Jettro Coenradie.
Open Service Gateway Initiative (OSGi) Reporter : 林學灝 侯承育 1.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Sameera Jayasoma 18 th July, 2009 Senior Software Engineer Introduction to OSGi The Dynamic Module System for Java.
Tool Integration with Data and Computation Grid GWE - “Grid Wizard Enterprise”
Migrating Desktop Marcin Płóciennik Marcin Płóciennik Kick-off Meeting, Santander, Graphical.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
© 2002, Youngjoon Choi, RESL, Inha University Page : 1 Open Services Gateway initiative OSGi Open Services Gateway Initiative Youngjoon Choi © Realtime.
ICT Strategy Intelligent Highways: Endpoint Adapters.
CPSC 875 John D. McGregor Architecture evolution.
Migrating Desktop Bartek Palak Bartek Palak Poznan Supercomputing and Networking Center The Graphical Framework.
Slide 1 ApacheCon 2011 > Doreen Seider> Using OSGi to Build Better Software > Using OSGi to Build Better Software Lessons from a Telemedicine.
Getting Started with the Open Services Gateway Initiative (OSGi) CNT 5517 Dr. Sumi Helal, Ph.D. Professor Computer & Information Science & Engineering.
Surya Bahadur Kathayat Outline  Ramses  Installing Ramses  Ramses Perspective (Views and Editors)  Importing/Exporting Example.
Introduction 1 Lars Vogel 4/22/2009.  Who am I?  Eclipse as a platform  What is Eclipse RCP?  Extension Points / Extensions  Equinox  SWT & JFace.
Tool Integration with Data and Computation Grid “Grid Wizard 2”
EUFORIA FP7-INFRASTRUCTURES , Grant Migrating Desktop Uniform Access to the Grid Marcin Płóciennik Poznan Supercomputing and Networking Center.
BelAmI JT6: Assisted Living and Working Joint Workshop Budapest, April 28./29. Ákos Nagy, András Szabó, Lóránt Vajda.
Microsoft ® Official Course Module 6 Managing Software Distribution and Deployment by Using Packages and Programs.
Introduction to OSGi +ActorFrame Surya Bahadur Kathayat
ITP 109 Week 2 Trina Gregory Introduction to Java.
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
© OSGi, All Rights Reserved Tech Spec Overview: Introduction Technical Specification Overview Introduction.
CPSC 875 John D. McGregor C22 - Architecture evolution.
©2001 OSGi, All Rights Reserved The OSGi Gateway and the Network Delivery of Managed Services Dave Marples
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Intro to the Atlas Platform Raja Bose Dr. Abdelsalam (Sumi) Helal January 23, 2007.
Real-Time Systems Lab. OSGi overview January 23, 2002 Sung-ho Park.
The EPIKH Project (Exchange Programme to advance e-Infrastructure Know-How) gLite Grid Introduction Salma Saber Electronic.
From “Hello World” to Real World : Building web apps with Spring OSGi Craig Walls The Spring Experience 2007 December 12, 2007.
Chapter 1 Introduction to Computers, Programs, and Java
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Introduction to Web Services
Presentation transcript:

OSGi & UPnP Technology 2009 Summer Ya-Lin Huang

2 Outline What is OSGi Technology Introduction Alliance Specifications Key Benefits OSGi Framework Service & Bundle Use Cases OSGi Implementation

3 What is OSGi Technology It’s a module system for the Java platform It’s dynamic It’s service-oriented A specification of the OSGi Alliance, a non-profit organization

4 Outline What is OSGi Technology Introduction Alliance Specifications Key Benefits OSGi Framework Service & Bundle Use Cases OSGi Implementation

5 Alliance OSGi - “Open Service Gateway Institute” The Alliance has been founded by Sun Microsystems, IBM, Ericsson and others in March Among its members are (as of April 2006) more than 35 companies from quite different business areas, for example Nokia, Motorola, Philips, BenQ, Siemens VDO Automotive, BMW, Gatespace Telematics, ProSyst, Samsung Electronics…

6 Specifications OSGi Release 1 (R1): May 2000 OSGi Release 2 (R2): October 2001 OSGi Release 3 (R3): March 2003 OSGi Release 4 (R4): October 2005 / September 2006 Core Specification (R4 Core): October 2005 Mobile Specification (R4 Mobile / JSR-232): September 2006 Latest release (R4.1 / JSR-291): May 2007

7 Specifications OSGi framework Standard service definitions Log Service Http Service Device Service Package Administration Service Permission Administration Service Configuration Administration Service Preferences Service User Administration Service

8

9 Key Benefits Platform Independence: OSGi member companies work in many different environments and as such they suffer different constraints, resulting in widely varying product characteristics and capabilities. Application Independence: The OSGi specifications focus on defining common APIs for service deployment. This makes the specifications suitable for Service Platforms for a variety of applications in different markets.

10 Key Benefits Multiple Service Support: OSGi environments should be capable of hosting multiple applications from different Service Providers on a single Service Platform with each application providing an independent set of services to the end user. Service Collaboration Support: An important aspect of the OSGi deployment model is that it allows the core platform to be extended with deployed services. This is not limited to end user oriented services only, which is a limitation of some other deployment models.

11 Key Benefits Multiple Network Technology Support: OSGi Service Platforms can work with wide area technologies like xDSL, Cable modems, Satellite, ISDN and PSTN and local area networks like Bluetooth, USB, IEEE 1394 Firewire. Popular service discovery techniques like UPnP, Jini, Salutation and several others work very well in conjunction with an OSGi Service Platform and can even potentially interwork transparently.

12 Key Benefits Security: The OSGi offers a fine grained security architecture that limits the potential harm a malicious or badly written application can do. Simplicity : The OSGi environment offers a service environment for everybody by removing much of the complexity and putting it into the hands of professionals. The environment can be remotely managed by a professional organization, if so desired.

13 Outline What is OSGi Technology Introduction Alliance Specifications Key Benefits OSGi Terminology OSGi Framework Service & Bundle Use Cases OSGi Implementation

14 OSGi Framework Services gateway Generic application framework Lightweight framework Simple component model Service registry Support for deployment

15 OSGi Platform Hardware Drivers e.g. Windows, Linux, VxWorks, QNX Operating System applicaion OSGi Framework System Services Multimedia BundlesHealth-Care Bundles e.g. J2ME, J2SE, J2EE Java Runtime Environment

16 OSGi Framework Hardware: the physical part of a computer. Operating System: a software program that manages the hardware and software resources of a computer. Java Runtime Environment: a software bundle from Sun Microsystems that allows a computer system to run a java application. Application: a subclass of computer software that employs the capabilities of a computer directly to a task that the user wishes to perform.

OSGi Framework The Framework is divided in a number of layers: Execution Environment Modules Life Cycle Management Service Registry. Additionally, there is a security system that is deeply intertwined with all the layers. 17

18 OSGi Framework Execution environment: the specification of the Java environment. Java 2 Configurations and Profiles. Modules: defines the class loading policies. The OSGi Framework is a powerful and strictly specified class loading model. It is based on top of Java but add modularization. Life Cycle Management: adds bundles that can be dynamically installed, started, stopped, updated, and uninstalled. Bundles rely on the module layer for class loading but add an API to manage the modules in run time.

19 OSGi Framework Service Registry: The service registry provides a cooperation model for bundles that takes the dynamics into account. The service registry provides a comprehensive model to share objects between bundles. A number of events are defined to handle the coming and going of services. Security is based on Java and the Java 2 security model.

20 OSGi Framework

21 Outline What is OSGi Technology Introduction Alliance Specifications Key Benefits OSGi Terminology OSGi Framework Service & Bundle Use Cases OSGi Implementation

22 Service & Bundle Services Provide applications Bundles (JAR file) Provide (export) and reuse (import) services via the framework Identify Java packages (classes) Implement specified interface (services) Register services with the Service Registry

23 Bundle Life Cycle

24 Bundle Acting Progress(1/3)

25 Bundle Acting Progress(2/3)

26 Bundle Acting Progress(3/3)

27 Outline What is OSGi Technology Introduction Alliance Specifications Key Benefits OSGi Terminology OSGi Framework Service & Bundle Use Cases OSGi Implementation

28 Typical Use Cases Internet Access Personal Communications Home Automation Home Security Home health care monitoring Entertainment Information management Automobiles

29 Typical Use Cases

30 Commercial Use Cases Nokia implements OSGi on 800 Ricoh Multi-functional Products (MFPs) laser printers BMW Research 3GT, Ertico GST Volvo Technology (VTEC) 3GT (Third Generation Telematics) GST (Global System for Telematics) CVIS (Cooperative Vehicle Infrastructure Systems) Philips iPronto

31 Outline What is OSGi Technology Introduction Alliance Specifications Key Benefits OSGi Terminology OSGi Framework Service & Bundle Use Cases OSGi Implementation

32 Framework Implementation IBM Lotus Expeditor ProSyst Software Knopflerfish OSGi Makewave (formerly Gatespace Telematics) Equinox OSGi (Eclipse project) Objectweb Oscar Apache Felix

Knopflerfish Installation (1) Software Environment JRE(Java Runtime Environment) Window XP Download Knopflerfish jar file Knopflerfish support OSGi R4 from Download knopflerfish_osgi_.jar

Knopflerfish Installation (2) Install JRE Execute knopflerfish_osgi_.jar double-clicking on the distribution file use the command: java -jar knopflerfish_osgi_.jar Or just extract the JAR file

Startup Knopflerfish Change the directory to the installation directory and start Knopflerfish double-clicking on framework.jar use the command: java -jar framework.jar Eclipse plugin rg/eclipse_install.html Bundle Action Bundle State and Information Output Input

BUNDLE DEVELOPMENT 36

37 Bundle Activator(1/3) Activator Class (implements BundleActivator) start() This method implements what should the bundle do when it starts. The same as main() method in common Java program. stop() This method implements what should the bundle do when it is going to stop.

38 Bundle Activator(2/3) Simple implementation package ismp.smart.HelloOSGi; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { System.out.println("HELLO!!"); } public void stop(BundleContext context) throws Exception { System.out.println("Byebye"); } package ismp.smart.HelloOSGi; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { System.out.println("HELLO!!"); } public void stop(BundleContext context) throws Exception { System.out.println("Byebye"); }

39 Bundle Activator(3/3) MANIFEST file Manifest-Version: 1.0 Bundle-Vendor: ISMP Bundle-Version: Bundle-Name: HelloOSGi Bundle-Activator: ismp.smart.HelloOSGi.Activator Bundle-Description: FirstBundle Import-Package: org.osgi.framework Bundle-SymbolicName: HelloOSGi Manifest-Version: 1.0 Bundle-Vendor: ISMP Bundle-Version: Bundle-Name: HelloOSGi Bundle-Activator: ismp.smart.HelloOSGi.Activator Bundle-Description: FirstBundle Import-Package: org.osgi.framework Bundle-SymbolicName: HelloOSGi

MANIFEST header Header NameDescription Bundle-ActiovatorBundle’s Activator class Bundle-ClassPathBundle Class Path Bundle-ContactAddressBundle Developer’s Bundle-DescriptionBundle usage and function description Bundle-DocURLBundle Document Address Bundle-NameBundle Name. Display for user. Bundle-NativeCode Make it be able to use self-generated Native Code (JNI NativeCode) Bundle-UpdateLocationBundle Update Location Bundle-VendorVendor Name Bundle-VersionBundle Version Information Export-packageExport Package Export-ServiceExport Service Import-packageImport Package Import-ServiceImport Service 40

41 Service Export(1/4) Activator Class (implements BundleActivator) start() We have to implement a class and a service method for this class, and register this service in the start() method. BundleContext.registerService (java.lang.String class, java.lang.Object service, java.util.Dictionary properties) stop() Some services should be unregistered before the bundle stopped. ServiceRegistration.unregister()

Service Export(2/4) Service interface and implementation 42 package ismp.smart.helloOSGiServices; import java.util.Date; public interface FirstService { public String getFormattedDate(Date date); } package ismp.smart.helloOSGiServices; import java.util.Date; public interface FirstService { public String getFormattedDate(Date date); } package ismp.smart.helloOSGiServices.impl; import java.text.DateFormat; import java.util.Date; import ismp.smart.helloOSGiServices.FirstService; public class FirstServiceImpl implements FirstService { public String getFormattedDate(Date date) { return DateFormat.getDateInstance(DateFormat.SHORT).format (date); } package ismp.smart.helloOSGiServices.impl; import java.text.DateFormat; import java.util.Date; import ismp.smart.helloOSGiServices.FirstService; public class FirstServiceImpl implements FirstService { public String getFormattedDate(Date date) { return DateFormat.getDateInstance(DateFormat.SHORT).format (date); }

43 Service Export(3/4) Register Service package ismp.smart.helloOSGiServices.impl;... import ismp.smart.helloOSGiServices.FirstService; public class Activator implements BundleActivator { public static BundleContext bc = null; public void start(BundleContext bc) throws Exception {... Activator.bc = bc; FirstService service = new FirstServiceImpl(); ServiceRegistration registration = bc.registerService( FirstService.class.getName(), service, new Hashtable()); System.out.println("Service registered: FirstService"); }... } package ismp.smart.helloOSGiServices.impl;... import ismp.smart.helloOSGiServices.FirstService; public class Activator implements BundleActivator { public static BundleContext bc = null; public void start(BundleContext bc) throws Exception {... Activator.bc = bc; FirstService service = new FirstServiceImpl(); ServiceRegistration registration = bc.registerService( FirstService.class.getName(), service, new Hashtable()); System.out.println("Service registered: FirstService"); }... }

44 Service Export(4/4) Manifest file Manifest-Version: 1.0 Bundle-Vendor: ISMP Bundle-Version: Bundle-Name: HelloOSGiServiceProvider Bundle-Activator: ismp.smart.helloOSGiServices.impl.Activator Bundle-Description: FirstBundleService Import-Package: org.osgi.framework Bundle-SymbolicName: HelloOSGiServiceProvider Export-Package: ismp.smart.helloOSGiServices Manifest-Version: 1.0 Bundle-Vendor: ISMP Bundle-Version: Bundle-Name: HelloOSGiServiceProvider Bundle-Activator: ismp.smart.helloOSGiServices.impl.Activator Bundle-Description: FirstBundleService Import-Package: org.osgi.framework Bundle-SymbolicName: HelloOSGiServiceProvider Export-Package: ismp.smart.helloOSGiServices

45 Service Import(1/3) Dynamic binding services public void start(BundleContext bc) throws Exception { System.out.println("start " + getClass().getName()); Activator.bc = bc; String filter = "(objectclass=" + FirstService.class.getName() + ")"; bc.addServiceListener(this, filter); ServiceReference references[] = bc.getServiceReferences(null, filter); for (int i = 0; references != null && i < references.length; i++) { this.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED,references[i])); } public void start(BundleContext bc) throws Exception { System.out.println("start " + getClass().getName()); Activator.bc = bc; String filter = "(objectclass=" + FirstService.class.getName() + ")"; bc.addServiceListener(this, filter); ServiceReference references[] = bc.getServiceReferences(null, filter); for (int i = 0; references != null && i < references.length; i++) { this.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED,references[i])); }

Service Import(2/3) Must implemented method 46 public void serviceChanged(ServiceEvent event) { switch (event.getType()) { case ServiceEvent.REGISTERED: log("ServiceEvent.REGISTERED"); this.service = (FirstService)Activator.bc.getService( event.getServiceReference()); this.startUsingService(); break; case ServiceEvent.MODIFIED: log("ServiceEvent.MODIFIED received"); this.stopUsingService(); this.service = (FirstService) Activator.bc.getService( event.getServiceReference()); this.startUsingService(); break; case ServiceEvent.UNREGISTERING: log("ServiceEvent.UNREGISTERING"); this.stopUsingService(); break; } public void serviceChanged(ServiceEvent event) { switch (event.getType()) { case ServiceEvent.REGISTERED: log("ServiceEvent.REGISTERED"); this.service = (FirstService)Activator.bc.getService( event.getServiceReference()); this.startUsingService(); break; case ServiceEvent.MODIFIED: log("ServiceEvent.MODIFIED received"); this.stopUsingService(); this.service = (FirstService) Activator.bc.getService( event.getServiceReference()); this.startUsingService(); break; case ServiceEvent.UNREGISTERING: log("ServiceEvent.UNREGISTERING"); this.stopUsingService(); break; }

Service Import(3/3) Manifest file 47 Manifest-Version: 1.0 Bundle-Vendor: ISMP Bundle-Version: Bundle-Name: HelloOSGiServiceClient Bundle-Activator: ismp.smart.helloOSGiServicesClient.impl.Activator Bundle-Description: FirstBundleServiceClient Import-Package: org.osgi.framework, ismp.smart.helloOSGiServicesClient Bundle-SymbolicName: HelloOSGiServiceClient Manifest-Version: 1.0 Bundle-Vendor: ISMP Bundle-Version: Bundle-Name: HelloOSGiServiceClient Bundle-Activator: ismp.smart.helloOSGiServicesClient.impl.Activator Bundle-Description: FirstBundleServiceClient Import-Package: org.osgi.framework, ismp.smart.helloOSGiServicesClient Bundle-SymbolicName: HelloOSGiServiceClient

Export Jar Eclipse Export Install Bundle Drag and Drop or click “Bundle Action” buttons - [Open Bundle(s)] If all the dependencies are satisfied, the installed bundle will automatically start, or it will prompt error messages. Start Bundle Click “Bundle Action” buttons - [Start Bundle] Stop Bundle Click “Bundle Action” buttons - [Stop Bundle] Uninstall Bundle Click “Bundle Action” buttons - [Uninstall Bundle] 48

DEMO 49

Homework 50