Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Distributed Systems Distributed Objects & Remote Invocation CORBA Dr. Sunny Jeong. Mr. Colin Zhang With Thanks.

Similar presentations


Presentation on theme: "1 Distributed Systems Distributed Objects & Remote Invocation CORBA Dr. Sunny Jeong. Mr. Colin Zhang With Thanks."— Presentation transcript:

1 1 Distributed Systems Distributed Objects & Remote Invocation CORBA Dr. Sunny Jeong. spjeong@uic.edu.hk Mr. Colin Zhang colinzhang@uic.edu.hk With Thanks to Prof. G. Coulouris, Prof. A.S. Tanenbaum and Prof. S.C Joo

2 2 Distributed Object & Remote invocation % rmic 클래스명 desktop Local Data Format Global Data Format (ex, XDR, CDR, Java object serialization ) Local Data Format Marshalling Unmarshalling Marshalling Unmarshalling Network Request Reply

3 3 Overviews  Common Object Resource Broker Architecture  Interface Definition Language (IDL)  Object Management Group (OMG) (http://www.omg.org) Specification  Java IDL (jdk1.2) use CORBA objects with Java Programming Language

4 Introduction-CORBA  Technology for Distributed Objects  Similar in function to Java RMI  Not Java-centric  Any language with IDL specification  IDL is a language-neutral interface definition language  Object Requst Broker (ORB) enables low- level communication between CORBA Objects

5 CORBA Architecture

6 Remote Interfaces and Stubs IDL Interface Stub Remote Object (Server) ClientSkeleton implements extends

7 CORBA Architecture  Client and Server Relationships common to CORBA and RMI  Server provides remote interface  Client calls remote interface  Object level interaction rather than application level interaction (sockets)  Objects can fulfill both roles

8 Client Side  Client has reference to remote object  Object reference has a stub method  Stand-in for remote method  Stub wired into ORB  Call on stub invokes ORB’s low-level communication routines  ORB forwards invocation to server

9 Server Side  ORB on Server Side uses Skeleton Code to translate remote invocation into call on the local object  Skeleton transforms results or errors and returns to ORB for delivery to client  ORB-ORB communication with IIOP (Internet Inter-ORB Protocol)

10 ORB  Different Vendors  IIOP based on TCP/IP by OMG  ORB Services  Look up (JDK1.2)  Object Persistence  Transactions  Messaging

11 Java IDL Development  Define interface to Remote Object with IDL  idlj or idltojava compiler generates stub and skeleton source, and code to interface with ORB  IDL interface can be implemented in any CORBA compliant language (C, C++, Smalltalk, COBOL, Ada )

12 Java IDL Development  Define interface to Remote Object with IDL  Idltojava(idlj) compiler generates stub and skeleton source, and code to interface with ORB  IDL interface can be implemented in any CORBA compliant language (C, C++, Smalltalk, COBOL, Ada)

13  Compile remote interface ( idltojava or idlj )  Implement the server. It should start ORB and wait on invocations from clients, as well as implement remote methods.  Implement client. Start ORB, look up server, obtain remote reference, and call remote method (  Start applications. Java IDL Execution (ctd)

14 Copyright © 1997 Alex Chaffee CORBA Flow Client Virtual Machine Client Server Virtual Machine Stub Remote Object Skeleton Name Server Virtual Machine “Hey” Server

15 CORBA Flow Client Virtual Machine Client Server Virtual Machine Stub Remote Object Skeleton Name Server Virtual Machine “Fred” Server 1 2 1. Server Creates Remote Object 2. Server Registers Remote Object Copyright © 1997 Alex Chaffee

16 CORBA Flow Client Virtual Machine Client Server Virtual Machine Stub Remote Object Skeleton Name Server Virtual Machine “Fred” Server 4 3. Client requests object from Name Server 4. Name Server returns remote reference (and stub gets created) 3 Copyright © 1997 Alex Chaffee

17 RMI Flow Client Virtual Machine Client Server Virtual Machine Stub Remote Object Skeleton Name Server Virtual Machine “Fred” Server 6 5. Client invokes stub method 6. Stub talks to skeleton 7. Skeleton invokes remote object method 57 Copyright © 1997 Alex Chaffee

18 Example  Hello World has two remote methods that returns a string & summation to be displayed.  Client invokes sayHello and sum on Hello server  ORB transfers invocation to servant object registered for interface  Servant’s sayHello and sum runs, returns String and summation  ORB transfers String and summation back to client  Client Displays String and summation

19 Hello.idl module HelloApp { interface Hello { string sayHello(); long sum(in long x); };

20  CORBA module is name space that is a container for related interfaces and definitions.  Like a Java Package  module statement mapped to java package statement  interface specifies contract object has with other objects  interface to interface in java Hello.idl - module

21  CORBA operations are behaviors that server promises to do on client’s behalf  operation to method in java  idlj (idltojava) Hello.idl creates a HelloApp directory, and six files.  HelloPOA.java : Abstract class is the server skeloton. It implements Hello.java. Server class will extend this class.  _ HelloStub.java : Client stub. Implements Hello.java Hello.idl - HellApp

22  Hello.java : Java version of IDL interface. Subclasses org.omg.CORBA.Object to provide base CORBA functionality.  HelloHelper.java : Provides other functionality. narrow method cast CORBA object reference to proper type.  HelloHolder.java : final class provides out and inout arguments.  HelloOperations.java: contains all the methods from IDL for stub and skeleton

23 Running the Example  Compile IDL by (idlj –fall __.idl)  Compile every files HellApp  Compile client and server  start name service: tnameserv -ORBInitialPort 1050 (ref. 0-1023) (or with demon : start orbd –ORBInitialPort 1050)  start client and server java HelloServer -ORBInitialPort 1050 java HelloClient -ORBInitialPort 1050 -ORBInitialHost ‘hostname’


Download ppt "1 Distributed Systems Distributed Objects & Remote Invocation CORBA Dr. Sunny Jeong. Mr. Colin Zhang With Thanks."

Similar presentations


Ads by Google