1 / 17

Local vs. distributed Objects

Local vs. distributed Objects. Differences between local and distributed objects in: References (to objects) Activation/Deactivation Migration Persistence Latency of Requests Concurrency Communication Security. Caller. Stub. Hvad viser figuren. public class HelloWorldProxy {

zaza
Download Presentation

Local vs. distributed Objects

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. Caller Stub 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; …

  3. Hvad viser figuren? Client Server Application Application Presentation Presentation Session Session Requests Transport Input Stream Transport Output Stream Results

  4. Hvad viser figuren? Client Server Application Application Presentation Presentation Session Session Request Datagrams Transport Transport Result Datagrams

  5. Called Caller Caller Called Stub Forklar figuren Caller Stub Transport Layer (e.g. TCP or UDP)

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

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

  8. Hvilke teknologier bruges her 3 Client Server Legacy code on server 1 2 Registry

  9. Forklar figuren

  10. Forklar figuren

  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) <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="TVPSService" provider="java:RPC"> <parameter name="className" value="tvps.TVPSService"/> <parameter name="allowedMethods" value="*"/> <beanMapping qname="myNS:Programme" xmlns:myNS="urn:BeanService" languageSpecificType="java:tvps.Programme"/> </service> </deployment> • 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å? • Given the WSDL (-p = destination package = hello): • java org.apache.axis.wsdl.WSDL2Java http://localhost:8080/axis/HelloWorld.jws?wsdl –p hello 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); } }

  13. Forklar figuren Hello.java rmic Compiler HelloImpl_Stub.class HelloImpl_Skeleton.class 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; }

  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://192.168.1.101/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. Pattern Client Server X Hvad viser figuren Client component Client Object SOAP X Server object Server component

  16. Hvad viser figuren? x

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

More Related