Corba. Corba services. The (very) global picture. Corba. Distributed Object Systems 3 CORBA/IDL. Corba. Features. Services



Similar documents
Introduction to Distributed Computing using CORBA

Infrastructure that supports (distributed) componentbased application development

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

Distributed Network Management Using SNMP, Java, WWW and CORBA

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

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

Distributed Applications with CORBA. Frank Kargl Chaos Computer Club, Ulm, Germany


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

Middleware Lou Somers

CORBA. BY VIRAJ N BHAT

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

CORBA Objects in Python

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

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

How To Use A Com In A Microsoft Com 2.5 (Dsi) (Dsi) (For Microsoft) (Com) (Sib) (Operations) (Orchestra) (Ahem) (I

Getting Started with the Internet Communications Engine

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

Architecture of the CORBA Component Model CORBA 3.0

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

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

The omniorbpy version 3 User s Guide

Crash Course in Java

CORBA I An Introduction To CORBA CptS 464/564 Sept 2, 2004

Interface Definition Language

Mixing Python and Java How Python and Java can communicate and work together

Tuple spaces and Object spaces. Distributed Object Systems 12. Tuple spaces and Object spaces. Communication. Tuple space. Mechanisms 2.

The Java Series Introduction to Java RMI and CORBA. The Java Series. Java RMI and CORBA Raul RAMOS / CERN-IT User Support Slide 1

Fundamentals of Java Programming

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

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

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

History OOP languages Year Language 1967 Simula Smalltalk

The University of Alabama in Huntsville Electrical and Computer Engineering CPE Test #4 November 20, True or False (2 points each)

The C Programming Language course syllabus associate level

Objects and classes. Objects and classes. Jarkko Toivonen (CS Department) Programming in Python 1

Remote Method Invocation in JAVA

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

CS506 Web Design and Development Solved Online Quiz No. 01

Limitations of Object-Based Middleware. Components in CORBA. The CORBA Component Model. CORBA Component

An Incomplete C++ Primer. University of Wyoming MA 5310

An Overview of Java. overview-1

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

Services. Relational. Databases & JDBC. Today. Relational. Databases SQL JDBC. Next Time. Services. Relational. Databases & JDBC. Today.

App Servers & J2EE Platform. Contents: Transaction Processing Monitors. TP Monitors (cont) TP-Monitors. TP Standards. TP Monitors (cont)

Problem Example Mobile phone after-sale services

Object Oriented Software Design II

C++FA 5.1 PRACTICE MID-TERM EXAM

Pemrograman Dasar. Basic Elements Of Java

The Efficiency Analysis of the Object Oriented Realization of the Client-Server Systems Based on the CORBA Standard 1

Java (12 Weeks) Introduction to Java Programming Language

N3458: Simple Database Integration in C++11

C++ Programming Language

Programming Languages CIS 443

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Distributed Applications. Python

Introduction to CORBA

Moving from CS 61A Scheme to CS 61B Java

Java and Distributed Object Models: An Analysis

System types. Distributed systems

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Java Programming Fundamentals

The programming language C. sws1 1

Inter-Domain Management between CORBA and SNMP :

Intelligent and Modular Load-Balancing CORBA Naming Service

: provid.ir

2! Multimedia Programming with! Python and SDL

Web Services. Copyright 2011 Srdjan Komazec

Sun Microsystems Inc. Java Transaction Service (JTS)

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

El Dorado Union High School District Educational Services

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

CS 111 Classes I 1. Software Organization View to this point:

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

Elements of Advanced Java Programming

Unifying the Global Data Space using DDS and SQL

Computer Programming Tutorial

CS 106 Introduction to Computer Science I

Java Cheatsheet. Tim Coppieters Laure Philips Elisa Gonzalez Boix

What is ODBC? Database Connectivity ODBC, JDBC and SQLJ. ODBC Architecture. More on ODBC. JDBC vs ODBC. What is JDBC?

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

Status of the CORBA Firewall Traversal RFP

Introduction to Java

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

Introduction to Python

Scanner. It takes input and splits it into a sequence of tokens. A token is a group of characters which form some unit.

Load Balancing in CORBA: A Survey. Response to the Aggregated Computing RFI

INF5140: Specification and Verification of Parallel Systems

Web Services. Distributed Object Systems 11. Web Services, SOAP and NET. Web Applications. Web Services. Web services vs Distributed Objects

Transcription:

Distributed Systems 3 CORBA/ Piet van Oostrum Sep 11, 2008 Corba Common Request Broker Architecture Middleware for communicating objects Context Management Group (OMG) Consortium of computer companies (Sun, HP, IBM,...) Defines standards (interfaces) for support of (distributed) OO applications Also for example UML Based on concrete available technology, propositions by consortium members Status Many services defined But not all implemented by all distributions yet Many commercial and open source implementations New services invented occasionally (e.g. Corba Components) Corba Corba The (very) global picture Corba services Piet van Oostrum 1 OMG To make collaboration Management go Architecture well Common Facilities Vertical Common Facilities Application s Horizontal Common Facilities Bus Services "System Frameworks" Common Facilities "Application Frameworks" Business s User Information Management Request Broker (ORB) Systems Management Task Management Naming Life Cycle Query Time Trader Licensing Events Transactions Properties Collections Security Interoperability Collaboration Persistence Externalization Concurrency Relationships Change Management The (very) global picture Common Services - Not OMG all services yetmanagement defined Architecture Piet van Oostrum 2 - Not all services yet defined Piet van Oostrum 3 Services Features Naming Referencing by name Naming schemes Events Sending events Registering interest in events Persistence Storing objects Distributed Life Cycle Systems 03/02/98 Atze Dijkstra Java RMI Creating, copying, moving, 3 deleting Dept. components of Comp.Science, on the bus UU Transactions Two-phase commit, rollback Static and dynamic method invocation Compile time or runtime definition of method invocation High-level language bindings Definition Language () Independent of language (C, C++, Smalltalk, Java, Python) Translates to language code Self-describing system Distributed Systems 03/02/98 Atze Dijkstra Java RMI 6 Dept. of Comp.Science, UU Contains information describing interfaces, methods (+ parameters), etc. a server provides Can be interrogated at runtime Many more... Piet van Oostrum 4 Piet van Oostrum 5 slides3.pdf September 11, 2008 1

Example Quoter Looking like normal use of service Notation used: C++ int main( void ) // Use a factory to bind to any quoter Quoter_var quoter = find_quoter_service("quoter") ; const char *stock_name = "ACME ORB, Inc." ; long value = quoter->get_quote(stock_name) ; cout << stock_name << " = " << value << endl ; return 0 ; Quoter interface Functionality defined in OMG interface Quoter exception Invalid_Stock ; long get_quote( in string stock_name ) raises (Invalid_Stock) ; Description Language Used by both clients and servers Language independent With compilers to specific languages Location transparent Piet van Oostrum 6 Piet van Oostrum 7 CORBA structure Dynamic Invocation Requests Stubs Client ORB ORB Core Dynamic Skeleton Adapter identical for all ORB implementations May be multiple object adaptors Stubs and a skeleton for each object type ORB dependent interface Implementation Static Skeleton Impl CORBA core components An Request Broker (ORB) Basic or Portable Adapter (BOA/POA) An Definition Language () A Static Invocation (SII) A Dynamic Invocation (DII) A Dynamic Skeleton (DSI) and Implementation Repositories Programming language mappings An Interoperability Spec (GIOP, IIOP) GIOP (General Inter-ORB Protocol) = protocol between local ORBs IIOP (Internet Inter-ORB Protocol) = GIOP through Internet (TCP/IP) Piet van Oostrum 8 Piet van Oostrum 9 Core components Request Broker (ORB) Central component location, creation, activation Message exchange Has its own interface for local services Local ORBs + G/IIOP = object bus NB. ORB is a distributed thing, but each local part is also called ORB Usually implemented as a library inside the process (e.g. DLL or Java package) Static Invocation (SII) Client stubs (proxy pattern) Static interface to object services Dynamic Invocation (DII) is runtime variant, interface repository is used for construction of calls Core components Static skeleton Framework through which calls are passed to object service Dynamic Skeleton (DSI) is dynamic variant adapter Provides mapping of object identifiers to implementation instances Uses implementation repository identifiers ORB translates local identifier to Interoperable References (IOR) and vice-versa IOR contains all information to locate the remote object Piet van Oostrum 10 Piet van Oostrum 11 slides3.pdf September 11, 2008 2

Adaptor Adapter Tasks of an object adapter Tasks of an object adaptor Up-call to method A skeleton Handle incoming requests Implementation ID ID B skeleton ID Adapter Broadcast services Manage object references Instantiate new objects Register new classes Impl. Basic Adapter (BOA) Basic service Barebones ORB Variety of server kinds Server kinds Single process accepting calls, blocking while handling Server per object starts at first call on object Server per method starts for each call Persistent server already exists BOA is deprecated adapter maps object ID s to object instances Skeleton maps methods names to method implementations Piet van Oostrum 12 Piet van Oostrum 13 Portable Adapter (POA) BOA is too restricted E.g. no support for moving objects or objects that are sleeping in a database. BOA is underspecified Vendors made their own extensions non-portable POA solves this Many different ways to create/revive objects Distributed Systems 03/02/98 Atze Dijkstra Java RMI 19 Dept. of Comp.Science, UU Will be treated in a later lecture. Corba implementations There are many Corba implementations: Several commercial implementations Open source implementations (see selection below) C++: TAO (The Ace ORB) OmniORB Orbit (used in Linux/Gnome) Java: built-in implementation in Java (called Java ) is not very good JacORB is a better implementation OpenORB (a bit antique) Python: Fnorb (written in Python) OmniORB Piet van Oostrum 14 Using Using 5 Create definitions 1 Client Client stubs stubs 2 Precompiler Skeletons 3 Add server impl code 4 Compile Server Server stubs stubs Instantiate Impl's Impl's 6 Adapter 7 Impl. Piet van Oostrum 15 Using From to runtime info Define object classes using Precompile file, creates stubs and skeletons Add implementation code to skeletons Compile code, creating misc interfaces and info Bind class definitions to interface repository (optional) Instantiate objects on server Register run-time objects with the implementation repository (optional) Calling Static interface as method invocation Uses normal object.method syntax Dynamic interface using special calls to construct message method invocation is constructed at run-time. Client Server Piet van Oostrum 16 Piet van Oostrum 17 slides3.pdf September 11, 2008 3

compiler x.idl Developer We use a subset of Corba version 2 defines simple interfaces Client Developer -to-java Compiler -to-c++ Compiler Server Developer version 3 defines components can be translated to C, C++, Java, Python, etc. app.java x.java x.h x.cpp x_skel.h x_skel.cpp srv.cpp Translation generates interface definitions, stubs, skeletons, etc. Other s (e.g. Microsoft ) are similar. Java ORB Run-Time Client Executable IIOP Server Executable C++ ORB Run-Time generated file (source: Iona) Piet van Oostrum 18 Piet van Oostrum 19 concepts 1 Module: namespace, like package in Java : Basic thing, between Java interface and class Abstract interface (no objects) Local interface (only for non-remote objects) Unconstrained interface Inheritance: can inherit from one or more other interfaces (multiple inheritance): interface Dog: Pet, Animal Inherits all variables, methods, exceptions,... Unconstrained interface may not inherit from local interface All unconstrained interfaces inherit from CORBA:: (this is Corba, not Java ). Constants: const double pi=3.14159; Operations (methods) concepts 2 Attributes (instance variables) Implemented by get/set methods Can be declared readonly (no set) Type declarations: give a name to a type typedef struct complex float re, im; typedef sequence<complex> vector; Exceptions: can have data members System exceptions: can be raised even when not specified User exceptions: must be declared with raises Standard exceptions: are defined in OMG documentation (both system and user) Piet van Oostrum 20 Piet van Oostrum 21 concepts 3 Names (identifiers) are case insensitive, so User, USER and user are the same. But you must use only one form Scopes: Names can be qualified by the module and interface in which they are defined. e.g. Stock::Quoter::get_quote If no module is used: ::Quoter::get_quote Members of structs, unions, etc. can also be qualified with the struct, etc. name Inside the same module the module part can be omitted, inside the same interface the interface part can be omitted, etc. types short 16 bit integer long 32 bit integer long long 64 bit integer signed and unsigned boolean float, double and long double fixed fixed point number char (8 bits character iso-8859-1) wchar (wide characters implementation dependent) Piet van Oostrum 22 Piet van Oostrum 23 slides3.pdf September 11, 2008 4

types Example string strings consisting of chars wstring strings consisting of wchars octet (8 bits unchanged) namng i context struct (like in C, C++, Pascal record) union (can contain different types, chosen with a switch construction) enum (enumeration constant) array multidimensional, fixed bounds sequence array like, one-dimensional; no fixed length (max may be specified) any can contain any other type. Piet van Oostrum 24 module MyAnimals CORBA cass l with /* def of Dog */ ( mul tiple) inher itance interface Dog:Pet, Animal inst. var s,... attribut e unsigned long age; excepti on NotInterested string explanation parame ters: type void Bark(in short how_ long) and di rection raises ( NotInterested) ; method /* def of Cat */ interface Cat: Animal void Eat(); Piet van Oostrum 25 Hello Quoter module HelloApp interface Hello string sayhello(); interface HelloFactory Hello create(in string message); module Stock // An exception is a combination of // an event and maybe some data. exception Invalid_Stock ; exception Invald_Quoter ; // like C++ class, Java interface interface Quoter long get_quote(in string stock_name) raises (Invalid_Stock) ; Piet van Oostrum 26 Piet van Oostrum 27 Quoter continued Complex types in Complex types should be given a name // Manage the lifecycle of a Quoter object interface Quoter_Factory // Returns a new Quoter selected by name // e.g. "MSFT" Quoter create_quoter(in string name) raises (Invalid_Quoter); void destroy_quoter(in Quoter quoter) ; Similiar to Java constructs in, out, inout specify direction of parameters enum struct union sequence array fixed typedef typedef long int; typedef string<30> name; typedef some_complex_type mytype; Note: the name to be defined comes last!! Piet van Oostrum 28 Piet van Oostrum 29 slides3.pdf September 11, 2008 5

Enum enum defines a series of named constants: enum Color Red, Green, Blue const Color favorite_color = Blue; module Mod enum Size small, medium, large const Mod::Size MYSIZE = Mod::medium; Error: const Color another = Mod::medium; // is an error Struct struct defines a type with a collection of fields Like a Java class without methods struct Point2D float x; float y; struct Address string<25> street; short number; string<20> city; Piet van Oostrum 30 Piet van Oostrum 31 Struct Better to use names for the complex types: In some cases this is obligatory typedef string<25> streetname; typedef string<20> cityname; struct Address streetname street; short number; cityname city; Sequence and array Arrays have fixed size and can be multidimensional: Define matrix as an array of 10*20 floats typedef double Point3D[3]; typedef float matrix[10][20]; First the type of the elements, then the name of the new type, then the dimensions!!! Sequences are onedimensional and are flexible in length They may have an upper bound typedef sequence<int> vector; typedef sequence<int, 10> bounded_vector; Piet van Oostrum 32 Piet van Oostrum 33 union union can contain any of a number of other types The choice is indicated by a discriminator This must be some integer, char, bool or enum. union message switch (char) case e : string english; case c : wstring chinese; union enum message_type SMS, Email struct sms_message long telephone_number; string<160> contents; struct email_message string From; string To; string Subject; string contents; Piet van Oostrum 34 Piet van Oostrum 35 slides3.pdf September 11, 2008 6

union union message switch (message_type) case SMS: sms_message sms; case Email: email_message email; to Java mapping Language mapping Most constructs map easily to Java Done by compiler Example constant, array module Example const long along = -12345; const long ArrayBound = 42; struct ArrayContainer long array[arraybound]; gives Piet van Oostrum 36 Piet van Oostrum 37 to Java mapping Another Example package Example; public final class along public static final int value = (int) (-12345L); public final class ArrayContainer // instance variables public int[] array; // constructors public ArrayContainer() public ArrayContainer(int[] array)... module StatMod interface Stat void init(); void additem(in double item); double getavg (); long getnum (); void getall (out double avg, out long num); Piet van Oostrum 38 Piet van Oostrum 39 Python crash course Python is an elegant dynamic programming language: No static type declarations Statements can be entered and executed directly in the interpreter High level datatypes: lists, tuples, dictionaries, classes,... Each python file is a module (namespace) and can be imported in other modules Block structure by indentation Python example class Test: #constructor, self is like this in Java def init (self, value): self.value = value def getval(self, x): return self.value, x # return a tuple x = Test(5) print x.getval(3) # should print (5, 3) instance variables/methods can only be referenced with dot notation (obj.var/obj.meth() without dot only local and global variables Piet van Oostrum 40 Piet van Oostrum 41 slides3.pdf September 11, 2008 7

Python server part 1 Python server part 2 import sys from Fnorb.orb import BOA, CORBA import StatMod_skel class StatServer(StatMod_skel.Stat_skel): def init(self): self.count = 0 self.sum = 0.0 def getavg(self): try: return self.sum/self.count except: return 0 def getall(self): return self.getavg(),self.getnum() def additem(self, x): self.sum += x self.count += 1 def getnum(self): return self.count Piet van Oostrum 42 Piet van Oostrum 43 Python server part 3 Python server part 3 # Initialise the ORB. orb = CORBA.ORB_init(argv, CORBA.ORB_ID) # Initialise the BOA. boa = BOA.BOA_init(argv, BOA.BOA_ID) # Create an object reference ( fred is the object key). obj = boa.create( fred, StatServer._FNORB_ID) # Create an instance of the implementation class. impl = StatServer() # Write the stringified object reference to a file f = open( Server.ref, w ) f.write(orb.object_to_string(obj)) f.close() # Start the event loop. boa._fnorb_mainloop() In this example we don t use a Naming service, just write the object reference to a file. boa.obj_is_ready(obj, impl) Piet van Oostrum 44 Piet van Oostrum 45 Python client Python client import sys from Fnorb.orb import CORBA import StatMod # Initialise the ORB. orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) # Read the server s stringified IOR from a file stringified_ior = open( Server.ref ).read() # Make sure that the server is not a nil object reference # (represented in Python by the value None). if server is None: raise Nil object reference! # Call the server! server.init() # server.additem etc. # Convert the stringified IOR into an active object reference. server = orb.string_to_object(stringified_ior) Piet van Oostrum 46 Piet van Oostrum 47 slides3.pdf September 11, 2008 8

Java client Java client import org.omg.corba.*; import java.util.*; import java.io.*; import StatMod.*; public class StatClient public static void main(string args[]) Stat stat; String ior; try ORB orb = ORB.init(args, null); stat.init(); stat.additem(7); stat.additem(4); System.out.println(stat.getAvg()); catch (Throwable e) System.err.println(e); e.printstacktrace(system.err); BufferedReader ref = new BufferedReader (new FileReader("Server.ref")); ior = ref.readline(); stat = StatHelper.narrow (orb.string_to_object(ior)); Piet van Oostrum 48 Piet van Oostrum 49 Translation to Java Java out parameters package StatMod; public interface StatOperations void init (); void additem (double item); double getavg (); int getnum (); void getall (org.omg.corba.doubleholder avg, org.omg.corba.intholder num); IntHolder count = new IntHolder(); DoubleHolder avg = new DoubleHolder();... stat.init(); stat.additem(7); stat.additem(4); // Use out parameters stat.getall(avg, count); System.out.println(avg.value+" "+count.value); Holder classes have a value attribute that contains the actual value of the (in)out parameter. Piet van Oostrum 50 Piet van Oostrum 51 slides3.pdf September 11, 2008 9