0% found this document useful (0 votes)
180 views18 pages

IS2103 A Dist Computing 1

This document discusses distributed computing and the model-view-controller (MVC) pattern. It introduces distributed object architecture with stubs, skeletons, and business objects. Remote method invocation (RMI) allows remote objects to communicate over a network using stubs and skeletons. The document outlines the steps to develop RMI applications, including defining remote interfaces, implementing servers, generating stubs and skeletons, starting the registry, and running client and server applications.

Uploaded by

Francis Pang
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
180 views18 pages

IS2103 A Dist Computing 1

This document discusses distributed computing and the model-view-controller (MVC) pattern. It introduces distributed object architecture with stubs, skeletons, and business objects. Remote method invocation (RMI) allows remote objects to communicate over a network using stubs and skeletons. The document outlines the steps to develop RMI applications, including defining remote interfaces, implementing servers, generating stubs and skeletons, starting the registry, and running client and server applications.

Uploaded by

Francis Pang
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

IS2103

DISTRIBUTED COMPUTING

User Interface

Business Logic

Database a abase Access Control

Dumb Terminal

Mainframe

Database

Presentation (1st Tier)

Business Logic (2nd Tier)

Backend (3rd Tier)

Windows GUI

Database

Personal Computer Java GUI

Network Computer

Database

Servlets

Java Web Server


4

ModelViewControllerPattern
Consistsofthreekindsofobjects Applicationobjects(Model) Screenpresentationobjects(View) Objectsmanagingthewayuserinterfacereactstouser input(Controller) BeforeMVC,userinterfacedesignstendedtolump

theseobjectstogether MVCdecouples d l them h toincrease i flexibility fl ibili and dreuse

DistributedObjectArchitecture
Basedonanetworkcommunicationlayer y Thereare3parts:
Businessobject Stub Skeleton

10

10

11

11

RMI

RemoteObject: AddServer

RMI

JVM 1

JVM 2

Client

Server

12

12

Client
1. Client invokes a business method

Network (RMI Protocol)


2. Communicate method invoked to Skeleton

Middle Tier
3. Skeleton invoke method on Business Object

RMI Loop p
STUB

SKELETON

BUSINESS OBJECT

5. Return results to Client

4. Communicate return values to Stub

13

Terms
Marshalling convertsobjectsintoabytestreamand

unmarshalling g reversesthep process converting gabyte y stream toanobject Objectserialization:theabilitytoconvertanobjectintoa stream t of fb bytes t th that tcanl later t be b converted t dback b ki into t acopy oftheoriginalobject Astub isaclientsideobjectthatrepresentstheremote object.Astubhasthesamelistofmethodsthattheremote objectexposestootherobjects Askeleton residesontheserversideandtakescareofall detailspertainingtotheremotenatureoftheserverside object j sothattheactualserversideobject j doesnothaveto worryabouthowtohandlethenetworklevelcommunication.
14

14

FindingObjectsinRMI
Usenamingordirectoryservice Needtofirstfindthenamingordirectoryservice Anaming gordirectory yservice isusually yrunonahost

listeningonacertainportnumber Theclienthastoknowthehostandportnumbersof thenamingordirectoryservicebeforeitcanlocate theremoteobject RMIimplementsitsownnamingservicewhichisa registry ofnamesmappedtoremoteobjects


15

15

StepsinDevelopingRMIApplications
DefinetheremoteinterfacefortheAddServerobject ImplementtheremoteinterfacewithAddServerImpl class Writeaclientapplicationtoinvoketheadd()methodofthe

AddServer Generatestubsandskeletons
rmic addRmi.AddServerImpl p

Writeaserverapplication Starttheregistry
start rmiregistry

Runtheserverapplication Runthe h client l application l


16

16

RunServerandClientApplications
RunServerApplication:
java addRmi.AddServerApp

RunClientApplication:
java addRmi.AddClientApp 127.0.0.1 3 4

Outputs:
First number is: 3 Second number is: 4 R Result l is: i 7.0 7 0
17

17

IS2103

18

You might also like