An Introduction to CORBA
Copyright © 1998 Bellcore. All Rights Reserved.
BELLCORE PROPRIETARY - INTERNAL USE ONLY.
This document contains proprietary information that shall be distributed, routed, or made available only within BELLCORE, except with written permission of BELLCORE.
DRAFT
Telcordia Contact:
Paolo Missier
paolo@research.telcordia.com +1 (973) 829 4644
March 29th, 1999
Doc Name – 2 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Part I: basic notions
Ÿ The rationale for CORBA: Middleware Interoperability – The Object Request Broker
– CORBA for Internet applications – Services
– Success stories, so far
Ÿ CORBA Core Reference Model and Architecture – CORBA IDL -- Interface Definition Language – Compile-time model: Stubs and Skeletons – Run-time model: remote object invocation – Object references
– Basic CORBA Object Model
Doc Name – 3 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Part II: basic notions applied
Ÿ A CORBA implementation:
– Inprise’s Visibroker: CORBA in Java Ÿ Selected features:
– IDL examples (chat.idl) – The ORB Interface PIDL
– Exporting server objects: the Basic Object Adapter ŸTie approach and ImplBase approach
– Object references and IORs
– Mixing client and server roles: client CallBacks
– Hands-on examples:
ŸHelloWorld ŸA simple chat server
Common Problems in Enterprise Information Systems
Ÿ Hardware and software systems heterogeneity, interoperability, distribution:
– different OSs, different network architectures
– independent application components developed in isolation – applications are available only on a subset of the servers – lack of standard internetworking
– lack of standard interfaces Ÿ Consequences:
– “Stovepipe systems”: ad hoc, proprietary integration solutions Ÿhigh maintenance costs
Ÿdifficult to evolve
– Inefficiency: redundant and duplicated data, error-prone multistep
data conversion
Doc Name – 5 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
The answer: Middleware
Middleware services = Standard programming interfaces +
Standard protocols + Distribution
Middleware (distributed services)
Platform Interfaces Home banking
Application
Credit Approval Application
Standard APIs
Solaris on SPARC Bank branch
server
DBMS Server
AIX on IBM RS/6000
Credit Check Service
DBMS Server Application-specific
services
Information Exchange
Services
Management Services
Doc Name – 6 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
What is Middleware?
Ÿ Features:
– Generic across applications and industries (“business-unaware”) – Available on multiple platforms
– Distributed
– Support standard interfaces and protocols Ÿ Examples:
– T ransaction Processing monitors (e.g. CICS, Tuxedo) – Presentation managers
– Directory services
– Peer-to-peer Messaging systems
– Notification services…
Doc Name – 7 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Middleware Service Classes
Network Programming Services (Sockets, LU6.2, … )
Basic Client/server Services (RPC, MOM, Security, Directory, Time, Notification, Transactions,...)
Primitive Services (Terminal Emulation, File Transfer, Email) Vertical Domain Services and Frameworks
(Wireless support, Telecomm Services, Multimedia, Groupware, CAD)
Distributed-Object Services (CORBA, DCOM, Active/X)
Network Services (TCP/IP, SPX/IPX, SNA,… )
Applications Application/
Business Aware
System/
Business Unaware
Architecture: Logical and Physical Layers
D + P + U
P + U
D D
P U
1-tier 2-tier 3-tier
Data
Processing
User
• Logical layers: systems components structure and interrelationships
• Physical layers: mapping of components onto a network of hosts
Doc Name – 9 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Client-server 2-tier Architectures
Data
Processing
User
Data
Processing
User User
Processing Processing
Data
Server
Client
Remote
Presentation Remote Data
Distributed Programs
Doc Name – 10 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Client-Server 3-tier A rchitectures
User Processing Processing
Data
User Processing Processing
Data
Processing Data
User Processing Processing
Data
Processing Front-end
Middle
Back-end
Doc Name – 11 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
CORBA: middleware interoperability
The Common Object Request Broker Architecture provides a standard for constructing System Architectures that are:
Ô interoperable, Ô object-oriented, Ô distributed, Ô middleware-based
• platform-independent and language-independent
• defines a standard mechanism for distributed inter-object communication (remote method invocation)
• defines standard interfaces to middleware services
CORBA Reference Model Architecture
Ÿ Core component: The Object Request Broker:
A distributed software bus for communication among
middleware services and applications
Doc Name – 13 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Distributed Middleware with CORBA
Object Request Broker Domain-specific
services for banking
CORBA Services:
Directory, Security, Transaction,
Life Cycle, ...
Bank branch server
Credit Check server Home banking
Application
Credit Approval Application
Doc Name – 14 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
The CORBA communication paradigm
Client Implementation Object
Object Request Broker
Mediated Method Invocation
Direct RPC
Remote Object Method Invocation
Doc Name – 15 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Basic ORB Functionalities
An ORB must provide:
– Access to common services
– Standard communication
Ÿcommon protocol (GIOP)
– Location transparency
Ÿserver activation and deactivation
– Insulation from system and platform dependencies
Ÿone interface, multiple implementations
The Object Management Group: http://www.omg.org
ŸCORBA is defined by the OMG
ŸFounded in 1989 by eight companies as a non-profit corporation. The consortium now includes over 800 members.
ŸCharter: establishment of industry guidelines and detailed object management specifications to provide a common framework for application development.
ŸOMG produces specifications, not implementations
Ÿ Implementations of OMG specifications can be found on over 50 operating systems
ŸNew specs proposal and adoption:
– initial RFI and RFPs submission, – evaluation and revision,
– review, recommendations and approval
Doc Name – 17 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Expected benefits of the ORB approach
Ÿ Provides universal notation for interfaces: IDL;
Ÿ Simplifies distributed computing
– remote and local object invocation are indistiguishable (?) – location transparency
– standard services (registration,… )
– standard protocol over several transport layers Ÿ Promotes component-based development
– components are reusable
– components are designed for integration Ÿ Enables large-scale use of design patterns
– Provides a path for legacy system integration through wrapping
Doc Name – 18 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
CORBA Success Stories
Ÿ Domains:
– Advertising/Marketing – Aerospace/Defense – Banking/Finance – Chemical/Petrochemical – Electronic Commerce – Government
– Healthcare/Insurance – Manufacturing – Publishing/Multimedia – Real Estate
– Research – Retail
– Software Companies – Telecommunications – T ransportation
Over 60 vendors committed to CORBA/IIOP:
IONA’s Orbix
Inprise’s Visibroker
Doc Name – 19 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
CORBA for Web applications - architecture
CORBA for Web applications - flows
Doc Name – 21 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Reference Model - detail
Doc Name – 22 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Implemented CORBA Services
ŸNaming - directory service: (svc name) Ô (svc object reference) ŸLifeCyle - server object management (Factory pattern)
ŸEvent - Producers notify consumers using events ŸT rading - service discovery: (svc attributes) Ô (svc name) ŸT ransactions - distributed (2PC), flat transactional objects ŸSecurity - specs only. IIOP over SSL currently used
Combinations of these services are implemented in:
• Orbix / IONA (http://www.iona.com)
• Visibroker / INPRISE (http://www.inprise.com/v isibroker)
• M3 / BEA (http://www.beasys.com/)
• TAO / UWSTL) (http://www.wustl.edu/~schmidt/ACE.html)
Doc Name – 23 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Architectural components
CORBA IDL -- Interface Definition Language
Ÿ IDL is the standard notation for defining software interfaces.
Ÿ It provides a means of separating interfaces from implementation for distributed object applications
Ÿ The standard has been stable since 1991 Ÿ IDL is language independent
– multiple standard language bindings: C, C++, Java, Smalltalk,...
Ÿ IDL enables platform independence
Ÿ IDL is pure specification, not implementation
Doc Name – 25 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Stubs and Skeletons
Client
Client Proxy (Stub Code)
Skeleton Code
Object Implementation
Object Request Broker (Remote Method Invocation)
Doc Name – 26 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Stubs and Skeletons II
Doc Name – 27 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Interoperable Object References (IORs)
Ÿ Unique identity of and object, used by clients to invoke its operations
– can be passed to clients:
Ÿas parameters or results of operations Ÿas strings (see IORs)
Ÿ IORs contain:
– name and location of the object implementation – interface type of the object
– unique key (within the scope of a server)
CORBA Object Model Concepts
ŸObject Implementations vs. Object References ŸTypes:
– all types are derived from the root type Object.
– structured types and template types are available ŸInterfaces: objects have single interfaces ŸOperation Semantics:
– at-most-once – best-effort
– Operation Signatures may include additional clauses: raises, oneway, context ŸAttributes
– attribute X is logically equivalent to a getX(), setX() operation pair
ŸExceptions: system-defined and user-defined (extensible)
Doc Name – 29 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
IDL Example (chat.idl)
typedef string Participant;
typedef sequence<Participant> Participants;
enum joinReturnCodes {JOIN_SUCCESS, DUPL_NICK};
interface ClientCallBack {
oneway void newMessage (in string message);
};
interface ChatServer {
exception FeatureNotSupportedException { string additionalInfo ;
};
oneway void say(in Principal chatter, in string Msg);
void whisper(in Principal chatter, in string toNick ) raises( FeatureNotSupportedException );
joinReturnCodes join(in ClientCallBack callBack , in string nickName , in Principal chatter) raises( FeatureNotSupportedException );
boolean leave(in Principal chatter );
Participants list() raises( FeatureNotSupportedException );
};
Doc Name – 30 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
A simpler IDL for the lab: HelloWorld1
// the simplest IDL example interface HelloWorld1 {
// one method, no parms string hello();
};
Doc Name – 31 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab1: environment setup
– Start the OSAGENT on the local subnet Ÿsource vbroker.csh
Ÿosagent &
– setup local dirs.: ~/visibroker/src/HW1 Ÿcreate hw1.idl
Ÿcopy and adjust Makefile – copy and adjust Makefile.config
to reflect your CLASSPATH Ÿcompile chat.idl using make idl
Ÿexamine the files created by the IDL compiler (in the same directory)
The ORB Interface
ŸThe ORB itself is described using pseudo-IDL:
– the defined objects are not restricted to IDL types
– Objects are typically implemented as libraries (see the Orbix classes dir) Ÿinterface ORB:
pseudo interface ORB {
string object_to_string (in Object obj);
Object string_to_object (in string str);
// much more }
Java:
public abstract class ORB { public static ORB init();
// etc.
}
Doc Name – 33 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab2: Hello World1: files
hw1.idl
IDL Compiler
Stub class Skeleton
class
Other support Java classes
HelloWorld Client Appl.
HelloWorld Object Implem
Java Compiler
Client bytecode
Server bytecode
Doc Name – 34 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab2: Hello World1: writing the client
Ÿ We need:
– client-side classes from the IDL compiler
HelloWorld1 hw1 = null; // interface object // init ORB
ORB orb = ORB.init(args, null); // args from command line
// obtain an object reference by binding to the server // use logical server name and specify target host hw1 = HelloWorld1Helper.bind (“HelloWorld1”,host);
// use the reference if (hw1 != null)
System.out. println ("Server said: "+ hw1.hello() );
Doc Name – 35 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab2: Hello World1: writing the service
CORBA Service = Servant + Server ŸServant: Object implementation
– implements the methods declared in the IDL interface void hello();
– is associated with a skeleton class by:
Ÿinheritance:
– extend a base class _InterfaceNameImplBase
Ÿdelegation: contain the object inside a _tie_InterfaceName – exported by the BOA
ŸServer: main listener:
– implements a main() method which:
Ÿinstantiates and activates implementation objects;
Ÿwaits for client connections (through the OSAGENT)
Exporting server objects: Tie method
IDL Compiler hw1.idl
HelloWorld1 Operations
(interface)
HelloWorld1 (interface)
_tie_HelloWorld1 (Java class)
contains
implements
implements HelloWorld1
Skeleton (class)
extends
Doc Name – 37 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Tie method: implementation proxy
HelloWorld1Operations
hello() {… } hello(){… }
_tie_HelloWorld1
HelloWorld1Operations m_impl
_tie_HelloWorld1 hw1Impl
hello()
hello() Remote
Client
Doc Name – 38 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab2: Hello World1: object implementation
class hw1Impl implements HelloWorld1Operations { String myLocation ;
public hw1Impl(String loc) { myLocation = loc; } public String hello() {
return new String("Hi there from "+ myLocation +"");
}
}
Doc Name – 39 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab2: Hello World1: server main class
public class hw1Server {
public static void main(String args []) { final String SERVER_NAME = "HelloWorld1";
String loc = "Padova , Italy";
// init the ORB
ORB orb = ORB.init(args, null);
BOA boa = orb.BOA_ init();
// instantiate one implementation object and tie it to a tie // object
HelloWorld1 hw = new _tie_HelloWorld1 (new hw1Impl(loc), SERVER_NAME);
// start receiving connection events boa.impl_is_ready(SERVER_NAME) ; System.out. println ("Server terminated”);
orb.disconnect (hw);
}
} // end class hw1Server
Lab2: Hello World1: compiling and running
– Run make -> client and server created – start server: vbj hw1Server &
– Run client: hw1Client <hostname>
– What happens:
hw1Client OSAGENT hw1Server
bind()
<start server>
<create hw1Impl>
boa..impl_is_ready()
<return objRef>
hw1.hello() Bind is not a standard
CORBA feature:
it is specific to Vbroker
Doc Name – 41 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
The Basic Object Adapter
Ÿ The BOA is a logical component of the ORB Ÿ Implementer’s perspective:
– informs the ORB of available objects and processes that are ready to receive requests
Ÿ Client’s perspective:
– ensures that an invocation to an object reference reaches a running process containing an object that can respond to it
Ÿ BOA functions:
– launch processes
– dispatch requests to processes
Ÿmust have access to the Implementation Repository
Ÿ BOA functions are listed in a PIDL
Doc Name – 42 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
BOA Implementation
Ÿ Three main physical components:
– the ORB daemon OSAGENT
– the BOA pseudo-object class org.omg.CORBA.BOA Ÿprovides the interface to register/activate objects
– generated IDL code (stub + skeleton)
Ÿ Binding object implementation and skeleton code:
– through a proxy: the T ie approach – by inheritance: _ImplBase approach
Ÿeach implementation object inherits the general skeleton for its class
Doc Name – 43 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Exporting server objects II:ImplBase approach
IDL Compiler
HelloWorld1 (interface)
_HelloWorld1 ImplBase
(class)
hw1Impl (Java class).
implements
extends HelloWorld1
Skeleton (class)
extends
Lab3: using _ImplBase
Ÿ Modify hw1Server to use _HelloServer1ImplBase instead of
_tieHelloServer1
Doc Name – 45 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
BOA: other functions
Ÿ Generation of object references
– explicit creation of objectRef (not normally used) Ÿ Authentication and access control
– get-principal() returns the identity of a client that caused the activation of an implementation object
– used by higher-level security services Ÿ Persistence
– get_id() returns the unique key to the object. It can be used as a key to a DB table
Doc Name – 46 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Passing “out” parameters: Holder objects
ŸIn CORBA, objects are passed by reference (objRef) Ÿbasic types and structs can be passed:
– by value (client Õ server)
public hello(in string clientName );
– by result (server Õ client)
public hello(out string serverTime );
ŸParameters in Java are passed by value – mismatch between Java and IDL
– Holder objects provide containers for data that is passed by result – CORBA provides Holder classes for predefined IDL types:
StringHolder i_ StringHolder = new StringHolder ();
– the IDL compiler generates new Holder classes for IDL objects:
public final class HelloWorld1Holder
Doc Name – 47 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab4: extend HelloWorld1 with a param
Ÿ New IDL (HelloWorld2.idl):
interface HelloWorld2 {
// one method, one out parm
string hello(out string serverTime );
};
Ÿ Extend client and server in dir HW2 (see notes):
– use the built-in StringHolder class
– access the string value through the value public data member Ÿ Recompile, register HelloWorld2, run it
Using IORs
ŸIn CORBA, a common string format is defined for object references:
IOR = Interoperable Object Reference
Ÿuse org.omg.CORBA.ORB.object_to_string(in Object obj) to create a IOR;
Ÿuse org.omg.CORBA.ORB.string_to_object(in string str) to create an object reference from a IOR
ŸIORs are unique
Ÿhere is an IOR obtained using object_to_string ():
[IOR:000000000000001449444c3a48656c6c6f576f726c64323a312e300000000001
0000000000000046000100000000000a6c6f63616c686f73740007d30000002e3a
5c6c6f63616c686f73743a48656c6c6f576f726c64323a6f626a313a3a4946523a48
656c6c6f576f726c643200]
Doc Name – 49 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Client CallBacks
ŸIn CORBA, clients and servers can easily switch roles:
– clients can:
Ÿmake objects available to the ORB, by:
– advertising their IOR, or
– passing the reference directly as arguments Ÿaccept incoming requests on those objects
ŸA CallBack in CORBA is a client-side object reference that is known to the server
– it can be used by the server to notify a client, e.g. of new events ŸPassing object references as method arguments:
// MyCallBack is a local class on the client
MyCallBack cb = new _ tieMyCallBack (new MyCallBack ());
obj.f(cb);
Ÿobj’s implementation treats cb just as another object reference:
– it can store it for later use;
– it can invoke methods on it
Doc Name – 50 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab5: program ChatServer using CallBacks
ŸThe chat server interface is defined in chat.idl ŸCurrently, there is only one chat room
– in general, one server may support multiple rooms, one for each exported server object
ŸEach client defines one callBack object of class ClientCallBack ; ŸClients can:
– register their callBacks and a nickname by calling join() – leave the room by calling leave()
– list participants in the room by calling list()
– send a message (a text line) to the chat by calling say() – send a private message to a participant by calling whisper()
Ÿdo not implement this. Instead, return a FeatureNotSupportedException
ŸThe server distributes (broadcasts) each incoming message to the
participants by calling each callBack
Doc Name – 51 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab5: writing the client
Ÿ Client code is similar to hw1Client, but extended with a callBack implementation;
class ClientCallBackImplementation
implements ClientCallBackOperations { public void newMessage (String message) {
// display message from the chat room }
}
• A callBack object is instantiated, wrapped in a
_tieClientCallBack , and passed to server with join():
ClientCallBackImplementation i_cb = new ClientCallBackImplementation ();
ClientCallBack cb = new _tie_ ClientCallBack (i_cb);
retCode = chatService .join( cb, nickName , username);
Lab5: writing the server
Ÿ The server receives and stores the callBack in the join() implementation:
The server calls newMessage () on the callBack when messages are received from participants:
public chat. joinReturnCodes join(chat. ClientCallBack callBack , String nickName ,
String chatter) {
// associate callBack to nickName and store the pair }
public void say(String nick, String msg) {
// iterate through all participants (omitted)
cb = (ClientCallBack ) participantList .nextElement ();
cb.newMessage ("["+nick+"]: "+ msg);
}
Doc Name – 53 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Summary
ŸCORBA 2.0:
– an open, distributed, object-oriented architecture designed for interoperability Ÿprovides some degree of location and implementation transparency for objects – basic compile-time model: stubs, skeletons, ORB
– basic run-time model: remote method invocation ŸCORBA IDL:
– a pure interface language. Supports inheritance;
– standard IDL mappings, specifically to Java;
ŸCORBA Implementation and vendor dependency:
– OrbixWeb by Iona: automatic server activation, various non-standard features
Doc Name – 54 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
What was not covered
Ÿ CORBA Services:
– Naming, Transaction, Trading, Event, Security, Externalization etc.
Ÿ(Naming service to be covered in follow-up class)
Ÿ ORB interoperability:
– Portable Object Adapters, the IIOP protocol Ÿ Related technology:
– Java RMI and its relationship to CORBA ŸJavaORBs, Java IDL
– Microsoft’s distributed component technology (DCOM) and its
relationship to CORBA
Doc Name – 55 Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.