Professional Documents
Culture Documents
1
Early Distributed Computing
2
What is CORBA?
3
Distributed Object-based Systems
Goal: transparently access remote objects in a distributed
system
Challenges:
- Ensure semantics of invoking a local object
- Accommodate heterogeneity, e.g., multiple languages, OSes, …
Client Server
Object Object
Middleware 4
Two Examples
5
CORBA
CORBA is similar in high level concepts to RMI
RMI is basically a simplified form of CORBA
It Adds:
Cross-platform
Multiple language interfaces
Widely used standard
Allows programs written in various languages to communicate
with each other as would two processes in the same address space.
Features leveraged by clients:
- Invocation transparency
- Implementation transparency
- Location transparency
6
CORBA Architecture
Remote-object: object implementation resides in server’s
address space
Client Server
Java Object
C++ Object
Skeleton
Client Server
Java Object
C++ Object
Skeleton
8
Skeleton
Provides iterface between server object and ORB
Unmarshaling: client invocation
Marshaling: server response
Client Server
Java Object
C++ Object
Skeleton
9
Object Adapters
10
Object Adapters
11
Object Adapters
12
Basic Object Adapter (BOA)
• BOA.impl_is_ready();
❢ Tells the BOA/ORB to begin listening for requests
Underspecified
- Initially unclear which features would be required on various
platforms
13
Portable Object Adapter (POA)
Replaces BOA
- Most commercial implementations still use BOA
Expanded scope of OA to include
- Activation policies
- Threading models
- Object life cycle (transient/persistent)
- Pre/post invocation capabilities
14
(Portable) Object Adapter (POA)
Register class implementations
Creates and destroys objects
Handles method invokation
Handles client authentication and access control
Client Server
Java Object
C++ Object
Skeleton
15
What is an ORB?
16
Object Request Broker (ORB)
ORB
17
Object Request Broker (ORB)
Request
ORB
18
ORB Usage
ORB is a singleton
ORB initialization
- Single static call to init() an ORB
- Afterorg.omg.CORBA.ORB
initialization, you register
orb = objects
org.omg.CORBA.ORB.init();
with the ORB using an Object Adapter
19
Proxy-based Invocation
Request
Request
Stub Skeleton
Request
ORB
20
ORB Abstraction
Client
Java
Java
? C++ Object Implementation
C++
IDL IDL
ORB
21
Object Request Broker ...
Communication infrastructure sending messages between
objects
Communication type:
- GIOP (General Inter-ORB Protocol)
- IIOP (Internet Inter-ORB Protocol) (GIOP on TCP/IP)
Client Server
Java Object
C++ Object
Skeleton
22
ORB and IIOP
23
Internet Inter ORB Protocol (IIOP)
Transport protocol
- Defines inter ORB communication
- Runs on top of TCP/IP
- Defines CORBA messages
IIOP is a specification
- Vendors must implement to be “CORBA-compliant”
- Allows for multi-vendor interoperability
24
CORBA Object
Server
CORBA
Interoperable Object Reference
Object
Interface C++/Java
IDL Implementation Servant
25
Interoperable Object Reference (IOR)
Server
CORBA
Interoperable Object Reference
Object
Interface C++/Java
IDL Implementation Servant
26
Interface Definition Language (IDL)
Describes interface
Language independent
Client and server platform independent
Server
CORBA
Interoperable Object Reference
Object
Interface C++/Java
IDL Implementation Servant
27
IDL (cont…)
28
Overall CORBA Architecture
Implementation Interface
repository repository Server
Client
Interface repository
interface repository provides information about registered IDL interfaces to clients
and servers that require it.
Skeleton
Stub
Implementation repository Object Adapter
IIOPon demand and locates running servers
activates registered servers
ORB ORB
uses the object adapter name to register and activate servers
29
CORBA Process
Write an IDL file which describes the interface to the distributed object.
Run idlj on the IDL file. This generates Java code that implements the
proxy code
Compile the java proxy code
Run nameserver
Implement the server
Implement the client
Start the applications
30
Development Steps
1 IDL
4 3
idltojava
Client Application Object Implementation
Stub 2 2 Skeleton
request
ORB ORB
response
steps:
1 write the IDL file
2 compile with idltojava (stubs/skeleton generated automatically)
3 write object implementation (servant)
4 write client application
31
Example of CORBA Services
32
CORBAservices are the baseline services available to all
objects sitting on the ORB communication bus.
33
Corba Services
Service Description
Collection Facilities for grouping objects into lists, queue, sets, etc.
Query Facilities for querying collections of objects in a declarative manner
Concurrency Facilities to allow concurrent access to shared objects
Transaction Flat and nested transactions on method calls over multiple objects
Event Facilities for asynchronous communication through events
Notification Advanced facilities for event-based asynchronous communication
Externalization Facilities for marshaling and unmarshaling of objects
Life cycle Facilities for creation, deletion, copying, and moving of objects
Licensing Facilities for attaching a license to an object
Naming Facilities for systemwide name of objects
Property Facilities for associating (attribute, value) pairs with objects
Trading Facilities to publish and find the services on object has to offer
Persistence Facilities for persistently storing objects
Relationship Facilities for expressing relationships between objects
Security Mechanisms for secure channels, authorization, and auditing
Time Provides the current time within specified error margins
34
CORBA vs. RMI
CORBA RMI
Platform independent JVM specific
Protocol independent Proprietary protocol
(IIOP) (JRMP)
Language Java specific
independent (IDL)
Objects by value Objects by value
(3.0) (serialization)
35
RMI Deployment
Interface Implementation
Definition Installation
Stubs Skeletons
36
CORBA Deployment
Interface Implementation
Stubs Skeletons
Repository Repository
37
CORBA Features
Language independence
Location transparency
Reuse of facilities & services
OMG IDL defined interfaces
Stub & Skeleton generation
Server activation
38
CORBA Resources
39
Creating a CORBA Object
40
public static void main(String[] args) {
try { Activating the QuoteServer
// Initialize object request broker
ORB orb = ORB.init(args, null);
} catch (SystemExcpetion e) { 41
Accessing a CORBA Object
42
Registering the QuoteServer
// Create a new QuoteServer ...
QuoteServer quoteServer = new QuoteServer();
.
.
.
// Obtain reference for our nameservice
org.omg.CORBA.Object object =
orb.resolve_initial_references("NameService");
// Since we have only an object reference, we must
// cast it to a NamingContext. We use a helper
// class for this purpose
43
Using a CORBA Object
44
Accessing the QuoteServer
// Create an object request broker
ORB orb = ORB.init(args, null);
// Obtain object reference for name service ...
org.omg.CORBA.Object object =
orb.resolve_initial_references("NameService");
// ... and narrow it to a NameContext
NamingContext namingContext = NamingContextHelper.narrow(object);
// Create a name component array
NameComponent name[] = { new NameComponent(”QuoteServer","") };
// Get a QuoteServer object reference ...
org.omg.CORBA.Object objectReference = namingContext.resolve(name);
// ... and narrow it to get a QuoteServer
QuoteServer quoteServer = QuoteServerHelper.narrow(objectReference);
// invoke methods on reference
Quote noveraQuote = quoteServer.getQuote(“MCTR”);
45
Technical/Architectural Overview
46
Technical/Architectural Overview
(cont.)
47
Technical/Architectural Overview
(cont.)
1. Transportation
2. Life Science Research
3. Utilities
4. C4I (Command, Control, Communications, Computers, and
Intelligence)
5. Space
48
Technical/Architectural Overview
(cont.)
Ob ject Servic es
General service inte rfaces
49
CORBA Basics
IDL J ava
module package
interface interface
struct class
const public static final
boolean boolean
char char
wchar wchar
octet octet
string java.lang.String
wstring java.lang.String
short short
unsigned short short
long int
unsigned long int
long long long
unsigned long long long
float float
double double
fixed (not supported in idlj) java.math.BigDecimal
sequence [] (array)
[] (array) [] (array)
Fig. 26.9 IDL keywords, types and their mappings to J ava keywords.
50
CORBA Basics (cont.)
51
CORBA Basics (cont.)
1. registerClient( this )
Client Server
2. clent.endMessage()
C lient a nd server are now d ead lo cked .
52
Distributed Exceptions
53
Case Study: Chat
54
Static Invocation Interface (SII), Dynamic Invocation
Interface (DII) and Dynamic Skeleton Interface (DSI)
55
Static Invocation Interface (SII), Dynamic Invocation
Interface (DII) and Dynamic Skeleton Interface (DSI)
(cont.)
Object adapter
- stands between a distributed object and its ORB
- enables clients to access ORB services:
• IOR generation
• security
• activation/deactivation
OMG specified two adapter types:
Object Management Group The OMG was formed in 1989 by a group of
vendors with the aim of creating a standard architecture for distributed objects
in networks.
- Basic Object Adapter (BOA)
• vague definition of an adapter which led to inconsistencies
between different vendors’ implementations
- Portable Object Adapter (POA)
• more widely used, even though more complex than BOAs
57
BOAs, POAs and TIEs (cont.)
58
BOAs, POAs and TIEs (cont.)
POA policies:
- ImplicitObjectActivation,
• tells POA outside object created servant and activated it
- IDAssignmentPolicy, and
• determines who is responsible for assigning a unique ID to a
given servant
- RequestProcessingPolicy.
• uses object id either to find matching servant or invoke default
service that uses object id to perform lookup in database
Policy combinations provide POAs with fine-grained control
over one or many servants.
59
BOAs, POAs and TIEs (cont.)
60
CORBA services
61
Naming Service
62
Security Service
63
Security Service (cont.)
- Level 2
• is everything level 1 provides in addition to:
1. more fine-grained user authentication
2. greater invocation security
3. auditing
4. finer control over secure invocations
5. delegation
6. administrators can set security policies
7. discovery of security policies by security-aware applications
8. discovery of security policies by ORBs and other services
64
Object Transaction Service
65
Object Transaction Service (cont.)
66
Object Transaction Service (cont.)
67
Persistent State Service
68
Persistent State Service (cont.)
69
Event and Notification Services
70
Event and Notification Services
(cont.)
71
Event and Notification Services
(cont.)
72
Event and Notification Services
(cont.)
C oncep tua lly, a Sup plie r send s a n Eve nt to a C onsume r.
Event
EventChannel
Event
ProxySupplier Co nsumer
Eve nt
73
EJBs and CORBA components
74
EJBs and CORBAcomponents
(cont.)
IDL keywords to support the C O RBA
C omponent Model (C C M)
component home provides
consumes import setRaises
emits local supports
finder multiple typeId
getRaises primaryKey typePrefix
Fig. 27.4IDL keywords to support the C ORBA C omponent Model.
75
EJBs and CORBAcomponents
(cont.)
76
EJBs and CORBAcomponents
(cont.)
77
EJBs and CORBAcomponents
(cont.)
78
EJBs and CORBAcomponents
(cont.)
79
EJBs and CORBAcomponents
(cont.)
80
EJBs and CORBAcomponents
(cont.)
C omp onent Type Desc ription
Service • Does not maintain state information (completely stateless)
• Does not have a unique id (primary key)
• Implements needed behavior
(e.g., calculateInterest,
addItemToShoppingCart, etc.)
• Can use transactions, is not included in the current
transaction
81
EJBs and CORBAcomponents
(cont.)
82
EJBs and CORBAcomponents
(cont.)
83
EJBs and CORBAcomponents
(cont.)
84
EJBs and CORBAcomponents
(cont.)
- Notification Service
• accessed indirectly
• container mediates use of event service by component
• container does not preclude direct use of Notification Service
❢ component developers are encouraged to define events in IDL as
way of keeping component’s functional description in one location
• keywords:
❢ publishes
» any number of consumers can subscribe to an event
» methods declared with publishes expected to be part of
shared interface of component
❢ emits
» only one consumer can subscribe to an event
» expected to be private channel used internally by system
85
EJBs and CORBAcomponents
(cont.)
87
When to Use RMI
88
When to Use RMI (cont.)
89
When to Use CORBA
90
RMI-IIOP
91
RMI-IIOP (cont.)
- runtime limitations:
• sending a tree graph from ORB to ORB may be problematic if
multiple nodes point to one object
• CORBA does not define distributed garbage collection
• Casting stubs may not work properly, so using the static
method narrow of class
java.rmi.PortableRemoteObject is encouraged.
• RMI downloads the stubs needed by client, CORBA does not.
92
RMI-IIOP (cont.)
93
RMIMessenger Case Study Ported
to RMI-IIOP
94
ChatServer RMI-IIOP
Implementation
ChatServerImpl
- implements ChatServer remote interface
• subclass of class javax.rmi.PortableRemoteObject
- does not implement method register
- handles registration with name services
95
Future Directions
96