0% found this document useful (0 votes)
12 views

Chapter 8 Distributed Objects and Components slides

Chapter 8 discusses distributed objects and components, focusing on the structure and interfaces defined in IDL (Interface Definition Language) for managing graphical objects. It elaborates on the CORBA architecture, including client-server interactions and Java implementations of CORBA interfaces. The chapter also covers various types and examples of IDL constructs, as well as application servers and transaction attributes in EJB.

Uploaded by

VB
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Chapter 8 Distributed Objects and Components slides

Chapter 8 discusses distributed objects and components, focusing on the structure and interfaces defined in IDL (Interface Definition Language) for managing graphical objects. It elaborates on the CORBA architecture, including client-server interactions and Java implementations of CORBA interfaces. The chapter also covers various types and examples of IDL constructs, as well as application servers and transaction attributes in EJB.

Uploaded by

VB
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

Slides for Chapter 8:

Distributed Objects and Components

From Coulouris, Dollimore, Kindberg and Blair


Distributed Systems:
Concepts and Design
Edition 5, © Addison-Wesley 2012
Figure 8.1
Distributed objects

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
2
Figure 8.2
IDL interfaces Shape and ShapeList

struct Rectangle{ 1 struct GraphicalObject { 2


long width; string type;
long height; Rectangle enclosing;
long x; boolean isFilled;
long y; };
};

interface Shape { 3
long getVersion() ;
GraphicalObject getAllState() ; // returns state of the GraphicalObject
};

typedef sequence <Shape, 100> All; 4


interface ShapeList { 5
exception FullException{ }; 6
Shape newShape(in GraphicalObject g) raises (FullException); 7
All allShapes(); // returns sequence of remote object references 8
long getVersion() ;
};

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 8.3
IDL module Whiteboard

module 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.4
IDL constructed types – 1

Type Examples Use


sequence typedef sequence <Shape, 100> All; Defines a type for a variable-length
typedef sequence <Shape> All sequence of elements of a specified
bounded and unbounded sequences IDL type. An upper bound on the
of Shapes length may be specified.

string String name; Defines a sequences of characters,


typedef string<8> SmallString; terminated by the null character. An
unbounded and bounded upper bound on the length may be
sequences of characters specified.

array typedef octet uniqueId[12]; Defines a type for a multi-dimensional


typedef GraphicalObject GO[10][8] fixed-length sequence of elements of a
specified IDL type.
this figure continues on the next slide

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 8.4
IDL constructed types – 2

Type Examples Use


record struct GraphicalObject { Defines a type for a record containing a
string type; group of related entities. Structs are
Rectangle enclosing; passed by value in arguments and
boolean isFilled; results.
};

enumerated enum Rand The enumerated type in IDL maps a


(Exp, Number, Name); type name onto a small set of integer
values.
union union Exp switch (Rand) { The IDL discriminated union allows
case Exp: string vote; one of a given set of types to be passed
case Number: long n; as an argument. The header is
case Name: string s; parameterized 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.5
The main components of the CORBA architecture

client server
implementation interface
repository repository object skeleton
adapter

client proxy Request ORB Servant


ORB
program for A core core A
Reply

or dynamic invocation or dynamic skeleton

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 8.6
CORBA Services (1)

this figure continues on the next slide

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
8
Figure 8.6
CORBA Services (continued)

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
9
Figure 8.7
Java interfaces generated by idlj from CORBA interface ShapeList

public 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.8
ShapeListServant class of the Java server program for CORBA interface ShapeList

import 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 slide

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 8.8 continued

public Shape newShape(GraphicalObject g)


throws ShapeListPackage.FullException { 1
version++;
Shape s = null;
ShapeServant shapeRef = new ShapeServant( g, version);
try {
org.omg.CORBA.Object ref =
theRoopoa.servant_to_reference(shapeRef); 2
s = 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 ShapeListServer

import 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"));2
rootpoa.the_POAManager().activate(); 3
ShapeListServant SLSRef = new ShapeListServant(rootpoa); 4
org.omg.CORBA.Object ref = rootpoa.servant_to_reference(SLSRef); 5
ShapeList SLRef = ShapeListHelper.narrow(ref);
org.omg.CORBA.Object objRef =orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef); 6
NameComponent nc = new NameComponent("ShapeList", ""); 7
NameComponent path[] = {nc}; 8
ncRef.rebind(path, SLRef); 9
orb.run(); 10
} catch (Exception e) { ... }
}}

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 8.10
Java client program for CORBA interfaces Shape and ShapeList

import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;
public class ShapeListClient{
public static void main(String args[]) {
try{
ORB orb = ORB.init(args, null); 1
org.omg.CORBA.Object objRef =
orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
NameComponent nc = new NameComponent("ShapeList", "");
NameComponent path [] = { nc };
ShapeList shapeListRef =
ShapeListHelper.narrow(ncRef.resolve(path)); 2
Shape[] sList = shapeListRef.allShapes(); 3
GraphicalObject g = sList[0].getAllState(); 4
} catch(org.omg.CORBA.SystemException e) {...}
}
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 8.11
An example software architecture

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
15
Figure 8.12
The structure of a container

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
16
Figure 8.13
Application servers

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
17
Figure 8.14
Transaction attributes in EJB.

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
18
Figure 8.15
Invocation contexts in EJB

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
19
Figure 8.16
An example component configuration in Fractal

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
20
Figure 8.17
The structure of a Fractal component

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
21
Figure 8.18
Component and ContentController Interfaces in Fractal

Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
22

You might also like