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 z
Container Component Model
Bundle
{
Example: Home Security System
{
Discussion z
Available Open Source Implementations {
z
Standard Services Definition
Oscar Demo
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. Service Provider
OSGi Platform 國立台灣大學資訊工程研究所 智慧型空間實驗室
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. {
What are the key elements of OSGi?
Container Component Model Standard 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
服務規格A
B1 A1
XX
A2 服務規格C A3
XX XX
C1 XX XX XX
XX
OSGi應用程式
Remote OBR / Internet
國立台灣大學資訊工程研究所 智慧型空間實驗室
Intelligent Space
Container Component Model 元件容器模型
{
{
{
LWC (Lightweight Container) z
Apache Avalon Framework (type 1 IoC)
z
Spring Framework (type 2 IoC)
z
Pico Container (type 3 IoC)
z
OSGi Service Platform
ECU Proposal
HWC (Heavyweight Container) z
MIDP (J2ME)
z
EJB (J2EE)
Microkernel z
JMX
z
Jboss
國立台灣大學資訊工程研究所 智慧型空間實驗室
這裏列出的是OSGi規格書有提到的幾個元件容器模型
Intelligent Space
ECU整合性平台架構圖 定 速 巡 航 系 統
車 用 安 全 系 統
其 它 新 增 系 統
G A 數 空 引 通 P B 位 調 擎 訊 S S 個 系 系 系 系 系 人 統 統 統 統 統 助 理 Component Adaptation Framework Light Weight Container Infrastructural Services Resource Allocating Services
圖 型 使 用 者 界 面
電 腦 語 音 輸 出
Auditing Networking Configuration Monitoring 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) Mail Services Bundle
Management Bundle
ZZZ Services Bundle
YYY Services Bundle
XXX Services Bundle
Http Services Bundle
Auth Services 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
Client
TeachingCourse course teacher
Use Relationship injection Instance relationship 國立台灣大學資訊工程研究所 智慧型空間實驗室
Teacher TeachingCourseFactory
Intelligent Space
Dependency Injection {
建構物件,初始化物件的工作由lightweight container來做。物件間的關係由config決定。 Course
Client
TeachingCourse course teacher
Use Relationship injection Instance relationship 國立台灣大學資訊工程研究所 智慧型空間實驗室
Teacher Lightweight container
xml
Intelligent Space
實作界面就可保証符合規格
國立台灣大學資訊工程研究所 智慧型空間實驗室
Intelligent Space
Design by Interface時可達到最大的彈性 CourseImpl_A
Course
Client
CourseImpl_B
TeachingCourse course teacher
Use Relationship injection Instance relationship 國立台灣大學資訊工程研究所 智慧型空間實驗室
Teacher Lightweight container
xml
Intelligent Space