Java Computing 6. RMI By Dr. Jiang B. Liu

Slides:



Advertisements
Similar presentations
Remote method invocation. Introduction First introduced in JDK 1.1. Allows distributed Java programs to work with each others by behaving as if they are.
Advertisements

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.
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
Remote Object Invocation Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
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.
CSE331: Introduction to Networks and Security Lecture 11 Fall 2002.
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,
Internet Software Development Remote Method Invocation Paul Krause.
Slides for Chapter 5: Communication between distributed objects
JAVA - Network DUT Info - Option ISI (C) Philippe Roose , 2005.
1 Distributed Objects Naim R. El-Far, PhD Candidate TA for SEG3202 Software Design and Architecture with N. El- Kadri (Summer 2005) Tutorial 3 of 4 – 10/6/2005.
1 Java Programming II Java Network II (Distributed Objects in Java)
CS 584 Lecture 18 l Assignment » Glenda assignment extended to the Java RMI Deadline » No Java RMI Assignment l Test » Friday, Saturday, Monday.
ICS 123 Java RMI ICS 123 Richard N. Taylor and Eric M. Dashofy* UC Irvine * with the usual thanks to David Rosenblum.
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.
Sun’s Jini Lab 2 Service Registration Client Lookup.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
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.
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 remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved TDTS04 Föreläsning.
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.
Example: RMI Program How to write it.
 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.
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.
1 Java Remote Method Invocation java.rmi.* java.rmi.registry.* java.rmi.server.*
Remote Method Invocation with Java-RMI
Presentation: RMI Continued 2 Using The Registry & Callbacks.
Creating Applications Using RMI Lesson 1B / Slide 1 of 19 Network and Distributed Programming in Java Pre-assessment Questions 1.Which of the following.
 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.
Slides for Chapter 5: Distributed objects and remote invocation From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition.
Remote Method Invocation A Client Server Approach.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
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.
import java.io.*; public class Customer implements Serializable { public Customer(int theAge, int theSex, String[] theHobbies) { age = theAge; sex.
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,
RMI Packages Overview java.rmi java.rmi.server java.rmi.registry
Remote Method Invocation
Remote Method Invocation
Java RMI (more) CS-328 Internet Programming.
Creating a Distributed System with RMI
Slides for Chapter 5: Distributed objects and remote invocation
Creating a Distributed System with RMI
Creating a Distributed System with RMI
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
----> In Server side dos window
Creating a Distributed System with RMI
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Java Computing 6. RMI By Dr. Jiang B. Liu  Java RMI Classes & Interfaces  Client/Server Development using RMI  Pizza Order application

Java RMI Classes and Interfaces Remote interface: The RMI system is based on remote interfaces through which a client accesses the methods of a remote object. server.UnicastRemoteObject class: the only RemoteServer subclass server object support by RMI at this time. Naming class: provide methods (bind/rebind, lookup) for server classes to make remote objects visible to clients.

Client/Server Development using Java RMI Create RMI Java server and server interface Create RMI client Compile RMI server (javac server.java) Compile RMI client (javac client.java) RMI compile the binary server (rmic server) Check the stub file and interface file Copy the stub file and server interface file to the client Run the client (Set SecurityManager lookup server object invoke the remote methods.) Start the rmi registry Run the server (Set SecurityManager Bind server object to the registry)

The ”Pizza Order" Application (Server: PizzaServer class) import java.awt.*; import java.rmi.*; import java.rmi.server.*; public class PizzaServer extends UnicastRemoteObject implements PizzaServerInterface { PizzaServer() throws RemoteException { super(); } public String orderPizza(String name,String address,String phone, int size, String toppings,String pizzatype ) throws RemoteException // Get pizza order infor ...

The ”Pizza Order" Application (Server: PizzaServer Class) public static void main(String args[]) { try { // set the security manager System.setSecurityManager(new RMISecurityManager()); // create the local instance of the PizzaServer PizzaServer svr = new PizzaServer(); // put the local instance into the Naming Server Naming.rebind("rmi://myhost/PizzaServer", svr); System.out.println("Debug: Pizza Server is ready..."); } catch(Exception exc) { System.out.println("Error! - " + exc.toString());

The ”Pizza Order" Application (Server: PizzaServerInterface Interface) import java.rmi.*; public interface PizzaServerInterface extends Remote { String orderPizza(String name,String address, String phone,int size,String toppings, String pizzatype ) throws RemoteException; } Notes: 1. PizzaServerInterface is a remote interface for client/server to specify the remote method prototypes. 2. The implementation of the remote method “orderPizza” is coded in PizzaServer class.

The ”Pizza Order" Application (Client: PizzaOrder Class) import java.awt.*; import java.rmi.*; import java.rmi.server.*; public class PizzaOrder extends Frame { // AWT GUI Commonets ... PizzaServerInterface pizzaServerIf; public PizzaOrder(PizzaServerInterface pif) // initialize the application frame super("Pizza Pizza!"); setLayout(null); resize(400, 480); // assign the pizza server interface pizzaServerIf = pif; // set up the UI

The ”Pizza Order" Application (Client: PizzaOrder Class) public boolean action(Event evt,Object obj) { if(evt.target == sendButton){ // get customer order ... try{ totalString = pizzaServerIf.orderPizza( name, address, phone, size, toppings, pizzatype); } catch(Exception exc){ System.out.println("Error - " + exc.toString()); // display final results …

The ”Pizza Order" Application (Client: PizzaOrder Class) public static void main(String args[]){ Remote remoteObj = null; PizzaServerInterface pizzaInterface = null; System.setSecurityManager( new RMISecurityManager()); try{ remoteObj = Naming.lookup("rmi://myhost/PizzaServer"); }catch(Exception exc){ System.out.println(exc.toString())System.exit(1);} if(remoteObj instanceof PizzaServerInterface) pizzaInterface = (PizzaServerInterface) remoteObj; }catch(Exception exc){…} PizzaOrder pizzaOrder=new PizzaOrder(pizzaInterface); pizzaOrder.show(); } }