Presentation is loading. Please wait.

Presentation is loading. Please wait.

CORBA Programming Using ACE/TAO

Similar presentations


Presentation on theme: "CORBA Programming Using ACE/TAO"— Presentation transcript:

1 CORBA Programming Using ACE/TAO
Ken Waller EEL Software Development for Real Time Engineering Systems Fall 2007

2 Agenda What Is CORBA? CORBA Basics Overview of ACE/TAO
Clients, Servers, and Servants ORBs and POAs IDL and the Role of IDL Compilers IORs Tying it all together Overview of ACE/TAO Example 1: Simple Client-Server CORBA Services Naming Service Trading Service Event Service Example 2: Using the Naming Service Multi-Threaded Issues Using CORBA Example 3: A Multi-Threaded Server

3 What Is CORBA? Common Object Request Broker Architecture
Common Architecture Object Request Broker – ORB Specification from the OMG Must be implemented before usable

4 What Is CORBA? More specifically:
“(CORBA) is a standard defined by the Object Management Group (OMG) that enables software components written in multiple computer languages and running on multiple computers to work together ” (1) Allows for Object Interoperability, regardless of: Operating Systems Programming Language Takes care of Marshalling and Unmarshalling of Data A method to perform Distributed Computing

5 What Is CORBA? CORBA Program A Running on a Windows PC Written in Java
Program B Running on a Linux Machine Written in C++

6 What is CORBA? CORBA is being used in many industries
Defense, Financial, Medical CORBA can be used to: Harness the power of several machines to solve a problem Several CPU’s Simulations Communicate between real Tactical Systems Perform true component based development

7 What is CORBA? Conceptually simple: “Devil is in the Details” (3)
Simply sending messages and data between objects running on different machines Not unlike objects communicating “Devil is in the Details” (3) Many new concepts and terms to learn ORB, POA, IOR, etc. “Alphabet Soup” True experts are rare and highly sought after Abstraction above Sockets

8 CORBA Basics: Clients, Servers, and Servants
CORBA Clients An Application (program) Request services from Servant object Invoke a method call Can exist on a different computer from Servant Can also exist on same computer, or even within the same program, as the Servant Implemented by Software Developer

9 CORBA Basics: Clients, Servers, and Servants
CORBA Servers An Application (program) Performs setup needed to get Servants configured properly ORB’s, POA’s Instantiates and starts Servants object(s) Once configuration done and Servant(s) running, Clients can begin to send messages Implemented by Software Developer

10 CORBA Basics: Clients, Servers, and Servants
Objects Implement interfaces Respond to Client requests Exists within the same program as the Server that created and started it Implemented by Software Developer

11 ORB’s and POA’s ORB: Object Request Broker The “ORB” in “CORBA”
At the heart of CORBA Enables communication Implemented by ORB Vendor An organization that implements the CORBA Specification (a company, a University, etc.) Can be viewed as an API/Framework Set of classes and method Used by Clients and Servers to properly setup communication Client and Server ORB’s communicate over a network Glue between Client and Server applications

12 ORB’s and POA’s POA: Portable Object Adapter
A central CORBA goal: Programs using different ORB’s (provided by different ORB Vendors) can still communicate In the early days of CORBA, this was not possible A clear shortcoming The POA was adopted as the solution Can be viewed as an API/Framework Set of classes and method Sits between ORB’s and Servants Glue between Servants and ORBs Job is to: Receive messages from ORB’s Activate the appropriate Servant Deliver the message to the Servant

13 CORBA Basics: IDL IDL: The Interface Definition Language
Keyword: Definition No “executable” code (cannot implement anything) Very similar to C++ Header Files Language independent from Target Language Allows Client and Server applications to be written in different (several) languages A “contract” between Clients and Servers Both MUST have the exact same IDL Specifies messages and data that can be sent by Clients and received by Servants Written by Software Developer

14 CORBA Basics: IDL Used to define interfaces (i.e. Servants)
Classes and methods that provide services IDL Provides… Primitive Data Types (int, float, boolean, char, string) Ability to compose primitives into more complex data structures Enumerations, Unions, Arrays, etc. Object-Oriented Inheritance

15 CORBA Basics: IDL IDL Compilers
Converts IDL files to target language files Done via Language Mappings Useful to understand your Language Mapping scheme Target language files contain all the implementation code that facilitates CORBA-based communication More or less “hides” the details from you Creates client “stubs” and Server “skeletons” Provided by ORB Vendor

16 CORBA Basics: IDL IDL Compiler IDL File Generates Generates
Client Program Client Stub Files Server Skeleton Files Servant Object Association Inheritance Client Programs used the classes in the Client Stub files to send messages to the Servant objects Servant Objects inherit from classes in the Server Skeleton files to receive messages from the Client programs Generated Files are in Target Language: C++ Java etc. Generated Files are in Target Language: C++ Java etc.

17 CORBA Basics: IDL Can also generate empty Servant class files
IDL Compiler converts to C++ (in this case)

18 CORBA Basics: IOR’s IOR: Interoperable Object Reference
Can be thought of as a “Distributed Pointer” Unique to each Servant Used by ORB’s and POA’s to locate Servants For Clients, used to find Servants across networks For Servers, used to find proper Servant running within the application Opaque to Client and Server applications Only meaningful to ORB’s and POA’s Contains information about IP Address, Port Numbers, networking protocols used, etc. The difficult part is obtaining them This is the purpose/reasoning behind developing and using CORBA Services

19 CORBA Basics: IOR’s Can be viewed in “stringified” format, but…
Still not very meaningful

20 CORBA Basics: IOR’s Standardized, to some degree: … …
Standardized by the OMG: Used by Client side ORB’s to locate Server side (destination) ORB’s Contains information needed to make physical connection NOT Standardized by the OMG; proprietary to ORB Vendors Used by Server side ORB’s and POA’s to locate destination Servants

21 CORBA Basics: Tying it All Together
In order to use CORBA: Obtain a CORBA implementation ACE/TAO is used in this presentation (free, open source) ORBIX (commercial) is most widely used (better support) Consider what platforms and languages vendor supports Learn how to use the CORBA API Can read the specification Massive Perhaps “too technical” Recommended: Find a good CORBA book More clear and concise See (3) Must also rely on documentation from the CORBA implementation provider The specs standardize lots of things, but not everything Some aspects left to the CORBA implementers

22 CORBA Basics: Tying it All Together
Recommended development strategy: Develop IDL and system architecture (i.e. High-Level design) Sequence Diagrams and UML can be useful during this phase Decide IOR passing strategy (i.e. CORBA Services) Design and Develop Server and Client programs

23 CORBA Basics: Tying it All Together
In general, a Server program must take the following steps: Configure the ORB Configure the POA Create and Configure the Servant object Register the Servant’s IOR with a CORBA Service Start the Servant In general, a Client program must take the following steps: Configure the ORB (different from Server ORB) Obtain a Servant’s IOR from a CORBA Service Use the IOR to call a method on the Servant object These directions are oversimplification Must learn how to use the CORBA API properly This is just a High-Level view In general, the server program must be run before the client program

24 CORBA Basics: Tying it All Together

25 CORBA Basics: Tying it All Together
Logical Flow Client Program Server Program Message(Data) Servant IOR (Servant Ref) Actual Flow Client Program Once ORB’s and POA’s set up and configured properly, transparency is possible ORB’s communicate over network POA’s activate servants and deliver messages Server Program Servant IOR (Servant Ref) POA ORB ORB

26 Overview of ACE/TAO ACE: Adaptive Communications Environment
Object-Oriented Framework/API Implements many concurrent programming design patterns Can be used to build more complex communications-based packages For example, an ORB Freely available from (2)

27 Overview of ACE/TAO TAO: The ACE ORB Built on top of ACE
A CORBA implementation Includes many (if not all) CORBA features specified by the OMG Not just an ORB Provides POA’s, CORBA Services, etc. Object-Oriented Framework/API Freely available from (2)

28 Example 1: Simply Client/Server

29 CORBA Services Previous example: This is not true distribution
Server started the Servant Servant wrote its IOR out to a file in a stringified format Client obtained IOR by reading the IOR in from the file This is not true distribution The CORBA Specification includes extensions to help facilitate obtaining IOR’s in a more distributed fashion

30 CORBA Services: The Naming Service
The CORBA Naming Service is similar to the White Pages (phone book) Servants place their “names,” along with their IOR’s, into the Naming Service The Naming Service stores these as pairs Later, Clients obtain IOR’s from the Naming Service by passing the name of the Servant object to it The Naming Service returns the IOR Clients may then use to make requests

31 CORBA Services: The Trading Service
The CORBA Naming Service is similar to the Yellow Pages (phone book) Servants place a description of the services they can provide (i.e. their “Trades”), along with their IOR’s, into the Trading Services The Trading Service stores these Clients obtain IOR’s from the Trading Service by passing the type(s) of Services they require The Trading Service returns an IOR Clients may then use to make requests

32 Example 2: Using the Naming Service

33 Multi-Threaded Issues Using CORBA
Server performance can be improved by using multiple threads GUI Thread Listening Thread Processing Thread Can also use multiple ORBs and POAs to improve performance Requires a multi-threaded solution

34 Example 3: A Multi-Threaded Server

35 Conclusions Advantages: Disadvantages:
Object-Oriented distributed communication Easy to define messages and data contents using IDL Once setup/configuration of ORB’s, POA’s, Servants, IOR’s complete, communication is fairly straightforward Relieves programmers from having to write Socket software Disadvantages: Can be difficult to learn Even harder to master Scalability issues could cause a mind-boggling amount of ORB’s, POA, threads, etc. to be used Acquiring IOR’s can be difficult

36 References (1) http://en.wikipedia.org/wiki/CORBA
(2) (3) “Advanced CORBA Programming with C++” by Henning and Vinoski

37 Questions?


Download ppt "CORBA Programming Using ACE/TAO"

Similar presentations


Ads by Google