Command Line Registry Tools

From Apache OpenOffice Wiki
Jump to: navigation, search

There are various tools to create, modify and use registries. This section shows some common use cases. The regmerge tool is used to merge multiple registries into a sub-key of an existing or new registry. For instance:

 $ regmerge new.rdb / test1.rdb test2.rdb

merges the contents of test1.rdb and test2.rdb under the root key / of the registry database 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 an identical key names exist in 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.rdb

The following command merges the contents of test1.urd and test2.urd under the key /UCR into the file myapp_types.rdb.

 $ regmerge myapp_types.rdb /UCR test1.urd test2.urd

The names of the keys in test1.urd and test2.urd should only be added to the /UCR key. This is a real life scenario as the files produced by the idl-compiler have a .urd-suffix. The regmerge tool needs to be run before the type library can be used in a program, because UNO expects each type description below the /UCR key.

Component Registration Tool

Components can be registered using the regcomp tool. Below, the components necessary to establish an interprocess connection are registered into the myapp_services.rdb.

 $ regcomp -register -r myapp_services.rdb \
                     -c uuresolver.dll \ 
                     -c brdgfctr.dll \ 
                     -c acceptor.dll \ 
                     -c connectr.dll \ 
                     -c remotebridge.dll

The \ means command line continuation. The option -r gives the registry file where the information is written to. If it does not exist, it is created, otherwise the new data is added. In case there are older keys, they are overwritten. The registry file (here myapp_services.rdb) must NOT be opened by any other process at the same time. The option -c is followed by a single name of a library that is registered. The -c option can be given multiple times. The shared libraries registered in the example above are needed to use the UNO interprocess bridge.

Registering a Java component is currently more complex. It works only in an installed office environment, the <OfficePath>/program must be the current working directory, the office setup must point to a valid Java installation that can be verified using jvmsetup from <OfficePath>/program, and Java must be enabled. See Tools - Options - General - Security. In 2.x, make sure that a Java is selected by using the Java panel of the options dialog (Tools - Options - OpenOffice - Java).

The office must not run. On Unix, the LD_LIBRARY_PATH environment variable must additionally contain the directories listed by the javaldx tool (which is installed with the office).

Copy the regcomp executable into the <officepath>/program directory. The regcomp tool must then be invoked using the following parameters :

 $ regcomp -register -r your_registry.rdb \
                     -br <officepath>/program/services.rdb \
                     -l \
                     -c file:///d:/test/JavaTestComponent.jar 

The option -r (registry) tells regcomp where to write the registration data and the -br (bootstrap registry) option points regcomp to a registry to read common types from. The regcomp tool does not know the library that has the Java loader. The -l option gives the service name of the loader to use for the component that must be The option can be omitted for C++ components, because regcomp defaults to the loader. The option -c gives the file url to the Java component.

File urls can be given absolute or relative. Absolute file urls must begin with file:///. All other strings are interpreted as relative file urls. The 3rdpartYcomp/filterxy.dll, ../../3rdpartycomp/filterxyz.dll, and filterxyz.dll are a few examples. Relative file urls are interpreted relative to all paths given in the PATH variable on Windows and LD_LIBRARY_PATH variable on Unix.

Java components require an absolute file URL for historical reasons.

Tip.png The regcomp tool should be used only during the development and testing phase of components. For deploying final components, the Extension Manager should be used instead. See Extensions.

UNO Type Library Tools

There are several tools that currently access the type library directly. They are encountered when new UNOIDL types are introduced.

  • idlc, Compiles .idl files into .urd-registry-files.
  • cppumaker, Generates C++ header for a given UNO type list from a type registry used with the UNO C++ binding.
  • javamaker, Generates Java .class files for a given type list from a type registry.
  • rdbmaker, Creates a new registry by extracting given types (including dependent types) from another registry, and is used for generating minimal, but complete type libraries for components. It is useful when building minimal applications that use UNO components.
  • regcompare, Compares a type library to a reference type library and checks for compatibility.
  • regmerge, Merges multiple registries into a certain sub-key of a new or already existing registry.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages