|
Contents |
|
Abstract |
|
While introducing a simple concept for UNO bootstrapping (see my mail in the udk.dev list), I noticed that there is a need for a general bootstrap-argument-passing-mechanism. At the moment, we have different locations where some kind of context knowledge for bootstrapping is needed:
Different, but similar concepts are used (e.g., a file with an entry which points to a special directory). I would like to unify these concepts and to use one mechanism for bootstrapping. I also would like to be able to configure the bootstrapping via command line arguments or via environment variables (which, for instance, may be set by setsolar).
|
|
Two Tiers |
|
During discussion on OpenOffice, the idea of a two tier approach emerged. This idea defines two general purpose mechanisms, which when used together, seem to fulfill all the requirements needed to default bootstrap any UNO application, including OpenOffice and OpenOffice Setup. The two tiers are:
|
|
Bootstrap Arguments |
|
A mechanism to allow differentiated access to bootstrap arguments at the runtime library (RTL) level is needed. Access Bootstrap Arguments via the RTLThe following two functions give access to any bootstrap arguments:
The first function gives direct access to any bootstrap parameter, which may be passed to the application. Four ways are defined by which parameters can be given to the application. The following is a precedence ordered list of the four ways:
Each of these methods is used exclusively, which means, the above mechanisms are tried in order and the search for a bootstrap argument stops with the first one providing a result. Bootstrap arguments which should be passed via command line, must have a special shape, so that they are distinguishable from other command line arguments:
Bootstrap arguments may get passed by an optional .ini/rc file. It is searched for this .ini/rc file beneath the executable. The .ini/rc file must have the same name as the executable, extended with an '.ini' for windows respectively an 'rc' for unix. Any executable extension like '.bin' or '.exe' is stripped from the name:
The name of the .ini/rc file to use can be overwritten with the 'setIniFileName' function. Bootstrap arguments may also get passed via environment variables:
Naming Conventions for Names of Bootstrap ArgumentsNames may only include characters, that is, allowed characters
for environment variables. This excludes '.', ' ', ';', ':' and
all non-ascii characters. Names are case insensitive. Two built-in
variables give access to a users configuration respectively
Range of Values for Bootstrap ArgumentsValues maybe be arbitrary unicode strings which have to be encoded using UTF8. A simple argument expansion is supported:
Special VariablesA special bootstrap argument is supported. This argument defines the name of the '.ini/rc' to use for finding bootstrap arguments. The name of the argument is:
This argument can only be used on the command line:
|
|
Application Arguments |
|
Application arguments are like bootstrap arguments, except, that they are not specifiable via environment variables or ini-files. Application arguments have to be given on the command line and are more like, the formerly called, command line arguments. The following two functions give access to application arguments:
The function "rtl_getAppCommandArg" also supports macro expansion as defined for bootstrap arguments. |
|
UNO Default Bootstrapping |
|
Several things are needed to bootstrap a UNO application, for example, the services the application wants to utilize or the types of the services, if they are not compiled in. Even a mutable and persistent registry for holding application specific data is sometimes needed (e.g., in case of OpenOffice/StarOffice). To bootstrap a UNO application an initial UNO-context is needed. A new function in cppuhelper provides a default, bootstrapped initial UNO-context. Creating a Default Bootstrapped UNO-contextAs already mentioned, a UNO application may need several data, which have to be provided by the application user. To ease the usage of the application, a new function in cppuhelper creates a default bootstrapped UNO-context: Reference<XComponentContext> SAL_CALL defaultBootstrap_InitialComponentContext() SAL_THROW((Exception));
This function is completely externally customizable by the following bootstrap arguments:
This, in conjunction with the rtl bootstrap argument passing possibility, should be sufficient, to bootstrap any UNO application.
|
|
Examples: |
|
Bootstrapping OpenOfficeOpenOffice uses one file as types and as services rdb. It also uses a user dependent writable rdb, which should be located in the users configuration directory. An 'sofficerc' with defines the bootstrap arguments may look like this:
|
|
Author: Kay
Ramme ($Date: 2001/09/18 12:52:46 $) |
|
|