RMI Remote Method Invocation - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

RMI Remote Method Invocation

Description:

Shared interface for client and server. Extend ... Deployment. server. download. client. Serialization. Other n tier Technologies. CORBA. COM . DCOM ... – PowerPoint PPT presentation

Number of Views:173
Avg rating:3.0/5.0
Slides: 15
Provided by: bills158
Category:

less

Transcript and Presenter's Notes

Title: RMI Remote Method Invocation


1
RMI Remote Method Invocation
  • Java n tier Applications

2
RMI-Client, Server
Client
RMI
Server
3
RMI Setup
  • Shared interface for client and server
  • Extend UnicastRemoteObject ends with Impl
  • Impl File Preparation
  • Create client source file
  • Create server source file
  • Create policy file
  • Start RMI server
  • Start client

4
Shared interface for client and server
  • import java.rmi.
  • public interface Product extends Remote
  • String getDescription() throws RemoteException

5
Extend UnicastRemoteObject
  • import java.rmi.
  • import java.rmi.server.
  • public class ProductImpl extends
    UnicastRemoteObject
  • implements Product
  • //Define constructors and methods in this class
    definition file.

6
Impl File Preparation
  • javac Impl source file
  • javac ProductImpl.java
  • rmic Impl class file
  • rmic ProductImpl

7
Create client source file
  • import java.rmi.
  • import java.rmi.server.
  • public class ProductClient
  • public static void main(String args)

8
Impl File Preparation main() method code
  • System.setSecurityManager(new
    RMISecurityManager())
  • String url "rmi//127.0.0.1/"
  • try
  • Product p (Product)Naming.lookup(url
    "Glendale")
  • System.out.println(p.getDescription())
  • catch(Exception e)
  • System.out.println("Found a client error -
    " e.getMessage())

9
Create server source file
  • import java.rmi.
  • import java.rmi.server.
  • public class RMIServerTest
  • public static void main(String args)
  • try
  • ProductImpl pl new ProductImpl("Glendale")
  • Naming.rebind("Glendale", pl)
  • System.out.println("Waiting for
    connection")
  • catch(Exception e)
  • System.out.println("Caught an exception - "
    e.getMessage())

10
Create Policy File
  • grant
  • permission java.net.SocketPermission
  • "1024-65535", "connect"

11
Start RMI server
  • start rmiregistry
  • java RMIServerTest

12
Start client
  • java Djava.security.policyclient.policy
    ProductClient

13
RMI Issues
  • Deployment
  • server
  • download
  • client
  • Serialization

14
Other n tier Technologies
  • CORBA
  • COM
  • DCOM
Write a Comment
User Comments (0)
About PowerShow.com