Title: CORBA Programming Using ACETAO
1CORBA Programming Using ACE/TAO
- Ken Waller
- EEL 6897 - Software Development for Real Time
Engineering Systems - Fall 2007
2Agenda
- What Is CORBA?
- CORBA Basics
- 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
3What Is CORBA?
- Common Object Request Broker Architecture
- Common Architecture
- Object Request Broker ORB
- Specification from the OMG
- http//www.omg.org/technology/documents/corba_spec
_catalog.htm - Must be implemented before usable
4What 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
5What Is CORBA?
CORBA
- Program A
- Running on a Windows PC
- Written in Java
- Program B
- Running on a Linux Machine
- Written in C
6What 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 CPUs
- Simulations
- Communicate between real Tactical Systems
- Perform true component based development
7What is CORBA?
- Conceptually simple
- 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
8CORBA 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
9CORBA Basics Clients, Servers, and Servants
- CORBA Servers
- An Application (program)
- Performs setup needed to get Servants configured
properly - ORBs, POAs
- Instantiates and starts Servants object(s)
- Once configuration done and Servant(s) running,
Clients can begin to send messages - Implemented by Software Developer
10CORBA Basics Clients, Servers, and Servants
- 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
11ORBs and POAs
- 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 ORBs communicate over a
network - Glue between Client and Server applications
12ORBs and POAs
- POA Portable Object Adapter
- A central CORBA goal Programs using different
ORBs (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 ORBs and Servants
- Glue between Servants and ORBs
- Job is to
- Receive messages from ORBs
- Activate the appropriate Servant
- Deliver the message to the Servant
13CORBA 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
14CORBA 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
15CORBA 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
16CORBA Basics IDL
IDL Compiler
IDL File
Generates
Generates
Client Stub Files
Server Skeleton Files
Client Program
Servant Object
Inheritance
Association
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.
17CORBA Basics IDL
- Can also generate empty Servant class files
IDL Compiler converts to C (in this case)
18CORBA Basics IORs
- IOR Interoperable Object Reference
- Can be thought of as a Distributed Pointer
- Unique to each Servant
- Used by ORBs and POAs 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 ORBs and POAs
- 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
19CORBA Basics IORs
- Can be viewed in stringified format, but
- Still not very meaningful
20CORBA Basics IORs
- Standardized, to some degree
- Standardized by the OMG
- Used by Client side ORBs to locate Server side
(destination) ORBs - Contains information needed to make physical
connection
- NOT Standardized by the OMG proprietary to ORB
Vendors - Used by Server side ORBs and POAs to locate
destination Servants
21CORBA 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
22CORBA 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
23CORBA 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 Servants 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 Servants 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
24CORBA Basics Tying it All Together
25CORBA Basics Tying it All Together
Logical Flow
Client Program
Server Program
Servant
Message(Data)
IOR (Servant Ref)
Actual Flow
Client Program
Server Program
- Once ORBs and POAs set up and configured
properly, transparency is possible - ORBs communicate over network
- POAs activate servants and deliver messages
Servant
IOR (Servant Ref)
POA
ORB
ORB
26Overview 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)
27Overview 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 POAs, CORBA Services, etc.
- Object-Oriented Framework/API
- Freely available from (2)
28Example 1 Simply Client/Server
29CORBA Services
- Previous example
- 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 IORs in a more
distributed fashion
30CORBA Services The Naming Service
- The CORBA Naming Service is similar to the White
Pages (phone book) - Servants place their names, along with their
IORs, into the Naming Service - The Naming Service stores these as pairs
- Later, Clients obtain IORs 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
31CORBA 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 IORs, into the Trading Services - The Trading Service stores these
- Clients obtain IORs 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
32Example 2 Using the Naming Service
33Multi-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
34Example 3 A Multi-Threaded Server
35Conclusions
- Advantages
- Object-Oriented distributed communication
- Easy to define messages and data contents using
IDL - Once setup/configuration of ORBs, POAs,
Servants, IORs 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 ORBs, POA, threads, etc. to be used - Acquiring IORs can be difficult
36References
- (1) http//en.wikipedia.org/wiki/CORBA
- (2) http//download.dre.vanderbilt.edu/
- (3) Advanced CORBA Programming with C by
Henning and Vinoski
37Questions?