II. Middleware for Distributed Systems

warmersafternoonΔίκτυα και Επικοινωνίες

23 Οκτ 2013 (πριν από 3 χρόνια και 7 μήνες)

63 εμφανίσεις

Principles of Object
-
Oriented Middleware

1

II. Middleware for Distributed Systems


Outline


Principles of Object
-
Oriented Middleware


CORBA, COM and Java/RMI


ORB Runtime


Resolving Heterogeneity


Dynamic Object Requests

Principles of Object
-
Oriented Middleware

2

Principles of Object
-
Oriented Middleware


Outline


Computer Networks


Types of Middleware


Object
-
oriented Middleware


Developing with Object
-
Oriented Middleware

Principles of Object
-
Oriented Middleware

3

Principles of Object
-
Oriented Middleware


Network Operating System


Facilitate physical interchange of electrical or optical signals as packets of
information


Detect and correct transmission errors


Implement routing of packets between hosts


Compose packets into messages


Application


Requesting operations from remote objects


Middleware


Shield lower level details from applications

Middleware

Network OS

Component
-
1

Component
-
n



Host
-
1

Hardware

Principles of Object
-
Oriented Middleware

4

Computer Networks


ISO/OSI Reference Model (7
-
layer model)

Physical

Data Link

Network

Transport

Session

Presentation

Application

Principles of Object
-
Oriented Middleware

5

Computer Networks


ISO/OSI Reference Model (7
-
layer model)

Physical

Data Link

Network

Transport

Session

Presentation

Application

Middleware

Principles of Object
-
Oriented Middleware

6

Available Middleware


Transaction
-
Oriented Middleware


Support transactions across different distributed db systems


Two
-
phase commit protocol to implement distributed transaction


Products: IBM’s CICS, etc.


Message
-
Oriented Middleware


Supports communication between distributed system components by facilitating message
exchange


Support asynchronous message delivery naturally


Support multi
-
casting


Fault tolerance (message queue on temporarily persistent storage)


De
-
coupling of client and server


Products: IBM’s MQSeries


Object Oriented Middleware


Has transaction
-
oriented middleware capabilities


Support synchronous communication with at
-
most
-
once semantics


Trend: to be integrated with message
-
oriented middleware

Principles of Object
-
Oriented Middleware

7

Available Middleware


RPC


Call across host boundaries


Origin of OO middleware


Interface Definition Language

Principles of Object
-
Oriented Middleware

8

Remote Procedure Calls


Presentation Layer


Resolution of data heterogeneity


Common data representation


Transmission of data declaration


Marshalling and Unmarshalling


static


Dynamic


Client and server stubs


Static implementations of marshalling and unmarshalling

Char * marshal() {


char * msg;


msg = new char[4*(sizeof(int) + 1) + strlen(name) + 1];


sprintf(msg, “%d%d%d%d%s”, dob.day, dob.month, dob.year, strlen(name), name;


return(msg);

};

Principles of Object
-
Oriented Middleware

9

Remote Procedure Calls


Session Layer


Enable client to locate an RPC server


Static binding: simple, lost location transparency


Dynamic binding: depending on a deamon


Support location transparency

Print_person (char* host, Player * pers) {


CLIENT * clnt;


clnt = clnt_create(host, 105040, 0, “udp”);


if (clnt == (CLIENT*) NULL) exit (1);


if (print_0(pers, clnt) == NULL)


clnt_perror(clnt, “call failed”);


clnt_destroy (clnt);

Principles of Object
-
Oriented Middleware

10

General Pattern for Remote Invocation


Call:


marshal arguments


convert to network format


locate server


transmit data

Client Code

Stub

Server Code

Skeleton

Infrastructure


Serve:


receive data


convert & unmarshal


invoke method


marshal return value


transmit data

Principles of Object
-
Oriented Middleware

11

Object
-
Oriented Middleware


IDL


Object types as parameters;


Failure handling;


inheritance

Interface Player: Object {


typedef struct Date {


short day; short onth; short year; };


attribute string name;


readonly attribute Date DoB;

}

Interface PlayerStore: Object {


exception IDNotFound{};


short save (in Player p);


Player load(in short id) raises (IDNotfound);

Void print (in Player p);

};

Principles of Object
-
Oriented Middleware

12

Object
-
Oriented Middleware


Presentation Layer


Similar to RPC


Support client and server stubs


Perform marshalling and unmarshalling


Resolve heterogeneity of data representation


Different from RPC


Define representation of object references


Marshalling/unmarshalling object references

Principles of Object
-
Oriented Middleware

13

Object
-
Oriented Middleware


Session Layer


Map object references to hosts


Implements object activation policies in the object adapter


Object adapters need to be able to start up severs, which register in an
implementation repository or registry


Implement operation dispatch


Implement synchronization

Object Reference

Hosts

Processes

Objects

Object Request Broker

Principles of Object
-
Oriented Middleware

14

Developing with Object
-
Oriented
Middleware



Design

Interface
Definition

Server Stub
Generation

Client Stub
Generation

Client
Coding

Server
Coding

Server
Registration

Principles of Object
-
Oriented Middleware

15

General Architecture for a DOC System

IDL Compilers

Registration
Service

Object
Skeleton

Object
Storage

Object Manager

Naming Service

Client Application

Server

Implementation

Client Stub

Interface

Object
Interface
Specification

Principles of Object
-
Oriented Middleware

16

CORBA


OMG standard


Enable interoperability between applications in heterogeneous distributed
environment


Common architecture framework


Common framework across heterogeneous hardware platforms and operating
systems


Common framework for inter
-
communication of application objects


Open distributed object computing infrastructure


Automate many common network programming tasks, such as


object registration, location, and activation;


Request demultiplexing


Framing and error
-
handling


Parameter marshalling and un
-
marshalling


Operation dispatching



Principles of Object
-
Oriented Middleware

17

CORBA


CORBA


Message
-
passing


Object
-
oriented programming



ORB


Automate network functions


Sit on the host between the data and the application layer


Handles request messages from clients to servers in transparent manner




Principles of Object
-
Oriented Middleware

18

CORBA Objects


A CORBA Object has an interface and an implementation


Interface


Interface is not bound to a specific implementation PL,


Interface Definition Language



Principles of Object
-
Oriented Middleware

19

Interface Definition


Purpose of Defining Interface


Instantiate meta
-
models


Provide details to class diagrams


Govern interaction between client and server


Provide basis for distributing type information


Provide basis for automatically generate client and server stub



Reading Material


Brose’s book chapter 2



Principles of Object
-
Oriented Middleware

20

Stub Generation


Difference between Method Calls and Object Requests



Called

Caller

Stub

Called

Stub

Caller

Transport Layer (e.g. TCP or UDP)

Principles of Object
-
Oriented Middleware

21

IDL Compiler


For each .idl file, idl compiler generates 4 files



Test.idl

IDL
-
Compiler

Testsv.hh

Testsv.cc

Testcl.hh

Testcl.cc

Principles of Object
-
Oriented Middleware

22

Implementation of Client Objects


A static object request is made by a client calling a local method
of a client stub


Stubs are typed


Stubs can achieve access transparency


Middleware may shortcut a stub if server and client reside on
the same host

Principles of Object
-
Oriented Middleware

23

Implementation of Server Objects


The generated server stub has to call the server implementation
that an application builder designed.


Interfaces and inheritance make server object implementations
type safe.

Player_Dispatch

Player_Imp

Player_Server

<<uses>>

Player_Dispatch

<<Interface>>
Player_Imp

Player_Server

<<uses>>

<<Implements>>

Inheritance

Interface

Principles of Object
-
Oriented Middleware

24

Server Registration


Server object must be registered


Registry


Implementation repository



System administrator maintain the repository



Middleware provide tools for maintain the repository


Register new server objects


Startup server objects


Stop/delete existing server objects

Principles of Object
-
Oriented Middleware

25

Summary


OO middleware built on top of the transport layer


OO middleware implements the session and presentation layers


Other than OO middleware, there are transactional, message
-
oriented, remote procedure call middleware


Session layer implements an
object adaptor
activating/deactivating objects, synchronize client and server
objects


Presentation layer resolve data heterogeneity


Development process for distributed objects


Idl, stub generation, coding, registration


Type safety


Implementation repository