Distributed Internet Applications - DIA. Principles of Object-Oriented Middleware

Similar documents
Middleware Lou Somers

Chapter 6. CORBA-based Architecture. 6.1 Introduction to CORBA 6.2 CORBA-IDL 6.3 Designing CORBA Systems 6.4 Implementing CORBA Applications

Infrastructure that supports (distributed) componentbased application development

Chapter 2: Remote Procedure Call (RPC)

Middleware: Past and Present a Comparison

Interface Definition Language

Web Services. Copyright 2011 Srdjan Komazec

Invocación remota (based on M. L. Liu Distributed Computing -- Concepts and Application

Motivation Definitions EAI Architectures Elements Integration Technologies. Part I. EAI: Foundations, Concepts, and Architectures

Distributed Objects and Components

Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme. Middleware. Chapter 8: Middleware

Module 17. Client-Server Software Development. Version 2 CSE IIT, Kharagpur


Lecture 7: Java RMI. CS178: Programming Parallel and Distributed Systems. February 14, 2001 Steven P. Reiss

Introduction CORBA Distributed COM. Sections 9.1 & 9.2. Corba & DCOM. John P. Daigle. Department of Computer Science Georgia State University

XII. Distributed Systems and Middleware. Laurea Triennale in Informatica Corso di Ingegneria del Software I A.A. 2006/2007 Andrea Polini

Introduction to Distributed Computing using CORBA

SOFT 437. Software Performance Analysis. Ch 5:Web Applications and Other Distributed Systems

Middleware and Distributed Systems. Introduction. Dr. Martin v. Löwis

Introduction to CORBA. 1. Introduction 2. Distributed Systems: Notions 3. Middleware 4. CORBA Architecture

What is Middleware? Software that functions as a conversion or translation layer. It is also a consolidator and integrator.

Introduction to Web Services

Layering a computing infrastructure. Middleware. The new infrastructure: middleware. Spanning layer. Middleware objectives. The new infrastructure

Communication. Layered Protocols. Topics to be covered. PART 1 Layered Protocols Remote Procedure Call (RPC) Remote Method Invocation (RMI)

COM 440 Distributed Systems Project List Summary

Lesson 4 Web Service Interface Definition (Part I)

Chapter 2: Enterprise Applications from a Middleware Perspective

Socket = an interface connection between two (dissimilar) pipes. OS provides this API to connect applications to networks. home.comcast.

Report of the case study in Sistemi Distribuiti A simple Java RMI application

Overview of CORBA 11.1 I NTRODUCTION TO CORBA Object services 11.5 New features in CORBA Summary

Distributed Network Management Using SNMP, Java, WWW and CORBA

Supporting Interactive Invocation of Remote Services within an Integrated Programming Environment

Event-based middleware services

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

Elements of Advanced Java Programming

Object-Oriented Middleware for Distributed Systems

It is the thinnest layer in the OSI model. At the time the model was formulated, it was not clear that a session layer was needed.

A Comparison of Service-oriented, Resource-oriented, and Object-oriented Architecture Styles

Service Oriented Architecture

Network Programming TDC 561

Chapter 11. User Datagram Protocol (UDP)

Architecture of the CORBA Component Model CORBA 3.0

MIDDLEWARE 1. Figure 1: Middleware Layer in Context

PERFORMANCE COMPARISON OF COMMON OBJECT REQUEST BROKER ARCHITECTURE(CORBA) VS JAVA MESSAGING SERVICE(JMS) BY TEAM SCALABLE

How To Write A Network Operating System For A Network (Networking) System (Netware)

Networks and Protocols Course: International University Bremen Date: Dr. Jürgen Schönwälder Deadline:

Outline SOA. Properties of SOA. Service 2/19/2016. Definitions. Comparison of component technologies. Definitions Component technologies

Netscape Internet Service Broker for C++ Programmer's Guide. Contents

CORBA. BY VIRAJ N BHAT

Service-Oriented Architecture and Software Engineering

3F6 - Software Engineering and Design. Handout 10 Distributed Systems I With Markup. Steve Young

WEB SERVICES. Revised 9/29/2015

Classic Grid Architecture

Research on the Model of Enterprise Application Integration with Web Services

Implementing Java Distributed Objects with JDBC

Introduction into Web Services (WS)

CORBA, DCOP and DBUS. A performance comparison.

Service Oriented Architecture

Chapter 4. Architecture. Table of Contents. J2EE Technology Application Servers. Application Models

CORBA Programming with TAOX11. The C++11 CORBA Implementation

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

Apache Thrift and Ruby

Java and ActiveX Projects

COMMMUNICATING COOPERATING PROCESSES

Distributed Systems. Outline. What is a Distributed System?

Network Communication

What is COM/DCOM. Distributed Object Systems 4 COM/DCOM. COM vs Corba 1. COM vs. Corba 2. Multiple inheritance vs multiple interfaces

Client-Server Architecture

Shared file. LINUX Virtual File System. Hard link. Linux ext2fs. Disk layout in general. Linux: ext2fs & ext3fs, Windows NTFS Distributed Processing

VisuSniff: A Tool For The Visualization Of Network Traffic

Mobile Devices: Server and Management Lesson 05 Service Discovery

The Service Revolution software engineering without programming languages

Going Interactive: Combining Ad-Hoc and Regression Testing

A Java-based system support for distributed applications on the Internet

Chapter 7, System Design Architecture Organization. Construction. Software

Resource Utilization of Middleware Components in Embedded Systems

Mapping of Services on Bluetooth Radio Networks

Using mobile phones to access Web Services in a secure way. Dan Marinescu

Network Attached Storage. Jinfeng Yang Oct/19/2015

How To Understand The Concept Of A Distributed System

CORBAservices. Naming. Part of the CORBA Naming Service Interface in IDL. CORBA Naming Service

Dissertation Title: SOCKS5-based Firewall Support For UDP-based Application. Author: Fung, King Pong

A Web-Based Real-Time Traffic Monitoring Scheme Using CORBA

Transcription:

Distributed Internet Applications - DIA Principles of Object-Oriented Middleware 1

Why Middleware? Distributed system construction directly on top of a transport layer is rather difficult. The communication will often need to send complex parameters. Different encodings of data types in memory. Parameters and return values might refer to other distributed system components. Developers and administrators would have to implement component activation. Type safety is an important concern. Achieving type safety manually is quite error prone. Implementing synchronization is rather tedious and error prone. 2

Using Network Operating System Application engineers could use network operating systems to exchange information based on sending fixedlength messages or writing into a byte stream Application Network Operating System 3

Middleware Middleware simplifies distributed system construction by implementing the presentation and session layers. Application Presentation Session Middleware Transport Network Data link Physical 4

Types of Middleware 1. Transaction-Oriented Middleware 2. Message-Oriented Middleware 3. Object-Oriented Middleware 5

Transaction-Oriented Middleware Transaction-Oriented Middleware is often used with distributed database applications. Object-oriented middleware has transaction-oriented middleware capabilities. 6

Message-Oriented Middleware Message-Oriented Middleware is used when reliable, asynchronous communication is the dominant form of distributed system interaction. IBM s MQSeries, Sun s ToolTalk and NCR s TopEnd This paradigm supports: Asynchronous Message Delivery Multi-Casting The degree of fault-tolerance is very high. Message queues store messages temporarily on persistent storage. Object-oriented middleware is starting to be integrated with message-oriented middleware. 7

Remote Procedure Calls (RPCs) An Remote Procedure Call (RPC) is a procedure call across host boundaries. It is invented by Sun Microsystems as part of their Open Network Computing (ONC) platform. The origin of object-oriented middleware is RPC. 8

RPC Interface Definition Language The server components that execute RPCs are called RPC programs. RPCs are clustered in RPC programs. An RPC program has an interface definition that defines procedures that can be called remotely. Interface definitions also define data types of arguments that can be passed to remote procedures. The DCE (Distributed Computing Environment) includes an interface definition language that is used to define these exports in a way that is independent of programming languages. 9

RPC Interface Definition Language Example: An interface definition in Sun s RPC interface definition language. const NL = 64; Struct Player { struct DoB { int day; int month; int year; } struct name<nl>; }; program PLAYERPROG { version PLAYERVERSION { void PRINT (Player) = 0; int STORE (Player) = 1; Player LOAD (int) = 2; } = 0; } = 105040; 10

RPC Presentation Layer RPC presentation layer integration maps application data structures onto a homogeneous and transmissible form. The mappings between application and transport data representations are called marshalling and unmarshalling. Tasks Achieved by the Presentation Layer Implementation 11

RPC Presentation Layer An example of marshalling and unmarshalling (generated by the IDL compiler): 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); }; void unmarshal(char * msg) { int name_len; sscanf(msg, %d %d %d %d, &dob.day, &dob.month, &dob.year,&name_len); name = new char[name_len + 1]; sscanf(msg, %d %d %d %d, &dob.day, &dob.month, &dob.year,&name_len, name); }; 12

RPC Presentation Layer Marshalling is specific to the particular remote procedures Marshalling can be implemented statically at compile time or determined dynamically at run-time. Stubs are generated by remote procedure call systems. Client and server stubs are static implementations of marshalling and unmarshalling. RPC systems on Unix provide an interface definition language compiler, called rpcgen, that generates a client stub and a server stub. 13

RPC Session Layer The session layer implementation needs to enable clients to locate an RPC server(statically or dynamically). 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); Is this location transparent? The above C code creates a client stub for the RPC program in previous example. If the creation succeeds, it calls the stub with print_0. 14

Dynamic Binding Each host of a Unix network that supports RPCs runs a daemon called portmap. Any RPC server registers its programs with the portmap daemon that runs on the host. Clients can contact a single portmap daemon to get a list of all programs that reside on the server. Clients can also broadcast a search for a program to all portmap daemons of a network and the portmap daemons with which the program is registered will respond. 15

Object-Oriented Middleware Object-Oriented Middleware evolved more or less directly from the idea of remote procedure calls. The first of these systems was OMG s Common Object Request Broker Architecture (CORBA). Microsoft added distribution capabilities to its Component Object Model (COM). Sun provided a mechanism for Remote Method Invocation (RMI). The idea here is to make object-oriented principles available for the development of distributed systems. 16

Interface Definition Language Every object-oriented middleware has an interface definition language (IDL). IDLs support the concept of object types as parameters; failure handling; and inheritance. A disadvantage of RPCs is that they are not reflexive. This means that procedures exported by one RPC program cannot return another RPC program. A server object that implements an object type can return other server objects. 17

An IDL Example interface Player: Object { typedef struct Date { short day; short month; 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 (IDNoFound); void print ( in Player p); }; Objects of type PlayerStore return a reference to another server object in operation load. 18

Presentation Layer Implementation The presentation layer implementation of object-oriented middleware is very similar to that of RPCs. Object-oriented middleware also supports client and server stubs. Object-oriented middleware presentation layers need to map object references to the transport format (marshalling and unmarshalling). 19

Session Layer Implementation The session layer implementation of object-oriented middleware is more complex than that of RPCs. Transport layer implementations, such as TCP and UDP, use addressing schemes based on host name and port numbers. RPC systems use the portmap daemon in order to map between service names and host names. The session layer of OO middleware needs to map object references to hosts. 1. Addressing of server objects is based on object references. 2. The object references are generated by the middleware. 3. The session layer implementation of object-oriented middleware maps object references to hosts in a fully transparent way. 20

Session Layer Implementation Session layer implements object activation policies in the object adapter. The object adapter implements the mapping of object references to active object implementations Object adapters need to be able to start up servers, which register in an implementation repository or registry. Session layer needs to implement operation dispatch. The object needs to invoke the requested operation. This is referred to as operation dispatch. Session layer needs to implement synchronization. Object requests are, by default, synchronous forms of communication. 21

Developing with Object-Oriented Middleware Design and Implementation Process Design Interface Definition Server Stub Generation Client Stub Generation Server Coding Client Coding Server Registration 22

Design Design the server objects based on requirements that existing and future client objects may have. Use an CASE tool that supports an object-oriented notation (UML). Class diagrams Sequence diagrams State diagrams 23

Interface Definition IDLs provide language constructs for all concepts of their underlying object model. Every object-oriented middleware has an object model. Interface definitions add considerable detail to class diagrams. Interfaces can be seen as contracts that govern the interaction between client and server objects. Interfaces are also the basis for distributing type information. Client and server stubs are automatically derived from interfaces. 24

Stub Generation Client and server stubs are proxies for servers and clients. Stubs are incarnations of the Proxy Design Pattern [Gamma et al., 1995]. A proxy is placeholder that hides a certain degree of complication. Client and server stubs hide the fact that an operation execution is being requested in a distributed fashion. Client (server) stub resides on the same host as the client (server) object. 25

Stub generation Method Calls versus Object Request 26

Stub Generation Process Stubs are generated by the IDL compiler that is provided by the middleware. 27

Distributed Ruby DRb - a library module - is a distributed object system for Ruby. It is written in pure Ruby and uses its own protocol. It does not rely on or interoperate with other distributed object system such as CORBA, DCOM, RMI, or.net. 28

Distributed Ruby DRb allows methods to be called remotely. References to objects can be passed between processes. Method arguments and return values are dumped and loaded in marshalled format. An object in a remote process is locally represented by a DRb::DRbObject instance. 29

Example: server code require 'drb/drb' URI = "druby://localhost:8787" class TimeServer def get_current_time return Time.now end end $server_object = TimeServer.new $SAFE = 1 DRb.start_service(URI, $server_object) DRb.thread.join [~/snb] $ ruby dserver.rb 30

Example: client code require 'drb/drb' SERVER_URI = "druby://localhost:8787" DRb.start_service timeserver = DRbObject.new_with_uri (SERVER_URI) puts timeserver.get_current_time [~/snb] $ ruby dclient.rb Fri Nov 12 17:30:32 CET 2004 31

Distributed Ruby An instance of DRb::DRbObject acts as a sort proxy for the remote object. Methods called upon this DRb::DRbObject, for example timeserver in the cline code, are forwarded to its remote object, for example $server_object in the server code. 32

Components of a DRb Application Server: Start a TCP server socket and listen. Bind an object to the drb server instance. Accept connections from clients and respond to messages they send. Optionally provide Access Control services Client: Establish a connection to a DRb server process. Bind a local object to the remote DRb object Send messages to the server object and receive lts messages. 33

Example: Use of Factory Pattern require "drb/drb" URI = "druby://localhost:8787" class Logger # Make DRb send Logger instances as # DRb reference, not copies. include DRb::DRbUndumped def initialize(name, fname) @name = name @file_name = fname end def log(msg) # method f = File.new(@file_name,"a+") f.puts("#{time.now}: #{@name}: #{msg}") f.close end end 34

Example: Use of Factory Pattern class LoggerFactory def initialize(base_dir) @base_directory = base_dir @loggers = {} end def get_logger(name) if!@loggers.has_key? name fname = name.gsub(/[.\/]/, "_").untaint @loggers[name] = Logger.new(name, @base_directory + "/" + fname) end return @loggers[name] end end 35

Example: Use of Factory Pattern THIS IS ALL SERVER_OBJECT = LoggerFactory.new("/Users/mortezanahrwar/tmp/dlog") $SAFE = 1 DRb.start_service(URI, SERVER_OBJECT) DRb.thread.join 36

Example: Use of Factory Pattern require 'drb/drb' SERVER_URI = "druby://localhost:8787" DRb.start_service log_service = DRbObject.new_with_uri(SERVER_URI) 37

Example: Use of Factory Pattern t1 = Thread.new{ logger = log_service.get_logger("loga") logger.log("hello, World!") logger.log("goodbye, World!") logger.log("=== EOT ===") } t2 = Thread.new{ logger = log_service.get_logger("logb") logger.log("hallo, beste mensen!") logger.log("dag beste mensen!") logger.log("=== EOT ===") } t3 = Thread.new{ logger = log_service.get_logger("logc") logger.log("123456789") logger.log("123456789".reverse) logger.log("=== EOT ===") } Client code 38

Example: Use of Factory Pattern t1.join t2.join t3.join puts "Bye!" Client code outputs Fri Nov 12 22:30:56 CET 2004: logb: Hallo, beste mensen! Fri Nov 12 22:30:56 CET 2004: logb: Dag beste mensen! Fri Nov 12 22:30:56 CET 2004: logb: === EOT === Fri Nov 12 22:30:56 CET 2004: logc: 123456789 Fri Nov 12 22:30:56 CET 2004: logc: 987654321 Fri Nov 12 22:30:56 CET 2004: logc: === EOT === Fri Nov 12 22:30:56 CET 2004: loga: Hello, World! Fri Nov 12 22:30:56 CET 2004: loga: Goodbye, World! Fri Nov 12 22:30:56 CET 2004: loga: === EOT === 39