CS603 Communication Mechanisms: DCE RPC (cont.) 23 January 2002.

Slides:



Advertisements
Similar presentations
Local vs. distributed Objects Differences between local and distributed objects in: –References (to objects) –Activation/Deactivation –Migration –Persistence.
Advertisements

RMI Varun SainiYing Chen. What is RMI? RMI is the action of invoking a method of a remote interface on a remote object. It is used to develop applications.
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.
Remote Method Invocation in Java Bennie Lewis EEL 6897.
Advanced Programming Rabie A. Ramadan Lecture 4. A Simple Use of Java Remote Method Invocation (RMI) 2.
Java Remote Method Invocation (RMI) In Java we implement object systems: O1O2 O3 thread 1thread 2 execution scheme JVM 1JVM 2 distribution scheme.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
FONG CHAN SING (143334) WONG YEW JOON (143388). JAVA RMI is a distributive system programming interface introduced in JDK 1.1. A library that allows an.
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.
Java RMI. What is RMI? RMI is an RPC system for an object based language. Objects provide a natural granularity for the binding of functions. –RMI allows.
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
EEC-681/781 Distributed Computing Systems Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
CSE331: Introduction to Networks and Security Lecture 11 Fall 2002.
CS603 Communication Mechanisms 18 January What is coming Remote procedure call – specific systems –DCE RPC –Java RMI –SOAP First project.
Introduction to Remote Method Invocation (RMI)
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Java RMI RMI = Remote Method Invocation. Allows Java programs to invoke methods of remote objects. Only between Java programs. Several versions (JDK-1.1,
Java RMI Essentials Based on Mastering RMI Rickard Oberg.
1 Java Programming II Java Network II (Distributed Objects in Java)
Chapter 4 Distributed objects and Remote Method Invocation
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
15 - RMI. Java RMI Architecture Example Deployment RMI is a part of J2SE (standard edition), but is used by J2EE) A J2EE server is not nessesary for using.
1 Languages and Compilers (SProg og Oversættere) Bent Thomsen Department of Computer Science Aalborg University With acknowledgement to Mitch Neilsen whose.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
1 Classnote#12 RMI. 2 RMI applications are often comprised of two separate programs: – a server and a client. A typical server application –creates some.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
Java RMI: Remote Method Invocation January 2000 Nancy McCracken Syracuse University.
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.
Presentation 18: RMI introduction. Goals of this lesson After this 35 min. lesson you will be: Introduced to Java RMI Ready to present RMI’s position.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
RMI-IIOP.  RMI-IIOP combines RMI-style ease of use with CORBA cross-language interoperability  Java™ Remote Method Invocation (RMI) provides a simple.
Silberschatz, Galvin, and Gagne  1999 Applied Operating System Concepts Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote.
Java Remote Method Invocation RMI. Idea If objects communicate with each other on one JVM why not do the same on several JVM’s? If objects communicate.
RMI Continued IS Outline  Review of RMI  Programming example.
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.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
 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.
1 Developing Application in Distributed Computing Environment (DCE)
Fall 2007cs4251 Distributed Computing Umar Kalim Dept. of Communication Systems Engineering 17/10/2007.
Java Remote Method Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
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 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
DISTRIBUTED OBJECTS AND REMOTE INVOCATION 1. 2 Topics  Middleware  Remote Method Invocation  Remote Procedure Call.
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
RMI Example. Compilation: /home2/fccheng/temp/RMI2> javac MyObject.java /home2/fccheng/temp/RMI2> javac RemoteServer.java /home2/fccheng/temp/RMI2> javac.
Remote Method Invocation A Client Server Approach.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Remote Method Invocation RMI architecture stubs and skeletons for remote services RMI server and client in Java Creating an RMI Application step-by- step.
Java RMI. RMI Any object whose methods can be invoked from another Java VM is called a remote object.
Khoa CNTT 1/37 PHẠM VĂN TÍNH   Java RMI (Remote Method Invocation)
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Distributed programming in Java Faculty:Nguyen Ngoc Tu Session 5 - RMI.
CSC 480 Software Engineering Lab 6 – RMI Nov 8, 2002.
Netprog Java RMI1 Remote Method Invocation.
RMI1 Remote Method Invocation Adapted from “Core Java 2” by Cay Horstmann.
January 26, Ann Wollrath Copyright 1999 Sun Microsystems, Inc., all rights reserved. Java ™ RMI Overview Ann Wollrath Senior Staff Engineer Sun Microsystems,
Principles of Software Development
Java Remote Method Invocation (RMI)
Remote Method Invocation
Advanced Remote Method Invocations
Java RMI (more) CS-328 Internet Programming.
Network and Distributed Programming in Java
CS 584 Lecture 18 Assignment Glenda assignment extended to the Java RMI Deadline No Java RMI Assignment Test Friday, Saturday, Monday.
Java Remote Method Invocation
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

CS603 Communication Mechanisms: DCE RPC (cont.) 23 January 2002

Sample IDL for message/reply RPC /* greet.idl * The "greet" interface. */ [uuid(3d6ead56-06e3-11ca-8dd beabcd), version(1.0)] /* import “like_c_includes.idl” */ /* type declarations (typedef) */ interface greetif { const long int REPLY_SIZE = 100; void greet( [in] handle_t h, [in, string] char client_greeting[], [out, string] char server_reply[REPLY_SIZE] ); }

Using defined interface: Client /* greet_client.c - Client of "greet" interface. usage: greet_client */ #include #include #include "greet.h“ #include "util.h" Int main(int argc, char *argv[]) { rpc_ns_handle_t import_context; handle_t binding_h; error_status_t status; idl_char reply[REPLY_SIZE]; /* Start importing servers using the name specified on the command line. */ rpc_ns_binding_import_begin(rpc_c_ns_syntax_default, (unsigned_char_p_t) argv[1], greetif_v1_0_c_ifspec, NULL, &import_context, &status); ERROR_CHECK(status, "Can't begin import"); /* Import the first server (we could iterate here, but we'll just take the first one). */ rpc_ns_binding_import_next(import_context, &binding_h, &status); ERROR_CHECK(status, "Can't import"); /* Make the remote call. */ greet(binding_h, (idl_char *) "hello, server", reply); printf("The Greet Server said: %s\n", reply); }

Using defined interface: Server /* greet_manager.c - Implementation of "greet" interface. */ #include #include "greet.h" void greet( handle_t h, idl_char *client_greeting, idl_char *server_reply ) { printf("The client says: %s\n", client_greeting); strcpy(server_reply, "Hi, client!"); }

Using defined interface: Setting up listener /* greet_server.c - usage: greet_server */ #include #include "greet.h" #include "util.h" Int main(int argc, char *argv[]) { unsigned32 status; rpc_binding_vector_t *binding_vector; /* Register interface with RPC runtime. */ rpc_server_register_if(greetif_v1_0_s_ifspec, NULL, NULL, &status); ERROR_CHECK(status, "Can't register interface"); /* Use all protocol sequences that are available. */ rpc_server_use_all_protseqs(rpc_c_protseq_max_reqs_default, &status); ERROR_CHECK(status, "Can't use protocol sequences"); /* Get the binding handles generated by the runtime. */ rpc_server_inq_bindings(&binding_vector, &status); ERROR_CHECK(status, "Can't get bindings for server");

Using defined interface: Server /* Register assigned endpoints with endpoint mapper. */ rpc_ep_register(greetif_v1_0_s_ifspec, binding_vector, NULL, (unsigned_char_p_t) "greet server version 1.0", &status); ERROR_CHECK(status, "Can't register with endpoint map"); /* Export ourselves into the CDS namespace. */ rpc_ns_binding_export( rpc_c_ns_syntax_default, (unsigned_char_p_t) argv[1], greetif_v1_0_s_ifspec, binding_vector, NULL, &status); ERROR_CHECK(status, "Can't export into CDS namespace"); /* Start listening for calls. */ printf("Listening...\n"); rpc_server_listen(rpc_c_listen_max_calls_default, &status); ERROR_CHECK(status, "Can't start listening for calls"); }

CS603 Communication Mechanisms: Java RMI 23 January 2002

Java RMI Overview –Supports remote invocation of Java objects –Key: Java Object Serialization Stream objects over the wire –Language specific History –Goal: RPC for Java –First release in JDK 1.0.2, used in Netscape 3.01 –Full support in JDK 1.1, intended for applets –JDK 1.2 added persistent reference, custom protocols, more support for user control.

Java RMI Advantages –True object-orientation: Objects as arguments and values –Mobile behavior: Returned objects can execute on caller –Integrated security –Built-in concurrency (through Java threads) Disadvantages –Java only Advertises support for non-Java But this is external to RMI – requires Java on both sides

Java RMI Components Base RMI classes –Extend these to get RMI functionality Java compiler – javac –Recognizes RMI as integral part of language Interface compiler – rmic –Generates stubs from class files RMI Registry – rmiregistry –Directory service RMI Run-time activation system – rmid –Supports activatable objects that run only on demand

Java RMI classes Java.rmi.Remote –Interface supporting remote objects java.rmi.server.UnicastRemoteObject –Continuously running server java.rmi.activation.Activatable –Server started by rmid daemon java.rmi.naming –Lookup: Returns stub given a name java.rmi.RMISecurityManager –Validates rights to access downloaded object

Java RMI Registry Operation

Java RMI Object Serialization Key difference from DCE: Can send object to be invoked at remote site –Allows objects as arguments/results Mechanism: Object Serialization –Object passed must inherit from serializable –Provides methods to translate object to/from byte stream Security issues: –Ensure object not tampered with during transmission –Solution: Class-specific serialization Throw it on the programmer

Building a Java RMI Application Define remote interface –Extend java.rmi.Remote Create server code –Implements interface –Creates security manager, registers with registry Create client code –Define object as instance of interface –Lookup object in registry –Call object Compile and run –Run rmic on compiled classes to create stubs –Start registry –Run server then client

Java RMI Sample interface import java.rmi.Remote; import java.rmi.RemoteException; public interface Hello extends Remote { String sayHello() throws RemoteException; }

Java RMI Sample Client import java.rmi.Naming; import java.rmi.RemoteException; public class HelloClient { public static void main(String args[]) { String message = "blank"; Hello obj = null; try { obj = (Hello)Naming.lookup("//myhost/HelloServer"); message = obj.sayHello(); System.out.println(message); } catch (Exception e) { System.out.println("HelloClient exception: " + e.getMessage()); e.printStackTrace(); } } }

Java RMI: Example Server import java.rmi.Naming; import java.rmi.RemoteException; import java.rmi.RMISecurityManager; import java.rmi.server.UnicastRemoteObject; public class HelloServer extends UnicastRemoteObject implements Hello { public HelloServer() throws RemoteException { super(); } public String sayHello() { return "Hello World!"; } public static void main(String args[]) { if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } try { HelloServer obj = new HelloServer(); Naming.rebind("//myhost/HelloServer", obj); System.out.println("HelloServer bound in registry"); } catch (Exception e) { System.out.println("HelloServer err: " + e.getMessage()); e.printStackTrace(); } } }

Java RMI Example: Compile and Run javac Hello.java HelloServer.java HelloClient.java rmic –d `pwd` HelloServer rmiregistry & # not in same directory java -Djava.rmi.server.codebase=file:///`pwd`/ -Djava.security.policy=opensocket HelloServer –opensocket: grant { permission java.net.SocketPermission "*", "connect"; }; Java HelloClient