1. Trang chủ
  2. » Giáo án - Bài giảng

Distributed Objects

72 292 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 72
Dung lượng 797 KB

Nội dung

Distributed Objects 2 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM Chapter Contents  Remote Method Invocations  Setting Up Remote Method Invocation  Parameter Passing in Remote Methods  Using RMI with Applets  Server Object Activation  Java IDL and CORBA 3 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM Objectives  Explains the models that make interobject communication possible;  Explains situations where distributed objects can be useful;  Shows you how to use remote objects and the associated remote method invocation (RMI) for communicating between two Java virtual machines (which may run on different computers);  Introduces you to CORBA, that allows communication between objects that are written in different programming languages (such as the Java programming language, C++, and so on). 4 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM Introduction to Remote Objects 5 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM The Roles of Client and Server 6 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM Review  In the traditional client/server model, the request from client is translated to an intermediary format.  The server parses the request format, computes the response, and formats the response for transmission to the client.  The client then parses the response and displays it to the user. 7 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM 8 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM The server proxy & client proxy  There are three common choices: • RMI, the Java Remote Method Invocation technology, supports method calls between distributed Java objects. • CORBA, the Common Object Request Broker Architecture, supports method calls between objects of any programming language. CORBA uses the Internet Inter-ORB Protocol, or IIOP, to communicate between objects. • SOAP, the Simple Object Access Protocol, is also programming-language neutral. However, SOAP uses an XML-based transmission format. 9 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM “The network is the computer”*  Consider the following program organization:  If the network is the computer, we ought to be able to put the two classes on different computers  RMI is one technology that makes this possible SomeClass AnotherClass method call returned object computer 1 computer 2 10 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM Stubs  When client code wants to invoke a remote method on a remote object, it actually calls an ordinary method of the Java programming language that is encapsulated in a surrogate object called a stub.  The stub resides on the client machine, not on the server. The stub packages the parameters used in the remote method into a block of bytes.  This packaging uses a device- independent encoding for each parameter. [...]... the server Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM 19 Interfaces (1)    Your client program needs to manipulate server objects, but it doesn't actually have copies of them The objects themselves reside on the server The client code must still know what it can do with those objects Their capabilities are expressed in an interface that is shared between the client and server and so resides simultaneously... Hải-Khoa CNTT-ĐHCN Tp.HCM 31 Listing Remote Objects  To listing all successfuls remote objects registed in rmiregistry: Context namingContext = new InitialContext(); NamingEnumeration lst = namingContext.list("rmi:"); while ( lst.hasMore()){ System.out.println( lst.next().getName()); } Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM 32 Listing Remote Objects Create by Võ Văn Hải-Khoa CNTT-ĐHCN... Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM 16 Processes  For RMI, you need to be running three processes     The Client The Server The Object Registry, rmiregistry, which is like a DNS service for objects You also need TCP/IP active Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM 17   Interfaces define behavior Classes define implementation Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM 18    In order... RMISecurityManager restricts all code in the program from establishing network connections However, the program needs to make network connections   To reach the RMI registry; and To contact the server objects Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM 35 Security(2)   To allow the client to connect to the RMI registry and the server object, you supply a policy file Here is a policy file that allows . 15 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM 16 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM Setting Up Remote Method Invocation 17 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM Processes  For RMI, . be useful;  Shows you how to use remote objects and the associated remote method invocation (RMI) for communicating between two Java virtual machines (which may run on different computers);  Introduces. C++, and so on). 4 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM Introduction to Remote Objects 5 Create by Võ Văn Hải-Khoa CNTT-ĐHCN Tp.HCM The Roles of Client and Server 6 Create by Võ Văn Hải-Khoa

Ngày đăng: 13/05/2014, 11:00

TỪ KHÓA LIÊN QUAN

w