INF 123: Software Architectures, Distributed Systems, and Interoperability Discussion Session Week 8 - Spring 2008 Instructor: Prof. Richard N. Taylor.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Remote Method Invocation in Java Bennie Lewis EEL 6897.
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.
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.
EEC-681/781 Distributed Computing Systems Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
INF 123: Software Architectures, Distributed Systems, and Interoperability Discussion Session Week 3 - Spring 2008 Instructor: Prof. Richard N. Taylor.
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.
INF 123: Software Architectures, Distributed Systems, and Interoperability Discussion Session Week 5 - Spring 2008 Instructor: Prof. Richard N. Taylor.
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.
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets Rethinking out tic-tac-toe game.
INF 123: Software Architectures, Distributed Systems, and Interoperability Discussion Session Week 1 - Spring 2008 Instructor: Prof. Richard N. Taylor.
RMI Components java.rmi: client-side RMI classes, interfaces, and exceptions java.rmi.server: server-side RMI classes, interfaces, and exceptions java.rmi.registry:
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.
Architecture of Software Systems RMI and Distributed Components Martin Rehák.
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.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
INF 123: Software Architectures, Distributed Systems, and Interoperability Discussion Session Week 1 - Spring 2008 Instructor: Prof. Richard N. Taylor.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
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.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
RMI RMI is the java API that facilitate distributed computing by allowing remote method calls. A remote method call represents a method invocation between.
RMI – Command Line CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Remote Method Invocation onlineTraining/rmi/RMI.html.
RMI Continued IS Outline  Review of RMI  Programming example.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
Presentation: RMI Continued 2 Using The Registry & Callbacks.
Vakgroep Informatietechnologie - IBCN CORBA & RMI Design of Distributed Software.
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.
RMI - Eclipse CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Li Tak Sing COMPS311F. RMI callbacks In previous example, only the client can initiate a communication with the server. The server can only response to.
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 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
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.
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.
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.
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.
Java Object-Relational Layer Sharon Diskin GUS 3.0 Workshop June 18-21, 2002.
Netprog Java RMI1 Remote Method Invocation.
Using RMI The Example of A Remote Calculator 1. Parts of A Working RMI System A working RMI system is composed of several parts. –Interface definitions.
Remote Method Invocation. Introduction What is Remote Method Invocation? Remote method invocation allows objects residing in one JVM execute methods.
Distributed and Parallel Processing George Wells.
Remote Method Invocation Internet Computing Workshop Lecture 17.
Principles of Software Development
Java Remote Method Invocation (RMI)
Remote Method Invocation
What is RMI? Remote Method Invocation
Remote Method Invocation
Java RMI (more) CS-328 Internet Programming.
Using RMI -The Example of A Remote Calculator
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:

INF 123: Software Architectures, Distributed Systems, and Interoperability Discussion Session Week 8 - Spring 2008 Instructor: Prof. Richard N. Taylor TA: Rosalva Gallardo

Overview Comments about Assignment 2 Assignment 3 Lunar Lander Game Server (RMI)

Assignment 3 Assignment 3 and the Discussion’s Slides for Week 7 and 8 are in eee. Assignment 3 Discussion

Deployment Server MachineClient Machine Network edu.uci.inf123 - SpacecraftStateIntf.java - SpacecraftState.java rmiregistry Lunar Lander Code edu.uci.inf123 - ServerRMI.java - SpacecraftStateIntf.java - SpacecraftState.java

Implementation: Interface package edu.uci.inf123; import java.rmi.Remote; import java.rmi.RemoteException; import java.util.HashMap; public interface SpacecraftStateIntf extends Remote { SpacecraftState getState(String identifier) throws RemoteException; void setState(String identifier, SpacecraftState state) throws RemoteException; void clearState(String identifier) throws RemoteException; HashMap getStates() throws RemoteException; }

Implementation: Spacecraft Status Bean package edu.uci.inf123; public class SpacecraftState implements java.io.Serializable { private static final long serialVersionUID = 1L; double altitude; double velocity; double fuel; public SpacecraftState() { altitude = 0.0; velocity = 0.0; fuel = 0.0; } public void setAltitude(double pAltitude) { altitude = pAltitude; } public double getAltitude() { return altitude; } public void setVelocity(double pVelocity) { velocity = pVelocity; } public double getVelocity() { return velocity; } public void setFuel(double pFuel) { fuel = pFuel; } public double getFuel() { return fuel; }

Implementation: Server package edu.uci.inf123; import java.rmi.registry.Registry; import java.rmi.registry.LocateRegistry; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.util.HashMap; public class ServerRMI implements SpacecraftStateIntf { HashMap states; public ServerRMI() { states = new HashMap (); } public SpacecraftState getState(String identifier) throws RemoteException { return (SpacecraftState)states.get(identifier); } public void clearState(String identifier) throws RemoteException { states.keySet().remove(identifier); } public void setState(String identifier, SpacecraftState state) throws RemoteException { states.put(identifier, state); } public HashMap getStates() throws RemoteException { return states; }

Implementation: Server (cont.) public static void main(String args[]) { try { ServerRMI obj = new ServerRMI(); SpacecraftStateIntf stub = (SpacecraftStateIntf) UnicastRemoteObject.exportObject(obj, 0); // Bind the remote object's stub in the registry System.setProperty("java.rmi.server.hostname", "tps.ics.uci.edu"); Registry registry = LocateRegistry.getRegistry(); registry.bind("SpacecraftStates", stub); System.err.println("Server ready"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); }

Implementation: RMI Client package edu.uci.inf123; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.util.HashMap; import java.util.Iterator; public class ClientRMI { private ClientRMI() {} public static void main(String[] args) { String host = "tps.ics.uci.edu"; try { Registry registry = LocateRegistry.getRegistry(host); SpacecraftStateIntf stub = (SpacecraftStateIntf) registry.lookup("SpacecraftStates"); SpacecraftState ss1, ss2; ss1 = new SpacecraftState(); ss1.setVelocity(25.00); System.out.println(”\nCurrent States:"); printStates(stub.getStates()); System.out.println("\nState set for rgallard_MyLL"); stub.setState("rgallard_MyLL", ss1); System.out.println("\nCurrent States:"); printStates(stub.getStates());

Implementation: RMI Client ss1.setVelocity(100.00); System.out.println(" \ nState set for rgallard_MyLL"); stub.setState("rgallard_MyLL", ss1); System.out.println(" \ nCurrent States:"); printStates(stub.getStates()); System.out.println(" \ nState get for rgallard_MyLL"); ss2 = stub.getState("rgallard_MyLL"); System.out.println(" \ nCurrent States:"); printStates(stub.getStates()); System.out.println(" \ nState cleared for rgallard_MyLL"); stub.clearState("rgallard_MyLL"); System.out.println(" \ nCurrent States:"); printStates(stub.getStates()); } catch (Exception e) { System.err.println("Exception: " + e.toString()); e.printStackTrace(); } private static void printStates(HashMap states) { Iterator iterator = states.keySet().iterator(); while(iterator. hasNext()) { String key = (String)iterator.next(); SpacecraftState value = (SpacecraftState)states.get(key); System.out.println("Key: " + key + " Values: alt=" + value.getAltitude() + ", vel=" + value.getVelocity() + ", fue=" + value.getFuel()); } } }

Output of RMI Client

Important Considerations For the name of the Local Spacecraft and Remote Spacecraft you should use the following pattern: #uciNetID_NameYouLike Ex: rgallard_Ariadne Make sure you will clean the state of your Local Spacecraft when your game finishes. If it is necessary run the ClientRMI to clean the states you create during your tests

Important Considerations Make sure you press “Return” after you enter the value in the text fields in the Lunar Lander Launcher menu. If you only use your mouse the value of the text fields will be null. Be careful. You are welcome to change the implementation to improve this, but this is not required.

Important Considerations Testing options: Using one machine: Test your application with the name for the Local Spacecraft and Remote Spacecraft being the same. Test your application using two different installations of Eclipse. Test your application using two different machines. You can ask for help to your classmates.

Important Considerations If you choose to test using two different installations of Eclipse. Make sure that you have the following in your new Eclipse installation: SubEclipse Plug-in ArchStudio Plug-in Check out source code of Myx.fw Check out your source code of LL from your SVN repository. If you see error makes sure the installation of the OpenGL libraries is correct.