|
|
Integrating into the GNOME desktopIntroduction IntroductionOpenOffice.org is a fully featured office productivity suite available for the most popular platforms. One aim of OpenOffice.org is to seamlessly integrate into each platform's most popular desktops. One major desktop on Linux and Solaris is developed by the open source GNOME project. The component model of the GNOME desktop is BONOBO, which is built on top of ORBIT, an open source CORBA ORB (Object Request Broker). To be able to communicate with the GNOME desktop, we want to develop a CORBA-UNO bridge using IIOP (Internet inter orb protocol). Goals for the bridgeThe main goal is to get a CORBA-bridge that supports all features necessary to communicate with the GNOME desktop. This would e.g. allow to script OpenOffice.org from a GNOME scripting language. As a secondary goal an arbitrary CORBA-ORB should be able to directly access OpenOffice.org using the same bridge (for example on windows). This would allow to integrate OpenOffice.org seamlessly into any CORBA environment.However, bridging UNO and CORBA is a non trivial task, as both component models are based on different fundamental concepts. This document should provide concepts about how to cope with most of these fundamental differences. It is supposed to grow within the next weeks as documentation either during and after development of the bridge. It should be a kind of an open document, as that important points brought up by the community will be inserted here. What exactly can be done with a CORBA-UNO bridge?An UNO-CORBA bridge allows to e.g. call methods at an UNO object (let's say a writer document) from the BONOBO object model. The caller does not need to know he is calling an UNO object, the only thing he does is invoking a method on a CORBA interface. It is not needed for the caller to have any UNO libraries in process nor is it needed for the callee to have any orbit libraries in process. The other way round, the bridge allows an UNO programmer to call CORBA objects from UNO. The UNO programmer does not have to have any special CORBA knowledge, he simply calls on UNO interfaces. To support callback interfaces, it should be possible to implement CORBA-interfaces in UNO and vice versa. Design conceptsAccessing UNO processes from CORBA and vice versaThe main problem of accessing an object in a different process is that you need the IOR (Interoperable Object Reference) of this object in the other process. The most common way is to have a daemon like process (typically a namingservice or a implementation repository) that administrates IORs. Every CORBA application can access this daemon to retrieve an IOR of the desired object. The root IOR of this daemon process must somehow be brought to every single application. How this is done, is orb dependent (possible solutions are a certain file on the filesystem, configuration files, environment variables, command line parameters, etc). The mechanism how to access this IOR should be made abstract to allow to implement a different mechanism for different orbs. A simple interface as following one should be sufficient.
returned stringified IOR can later be used to create an UNO interface reference to the object. Therefor will exist an CORBA bridge interface with a method
The returned Any contains an UNO interface reference. This can be used to directly make calls.
So far the problem, how OpenOffice.org can access CORBA services, is solved. But what is the other way round? How can we get the OpenOffice.org servicemanager into the oaf? There are multiple possible solutions.
Which solution will be used is not yet determined. Oneway calls
CORBA does not guarantee the sequence of calls for oneways. However,
a lot of UNO interfaces and implementations rely on that (think of the sequence
Oneway with CORBA interfaces however should be supported, as there it must have been decided during design, that the series of calls is not important. Is a special solution for GNOME possible (maybe the implementation guarantees the sequence of calls)? Object lifetimeSeveral use cases must be taken into account when talking about object lifetime.
Thread identityUNO interprocess bridges preserve thread identity, that means when process A calls process B and in the same request process B calls again process A, the same thread waiting in process A will take over the new request. This ensures that thread local resources (locked mutexes, thread local storage, etc.) are preserved.An arbitrary CORBA orb may not support thread identity. The id can be inserted into the service context list. If the CORBA process supports it, it is fine, if not thread identity cannot be preserved, this could result in deadlocks. The service context id LogicalThreadId can be reused, that was original designed for DCOM interoperability. An appropriate ID for this should be applied at the omg. Object identityCORBA does not guarantee object identity , but several UNO interfaces (especially container and broadcaster/listener interfaces) rely on that. I would like to introduce a typical example, where such a problem occurs.
The XBroadcaster interface is implemented by the UNO object U (in the UNO process), the XListener interface is implemented by the CORBA object C in the CORBA process. Now there is an actor, that wants to add C into U and later remove C from U. Adding is no problem, but removing is. The CORBA bridge in the UNO process must know, that the reference passed with the removeListener() method, is the same, that was passed with the addListener() method. However, it can't know for sure just by seeing the object reference, because in CORBA it is possible, that two object references denote one object. The problem is even worse, because the removal may work most of the time (object references passed by add/remove are identical), but sometimes not. Note, that the check for object identity in UNO is done by comparing the pointer of the XInterface proxy. So a UNO-CORBA bridge must ensure, that interfaces belonging to the same object get the same proxy. This must be done for every interface reference, because the bridge does not know in advance, if there will be a check for object identity. Possible solutions for this problem are :
Implementation conceptsObject identifierWhat object identifiers get incoming CORBA objects within UNO and what object ids get outgoing UNO objects?As there is currently no better proposal for the object identity problem, we assume that solution 1. is chosen. First the mapping of UNO objects to CORBA is discussed. Below you find a typical example of an UNO object implementing multiple interfaces.
The Pipe object is instantiated in the UNO process and is passed as an XInterface reference to the CORBA-process. In CORBA, object references contain the most derived type and (beside other things) an unique object identifier. A request can be invoked by sending the unique object identifier (and thus leaving out the type information). As there is no most derived type in UNO, the UNO-CORBA bridge must be able to extract solely from the object identifier, which object and which interface the request is meant for. The bridge could use the UNO object identifier and try to find out by the method name, which interface shall be called on. But this would mean that it is not possible to have two methods with the same name in two different interfaces. So the UNO-CORBA bridge should use the UNO object identifier as an prefix and adds a type identifier. The type identifier may either be the complete type name or a single byte (the bridge ensures the byte's uniqueness for every single object ). So in the above example, if the UNO object identifier is "leo", the CORBA object identifier could be
For persistent object references, the name given to the object when inserting it into the bridge is used (Note that this will only be done for the exact type, other interfaces of the persistent object will have transient ids), so for persistent references, there is no type suffix.
Now the mapping of CORBA objects to UNO is discussed. If an CORBA object implements UNO
interfaces, the object must implement a For CORBA objects implementing CORBA interfaces, the bridge itself must generate an object identifier. It may happen that the same object gets different object identifiers, because the CORBA-UNO bridge has no possibility get the id of the object. So object identity for these objects will not work in UNO. However, the bridge must ensure, that an identifier is unique, therefor it is not sufficient to use the CORBA object identifier (two different CORBA processes may use the same identifier). Therefor an connection dependent prefix is added to the object identifier (maybe a GUID generated for every connection). CorbaBridge serviceThe CorbaBridge service is the interface between the UNO developer and the core bridge. In general, this service is used at startup and shutdown of the bridge.What does the bridge need?
Below you can find a first possible draft of the interface. No error handling yet specified.
Interprocess connection managementA normal UNO-UNO interprocess bridge just owns one interprocess connection. This is not appropriate for the UNO-CORBA bridge, because interface references handed out over one connection can come in again over a different connection and must still be valid, so all connections must end in one bridge.The UNO-CORBA bridge needs to distinct between connections initiated from the UNO process or from an arbitrary CORBA process. If a request shall be invoked on a object, that has not been invoked before, the IOR must be parsed for a host/port combination. The bridge has a hashmap for actively initiated connections. The key is host/port and the connection is the value. If there is no match, the bridge tries to initiate a connection. On success, the connection is added to the hashmap. The proxy should store that it got the object last time over this connection for performance reasons. Actively initiated connections can be closed at any time. This should be done, when the last proxy, that uses this connection, dies. Passively initiated connections should be closed by the remote process. Another possibility would be to close it when the last stub for this connection dies, however then a CloseConnection message must be sent. Bidirectional communication (as specified by GIOP 1.2) should be ignored in the first run, because it complicates things a lot. IIOP versionsI think IIOP versions 1.0 is sufficient for the first running ORB. The following features are added in the following versions :
How can the CORBA-UNO bridge be deployed for the GNOME orbit?(prebuilding stub/proxy code?, which compiler to use?, where to put the libraries?, how do we get the UNO types into the typelibrary?)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


