300 likes | 538 Views
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. Outline Computer Networks Types of Middleware
E N D
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
Principles of Object-Oriented Middleware • Outline • Computer Networks • Types of Middleware • Object-oriented Middleware • Developing with Object-Oriented Middleware Principles of Object-Oriented Middleware
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 Component-1 Component-n … Middleware Network OS Hardware Host-1 Principles of Object-Oriented Middleware
Computer Networks • ISO/OSI Reference Model (7-layer model) Application Presentation Session Transport Network Data Link Physical Principles of Object-Oriented Middleware
Computer Networks • ISO/OSI Reference Model (7-layer model) Application Presentation Middleware Session Transport Network Data Link Physical Principles of Object-Oriented Middleware
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
Available Middleware • RPC • Call across host boundaries • Origin of OO middleware • Interface Definition Language Principles of Object-Oriented Middleware
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
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
General Pattern for Remote Invocation • Call: • marshal arguments • convert to network format • locate server • transmit data Client Code Server Code Stub Skeleton Infrastructure • Serve: • receive data • convert & unmarshal • invoke method • marshal return value • transmit data Principles of Object-Oriented Middleware
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
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
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 Request Broker Processes Hosts Objects Object Reference Principles of Object-Oriented Middleware
Developing with Object-Oriented Middleware Design Interface Definition Server Stub Generation Client Stub Generation Server Coding Client Coding Server Registration Principles of Object-Oriented Middleware
General Architecture for a DOC System Registration Service Object Skeleton Object Storage Server Implementation Object Manager Object Interface Specification IDL Compilers Naming Service Client Stub Interface Client Application Principles of Object-Oriented Middleware
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
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
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
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
Stub Generation • Difference between Method Calls and Object Requests Caller Caller Called Stub Stub Called Transport Layer (e.g. TCP or UDP) Principles of Object-Oriented Middleware
IDL Compiler • For each .idl file, idl compiler generates 4 files Test.idl IDL-Compiler Testcl.hh Testsv.hh Testcl.cc Testsv.cc Principles of Object-Oriented Middleware
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
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. <<uses>> <<uses>> Player_Imp <<Interface>> Player_Imp Player_Dispatch Player_Dispatch <<Implements>> Player_Server Player_Server Inheritance Interface Principles of Object-Oriented Middleware
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
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 Principles of Object-Oriented Middleware