Professional Documents
Culture Documents
Broker Architecture
Ali Ghodsi
aligh@imit.kth.se
1
Goal of lecture
Less breadth
Read van Steen’s book
2
Reading suggestions
Tanenbaum & van Steen
CORBA
Section 2.3 page page 85-98
Section 3.2.2 page 152-158
Section 9.1
Links
Nice CORBA tutorial:
http://www.omg.org/gettingstarted/
3
Outlook
General Overview
General Information
Applications
Quick Architectural Overview
OOP plus Distribution Transparency
CORBA main overview
Interface Definition Language (IDL)
Types
Examples
Mappings
ORB
DII (and DSI)
ORB interface
Object Reference
POA
Persistent and Transient Objects
Conclusions
2004-02-02 A. Ghodsi aligh@imit.kth.se 4
4
General CORBA Information
Distributed Object Model (more later)
It is a middleware
Difference between Network OS Middleware?
5
Real World Applications?
Support ”dinosaurs”
Companies have invested years of development in
projects done in ADA, C, Smalltalk…
CORBA enables interoperability with new languages
6
Outlook
General Overview
Quick Architectural Overview
OOP with Distribution Transparency
CORBA overview
Interface Definition Language (IDL)
Types
Examples
Mappings
ORB
Conclusions
7
CORBA builds on the DOM
Provides a nice model
Encapsulation
Inheritance
Polymorphism
8
Exploiting Encapsulation
Encapsulation enables:
Distribution Transparency
Have stubs and skeletons that together with ORBs
enable distribution*.
Inter-operability**
Define interfaces in a standardised way
Interface Definition Language (IDL)
9
Goal 1: Distribution Transparency
Encapsulation: black-box principle
Has an interface
Implementation details
public interface MathBox {
hidden
int add(int x, int y);
} Transparently
distribute
public class MathBoxCL
… implements MathBox {
MathBox obj = new MathBoxCL(); MathBoxCL() {}
System.out.println(obj.add(10,20)); int add(int x, int y)
… { return x+y; }
}
2004-02-02 A. Ghodsi aligh@imit.kth.se 10
10
Distribution Transparency
Missing parts:
Client • Marshalling Server Implementation
… int add(int x, int y)
• Unmarshalling
MathBox obj = new MathBoxCL(); { return x+y; }
Integer result = obj.add(10,20);
• References
…
MathBoxCL (SKELETON)
• Binding client to server
int invoke(msg msg)
MathBoxCL (PROXY) {{ int x, y;
x=msg.Unmarshall(INT);
x=msg.Unmarshal(INT);
int add(int x, int y)
y=msg.Unmarshall(INT);
y=msg.Unmarshal(INT);
{ Msg msg=new Msg();
res=serverImpl.add(x,y);
msg.Marshall(x);
msg.Marshal(x);
Msg msg=new Msg();
msg.Marshall(y);
msg.Marshal(y);
msg.marshall(res);
msg.marshal(res);
SendReqMsg(HOST,IP,msg);
SendReqMsg(HOST,IP,msg);
SendRespMsg(HOST,IP,msg);
SendRespMsg(HOST, IP, msg);
}
}
11
Goal 2: Inter-operability
Use a language with standardized syntax to
define the interface
Generate the stub and the skeleton
Programming Language Independent
C++
JAVA
MathBoxCL (SKELETON)
int invoke(Msg msg)
{ int x, y;
MathBoxCL (STUB) msg=GetMsg();
int add(int x, int y)
{ Msg msg=new Msg(); x=msg.Unmarshal(INT);
msg.Marshal(x); y=msg.Unmarshal(INT);
msg.Marshal(y); res=serverImpl.add(x,y);
SendReqMsg(HOST,IP,msg); Msg msg=new Msg();
} msg.marshal(res);
SendRespMsg(HOST, IP, msg);
}
12
Overview
operation()
Client args + return Object Implementation
value
Object
SKELETON
STUB Adapter
Network
ORB Core ORB Core
ORB-dependent implementation
Application specific Stub and Skeleton
Same inteface. ORB-independent
13
Outlook
General Overview
Architecture Overview
Interface Definition Language (IDL)
Types
Example
Language Mappings
ORB
Conclusions
14
Interface Definition Language
Builds on OOP principle of encapsulation
Clear boundary between implementation and interface
Independent
Programming Language (Only OO?)
OS
Platform
Network Connection
etc
15
IDL’s Type System
Two levels:
Interfaces for CORBA objects!
One interface per CORBA object
Official types for variables
integers, floats
struct, enum
array
string
binary values
…and more!
Scoped types
modules
exceptions
Interfaces
structs
16
Examples
DSLABS.IDL:
typedef string GroupMembers[4];
interface DS_project {
long register_project(in long groupId, in string status, inout string date);
long get_status(in long groupId, out string state, out string date, out
GroupMembers gm);
};
17
IDL language mappings
OMG defines mappings to different languages
C, C++, Java, Smalltalk, COBOL, Ada, Lisp, PL/1,
Python, and IDLscript
Proprietary mappings exist for obscure languages,
though not standardized!
18
Outlook
General Overview
Architecture Overview
Interface Definition Language (IDL)
ORB
DII (and DSI)
ORB interface
Object References
POA
Persistent and Transient Objects
Conclusions
19
Compile time vs Runtime?
20
Dynamic Invocation Interface (DII)
Generic run-time invocation
21
Dynamic Invocation Interface (DII) cont.
In essence:
Search and fetch an IDL from an Interface
Repository. (remember binary presentation
of IDL)
Construct a request
Specify target object, operation, and
parameters
Invoke the request
C++ (not entirely true)
invoke(remoteObj, ”getStatus”, paramters)
Java uses reflection/introspection (transparent):
remoteObj.getStatus(paramters);
2004-02-02 A. Ghodsi aligh@imit.kth.se 22
22
Complete picture
operation()
Client args + return Object Implementation
value
Dynamic
Static Object
Dynamic Static Skeleton
Skeleton Adapter
Invocation Stub Interface
Network
ORB Core ORB Core
ORB-dependent implementation
Application specific Stub and Skeleton
Same inteface. ORB-independent
23
Object References
Remote object references
Enable clients to invoke CORBA objects
Three incarnations
Language specific implementation
E.g. pointer to a stub in C++ implementing the
IDL
Not valid outside local computation space
Language independent ORB representation
IOR, Inter-operable Object Referenece
Supported by all ORBs
Textual representation
Send by e-mail, store in DB, textfiles and so on.
24
Inter-operable Object References (IOR)
25
ORB Interface
operation()
Client args + return Object Implementation
value
Dynamic
ORB Static Object
Dynamic Static Skeleton
Interface Skeleton Adapter
Invocation Stub Interface
Network
ORB Core ORB Core
ORB-dependent implementation
Application specific Stub and Skeleton
Same inteface. ORB-independent
26
ORB Interface
Standard interface (defined in IDL)
All ORBs implement this interface
27
How do I get an IOR?
All ORBs implement:
string_to_object()
file, e-mail, phone :)
resolve_initial_references()
Returns an IOR for naming service, interface
repository
Continue to search for IOR’s in a naming
service
28
Portable Object Adapter (POA)
operation()
Client args + return Object Implementation
value
Dynamic
Dynamic
ORB Skeleton
Static Object
Static Skeleton
Interface Interface Adapter
Invocation Stub
Network
ORB Core ORB Core
ORB-dependent implementation
Application specific Stub and Skeleton
Same inteface. ORB-independent
29
Why Object Adapters?
Client 1 Server
dsObject.calculate(); DsObject::calculate()
{
Client 2 ...
dsObject.calculate(); }
30
Why Object Adapters? (2)
Client 1 Server
dsObject.calculate(); DsObject::calculate()
{
Client 2 ...
dsObject.calculate(); }
31
Why Object Adapters? (2)
Client 1 Server
dsObject.calculate(); DsObject::calculate()
{
Client 2 ...
dsObject.calculate(); }
32
Why Object Adapters? (2)
Client 1 Server
dsObject.calculate(); DsObject::calculate()
{
Client 2 ...
dsObject.calculate(); }
Lifespan policy:
Transient objects
Persistent Objects
Continues to exist even if activated/deactivated?
33
Portable Object Adapter – PL meets
ORB!
POA is generic and CORBA object independent
and implements different activation policies
34
Portable Object Adapter
OBJ 1 OBJ 2 OBJ 3
Invoke right OBJ2 -> skel2 Invoke the right OBJ3 -> skel3
skeleton skeleton
Server Demultiplexer
Dispatch requests POA1
35
Transient Object Illustration
Client
_dsd->student_operation()
Object Implementation
36
Persistent Objects
A IOR to a Persistent Object always points
to the same object
Migration Transparency
Location Transparency
37
Persistent Objects continued
Its life cycle is independent of the objects
I.e. its existence is independent of whether the
object is in the local address-space.
ORBs can automatically startup objects
implementing persistent CORBA objects
38
How is this possible?
Implementation repository (IMR) is used
Keeps information about
Object Adapter
Startup Command
Current Server
39
Persistent Objects Illustrated
Client
Implem. Repository Object Implementation
_dsd->student_operation()
IMR Table
Adapter Startup Address
ORB Core
Active Object Maps
Stub OA4:
_InfoSec
Request message
OA5:
Unique ID : ”13FABCDA” ”OA5”, ”_DSD”
_DSC Skeleton
student_operation() + par _DSD
40
Failure and replication (IOR cont)
Multiple locations in one reference. If an invocation fails, go to next location
41
Summary-1
CORBA is a standardization effort
Provides inter-operability
42
Summary-2
Provides both Dynamic and Static invocations
DII/DSI and STUBS/SKELETONS
43
What did I miss?
A whole lot! ☺
CORBA facilities/services
Synchronization
Caching
Replication
Fault-tolerance
Security
Comparison of CORBA against
.NET
DCOM
Java RMI
etcetera
Please read chapter 9!
2004-02-02 A. Ghodsi aligh@imit.kth.se 44
44
The End
45