SandUhr features a full-grown CORBA interface. This can be used to create new timer objects from scripts or programs or to query or modify existing timer objects. The interface even allows you to plug in custom alarm actions, for example to deliver an alarm message by email.
CORBA is a complex framework, designed to tie together pieces of a program, which may be written in different programming languages and may run on different computers in a network. The full list of buzz-words may be found at the official CORBA web site www.corba.org.
CORBA is object oriented. A CORBA server implements objects. A client sends requests to these object, to perform specific tasks. The SandUhr application implements two classes of objects:
SandUhr::Timer objects. These correspond to the sand-glass shaped windows you see on your screen. They implement requests to set or query the items from the timers properties dialog.
SandUhr::TimerFactory objects. Each instance of the SandUhr program implements one factory object. This loosely corresponds to the SandUhr control window from the timers' popup window. The main function of these factory objects is to create new timers.
The CORBA support of SandUhr is implemented with the help of ORBit, the standard CORBA ORB for use with the GNOME environment. You can find more information about ORBit at the ORBit homepage. The inter-ORB-communication is standardised, so in theory you can use any ORB implementation to access SandUhr. If you want to learn more about CORBA you should read the CORBA Applications In GNOME white-paper by Elliot Lee. It is published on the GNOME development site.
In all examples below I will use the Python bindings for ORBit. You can find these at orbit-python.sault.org. You will also need the GNOME OAF library. I use the python bindings which are included in the bonobo-python package at bonobo-python.lajnux.nu.
Using CORBA to create a new timer is easy. The only problem is, to get hands on a SandUhr::TimerFactory object. Once we have this object, we can ask it, to create a timer for us. This problem is solved by the GNOME object activation framework OAF. We can simple ask the OAF for a CORBA object, which implements the SandUhr::TimerFactory interface. This is demonstrated by Example 3.
Once you have mastered this example, it is really easy to further customise the timer. Example 4 shows, how to create a pink timer, which beeps five times instead of three. The full list of available requests is documented in SandUhr::Timer(3).
A more involved usage of the CORBA interface is to plug new alarm actions into SandUhr. This allows you to run arbitrary code to deliver an alarm message. Example 5 below shows how you can deliver the alarm per email.
Here your application has to act as a CORBA server, which implements the the SandUhr::AlarmAction interface. The interface is documented in SandUhr::AlarmAction(3). Your server has to implement the SandUhr::AlarmAction::NeedsPopup attribute and the SandUhr::AlarmAction::Attach, SandUhr::AlarmAction::Detach, and SandUhr::AlarmAction::Deliver methods.
In object oriented programming languages usually the ORB implementation will provide a class named similar to SandUhr__POA::AlarmAction. For the Python bindings it is called SandUhr__POA.AlarmAction. To implement the alarm action you have to derive a subclass of this class and to overload NeedsPopup, Attach, Detach, and Deliver.
Because SandUhr must access the object implemented by your server, you have to keep your server running until the alarm is delivered. Usually this is achived by calling the ORB::run method of your ORB implementation.
There is another possibility to plug in an alarm action. You can find out the IOR string of your AlarmAction object with the help of the ORB::object_to_string method. If you fill in this string into the corresponding entry in the action tab of a timer's properties dialog, the timer will deliver the alarm with the help of your server. This is demonstrated by Example 6.
![]() | This technique will come in handy if you use a CORBA language binding where there are no bindings for the OAF library. This library is not needed here. |