You are on page 1of 25

OSGi: A Service-Oriented

Infrastructure for Smart Home


Reference
R. S. Hall and H. Cervantes, "Challenges in Building
Service-Oriented Applications for OSGi," in IEEE
Communications(Impact Factor=2.406), vol. 42, May 2004.

OSGi Alliance, “OSGi Service Platform Technical


Whitepaper 3.0,” July 2004.

Reporter
Chun-Feng Liao
Apr 4,2005

Intelligent Space
國立台灣大學資訊工程研究所 智慧型空間實驗室
Agenda
{ Introduction
z How OSGi related to E-Home ?
{ OSGi Component Model Container
Component Model
z Bundle
Standard
{ Example: Home Security System Services Definition

{ Discussion
z Available Open Source Implementations
{ Oscar Demo
z How can we use OSGi ?

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


OSGi Target Market : E-Home
{ The initial target market of OSGi is home service
gateways.
{ Assume all houses contain a home area network,
and nearly all household devices are connected.
{ Now OSGi ‘s vision is expanded to the
automobile environment.

OSGi Platform
Service Provider

OSGi Platform
國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space
Residential Gateway

Gateway

Image Source:R. S. Hall and H. Cervantes, "Challenges in Building Service-Oriented Applications for
OSGi," in IEEE Communications, vol. 42, May 2004.

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Introduction
{ What is the major contributions of OSGi Service
Platform?
Deal with the delivery of managed services into
networked environments of embedded devices. Container
Component Model

Standard

{ What are the key elements of OSGi? Services Definition

1. Lightweight container component model for “bundles”.


2. Standard services
• OSGi最大的貢獻在於提出一個服務導向(Service-Oriented)的輕量
級元件模型。
• 服務導向元件二要素:
• Dynamism
• Substitutability
國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space
Autonomous Service Discovery and
Binding
Local OBR (Oscar Bundle Repository)

XX B2
服務規格B
XX
XX B1 服務規格A
A1

XX A2

服務規格C
A3
XX
XX C1
XX

XX XX OSGi應用程式
XX Remote OBR / Internet

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Container Component Model
元件容器模型

{ LWC (Lightweight Container)


z Apache Avalon Framework (type 1 IoC)
z Spring Framework (type 2 IoC) ECU Proposal
z Pico Container (type 3 IoC)
z OSGi Service Platform
{ HWC (Heavyweight Container)
z MIDP (J2ME)
z EJB (J2EE)
{ Microkernel
z JMX
z Jboss 這裏列出的是OSGi規格書有提到的幾個元件容器模型

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


ECU整合性平台架構圖

定 車 其 圖
速 A 用 G 它 數 型 電 新
巡 B 空 引 通 P
安 新 位 使 腦 增
航 S 調 擎 訊 S
全 增 個 用 語 軟
系 系 系 系 系 系
系 系 人 者 音 體
統 統 統
統 統 統 統 統 助 界 輸 服
Component Adaptation Framework 理 面 出 務
Light Weight Container
Infrastructural Services
Resource Auditing Networking Configuration Monitoring 新增
Allocating Services Services Services Services 服務
Services

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Bundle (Component in OSGi)
{ Physical View
z A java-based jar file.
z Can not run without container (how to do unit
testing ?)
{ Logical View
z Service provider or consumer.
z Can publish, discover(?) or bind to another service.
{ Need not take care of lifecycle issues.
z Management tasks are done by OSGi platform.

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Bundle Lifecycle

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


OSGi Applications
{ A typical OSGi application is built around an
extensible core.
{ Provide heigher-level application-specific
services.
OSGi Applications (Bundle)

Auth Services Bundle

YYY Services Bundle


XXX Services Bundle
Http Services Bundle

ZZZ Services Bundle

Mail Services Bundle


Management Bundle
Log Services Bundle

Standard Services
(Cross cutting concerns)
OSGi Service Platform
國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space
http://research.microsoft.com/adapt/MSBNx/

Example: A Home Security System


active

passive
event

Bayesian Network poll

判斷為歹徒入侵,通知110 判斷非入侵事件,僅加以記錄

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Discussion
{ OSGi, UPnP, HAVi and Jini.
{ Open Source OSGi Implementations
z Oscar (R.S.Hall, Grenoble Univ. )
z Knopflerfish (Gatespace)
z Physalis (.NET Compact Framework)
{ How can we make use of OSGi?

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space
Device

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Context

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Agents

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Backup

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Web Services-Technical View

Image Source:
Heather Kreger

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Dependency Injection的分類
{ Dependency Injection provide help us to
implement the IoC
z Interface Injection (type 1 IoC)
z Setter Injection (type 2 IoC)
z Constructor Injection (type 3 IoC)

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


傳統做法
{ 建構物件,初始化物件的工作由Client來做。物件
間的關係由是寫死的。

Course

TeachingCourse
course
teacher
Use
Teacher
Relationship injection

Instance relationship
Client

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Factory Class
{ 建構物件,初始化物件的工作由Factory來做。物
件間的關係由factory決定。

Course

TeachingCourse
Client course
teacher
Use
Teacher
Relationship injection

Instance relationship TeachingCourseFactory


國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space
Dependency Injection
{ 建構物件,初始化物件的工作由lightweight
container來做。物件間的關係由config決定。

Course

TeachingCourse
Client course
teacher
Use
Teacher
Relationship injection
Lightweight
Instance relationship xml
container
國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space
實作界面就可保証符合規格

國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space


Design by Interface時可達到最大的彈性
CourseImpl_A

Course CourseImpl_B

TeachingCourse
Client course
teacher

Teacher
Use
Lightweight
Relationship injection container xml
Instance relationship
國立台灣大學資訊工程研究所 智慧型空間實驗室 Intelligent Space

You might also like