Slide 1 Objektorienteret Middleware (OOMI) CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application.

Slides:



Advertisements
Similar presentations
CS Network Programming CS 3331 Fall CS 3331 Outline Socket programming Remote method invocation (RMI)
Advertisements

1 Streams and Input/Output Files Part 2. 2 Files and Exceptions When creating files and performing I/O operations on them, the systems generates errors.
Network Programming and Java Sockets
Using RMI–IIOP in the Development of Distributed Applications Dr. P.G.Sarang, President & ABCOM Information Systems Private. Limited.,
1 Network Programming and Java Sockets Rajkumar Buyya Grid Computing and Distributed Systems (GRIDS) Laboratory Dept. of Computer Science and Software.
DISTRIBUTED OBJECTS AND REMOTE INVOCATION
Slides for Chapter 20: CORBA Case Study From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Addison-Wesley 2005.
Java IDL Callback Object. interface Listener { void message(in string msg); }; interface MessageServer { void register(in Listener lt); };
Chapter 10 Ch 1 – Introduction to Computers and Java Streams and File IO 1.
1 Java Remote Method Invocation java.rmi.* java.rmi.registry.* java.rmi.server.*
15-May-15 RMI Remote Method Invocation. 2 “The network is the computer” Consider the following program organization: If the network is the computer, we.
Common Object Request Broker Architecture (CORBA) By: Sunil Gopinath David Watkins.
CORBA Architecture Nitin Prabhu. Outline CORBA Object Model CORBA Architecture Static Invocation Dynamic Invocation CORBA Communication Model.
CORBA over ATM San Diego State University Department of Mathematical and Computer Sciences San Diego, April 6-7, 2000 Workshop ATM Networking Worawan Tunsiengsomjareon,
1 Distributed Systems Distributed Objects & Remote Invocation CORBA Dr. Sunny Jeong. Mr. Colin Zhang With Thanks.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
1 HANDOUT 14 Remote Method Invocation (RMI) BY GEORGE KOUTSOGIANNAKIS THIS DOCUMENT CAN NOT BE REPRODUCED OR DISTRIBUTED WITHOUT TH E WRITTEN PERMISSION.
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
A First Java ORB Application 1  Object Request Broker (ORB)  This is the object manager in CORBA  Mechanisms for specifying interfaces  Interface Definition.
II. Middleware for Distributed Systems
By Dr. Jiang B. Liu 11. Java IDL and CORBA  Generic ORB Core  idltojava development tool  CORBA Object Service (COS) name service - nameserv  Java.
1 Aniruddha Gokhale Vanderbilt University, Spring 2003 Intro to TAO Programming Study the Hello example in ACE_wrappers/TAO/tests –Show IDL definition,
Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
CORBA Celsina Bignoli Enterprise Computing Corporation have similar computing environments: –mixed set of HW platforms –a mixed set.
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
Cli/Serv.: rmiCORBA/131 Client/Server Distributed Systems v Objectives –introduce rmi and CORBA , Semester 1, RMI and CORBA.
Information Management NTU Interprocess Communication and Middleware.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
Slide 1 CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application ITONK1.
Chapter 9 1 Chapter 9 – Part 1 l Overview of Streams and File I/O l Text File I/O l Binary File I/O l File Objects and File Names Streams and File I/O.
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
Objekt orienteret Netværkskommunikation CORBA Introduction & CORBA Programming.
Abhishek Bachchan Vishal Patangia
CORBA/IDL Common Object Resource Broker Architecture (CORBA) Interface Definition Language (IDL) Object Management Group (OMG) ( Specification.
CORBA – Command Line CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
RMI-IIOP.  RMI-IIOP combines RMI-style ease of use with CORBA cross-language interoperability  Java™ Remote Method Invocation (RMI) provides a simple.
MSc Course in Advanced Distributed Systems Session 2.2: Practical CORBA Programming
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
CORBA Details Three Tier Architecture CORBA API Holders and Helpers COS Naming and Naming Contexts Transient and Persistent Objects Properties Callbacks.
Distributed Objects and Middleware. Sockets and Ports Source: G. Coulouris et al., Distributed Systems: Concepts and Design.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
Presentation: RMI introduction. Goals of this lesson After this 35 min. lesson you will be: Introduced to Java RMI Ready to present RMI’s position in.
Slide 1 Objektorienteret Netværkskommunikation CORBA Introduction.
Update on CORBA Support for Babel RMI Nanbor Wang and Roopa Pundaleeka Tech-X Corporation Boulder, CO Funded by DOE OASCR SBIR.
CORBA – Eclipse CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
CORBA_1/001 Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki CORBA:
 Common Object Request Broker Architecture  An industry standard developed by OMG to help in distributed programming.
Server-Side Java Mapping Copyright © ZeroC, Inc. Ice Programming with Java 6. Server-Side Java Mapping.
Presentation 11: RMI introduction. Ingeniørhøjskolen i Århus Slide 2 af 20 Goals of this lesson After these 2x35 lessons you will be –Introduced to Java.
Remote Method Invocation with Java-RMI
Presentation: RMI Continued 2 Using The Registry & Callbacks.
DISTRIBUTED OBJECTS AND REMOTE INVOCATION 1. 2 Topics  Middleware  Remote Method Invocation  Remote Procedure Call.
Slide 1 of 15 © Ingeniørhøjskolen i Århus CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application.
// messenger.idl interface Messenger { boolean send_message ( in string user_name, in string subject, inout string message ); };
(C) 2003 University of ManchesterCS31010 Lecture 14: CORBA.
IDL Models The Inheritance Model: Using the Inheritance Model, you implement the IDL interface using an implementation class that also extends the compiler-generated.
Presentation 24 Ultra Simple.NET Remoting to CORBA bridge.
Object-Oriented Middleware (OOMI) Locating Distributed Objects Emmerich – Chapter
Topic 5: CORBA RMI Dr. Ayman Srour
CORBA & Design Pattern Csc8350 Advanced Software Engineering Georgia State University Dr. Xiaolin Hu.
CORBA Barış COŞKUN Çağatay DİKİCİ. INTRODUCTION Computer networks are heterogenous In 1989 OMG(Object Management Group) was formed to address the problems.
CORBA & Design Pattern Csc8350 Advanced Software Engineering Georgia State University Dr. Xiaolin Hu.
Only small steps in CORBA programming – much complexity
Remote Method Invocation
The Common Object Request Broker Architecture (CORBA)
The Common Object Request Broker Architecture (CORBA)
Copyright © 2001 Qusay H. Mahmoud
Presentation transcript:

Slide 1 Objektorienteret Middleware (OOMI) CORBA Programming: Presentation of a simple “Hello World” CORBA client and server application

Slide 2 Outline CORBA programming Code examples We will make a very small CORBA application with a Java server, Java Client & C++ client application In Java (SUN ORB) What gets generated? What files do we need to write (client + server)? In Orbacus C++ ORB We make a client Only small steps in CORBA programming – much complexity

Slide 3 “Hello World” CORBA Example with file IOR Client app. Server app. Development PC CORBA Java / C++ Hello World Client CORBA Java Hello World Server TCP/IP Network TCP/IP Network User activa- tes client Server returns “Hello World !“

Slide 4 Who’s doing what? Some code will get generated by the IDL compiler Some code we will need to implement ourselves Starting with the IDL file

Slide 5 IDL Interface of Hello Servant module HelloApp interface Hello { string sayHello(); };

Slide 6 IDL Compiler Example Java Hello.idl file Java IDL Compiler - IDLJ Hello.java (Both Client & Server) contains the Java version of the IDL interface. HelloOperations.java contains the methods – here only sayHello(). All the operations in the IDL interface are placed in the operations file. _HelloStub.java is the client stub. HelloPOA.java is the skeleton class you should extend from. It implements dynamic invocation functions. HelloHelper.java (Both Client & Server) provides auxiliary functionality, notably the narrow() method required to cast CORBA object references to their proper types. HelloHolder.java Whenever the IDL type is an out or an inout parameter, the Holder class is used. Generates Input What gets generated by the IDL Compiler

Slide 7 Extract from _HelloStub.java What are we looking at?

Slide 8 Extract from HelloHelper.java Discuss with your neighbor 2 min. what is this? what is it used for?

Slide 9 Extract from HelloPOA Discuss with your neighbor 2 min. what is this? what is used for? More on this later

Slide 10 // HelloServer.java, stringified object reference version // Stefan Wagner, 2003 import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; import org.omg.PortableServer.*; import org.omg.PortableServer.POA; import HelloApp.*; //This is the servant - implementing the methods from the IDL class HelloServant extends HelloPOA { private ORB orb; public HelloServant(ORB orb) { this.orb = orb; } public String sayHello() { return "\nHello world !!\n"; } Constructor taking ORB as a parameter (from HelloPOA) HelloServant The server object (Part 1) The CORBA operation implemented By extending from HelloPOA we may communicate with ORB Implemented manually

Slide 11 //This is the HelloServer - the server running the HelloServant - Servant public class HelloServer { public static void main(String args[]) { try{ // create and initialize the ORB org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); // create servant and register it with the ORB HelloServant helloRef = new HelloServant(orb); // get reference to rootpoa and activate the POAManager POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); rootpoa.the_POAManager().activate(); // get object reference from the servant org.omg.CORBA.Object ref = rootpoa.servant_to_reference(helloRef); Hello href = HelloHelper.narrow(ref); // stringify the helloRef and dump it in a file String oir = orb.object_to_string(href); java.io.PrintWriter out = new java.io.PrintWriter(new java.io.FileOutputStream("object.ref")); out.println(oir); out.close(); // wait for invocations from clients orb.run(); } catch (Exception e) { System.err.println("ERROR: " + e); e.printStackTrace(System.out); } } } HelloServant The server object (Part 2) Init ORB and register servant with ORB Start the orb server process The POA produces the reference Narrow the call (CORBA type cast + IDL type check) Object reference ”stringified” and Sent to file object.ref Object reference ”stringified” and Sent to file object.ref Activate rootPOA Implemented manually

Slide 12 // HelloClientSOR.java, stringified object reference version import java.io.*; import org.omg.CORBA.*; import HelloApp.HelloHelper; import HelloApp.*; public class HelloClientSOR { public static void main(String args[]) { try { // create and initialize the ORB org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); // Get the stringified object reference and destringify it. java.io.BufferedReader in = new java.io.BufferedReader(new java.io.FileReader("object.ref")); String ref = in.readLine(); org.omg.CORBA.Object obj = orb.string_to_object(ref) ; Hello helloRef = HelloHelper.narrow(obj); // call the Hello server object and print results String Hello = helloRef.sayHello(); System.out.println(Hello); } catch (Exception e) { System.out.println("ERROR : " + e) ; e.printStackTrace(System.out);} } HelloClientSOR The Client program Init ORB Narrow the call (CORBA type cast + IDL type check) Object reference Read from file Object reference Read from file Call via Proxy Implemented manually Discuss with your neighbor 2 min. what happens after sayHello()

Slide 13 What is this object.ref file? IOR: Interoperable Object Reference Includes info on: Repository ID (standard), Endpoint Info (standard) - including IP and port number, Object Key (proprietary) Can be written into a file Not really nice with a file-based reference – or what? May employ a naming service instead This we shall look at later File-based may be necessary due to firewall problems Possible to use a HTTP or FTP server for distributing the references IOR: c3 a48656c6c6f f48656c6c6 f3a312e c e e e312e b afabcb a80a a

Slide 14 Parsed IOR _IIOP_ParseCDR: byte order BigEndian, repository id, 1 profile _IIOP_ParseCDR: profile 1 is 138 bytes, tag 0 (INTERNET), BigEndian byte order (iiop.c:parse_IIOP_Profile): bo=BigEndian, version=1.2, hostname= , port=1658, object_key= (iiop.c:parse_IIOP_Profile): encoded object key is (iiop.c:parse_IIOP_Profile): non-native cinfo is object key is ; no trustworthy most-specific-type info; unrecognized ORB type; reachable with IIOP 1.2 at host " ", port For the translation of IORs

Slide 15 #include int run(CORBA::ORB_ptr); int main(int argc, char* argv[]) {int status = EXIT_SUCCESS; CORBA::ORB_var orb; try { orb = CORBA::ORB_init(argc, argv); status = run(orb); } catch (const CORBA::Exception&) { status = EXIT_FAILURE; } if(!CORBA::is_nil(orb)) { try { orb -> destroy(); } catch(const CORBA::Exception&) {status = EXIT_FAILURE; } } return status; } HelloCorba C++ Client Part 1 Init ORB Destroy ORB Call run method (see next slide) Implemented manually

Slide 16 … int run(CORBA::ORB_ptr orb) { const char* refFile = "object.ref"; ifstream in(refFile); char s[2048]; in >> s; CORBA::Object_var obj = orb -> string_to_object(s); HelloApp::Hello_var hello = HelloApp::Hello::_narrow(obj); cout sayHello() << endl; return 0; } HelloCorba C++ Client Part 2 Narrow the call (CORBA type cast) to the Hello_var smartpointer (helper + memory management) Narrow the call (CORBA type cast) to the Hello_var smartpointer (helper + memory management) Object reference Read from file Object reference Read from file Call method via Proxy and print result HelloApp::Hello_var smartpointer type Generated by IDL compiler + Hello Read more on Smartpointer types in OOMI-1 chapter 4

Slide 17 Læringsmål Alignment Når kurset er færdigt forventes den studerende at kunne: Definere, beskrive og sammenligne forskellige typer af objektorienterede middleware frameworks til apparater og computere, med primær fokus på CORBA og sekundært ICE teknologierne, herunder fordele og ulemper forbundet med de forskellige teknologier Definere og beskrive principper omkring transparens og heterogenitet i relation til middlewareteknologier Definere og beskrive gængse teorier, metoder og retningslinier indenfor det objektorienterede middleware paradigme og anvende disse til at designe effektive distribuerede systemer Designe og konstruere et distribueret system der gør brug af CORBA og ICE teknologierne med tilhørende værktøjssupport I kan nu definere og beskrive Grundlæggende CORBA kodearkitektur og kode I kan nu definere og beskrive Grundlæggende CORBA kodearkitektur og kode Kode til stubbe, proxy, IDL, Retningslinier, transp., hetero. IDL Compiler, referencer Kode til stubbe, proxy, IDL, Retningslinier, transp., hetero. IDL Compiler, referencer Grundlæggende forståelse For hvad der skal til af Java og C++ Kode til et CORBA system Grundlæggende forståelse For hvad der skal til af Java og C++ Kode til et CORBA system MANGLER: praktisk erfaring: kommer med øvelser og opgave