RMI - PowerPoint PPT Presentation

About This Presentation
Title:

RMI

Description:

RMI J2EE I / 2006-02-25 RMI URL JavaTM Remote Method ... – PowerPoint PPT presentation

Number of Views:190
Avg rating:3.0/5.0
Slides: 47
Provided by: tomo71
Category:
Tags: rmi | corba | j2ee

less

Transcript and Presenter's Notes

Title: RMI


1
RMI
  • J2EE I
  • ?? / 2006-02-25

2
??????
  • ?????????????????
  • RMI ?????????

3
??URL
  • JavaTM Remote Method Invocation (RMI)
  • http//java.sun.com/j2se/1.5.0/ja/docs/ja/guide/rm
    i/index.html
  • Sun Microsystems ??? RMI ??????

4
????????
5
????????
  • ??????????????????????????????????

6
??????????
  • CORBA
  • DCOM
  • RPC ?
  • Java RMI
  • Peer to Peer (P2P) ?
  • ????

7
RMI ????
8
RMI ??
  • Remote Method Invocation (??????????) ??
  • ?? Java Virtual Machine ?????????????????
  • Java Virtula Machine ????????????????
  • ????????????????

9
???Java????????
  • Hello ????????????????
  • ????????? sayHello ??????????

10
RMI???
11
RMI ???
  • ??????? Hello ????????????????
  • ????????????????? sayHello ??????????
  • Hello ???????????????
  • ???? sayHello ?????????????????????????

12
RMI ??????????
  • Hello ???????????????????????????????????????
  • ??????????????????????????????????

13
RMI????
14
??????????
  • ??????????????????????????????
  • ??????????????????????????????

15
?????????
  • RMI ??????????????????????????????????????
  • ???????????????????????? or??????????

16
rmiregistry
  • ????????????????????????
  • ??????? rmiregistry ???????????????????

17
RPC (Remote Procedure Call)
  • RMI ?????????
  • Sun Microsystems ??????????
  • ????????????????????????
  • Unix, Windows ??????????

18
RMI ??????????
19
Remote??????? (1)
  • import java.rmi.Remote
  • import java.rmi.RemoteException
  • public interface Hello extends Remote
  • public String sayHello()
  • throws RemoteException

20
Remote??????? (2)
  • ???????????????????????
  • ????????????????????
  • ??????????????????????????
  • java.rmi.Remote ??????
  • ???????????RemoteException ????????????

21
?????????? (1)??????
  • public class Server implements Hello
  • ......

22
?????????? (2)??????
  • Hello ?????????????

23
?????????? (3)????
  • public String sayHello()
  • return "Hello world!"

24
?????????? (4)????
  • ???????????????????????

25
?????????? (6)main???? (1)
  • // ?????????
  • Server obj new Server()
  • // ??????
  • Hello stub (Hello)
  • UnicastRemoteObject.exportObject(obj, 0)

26
?????????? (7)main???? (2)
  • // rmiregistry ?????????
  • Registry registry
  • LocateRegistry.getRegistry()
  • registry.bind("Hello", stub)

27
????????????? (1)
  • // rmiregistry ???????????
  • Registry registry
  • LocateRegistry.getRegistry(host)
  • Hello stub (Hello) registry.lookup("Hello")

28
????????????? (2)
  • // ???? sayHello ?????????
  • String response stub.sayHello()

29
RMI ????
30
???????????
  • javac Hello.java
  • javac Server.java
  • javac Client.java

31
??????????????????????
  • ????
  • Hello.class
  • Server.class
  • ???????
  • Hello.class
  • Client.class

32
rmiregistry ???
  • start rmiregistry
  • ??????? rmiregistry ???
  • ??????????????????????

33
??????
  • java Server

34
?????????
  • java Client

35
?????????????
36
??????????main????????
  • // ?????????????????
  • if (System.getSecurityManager() null)
  • System.setSecurityManager(
  • new RMISecurityManager()
  • )

37
??? (??????)???
  • rmic Server
  • ?????????????2????????????
  • Server_Stub.class
  • rmic keep Server ??????????????????????????????

38
??????????????????????
  • ????
  • Hello.class
  • Server.class
  • ???
  • policy.txt (??)
  • ???????
  • Hello.class
  • Client.class
  • policy.txt (??)

39
?????? (1)???????
  • java -Djava.rmi.server.codebase
  • file///C\Home\rmi\
  • -Djava.security.policypolicy.txt Server
    localhost

40
?????? (2)codebase (1)
  • java.rmi.server.codebase
  • file///C\Home\rmi\
  • codebase ??????????????????
  • ??????C\Home\rmi\ ???????????

41
?????? (3)codebase (2)
  • C\Home\rmi\
  • ??? \ ?????
  • Codebase ?? Web?? URL ????????????
  • http//www.wakhok.ac.jp/tomoharu/
  • ?? URL ??????????

42
?????? (4)codebase (3)
  • ??????????????codebase ?????? URL
    ????????????????????????????????????????????

43
?????? (5)???????????
  • java.security.policypolicy.txt
  • policy.txt ????????????????????

44
?????? (6)policy.txt ???
  • grant
  • // Allow everything for now
  • permission java.security.AllPermission
  • ???????????????????

45
?????????
  • java -Djava.security.policypolicy.txt Client
    localhost

46
???
  • Cygwin ??????????? (?????)?
  • ?????????????????????????????
  • ??????????????????????????????????????????????????
    ?????????
Write a Comment
User Comments (0)
About PowerShow.com