OAF tutorial

Table of Contents
What is OAF ?
Checklist

What is OAF ?

OAF was designed as a replacement for the limited libgnorba library used in GNOME. libgnorba is responsible on GNOME 1.0.x and 1.2.x systems for the activation of CORBA objects. libgnorba allows you to browse the available CORBA servers on your system (running or not). It keeps track of the running servers so that if you ask for a server which is already running, you will not start it again but will reuse the already running one.


The need for a replacement

libgnorba works well in a limited number of cases and suffers of a number of design issues. More specifically:

  • It cannot handle the non-local case gracefully. ie: you cannot start a remote CORBA server with libgnorba.

  • It uses evil hacks to keep track of the system's CosNaming service making it unusable on systems where an X server is not running. (for details, read libgnorba code ;-)

  • libgnorba allows you to only request specific servers by their name: you cannot ask for a server which provides a specific service. You have to ask for a server which you know provides a specific service.

OAF was designed to address these issues. The remote issue is completely solved by the oaf daemon (see the chapter called OAF Architecture), the evil hacks regarding X are part of our past and the grand OAF query langage (see the chapter called OAF Query Langage) gives you the ability to perform arbitrary queries on the database of CORBA servers.

Basically, OAF keeps track of all the CORBA servers installed on your machine and can track any other machine's CORBA servers provided you set up OAF correctly and allows you to perform queries on the properties of these servers. The following very simple example will make things rather clear:
CORBA_Object o = oaf_activate ("repo_ids.has ('IDL:GNOME/Graph/Layout:1.0')",
                               NULL, 0, NULL, &ev);
      
This will ask for a component which supports the GNOME/Graph/Layout:1.0 interface. You can also do much more complicated things. OAF will find one whcih matches the query and will take all the necessary measures required to get the server running (if it is a shared library progam, it will load the relevant library in memory. If you need a Factory, it will launch the factory and request the factory to create the relevant object).


Getting started

Here follows a very simple-stupid example of what you can do with OAF. The complete API description of liboaf, the OAF query langage reference and the .oafinfo file format reference are included in this document and are recommended readings. Reading the chapter called OAF Architecture is also a good idea.