an introduction to corbaatzeni/psfiles/corbaintro.pdfcorba: middleware interoperability the common...
TRANSCRIPT
Page 1
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 writtenpermission of BELLCORE. DRAFT
Telcordia Contact:Paolo [email protected]+1 (973) 829 4644March 29th, 1999
Doc Name – 2Telcordia 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
Page 2
Doc Name – 3Telcordia 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
Doc Name – 4Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Common Problems in Enterprise InformationSystems
�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 multistepdata conversion
– Custom interface solutions (order (N x N) Interfaces)
Page 3
Doc Name – 5Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
The answer: MiddlewareMiddleware services = Standard programming interfaces +
Standard protocols + Distribution
Middleware(distributed services)
Platform Interfaces
Home bankingApplication
Credit ApprovalApplication
Standard APIs
Solaris onSPARC
Bank branchserver
DBMSServer
AIX onIBM RS/6000
Credit CheckService
DBMSServer
Application-specificservices
InformationExchangeServices
ManagementServices
Doc Name – 6Telcordia 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:– Transaction Processing monitors (e.g. CICS, Tuxedo)– Presentation managers– Directory services– Peer-to-peer Messaging systems– Notification services…
Page 4
Doc Name – 7Telcordia 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,… )
ApplicationsApplication/BusinessAware
System/BusinessUnaware
Doc Name – 8Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Architecture: Logical and Physical Layers
D +P +U
P +U
DD
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
Page 5
Doc Name – 9Telcordia 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
RemotePresentation Remote Data
DistributedPrograms
Doc Name – 10Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Client-Server 3-tier Architectures
User
Processing
Processing
Data
User
Processing
Processing
Data
Processing
Data
User
Processing
Processing
Data
ProcessingFront-end
Middle
Back-end
Page 6
Doc Name – 11Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
CORBA: middleware interoperability
The Common Object Request Broker Architecture provides astandard 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
Doc Name – 12Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
CORBA Reference Model Architecture
�Core component: The Object Request Broker:A distributed software bus for communication amongmiddleware services and applications
Page 7
Doc Name – 13Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Distributed Middleware with CORBA
Object Request Broker
Domain-specificservices
for banking
CORBA Services:Directory,Security,
Transaction,Life Cycle,
...
Bank branchserver
Credit Checkserver
Home bankingApplication
Credit ApprovalApplication
Doc Name – 14Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
The CORBA communication paradigm
Client ObjectImplementation
Object Request Broker
MediatedMethodInvocation
Direct RPC
Remote Object Method Invocation
Page 8
Doc Name – 15Telcordia 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
Doc Name – 16Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
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 forapplication 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
Page 9
Doc Name – 17Telcordia 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 – 18Telcordia 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– Transportation
Over 60 vendors committed toCORBA/IIOP:
IONA’s OrbixInprise’s Visibroker
Page 10
Doc Name – 19Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
CORBA for Web applications - architecture
Doc Name – 20Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
CORBA for Web applications - flows
Page 11
Doc Name – 21Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Reference Model - detail
Doc Name – 22Telcordia 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�Trading - service discovery: (svc attributes) Ô (svc name)�Transactions - 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)
Page 12
Doc Name – 23Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Architectural components
Doc Name – 24Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
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
Page 13
Doc Name – 25Telcordia 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 – 26Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Stubs and Skeletons II
Page 14
Doc Name – 27Telcordia 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 itsoperations– 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)
Doc Name – 28Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
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)
Page 15
Doc Name – 29Telcordia 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 – 30Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
A simpler IDL for the lab: HelloWorld1
// the simplest IDL exampleinterface HelloWorld1 {
// one method, no parmsstring hello();
};
Page 16
Doc Name – 31Telcordia 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.configto reflect your CLASSPATH
�compile chat.idl using make idl�examine the files created by the IDL compiler (in the same directory)
Doc Name – 32Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
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.
}
Page 17
Doc Name – 33Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab2: Hello World1: files
hw1.idl
IDLCompiler
Stubclass
Skeletonclass
Other supportJava classes
HelloWorldClient Appl.
HelloWorldObject Implem
JavaCompiler
Clientbytecode
Serverbytecode
Doc Name – 34Telcordia 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 ORBORB 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 hosthw1 = HelloWorld1Helper.bind (“HelloWorld1”,host);
// use the referenceif (hw1 != null)
System.out. println("Server said: "+ hw1.hello());
Page 18
Doc Name – 35Telcordia 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 interfacevoid 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)
Doc Name – 36Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Exporting server objects: Tie method
IDLCompiler
hw1.idl
HelloWorld1Operations(interface)
HelloWorld1(interface)
_tie_HelloWorld1(Java class)
hw1Impl(Java class).
contains
implements
implements
HelloWorld1Skeleton(class)
extends
Page 19
Doc Name – 37Telcordia 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()
RemoteClient
Doc Name – 38Telcordia 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+"");
}
}
Page 20
Doc Name – 39Telcordia 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 ORBORB 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 eventsboa.impl_is_ready(SERVER_NAME) ;System.out.println("Server terminated”);orb.disconnect (hw);
}} // end class hw1Server
Doc Name – 40Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
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
Page 21
Doc Name – 41Telcordia 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 toreceive 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 – 42Telcordia 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 Tie approach
– by inheritance: _ImplBase approach�each implementation object inherits the general skeleton for its class
Page 22
Doc Name – 43Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Exporting server objects II:ImplBase approach
IDLCompiler
HelloWorld1(interface)
_HelloWorld1ImplBase
(class)
hw1Impl(Java class).
implements
extends
HelloWorld1Skeleton(class)
extends
Doc Name – 44Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab3: using _ImplBase
�Modify hw1Server to use _HelloServer1ImplBase instead of_tieHelloServer1
Page 23
Doc Name – 45Telcordia 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 – 46Telcordia 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
Page 24
Doc Name – 47Telcordia 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 parmstring 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
Doc Name – 48Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
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) tocreate 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
0000000000000046000100000000000a6c6f63616c686f73740007d30000002e3a5c6c6f63616c686f73743a48656c6c6f576f726c64323a6f626a313a3a4946523a48656c6c6f576f726c643200]
Page 25
Doc Name – 49Telcordia 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 tothe 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 clientMyCallBack 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 – 50Telcordia 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 exportedserver 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 theparticipants by calling each callBack
Page 26
Doc Name – 51Telcordia 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 callBackimplementation;
class ClientCallBackImplementationimplements 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);
Doc Name – 52Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
Lab5: writing the server
�The server receives and stores the callBack in the join()implementation:
The server calls newMessage() on the callBack when messages arereceived 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);
}
Page 27
Doc Name – 53Telcordia 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 – 54Telcordia 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 itsrelationship to CORBA
Page 28
Doc Name – 55Telcordia Technologies Proprietary - Internal use only. See proprietary restrictions on title page.
References
�D.Schmidt, Overview of CORBA: http://siesta.cs.wustl.edu/~schmidt/corba-overview.html�R.Orfali, D. Harkey, Client/Server Programming with Java and CORBA, Wiley
1997�T. Mowbray, W. Ruh, Inside CORBA, Addison-Weslet 1997�T. Mowbray, R. Zahavi, The Essential CORBA, Wiley 1995�T. Mowbray, R. Malveau, CORBA Design Patterns, Wiley 1997�J. Farley, Java Distributed Computing, O’Reilly 1997�The OMG website: http://www.omg.org