Presentation is loading. Please wait.

Presentation is loading. Please wait.

Local vs. distributed Objects Differences between local and distributed objects in: –References (to objects) –Activation/Deactivation –Migration –Persistence.

Similar presentations


Presentation on theme: "Local vs. distributed Objects Differences between local and distributed objects in: –References (to objects) –Activation/Deactivation –Migration –Persistence."— Presentation transcript:

1 Local vs. distributed Objects Differences between local and distributed objects in: –References (to objects) –Activation/Deactivation –Migration –Persistence –Latency of Requests –Concurrency –Communication –Security

2 Hvad viser figuren 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

3 Application Presentation Session Transport Application Presentation Session Transport Input Stream Output Stream Requests Results ClientServer Hvad viser figuren?

4 Result Datagrams Application Presentation Session Transport Application Presentation Session Transport Request Datagrams ClientServer Hvad viser figuren?

5 Forklar figurenCalledCalled Stub CallerCalledCalledCaller Caller Transport Layer (e.g. TCP or UDP)

6 Interface Definition Design Server Stub Generation Client Stub Generation Server Coding Client Coding Server Registration Forklar figuren

7 Team.idl included in generates reads IDL-Compiler Teamcl.hh Teamcl.cc Teamsv.cc Teamsv.hh Forklar figuren Team.wsdl Team.java Team.midl

8 Hvilke teknologier bruges her Client Server Registry Legacy code on server Legacy code on server

9 Forklar figuren

10

11 Forklar hvad vi kigger på TV-Program Web service (TVPSService.class): Java Server C# Client (Pocket PC.NET CF) Java Client (UNIX, LINUX, Windows) Key elements: Package of service = tvps Class of service = tvps.TVPSService Allowed methods = all (*) Custom class (return parameter) = tvps.Programme

12 Hvad ser vi på? package hello; public class HelloWorldClient { public static void main (String args[]) throws Exception { // Make a service HelloWorldService service = new HelloWorldServiceLocator(); //Now use the service to get a stub which implements the SDI HelloWorld stub = (HelloWorld) service.getHelloWorld(); String text = stub.getHelloWorldMessage("Test af OO indpakning"); System.out.println(”Recieved from server: "+text); } Given the WSDL (-p = destination package = hello): java org.apache.axis.wsdl.WSDL2Java –p hello

13 package examples.hello; import java.rmi.Remote; import java.rmi.RemoteException; public interface Hello extends Remote { String sayHello() throws RemoteException; void someOther(String param) throws RemoteException; } rmic Compiler HelloImpl_Stub.class HelloImpl_Skeleton.class Forklar figuren Hello.java

14 package examples.hello; import java.rmi.Naming; import java.rmi.RemoteException; import java.rmi.RMISecurityManager; import java.rmi.server.UnicastRemoteObject; public class HelloImpl extends UnicastRemoteObject implements Hello { public HelloImpl() throws RemoteException { super(); } public String sayHello() { return "Hello World! ; } public static void main(String args[]) { // Create and install a security manager //if (System.getSecurityManager() == null) { // System.setSecurityManager(new RMISecurityManager()); //} try { HelloImpl obj = new HelloImpl(); // Bind this object instance to the name "HelloServer" Naming.rebind("rmi:// /HelloServer", obj); System.out.println("HelloServer bound in registry"); } catch (Exception e) { System.out.println("HelloImpl err: " + e.getMessage()); e.printStackTrace(); } Hvad ser vi på. Forklar.

15 Hvad viser figuren Client Object SOAP X Server object Client component Server component Pattern Client Server X

16 Hvad viser figuren? x

17 Persistence Concepts Datastore Sessions Storage Objects Storage Homes Storage Home Incarnation Storage Object Incarnation RDBMS Server RDBMS Table Object = row in RDBMS table C++/Java object

18 Forklar nedenstående ServerClient Stub Registry Interfaces Skeleton Activation Interfaces RMI Runtime (rmid,rmiregistry) made by made by? bind lookup


Download ppt "Local vs. distributed Objects Differences between local and distributed objects in: –References (to objects) –Activation/Deactivation –Migration –Persistence."

Similar presentations


Ads by Google