2
2004-02-02 A. Ghodsi [email protected] 2
Goal of lecture
Go a bit more into depth on the corearchitecture of CORBA
Less breadthRead van Steen’s book
3
2004-02-02 A. Ghodsi [email protected] 3
Reading suggestionsTanenbaum & van Steen
CORBASection 2.3 page page 85-98Section 3.2.2 page 152-158Section 9.1
Read chapter 9 and compare other systems with CORBACompare RPC and DCE Remote Objects with CORBA
LinksNice CORBA tutorial:http://www.omg.org/gettingstarted/
4
2004-02-02 A. Ghodsi [email protected] 4
OutlookGeneral Overview
General InformationApplications
Quick Architectural OverviewOOP plus Distribution TransparencyCORBA main overview
Interface Definition Language (IDL)TypesExamplesMappings
ORBDII (and DSI)ORB interfaceObject ReferencePOAPersistent and Transient Objects
Conclusions
5
2004-02-02 A. Ghodsi [email protected] 5
General CORBA InformationDistributed Object Model (more later)
It is a middlewareDifference between Network OS Middleware?
Only a standard (v 2.7, 3.0)No reference implementation!Many independent implementations
OMG - Non-profit organization 800 members!Standardized UML and more…
6
2004-02-02 A. Ghodsi [email protected] 6
Real World Applications?Support ”dinosaurs”
Companies have invested years of development in projects done in ADA, C, Smalltalk…CORBA enables interoperability with new languages
Languages with small user-baseEg Erlang, again interoperability
Big ERM, ERP, ISMany different architectures, languages, platforms…
7
2004-02-02 A. Ghodsi [email protected] 7
OutlookGeneral OverviewQuick Architectural Overview
OOP with Distribution TransparencyCORBA overview
Interface Definition Language (IDL)TypesExamplesMappings
ORBConclusions
8
2004-02-02 A. Ghodsi [email protected] 8
CORBA builds on the DOMProvides a nice model
Encapsulation
Inheritance
Polymorphism
9
2004-02-02 A. Ghodsi [email protected] 9
Exploiting EncapsulationEncapsulation enables:
Distribution TransparencyHave stubs and skeletons that together with ORBsenable distribution*.
Inter-operability**Define interfaces in a standardised wayInterface Definition Language (IDL)
10
2004-02-02 A. Ghodsi [email protected] 10
Goal 1: Distribution Transparency
Encapsulation: black-box principleHas an interfaceImplementation detailshidden public interface MathBox {
int add(int x, int y);
}
public class MathBoxCLimplements MathBox {
MathBoxCL() {}
int add(int x, int y)
{ return x+y; }
}
…
MathBox obj = new MathBoxCL();
System.out.println(obj.add(10,20));
…
Transparentlydistribute
11
2004-02-02 A. Ghodsi [email protected] 11
Distribution Transparency
Client…
MathBox obj = new MathBoxCL();Integer result = obj.add(10,20);
…
Server Implementationint add(int x, int y) { return x+y; }
MathBoxCL (PROXY)int add(int x, int y) { Msg msg=new Msg();
msg.Marshal(x);msg.Marshal(y);SendReqMsg(HOST,IP,msg);
}
MathBoxCL (SKELETON)int invoke(msg msg){ int x, y;
x=msg.Unmarshal(INT);y=msg.Unmarshal(INT);res=serverImpl.add(x,y);Msg msg=new Msg();msg.marshal(res);SendRespMsg(HOST, IP, msg);
}
MathBoxCL (PROXY)int add(int x, int y) { Msg msg=new Msg();
msg.Marshall(x);msg.Marshall(y);SendReqMsg(HOST,IP,msg);
}
MathBoxCL (SKELETON)int invoke(msg msg) { int x, y;
x=msg.Unmarshall(INT);y=msg.Unmarshall(INT);res=serverImpl.add(x,y);Msg msg=new Msg();msg.marshall(res);SendRespMsg(HOST,IP,msg);
}
Missing parts:
• Marshalling
• Unmarshalling
• References
• Binding client to server
12
2004-02-02 A. Ghodsi [email protected] 12
Goal 2: Inter-operability
Use a language with standardized syntax to define the interfaceGenerate the stub and the skeleton
Programming Language Independent
MathBoxCL (STUB)int add(int x, int y) { Msg msg=new Msg();
msg.Marshal(x);msg.Marshal(y);SendReqMsg(HOST,IP,msg);
}
MathBoxCL (SKELETON)int invoke(Msg msg) { int x, y;
msg=GetMsg();x=msg.Unmarshal(INT);y=msg.Unmarshal(INT);res=serverImpl.add(x,y);Msg msg=new Msg();msg.marshal(res);SendRespMsg(HOST, IP, msg);
}
JAVAC++
13
2004-02-02 A. Ghodsi [email protected] 13
Overview
STUB
Client Object Implementationoperation()args + return
value
SKELETON Object Adapter
ORB-dependent implementationApplication specific Stub and Skeleton
ORB Core ORB Core
Same inteface. ORB-independent
Network
14
2004-02-02 A. Ghodsi [email protected] 14
OutlookGeneral OverviewArchitecture OverviewInterface Definition Language (IDL)
TypesExampleLanguage Mappings
ORBConclusions
15
2004-02-02 A. Ghodsi [email protected] 15
Interface Definition Language
Builds on OOP principle of encapsulationClear boundary between implementation and interface
IndependentProgramming Language (Only OO?)OSPlatformNetwork Connectionetc
Can be converted to a binary format and stored in a database (i.e. well-defined schema, iterators)
Interface Repository (IR)A Repository ID for each interface
16
2004-02-02 A. Ghodsi [email protected] 16
IDL’s Type System
Two levels:Interfaces for CORBA objects!
One interface per CORBA objectOfficial types for variables
integers, floatsstruct, enumarraystringbinary values…and more!
Scoped typesmodulesexceptionsInterfacesstructs
17
2004-02-02 A. Ghodsi [email protected] 17
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);
};
18
2004-02-02 A. Ghodsi [email protected] 18
IDL language mappingsOMG defines mappings to different languages
C, C++, Java, Smalltalk, COBOL, Ada, Lisp, PL/1, Python, and IDLscriptProprietary mappings exist for obscure languages, though not standardized!
Every ORB has an IDL compilerCreates
A STUB and A SKELETON
19
2004-02-02 A. Ghodsi [email protected] 19
OutlookGeneral OverviewArchitecture OverviewInterface Definition Language (IDL)ORB
DII (and DSI)ORB interfaceObject ReferencesPOAPersistent and Transient Objects
Conclusions
20
2004-02-02 A. Ghodsi [email protected] 20
Compile time vs Runtime?
What if interfaces change?Recompile everything? UnfeasableDynamic interface definitions required:
IS (Information Systems)ERM (Enterprise Resource Management systems)Batch Serviceetcetera
21
2004-02-02 A. Ghodsi [email protected] 21
Dynamic Invocation Interface (DII)
Generic run-time invocation
No compile-time knowledge of CORBA object interfacesNo stub and skeleton needed a-prioriInstead, a generic interface is used
Of course defined in IDL
22
2004-02-02 A. Ghodsi [email protected] 22
Dynamic Invocation Interface (DII) cont.
In essence:Search and fetch an IDL from an Interface Repository. (remember binary presentation of IDL)Construct a requestSpecify target object, operation, and parametersInvoke the request
C++ (not entirely true)invoke(remoteObj, ”getStatus”, paramters)
Java uses reflection/introspection (transparent):remoteObj.getStatus(paramters);
23
2004-02-02 A. Ghodsi [email protected] 23
Complete picture
StaticStub
Client Object Implementationoperation()args + return
value
StaticSkeletonDynamic
Invocation
DynamicSkeletonInterface
Object Adapter
ORB-dependent implementationApplication specific Stub and Skeleton
ORB Core ORB Core
Same inteface. ORB-independent
Network
24
2004-02-02 A. Ghodsi [email protected] 24
Object ReferencesRemote object references
Enable clients to invoke CORBA objects
Three incarnationsLanguage specific implementation
E.g. pointer to a stub in C++ implementing the IDLNot valid outside local computation space
Language independent ORB representationIOR, Inter-operable Object RefereneceSupported by all ORBs
Textual representationSend by e-mail, store in DB, textfiles and so on.
25
2004-02-02 A. Ghodsi [email protected] 25
Inter-operable Object References (IOR)
Remote Object Reference”Reference to an object on a serverProtocolHostname & Port
*GIOP, address, port ex: ”IIOP v1.0”,”ripper.it.kth.se”, 8765
Object Key(Adapter & Object Name)
*Which object adapter, which object?
ex: ”OA5”, ”_DSD”
Type Name(Repository ID)
Repository ID ex: ”IDL:KTH/imit/DSD:1.0”
26
2004-02-02 A. Ghodsi [email protected] 26
ORB Interface
ORBInterface
Client Object Implementationoperation()args + return
value
StaticStub
StaticSkeletonDynamic
Invocation
DynamicSkeletonInterface
Object Adapter
ORB-dependent implementationApplication specific Stub and Skeleton
ORB Core ORB Core
Same inteface. ORB-independent
Network
27
2004-02-02 A. Ghodsi [email protected] 27
ORB InterfaceStandard interface (defined in IDL)
All ORBs implement this interface
Important services provided:Bootstrapping, getting initial referencesConverting Object References to Strings and vice versaObject Reference Counting
Distributed garbage collection
28
2004-02-02 A. Ghodsi [email protected] 28
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
repositoryContinue to search for IOR’s in a namingservice
29
2004-02-02 A. Ghodsi [email protected] 29
Portable Object Adapter (POA)
Client Object Implementationoperation()args + return
value
Object Adapter
ORB Core ORB CoreNetwork
ORBInterfaceStatic
Stub
StaticSkeletonDynamic
Invocation
DynamicSkeletonInterface
ORB-dependent implementationApplication specific Stub and SkeletonSame inteface. ORB-independent
30
2004-02-02 A. Ghodsi [email protected] 30
Why Object Adapters?
Several clients call the same object, whatto do?
Demultiplex requests
Client 1dsObject.calculate();
Client 2dsObject.calculate();
ServerDsObject::calculate()
{
...
}
31
2004-02-02 A. Ghodsi [email protected] 31
Why Object Adapters? (2)
Queue requests or run in separate threads?Serialize all requestsOne thread per objectOne thread per invocationPool of threads
Client 1dsObject.calculate();
Client 2dsObject.calculate();
ServerDsObject::calculate()
{
...
}
32
2004-02-02 A. Ghodsi [email protected] 32
Why Object Adapters? (2)
Security between the objects?Sandboxing?Share methods, separate data?
Client 1dsObject.calculate();
Client 2dsObject.calculate();
ServerDsObject::calculate()
{
...
}
33
2004-02-02 A. Ghodsi [email protected] 33
Why Object Adapters? (2)
Lifespan policy:Transient objectsPersistent Objects
Continues to exist even if activated/deactivated?
Client 1dsObject.calculate();
Client 2dsObject.calculate();
ServerDsObject::calculate()
{
...
}
34
2004-02-02 A. Ghodsi [email protected] 34
Portable Object Adapter – PL meetsORB!
POA is generic and CORBA object independent and implements different activation policies
POA keeps pointers to skeletons*
An Object Identifier is associated with object.
A table called Active Object Map maps betweenObject Identifers => Skeletons
35
2004-02-02 A. Ghodsi [email protected] 35
Portable Object Adapter
Server DemultiplexerDispatch requests
to the right POA
POA1
POA2
POA1 (policy1)Invoke right
skeleton
Active Object Map
OBJ2 -> skel2
OBJ1 -> skel1
OBJ 1
skel1
OBJ 2
skel2
POA2(policy2)Invoke the right
skeleton
Active Object Map
OBJ3 -> skel3
OBJ 3
skel3
36
2004-02-02 A. Ghodsi [email protected] 36
Transient Object Illustration
Stub
Object Adapter
ORB Core
Client_dsd->student_operation()
Object Implementation
ORB Core
Request message
Unique ID : ”13FABCDA” ”OA5”, ”_DSD”
student_operation() + *par
Active Object Maps
OA4:
_InfoSec
OA5:
_DSC
_DSD
Skeleton
Reply message
return variables, out parameters
Unique ID : ”13FABCDA”
STUB: Object Reference
”IIOP v1.0”,”ripper”, 8765 ”OA5”, ”_DSD”IDL:Institution/IT/DSD:1.0
37
2004-02-02 A. Ghodsi [email protected] 37
Persistent Objects
A IOR to a Persistent Object always points to the same object
Migration TransparencyLocation Transparency
Ceases to exist only if the CORBA object is logically destroyed
Might moveMight change IP, Port, MachineMight change POAetc
38
2004-02-02 A. Ghodsi [email protected] 38
Persistent Objects continuedIts 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
39
2004-02-02 A. Ghodsi [email protected] 39
How is this possible?Implementation repository (IMR) is usedKeeps information about
Object AdapterStartup CommandCurrent Server
40
2004-02-02 A. Ghodsi [email protected] 40
STUB: Object Reference
”IIOP v1.0”,”IMR”, 8765 ”OA5”, ”_DSD”IDL:KTH/imit/DSD:1.0
ORB Core
Persistent Objects Illustrated
Stub
ORB Core
Client_dsd->student_operation()
Object Implementation
ORB Core
Skeleton
Implem. Repository
IMR Table
ir:1444/startupyOA_2
ripper:313rsh ripper /runOA5
bored:131rsh x ”/bin/st”xOA_1
AddressStartupAdapter
Active Object Maps
OA4:
_InfoSec
OA5:
_DSC
_DSD
Request message
Unique ID : ”13FABCDA” ”OA5”, ”_DSD”
student_operation() + par
”IIOP v1.0”,”ripper”, 313
Location ForwardReply message
return variables, out parameters
Unique ID : ”13FABCDA”
41
2004-02-02 A. Ghodsi [email protected] 41
Failure and replication (IOR cont)
Protocol1Hostname1 & Port1
*GIOP, address, port ex: ”IIOP v1.0”,”ripper.it.kth.se”, 8765
Object1 Key(Adapter1 & Object1 Name)
Type Name(Repository ID)
Repository ID ex: ”IDL:KTH/imit/DSD:1.0”
HOST1/PORT2/ADAPTER2/OBJECT2 ex: ripper1/1234/oa1/obj1
HOST2/PORT2/ADAPTER2/OBJECT2 ex: ripper2/3233/oa3/obj6…
Remote Object Reference”Reference to an object on a serverProtocol2Hostname2 & Port2
Object2 Key(Adapter2 & Object2 Name)
Multiple locations in one reference. If an invocation fails, go to next location
42
2004-02-02 A. Ghodsi [email protected] 42
Summary-1CORBA is a standardization effort
Based on the the Distributed Object Model
Provides inter-operability
Uses proprietary interface language: IDLAll CORBA objects have an interface in IDL Most of the services offered by CORBA have an interface in IDL
43
2004-02-02 A. Ghodsi [email protected] 43
Summary-2
Provides both Dynamic and Static invocationsDII/DSI and STUBS/SKELETONS
Stubs/Skeletons talk to an ORB
The ORB uses a standardized protocol to exchangeMessages(Req/Resp), IORs (persistent/transient)
ORB uses a POA to implement different activation policiesThreading policyLifespan policy (Persistent vs. Transient Objects)Security (sandboxing of object implementations)
44
2004-02-02 A. Ghodsi [email protected] 44
What did I miss?A whole lot! ☺
CORBA facilities/servicesSynchronizationCachingReplicationFault-toleranceSecurity
Comparison of CORBA against.NET DCOMJava RMIetcetera
Please read chapter 9!