corba
DESCRIPTION
COMMON OBJECT REQUEST BROKER ARCHITECTURETRANSCRIPT
![Page 2: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/2.jpg)
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
![Page 3: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/3.jpg)
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/
![Page 4: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/4.jpg)
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
![Page 5: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/5.jpg)
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…
![Page 6: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/6.jpg)
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…
![Page 7: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/7.jpg)
7
2004-02-02 A. Ghodsi [email protected] 7
OutlookGeneral OverviewQuick Architectural Overview
OOP with Distribution TransparencyCORBA overview
Interface Definition Language (IDL)TypesExamplesMappings
ORBConclusions
![Page 8: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/8.jpg)
8
2004-02-02 A. Ghodsi [email protected] 8
CORBA builds on the DOMProvides a nice model
Encapsulation
Inheritance
Polymorphism
![Page 9: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/9.jpg)
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)
![Page 10: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/10.jpg)
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
![Page 11: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/11.jpg)
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
![Page 12: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/12.jpg)
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++
![Page 13: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/13.jpg)
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
![Page 14: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/14.jpg)
14
2004-02-02 A. Ghodsi [email protected] 14
OutlookGeneral OverviewArchitecture OverviewInterface Definition Language (IDL)
TypesExampleLanguage Mappings
ORBConclusions
![Page 15: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/15.jpg)
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
![Page 16: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/16.jpg)
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
![Page 17: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/17.jpg)
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);
};
![Page 18: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/18.jpg)
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
![Page 19: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/19.jpg)
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
![Page 20: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/20.jpg)
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
![Page 21: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/21.jpg)
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
![Page 22: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/22.jpg)
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);
![Page 23: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/23.jpg)
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
![Page 24: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/24.jpg)
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.
![Page 25: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/25.jpg)
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”
![Page 26: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/26.jpg)
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
![Page 27: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/27.jpg)
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
![Page 28: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/28.jpg)
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
![Page 29: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/29.jpg)
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
![Page 30: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/30.jpg)
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()
{
...
}
![Page 31: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/31.jpg)
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()
{
...
}
![Page 32: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/32.jpg)
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()
{
...
}
![Page 33: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/33.jpg)
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()
{
...
}
![Page 34: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/34.jpg)
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
![Page 35: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/35.jpg)
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
![Page 36: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/36.jpg)
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
![Page 37: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/37.jpg)
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
![Page 38: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/38.jpg)
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
![Page 39: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/39.jpg)
39
2004-02-02 A. Ghodsi [email protected] 39
How is this possible?Implementation repository (IMR) is usedKeeps information about
Object AdapterStartup CommandCurrent Server
![Page 40: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/40.jpg)
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”
![Page 41: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/41.jpg)
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
![Page 42: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/42.jpg)
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
![Page 43: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/43.jpg)
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)
![Page 44: CORBA](https://reader033.vdocuments.net/reader033/viewer/2022051413/5562b24cd8b42a7c4a8b5634/html5/thumbnails/44.jpg)
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!