ODU CS 775 - Distributed Objects and Components

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22From Coulouris, Dollimore, Kindberg and BlairDistributed Systems: Concepts and DesignEdition 5, © Addison-Wesley 2012Slides for Chapter 8: Distributed Objects and Components2Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.1Distributed objects2Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.2IDL interfaces Shape and ShapeListstruct Rectangle{ 1long width; long height;long x;long y;} ;struct GraphicalObject { 2string type; Rectangle enclosing; boolean isFilled;};interface Shape { 3long getVersion() ;GraphicalObject getAllState() ; // returns state of the GraphicalObject};typedef sequence <Shape, 100> All; 4interface ShapeList { 5exception FullException{ }; 6Shape newShape(in GraphicalObject g) raises (FullException); 7All allShapes(); // returns sequence of remote object references 8long getVersion() ;};Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.3IDL module Whiteboardmodule Whiteboard {struct Rectangle{...} ;struct GraphicalObject {...};interface Shape {...};typedef sequence <Shape, 100> All;interface ShapeList {...};};Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.4IDL constructed types – 1Type Examples Usesequencetypedef sequence <Shape, 100> All;typedef sequence <Shape> Allbounded and unbounded sequencesof ShapesDefines a type for a variable-lengthsequence of elements of a specified IDL type. An upper bound on thelength may be specified.stringString name; typedef string<8> SmallString; unbounded and boundedsequences of charactersDefines a sequences of characters,terminated by the null character. Anupper bound on the length may bespecified.arraytypedef octet uniqueId[12];typedef GraphicalObject GO[10][8]Defines a type for a multi-dimensionalfixed-length sequence of elements of aspecified IDL type.this figure continues on the next slideInstructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.4 IDL constructed types – 2Type Examples Userecordstruct GraphicalObject { string type; Rectangle enclosing; boolean isFilled; };Defines a type for a record containing agroup of related entities. Structs arepassed by value in arguments andresults. enumeratedenum Rand (Exp, Number, Name);The enumerated type in IDL maps atype name onto a small set of integervalues.unionunion Exp switch (Rand) { case Exp: string vote; case Number: long n; case Name: string s;The IDL discriminated union allowsone of a given set of types to be passedas an argument. The header isparameterized by an enum, which specifies which member is in use. };Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.5The main components of the CORBA architectureclient server proxyor dynamic invocationimplementation repositoryobjectadapterORBORB skeletonor dynamic skeletonclient programinterface repositoryRequestReplycorecore for AServant A8Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.6CORBA Services (1)this figure continues on the next slide9Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.6CORBA Services (continued)9Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.7Java interfaces generated by idlj from CORBA interface ShapeListpublic interface ShapeListOperations { Shape newShape(GraphicalObject g) throws ShapeListPackage.FullException; Shape[] allShapes(); int getVersion();}public interface ShapeList extends ShapeListOperations, org.omg.CORBA.Object,org.omg.CORBA.portable.IDLEntity { }Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.8ShapeListServant class of the Java server program for CORBA interface ShapeListimport org.omg.CORBA.*; import org.omg.PortableServer.POA;class ShapeListServant extends ShapeListPOA {private POA theRootpoa; private Shape theList[];private int version; private static int n=0;public ShapeListServant(POA rootpoa){theRootpoa = rootpoa; // initialize the other instance variables}// continued on the next slideInstructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.8 continuedpublic Shape newShape(GraphicalObject g) throws ShapeListPackage.FullException { 1version++; Shape s = null; ShapeServant shapeRef = new ShapeServant( g, version); try {org.omg.CORBA.Object ref = theRoopoa.servant_to_reference(shapeRef); 2s = ShapeHelper.narrow(ref);} catch (Exception e) {} if(n >=100) throw new ShapeListPackage.FullException();theList[n++] = s;return s; }public Shape[] allShapes(){ ... }public int getVersion() { ... }}Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5 © Pearson Education 2012 Figure 8.9 Java class ShapeListServerimport org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*;import org.omg.CORBA.*; import org.omg.PortableServer.*;public class ShapeListServer {public static void main(String args[]) { try{ORB orb = ORB.init(args, null); 1 POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));2rootpoa.the_POAManager().activate(); 3ShapeListServant SLSRef = new ShapeListServant(rootpoa); 4 org.omg.CORBA.Object ref = rootpoa.servant_to_reference(SLSRef); 5ShapeList SLRef = ShapeListHelper.narrow(ref); org.omg.CORBA.Object objRef =orb.resolve_initial_references("NameService");


View Full Document

ODU CS 775 - Distributed Objects and Components

Download Distributed Objects and Components
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Distributed Objects and Components and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Distributed Objects and Components 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?