introduction to service computing - iowa state university

27
Com S/Geron 415X Gerontechnology in Smart Home Environments Lecture 9 – Intro to Service Computing Dr. Hen-I Yang ComS Dept., ISU Feb. 22, 2011

Upload: others

Post on 30-Jan-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Service Computing - Iowa State University

Com S/Geron 415X Gerontechnology in Smart Home

Environments

Lecture 9 – Intro to Service Computing

Dr. Hen-I Yang

ComS Dept., ISU

Feb. 22, 2011

Page 2: Introduction to Service Computing - Iowa State University

Reflection

Page 3: Introduction to Service Computing - Iowa State University

Peeking Ahead

Today (2/22)

Introduction to Service Computing

Thursday (2/24)

Introduction to Design

Next Tuesday (3/1)

Midterm

Next Thursday (3/3)

OSGi Service Programming Workshop – Smart Home Lab

Page 4: Introduction to Service Computing - Iowa State University

Midterm

Next Tuesday (March 1, 2011) in class

80 minutes

Reviews materials covered until today’s lecture

You can bring One page single-sided hand-written letter-

size crib sheet

Page 5: Introduction to Service Computing - Iowa State University

Midterm Review

Aging

Optimal, Normal and Pathological Aging

ADL and IADL

Field trip experience

Assistive Technology

Various functional impairments associated with aging

Seven assistive functions

Examples of assistive technology/device/service

Theories of Assistive Technology Adoption

Person-Environment (P-E) Fit

Congruence Theory

Adoption Lags

Introduction to Service Computing

Page 6: Introduction to Service Computing - Iowa State University

Service Oriented Architecture (SOA)

A group of services which communicate with each other.

The process of communication involves either simple data

passing or it could involve two or more services

coordinating some activities.

Some means of connecting services to each other is

needed.

www.webit.com.my/www/lang/en/show.do?page=154&articleid=3137

Page 7: Introduction to Service Computing - Iowa State University

Service Computing

Specialization is one of

the defining characterization

of modern society

People don’t do everything by

themselves anymore

Better quality, lower cost,

higher availability

Services are based on

contract

Services are

interchangeable

Services can be composed

Feel Sick

Go to the hospital

Check-in

Initial Evaluation

X-ray and chem panel

Diagnosis

Get Prescription

Fill Prescription

Render payment

Go home and

bed rest

Patient

EMT

Receptionist

Lab Scientist

Doctor

Cashier

Pharmacist

Mom

EMT1, EMT2, …

Amy, Joe, Jane,…

Doctor

Doctor

Page 8: Introduction to Service Computing - Iowa State University

Planning A Trip

Book a flight …. Airline

Reserve a hotel room …. Hotel

Reserve a rental car …. Rental car company

Reserve tickets to events of interest….

Box office

Get foreign currency …. Bank

Page 9: Introduction to Service Computing - Iowa State University

Planning A Trip

Talk to a Travel Agent (or Concierge Service)

Book a flight

Reserve a hotel room

Reserve a rental car

Reserve tickets to events of interest

Get foreign currency

Page 10: Introduction to Service Computing - Iowa State University

Illustration of a Service

Airline Service

Service Area: U.S. Domestic

Hub: Des Moines, IA

Planes: Jets

Reserve a flight

Query flight status

Cancel a flight

Page 11: Introduction to Service Computing - Iowa State University

Illustration of a Composite Service

Travel Agent

Service

Airline Service

Hotel Service Car Rental Service Box Office Service

Foreign Currency

Exchange Service

Page 12: Introduction to Service Computing - Iowa State University

Service

Every function is implemented as a service

Often a single service provides a single action

Interfaces are provided to let other services know how to

utilize them

Metadata

Contains characteristics

Describes data that drives the service

Can be used to compose dynamically by discovery and incorporation

of defined services, to maintain coherence and integrity

Allow system designers to understand and manage with a reasonable

expenditure of cost and effort

XML is frequently used as description container

Page 13: Introduction to Service Computing - Iowa State University

Services

Interface

Define the type of services offered

Define the inputs and outputs

Implementation

Often is kept secret as a black box

Meta-data

Describe any information that’s relevant to the service, can be

Human readable

Machine readable

Attributes and Emergent Properties (sometimes described in the meta-data)

Page 14: Introduction to Service Computing - Iowa State University

Example of a Service: Thermometer

Interface: read – return temperature

Implementation: mercury, bi-metallic, spring

Meta-data:

return readings in Fahrenheit,

located in Smart Home Lab

owned by Bob

Page 15: Introduction to Service Computing - Iowa State University

Exercise: ATM

Interface:

Withdraw – return bills or error message

query – return balance of the account

Implementation

Known only to the Manufacturer of the ATM

Meta-data

Name of the bank

Serial number

Which currency is available

Page 16: Introduction to Service Computing - Iowa State University

Example of a Service: Chef

Interface: order, cash – return dishes

Implementation:

Trainings at professional culinary schools

Collection of family recipes

Personal culinary artistic talents

Hard-earned experience from years of torturing family and neighbors

Meta-data:

name

location

Expertise/style of food

Page 17: Introduction to Service Computing - Iowa State University

Service Composition

“If the weather gets too hot (temperature is higher than 95℉), I am going to get some cash and buy myself a

banana splits from that fancy restaurant”

Query ↔ 96 Withdraw(20) ↔ $$$ Order(banana splits) ↔ dish

Page 18: Introduction to Service Computing - Iowa State University

Service Oriented Architecture – Revisit

Loosely-integrated suite of services that can be used within multiple business domains.

Services communicate with each other and coordinate some activities to provide certain service.

Provide means of searching and connecting services to each other.

Platform (OS, programming language, medium) independent

Encapsulation: services not originally designed for SOA can be wrapped and consolidated to appear as a service

Abstraction: internal logic is hidden from the users other than those specified in the contract

Page 19: Introduction to Service Computing - Iowa State University

Advantages of SOA

Reuse

Lower cost

Better quality

Faster development

Flexibility

Adaptive

Tolerance to failures

Composability

Obfuscation

Don’t care about how it is done, as long as it is done

Compartimization

Outsourced and Specialization

Reduce local resource requirement

Less maintenance overhead

Page 20: Introduction to Service Computing - Iowa State University

Case Study: OSGi ™ Platform A dynamic module system for Java™.

It provides the standardized primitives that allow applications to be constructed from small, reusable and collaborative components.

Components can be composed into an application and deployed.

Allow changing of the composition dynamically on the device of a variety of networks, without requiring restarts.

A service-oriented architecture that decouples components, and enables these components to dynamically discover each other for collaboration.

Many standard component interfaces for common functions like HTTP servers, configuration, logging, security, user administration, XML and many more are available and well-tested.

http://www.osgi.org/osgi_technology/index.asp?section=2

Page 21: Introduction to Service Computing - Iowa State University

OSGi ™ Platform

http://www.osgi.org/osgi_technology/index.asp?section=2

Page 22: Introduction to Service Computing - Iowa State University

OSGi Bundle Life Cycle Management

Activator

Page 23: Introduction to Service Computing - Iowa State University

OSGi Bundles Bundles: Basic components in OSGi environment

Standard Bundle Composition:

Manifest

Code

Interface class

Defines the visible external behavior of the bundle

Methods that will be exposed to other bundles, and allow other bundles to invoke

Activator class

Life cycle management

Gets invoked first when an bundle becomes active

Handles details such as a) The starting condition b) The cleanup actions c) The plan of action when other bundles joins or leaves d) bind the local variables to instances of the bundles that would be used later

Implementation class

The real deal: the actual implementation of the functionalities/methods specified in the interface class

Actual usage of the variables specified and bound in the activator class

Where the real application logic is

Page 24: Introduction to Service Computing - Iowa State University

OSGi Manifest (Meta Data)

Bundle-Name: ATM

Bundle-SymbolicName: edu.isu.atm

Bundle-Description: An ATM bundle

Bundle-ManifestVersion: 1

Bundle-Version: 1.0.0

Bundle-Activator: edu.isu.atm.Activator

Export-Package: edu.isu.atm;version="1.0.0"

Import-Package: edu.isu.dispenser;version="1.3.0“;

edu.isu.db;version="1.3.0"

Page 25: Introduction to Service Computing - Iowa State University

OSGi Bundles – Interface public interface ATMService {

public int withdraw(int account, int amount);

public int query(int account);

}

Page 26: Introduction to Service Computing - Iowa State University

OSGi Bundles – Activator public class ATMActivator {

private ATMImpl service = null;

public void start(BundleContext context) throws

Exception {

service = new DemoImpl(context, this);

new Thread(service).start();

}

public void stop(BundleContext context) throws Exception

{

service.shutdown();

}

public void serviceAddition(ServiceEvent event) { … }

public void serviceModification(ServiceEvent event) { … }

public void serviceRemove(ServiceEvent event) { … }

}

Page 27: Introduction to Service Computing - Iowa State University

OSGi Bundles – Implementation public class ATMImpl implements ATMService {

protected Dispenser out;

protected AccountDatabase db;

protected boolean running;

public void processWithdrawRequest(int account, int amount) {

accountInfo = db.retrieveAccountInfo(account);

if (accountInfo == null)

{

error(“Invalid account info);

}

else {

if (accountInfo.balance > amount) {

out.dispense(amount/20);

}

}

}

}