Registries in UNO |
Contents |
||
Overview Viewing registries Command line registry tools Adding components to the office Bootstrapping arbitrary UNO C++ processes | ||
Overview |
||
This document provides information about meaning and usage of UNO-registries within
arbitrary UNO processes.
UNO-registries store binary data in a tree-like structure. It has nothing to do with the windows registry (except that they follow a similar concept). UNO-registries mainly store two types of data
Both types of data are in general stored into a file with a .rdb-suffix ( registry database ). This documents explains more details about the two types of data, explains the tools how to prepare a proper registry and the different possibilites about how to bootstrap a C++ process with a registry. Another chapter deals with the registries used in OpenOffice. | ||
Viewing registries |
||
UNO typelibraryTo be useable by a UNO C++ process, all type descriptions must be available within the registry under the /UCR main key (UCR = Uno Core Reflection). You can have a look at the file office-install/program/applicat.rdb using the regview tool, which comes with the office development kit. For instance
dumps all type descriptions used within the office to stdout. One can check if a certain type is included within the registry by invoking the following command
$ regview applicat.rdb /UCR/com/sun/star/bridge/XUnoUrlResolver /UCR/com/sun/star/bridge/XUnoUrlResolver Value: Type = RG_VALUETYPE_BINARY Size = 461 Data = minor version: 0 major version: 1 type: 'interface' uik: { 0x00000000-0x0000-0x0000-0x00000000-0x00000000 } name: 'com/sun/star/bridge/XUnoUrlResolver' super name: 'com/sun/star/uno/XInterface' Doku: "" IDL source file: "O:\UDK303\src\udkapi\com\sun\star\bridge\XUnoUrlResolver.idl" number of fields: 0 number of methods: 1 method #0: com/sun/star/uno/XInterface resolve([in] string sUnoUrl) raises com/sun/star/connection/NoConnectException, com/sun/star/connection/ConnectionSetupException, com/sun/star/lang/IllegalArgumentException Doku: "" number of references: 0 The regview-tool knows the format of the binary blob containing the typedescription and dumps it in a human readable form. Registered servicesOnly the UNO component itself provides the data about its implementations. In order not to load each available UNO component into memory when starting a UNO process, the data is assembled once (e.g. during setup) and stored into a registry. This process is called component registration. Tools for performing this task are discussed below.For an installed OpenOffice, the applicat.rdb contains the registry information. The data
is stored within the /IMPLEMENTATIONS and /SERVICES key. Below you can find a sample
SERVICES key for the
$ regview applicat.rdb /SERVICES/com.sun.star.io.Pipe /SERVICES/com.sun.star.io.Pipe Value: Type = RG_VALUETYPE_STRINGLIST Size = 38 Len = 1 Data = 0 = "com.sun.star.comp.io.stm.Pipe" It just contains one implementation name (it may contain more than one, but in general only the first is used). Within the IMPLEMENTATIONS section, you can find the following entry :
$ regview applicat.rdb /IMPLEMENTATIONS/com.sun.star.comp.io.stm.Pipe /IMPLEMENTATIONS/com.sun.star.comp.io.stm.Pipe / UNO / ACTIVATOR Value: Type = RG_VALUETYPE_STRING Size = 34 Data = "com.sun.star.loader.SharedLibrary" / SERVICES / com.sun.star.io.Pipe / LOCATION Value: Type = RG_VALUETYPE_STRING Size = 8 Data = "stm.dll" The implementations section holds three types of data.
| ||
Command line registry tools |
||
There are various tools to create, modify and use registries. The command line options are
discussed in detail here. This chapter shall show some common
use cases.
GeneralThe regmerge tool is used to merge multiple registries into a subkey of an existing or new registry. For instance1. $ regmerge new.rdb / test1.rdb test2.rdb merges the contents of test1.rdb and test2.rdb into the file new.rdb. The names of the keys are preserved, because both registries are merged into the root-key. In case new.rdb existed before, the previous contents remain in new.rdb unless there exist identical keynames in either test1.rdb and test2.rdb. In this case, the content of these keys is overwritten with the ones in test1.rdb or test2.rdb. So the above command is semantically identical to $ regmerge new.rdb / test1.rdb $ regmerge new.rdb / test2.rdb2.
$ regmerge myapp_types.rdb /UCR test1.urd test2.urd merges the contents of test1.urd and test2.urd into the file myapp_types.rdb. The names of the keys in test1.urd and test2.urd get a /UCR prepended. ( The files produced by the idl-compiler have a .urd-suffix. The regmerge tool needs to be run before the typelibrary can be used in a program, because the /UCR key must be prepended ).
$ regcomp -register -r myapp_services.rdb \ -c uuresolver.dll \ -c brdgfctr.dll \ -c acceptor.dll \ -c connectr.dll \ -c remotebridge.dll( \ means here command line continuation ). The option -r gives the registry, where the information shall be written to. If it doesn't exist, it is created, otherwise the new data is added (in case there are older keys, they get overridden). The option -c can be given multiple times, it is followed by a single library name, that shall be registered. Registering a java-component is currently more complicated (we are working on improving the process). It works only in a installed office environment ( office-install/program must be your current working directory), the office setup must point to a valid java installation (you may start jvmsetup from the office/program directory to verify this), and java must be enabled ( see Extras/Options/General/Security). On windows, you MUST copy the regcomp.exe into the office/program directory.
$ regcomp -register -br applicat.rdb \ -l com.sun.star.loader.Java2 \ -r applict.rdb \ -c file:///i:/o641d3pro/program/JavaTestComponent.jar The -br option is used to give the regcomp-tool a registry to work on, because the regcomp-tool doesn't know, in which library the java-loader is to be found. The -l option gives the servicename of the loader to use for the component (it must be com.sun.star.loader.Java2 ). The option can be omitted for C++ components, because regcomp defaults to the com.sun.star.loader.SharedLibrary loader. The option -c gives the (MANDATORY ABSOLUTE) file url to the java component. UNO typelibraryThere are serveral tools, that currently access the typelibrary directly, they are mainly used during building.
| ||
Adding components to the office |
||
StarOffice 6.0 (or OpenOffice 1.0) uses 2 registries, the applicat.rdb (which can be found
at office-install/program/applicat.rdb) and the user60.rdb (which can be found in the home
directory on unix and within the application data directory of your personal windows profile).
The applicat.rdb contains all types which are used by the office. During setup, all choosen components get registered also into the applicat.rdb. The user-specific user60.rdb is opened for write access and is by default empty. How to add a component to an office installation ?A component may bring along new types and new component registration information. There are multiple ways how to integrate a new component into the office (with different advantages/disadvantages) :
| ||
Bootstrapping arbitrary UNO C++ processes |
||
There are many ways to bootstrap an UNO C++ application (probably too many). For every way
you need to properly prepare one or multiple registry files.
Preparing registriesIn general you should have different files for registered components and typelibraries. There are multiple reasons therefor
Bootstrapping mechanismsIn the following all ways of bootstrapping an UNO component context are explained.The uno.exe toolTODOC++ UNO bootstrapping via cppu::defaultBootstrap_InitialComponentContext()TODOC++ UNO bootstrapping via cppu::createRegistryServiceFactory()TODOJava UNO bootstrapping via com.sun.star.comp.helper.Bootstrap.createInitialComponentContext()TODO | ||
Author: Joerg
Budischewski ($Date: 2002/01/24 14:49:40 $)
Copyright 2001 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA. |
||
|