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.

Slides:



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

What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
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.
Presentation 4: Principles of Object-Oriented Middleware.
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.
Remote Method Invocation
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.
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.
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.
Practical Issues of RPCCS-4513, D-Term Remote Procedure Call Practical Issues CS-4513 Distributed Computing Systems (Slides include materials from.
Java RMI RMI = Remote Method Invocation. Allows Java programs to invoke methods of remote objects. Only between Java programs. Several versions (JDK-1.1,
CS603 Communication Mechanisms: DCE RPC (cont.) 23 January 2002.
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets Rethinking out tic-tac-toe game.
Presentation 4: Principles of Object-Oriented Middleware.
1 Java Programming II Java Network II (Distributed Objects in Java)
Presentation: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
Presentation: Other Object Oriented Middlewares. Outline Web services Java RMI.NET Remoting WCF For each technology Compare: heterogenity (platform, OS,
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.
Presentation 4: Principles of Object-Oriented Middleware.
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.
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.
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.
Remote Method Invocation onlineTraining/rmi/RMI.html.
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.
 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.
Objektorienteret Middleware (OOMI)
Fall 2007cs4251 Distributed Computing Umar Kalim Dept. of Communication Systems Engineering 17/10/2007.
Presentation 4: Principles of Object-Oriented Middleware.
Java Remote Method Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Objektorienteret Netværkskommunikation (ITONK1) CORBA Introduction.
Presentation 4: Principles of Object-Oriented Middleware.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
Presentation: Special Repetition Recap on Distributed Principles.
Florida State UniversityCOP Advanced Unix Programming Remote Method Invocation /rmi/index.html.
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.
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
CSC 480 Software Engineering Lab 6 – RMI Nov 8, 2002.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Presentation 13: RMI continued – more advanced issues: Activation & RMI over IIOP.
January 26, Ann Wollrath Copyright 1999 Sun Microsystems, Inc., all rights reserved. Java ™ RMI Overview Ann Wollrath Senior Staff Engineer Sun Microsystems,
Java Remote Method Invocation (RMI)
Broker in practice: Middleware
Remote Method Invocation
What is RMI? Remote Method Invocation
Remote Method Invocation
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
Presentation transcript:

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 RMI Ready for trying out a simpel ”Hello World” excersice in the LAB –Ready to present RMI’s position in the Middleware technology family on class YOU WILL NOT –Be an RMI expert Later in RMI: –We will look at more advanced issues –Activation, Call-back, RMI on IIOP

Ingeniørhøjskolen i Århus Slide 3 af 20 Outline Theory: (35 min.) –Introduction to Java RMI Group work: (15 min.) –Pro’s & con’s of Java RMI vs. SOAP When to use which technology… –Differences and equalities with SOAP & RMI Plenum: (15 min.) –Discussion of group work –Next time: one group will present … so prepare!

Ingeniørhøjskolen i Århus Slide 4 af 20 Java RMI In Java 1.0 object communication was confined to objects in one Virtual Machine (VM) Remote Method Invocation (RMI) from Java 1.1 supports communication between different VMs, potentially across the network Provides tight OO integration with Java Work in heterogeneous environment (servers) BUT ONLY with Java (so far) – so no language transparency

Ingeniørhøjskolen i Århus Slide 5 af 20 Java RMI features Build on Java’s existing object model -> easy No need for IDL – use Java interfaces Arguments & return values can be all types specializing java.io.Serilizable or java.rmi.Remote Dynamic loading of classes Use of build in Java Security Manager Distributed Garbage Collection Integrates with CORBA (later) BUT NOT IN J2ME!!! (use SOAP)

Ingeniørhøjskolen i Århus Slide 6 af 20 Java RMI position Middleware Transaction-Oriented –IBM CICS –BEA Tuxedo –Encina Message-Oriented –IBM MQSeries –DEC Message Queue –NCR TopEnd –(SOAP) RPC Systems –ANSA –Sun ONC –OSF/DCE –(SOAP) Object-Oriented –OMG/CORBA –DCOM –Java/RMI –(SOAP)

Ingeniørhøjskolen i Århus Slide 7 af 20 Local Java call vs. Java RMI callCalledCalled Stub CallerCalledCalledCaller Caller Transport Layer (e.g. TCP or UDP) Similar to SOAP and CORBA – using Proxy

Ingeniørhøjskolen i Århus Slide 8 af 20 Interface Definition Design Server Stub Generation Client Stub Generation Server Coding Client Coding Server Registration Development Steps – RMI vs SOAP SOAP: WSDL Java2WSDL WSDL2JAVA AXIS SOAP RMI: rmic RMI: JAVA J2SE JDK Start with Server Interface Coding: JAVA Start with Server Interface Coding: JAVA rmiregistry

Ingeniørhøjskolen i Århus Slide 9 af 20 Team.wsdl included in generates reads WSDL-compiler Teamcl.hh Teamcl.cc Teamsv.cc Teamsv.hh Stub Generation in SOAP

Ingeniørhøjskolen i Århus Slide 10 af 20 Team.idl included in generates reads IDL-Compiler Teamcl.hh Teamcl.cc Teamsv.cc Teamsv.hh Stub Generation in CORBA

Ingeniørhøjskolen i Århus Slide 11 af 20 package examples.hello; import java.rmi.Remote; import java.rmi.RemoteException; public interface Hello extends Remote { String sayHello() throws RemoteException; void someOther(String param) throws RemoteException; } rmic Compiler HelloImpl_Stub.class HelloImpl_Skeleton.class Stub Generation in Java RMI NOTE: In fact, it is the HelloImpl that is used! NOTE: In fact, it is the HelloImpl that is used! Hello.java Must Extend from Interface Remote Must Extend from Interface Remote From RMI v. 1.2 no skeleton is generated From RMI v. 1.2 no skeleton is generated

Ingeniørhøjskolen i Århus Slide 12 af 20 C++ Compiler, Linker Server Client.cc Server.cc C++ Compiler, Linker Client Team.idl included in generates reads IDL-Compiler Teamcl.hh Teamcl.cc Teamsv.cc Teamsv.hh CORBA Client and Server Implementation

Ingeniørhøjskolen i Århus Slide 13 af 20 Java compiler - javac Server HelloClient.java HelloImpl.java Java compiler - javac Client Hello.java included in generates reads rmic Compiler RMI Client and Server Implementation HelloImpl_Stub.class HelloImpl_Skeleton.class

Ingeniørhøjskolen i Århus Slide 14 af 20 package examples.hello; import java.rmi.Naming; import java.rmi.RemoteException; import java.rmi.RMISecurityManager; import java.rmi.server.UnicastRemoteObject; public class HelloImpl extends UnicastRemoteObject implements Hello { public HelloImpl() throws RemoteException { super(); } public String sayHello() { return "Hello World! ; } public static void main(String args[]) { // Create and install a security manager //if (System.getSecurityManager() == null) { // System.setSecurityManager(new RMISecurityManager()); //} try { HelloImpl obj = new HelloImpl(); // Bind this object instance to the name "HelloServer" Naming.rebind("rmi:// /HelloServer", obj); System.out.println("HelloServer bound in registry"); } catch (Exception e) { System.out.println("HelloImpl err: " + e.getMessage()); e.printStackTrace(); } Server object (HelloImpl.java) Security manager needs a security policy – for access control (i.e. file system). Security manager needs a security policy – for access control (i.e. file system). Instantiate a new object and register (bind it) in the ”rmiregistry” Instantiate a new object and register (bind it) in the ”rmiregistry” Implement all methods from interface Hello.java Implement all methods from interface Hello.java Extend UnicastRemote and implemet Hello Interfacet Extend UnicastRemote and implemet Hello Interfacet ”rmiregistry” is a simpel name server with methods to bind objects (bind/rebind) – and Find them again (lookup) –> client ”rmiregistry” is a simpel name server with methods to bind objects (bind/rebind) – and Find them again (lookup) –> client

Ingeniørhøjskolen i Århus Slide 15 af 20 package examples.hello; import java.rmi.Naming; import java.rmi.RemoteException; public class HelloClient { public static void main(String args[]) { try { obj = (Hello)Naming.lookup("rmi:// /HelloServer"); String message = obj.sayHello(); System.out.println(message); } catch (Exception e) { System.out.println("HelloApplet exception: " + e.getMessage()); e.printStackTrace(); } ”lookup” the HelloServer – and call Method sayHello() on Stub ”lookup” the HelloServer – and call Method sayHello() on Stub Client object (HelloClient.java) Remember – that the stub and skeleton classes get generated by the ”rmic” compiler Remember – that the stub and skeleton classes get generated by the ”rmic” compiler AND THAT’S IT!

Ingeniørhøjskolen i Århus Slide 16 af 20 Architecture ServerClient Stub Registry Interfaces Skeleton Activation Interfaces RMI Runtime (rmid,rmiregistry) coded manually rmic generated bind lookup

Ingeniørhøjskolen i Århus Slide 17 af 20 Things to remember No attributes in Java Interfaces (as opposed to CORBA IDL) -> RMI does not support attributes Attributes must be represented as set and get operations by the designer

Ingeniørhøjskolen i Århus Slide 18 af 20 Things to remember II Parameter passing different than normal Java in single VM Atomic types are passed by value Remote objects are passed by reference Non-Remote objects are passed by value! And of course – if an object is not on the client – the ByteCode gets transferred (the class incl. implementation)

Ingeniørhøjskolen i Århus Slide 19 af 20 Key Points True and beautiful OO Middleware Easy to learn – for Java developers No need for a separate IDL (use Java Interfaces) Distributed Garbage Collection ByteCode transfers automatically Works in heterogene environment – but only with Java No build in services (except for the registry) Depends on other API’s – JavaSpaces, JINI, JDBC, EJB, JDO etc. – integrated into a framework (ROAD JAVA from MÆRSK DATA)

Ingeniørhøjskolen i Århus Slide 20 af 20 Introduction complete – now Group Work Group work: (15 min.) –Pro’s & con’s of Java RMI vs. SOAP When to use which technology… –Differences and equalities with SOAP Reflection in plenum: (15 min.) –Discussion of group work –Next time: one random group will present … so prepare! Presentation next time –Use book and articles as source of knowledge –Use figures from teachers former presentations