Presentation is loading. Please wait.

Presentation is loading. Please wait.

Presentation: Special Repetition Recap on Distributed Principles.

Similar presentations


Presentation on theme: "Presentation: Special Repetition Recap on Distributed Principles."— Presentation transcript:

1 Presentation: Special Repetition Recap on Distributed Principles

2 Ingeniørhøjskolen i Århus Slide 2 af 17 Outline Some troubles with the understanding detected at last weeks exercises –Mapping principles with technology –We will recap on some principles (apx. 10 min.) –You will form groups of 3-4 too discuss the problems at hand – and make the mappings yourselves (apx. 15 min.) –We will discuss your conclusions (10-15 min.) After today – I expect you to understand all principles – if not -> read and discuss in your study groups!

3 Ingeniørhøjskolen i Århus Slide 3 af 17 Method Call vs. Object RequestCalledCalled Stub CallerCalledCalledCaller Caller Transport Layer (e.g. TCP or UDP)

4 Ingeniørhøjskolen i Århus Slide 4 af 17 Server Class – The Skeleton (Stub) … public class HelloWorldServerThread extends Thread { protected DatagramSocket socket = null; public HelloWorldServerThread() throws IOException { super(); socket = new DatagramSocket(4450); } public void run() { while (true) { … if (request.startsWith("sayHelloWorld")) { new String(packet.getData()); // figure out response String response = null; //Call the HelloWorldOO method & place it in response HelloWorldOO helloWorldOO = new HelloWorldOO(); response = helloWorldOO.sayHelloWorld(); buf = response.getBytes(); … socket.send(packet); …CalledCalled Stub

5 Ingeniørhøjskolen i Århus Slide 5 af 17 The Client Stub - HelloWorldProxy public class HelloWorldProxy { public HelloWorldProxy() { } public String sayHelloWorld() { … // get a datagram socket socket = new DatagramSocket(); // send the request byte[] buf = new byte[256]; buf = methodCalled.getBytes(); InetAddress address = InetAddress.getByName("localhost"); DatagramPacket packet = new DatagramPacket(buf, buf.length, address, 4450); socket.send(packet); // get a response packet = new DatagramPacket(buf, buf.length); socket.receive(packet); response = new String(packet.getData()); } catch (Exception e) { e.printStackTrace(); } socket.close(); return response; … Stub Caller

6 Ingeniørhøjskolen i Århus Slide 6 af 17 Achieving Access Transparency package chapter1; public class HelloWorldClient { public static void main(String[] args) { System.out.println("Recieved from Server: " + new HelloWorldProxy().sayHelloWorld()); } … and thus we have achieved access transparency using rather simple constucts (the Proxy pattern). We could have achieved an even higher degree of transparency by using an interface definition – and thus a contract between Client & Server. Stub Caller

7 Ingeniørhøjskolen i Århus Slide 7 af 17 Direct Use of Network Protocols implies Manual mapping of complex request parameters to byte streams or datagrams – is complex & error prone Manual resolution of data heterogeneity –encoding differs on NT & UNIX (what is the format of an Integer?) Manual identification of components –References must be established manually (host add., port nr. etc.) Manual implementation of component activation No guarantees for type safety Manual synchronization of interaction between distributed components –Developers need to handle TCP/UDP output stream/responses No quality of service guarantees –Transactions, Security, Concurrency, Scalability, Reliability

8 Ingeniørhøjskolen i Århus Slide 8 af 17 = Reason for Using Middleware Layered between Application and OS/Network Makes distribution transparent Resolves heterogeneity of –Hardware –Operating Systems –Networks –Programming Languages Provides development and run-time environment for distributed systems “Gets you of the hook” – concerning the nasty stuff in network programming

9 Ingeniørhøjskolen i Århus Slide 9 af 17 Flashback to HelloWorld Example How to map complex types? –e.g. returning a struct (in C, C++) or an object (in C++, Java, C#, etc.)? –How would you do it?

10 Ingeniørhøjskolen i Århus Slide 10 af 17 Interface Definition Facilitating Type Safety Server Client Request Reply Client & Server has a contract Client & Server has a contract

11 Ingeniørhøjskolen i Århus Slide 11 af 17 Interface Definition Language Every object-oriented middleware has an interface definition language (IDL) –In Web services = WSDL, CORBA = IDL, DCOM = MIDL, Java RMI = Java Interfaces Object-oriented middleware provide IDL compilers that create client and server stubs to implement session and presentation layer

12 Ingeniørhøjskolen i Århus Slide 12 af 17 IDL Example interface Player : Object { typedef struct _Date { short day; short month; short year; } Date; attribute string name; readonly attribute Date DoB; }; interface PlayerStore : Object { exception IDNotFound{}; short save (in Player p); Player load(in short id) raises(IDNotFound); void print(in Player p); };

13 Ingeniørhøjskolen i Århus Slide 13 af 17 HelloWorld.jws?wsdl

14 Ingeniørhøjskolen i Århus Slide 14 af 17 Interface Definition Design Server Stub Generation Client Stub Generation Server Coding Client Coding Server Registration Development Steps SOAP: WSDL Java2WSDL WSDL2JAVA AXIS SOAP

15 Ingeniørhøjskolen i Århus Slide 15 af 17 Team.idl included in generates reads IDL-Compiler Teamcl.hh Teamcl.cc Teamsv.cc Teamsv.hh Stub Generation Team.wsdl Team.java Team.midl

16 Ingeniørhøjskolen i Århus Slide 16 af 17 C++ Compiler, Linker Server Client.cc Server.cc C++ Compiler, Linker Client Team.idl included in generates reads IDL-Compiler Teamcl.hh Teamcl.cc Teamsv.cc Teamsv.hh Client and Server Implementation

17 Ingeniørhøjskolen i Århus Slide 17 af 17 Assignment Find the excerises you have made so far –Ultra simple UDP solotion –AXIS Web service Discuss the following in student groups of 3-4: 1.What technologies are used for building Web serivces? 2.When are the individual technologies used in Web services (every time a request is made or …)? 3.How do the specific technologies from above (from 2.) map to the general principles discuessed earlier on? (IDL, stub, proxy, skeleton, design, client, server,etc) 4.Make a figure (in your own words and style) describing the development steps needed – and map these to the Web service technologies


Download ppt "Presentation: Special Repetition Recap on Distributed Principles."

Similar presentations


Ads by Google