C++ UNO Runtime Engine
The C++ UNO Runtime Engine is implemented under the cppuhelper module. During bootstrap, it installs a type manager and a service manager. The service manager is installed as follows:
cppuhelper/source/servicemanager.hxx
1
rtl::Reference smgr(
2
new cppuhelper::ServiceManager);
3
smgr->init(getBootstrapVariable(bs, "UNO_SERVICES"));
Copied!
The Service Manager is initialized by parsing a config file, which the environment variable UNO_SERVICES points to on application startup. Whilst there is a legacy config files in a binary format, the preferred format is a well defined XML file. The services configuration file starts something like this:
services.rdb
1
<?xml version="1.0"?>
2
<components xmlns="http://openoffice.org/2010/uno-components">
3
<component loader="com.sun.star.loader.SharedLibrary"
4
environment="gcc3" prefix="binaryurp"
5
uri="vnd.sun.star.expand:$URE_INTERNAL_LIB_DIR/libbinaryurplo.dylib">
6
<implementation name="com.sun.star.comp.bridge.BridgeFactory">
7
<service name="com.sun.star.bridge.BridgeFactory" />
8
</implementation>
9
</component>
10
<component loader="com.sun.star.loader.SharedLibrary"
11
environment="gcc3" prefix="io"
12
uri="vnd.sun.star.expand:$URE_INTERNAL_LIB_DIR/libiolo.dylib">
13
<implementation name="com.sun.star.comp.io.Pump">
14
<service name="com.sun.star.io.Pump" />
15
</implementation>
16
<implementation name="com.sun.star.comp.io.stm.DataInputStream">
17
<service name="com.sun.star.io.DataInputStream" />
18
</implementation>
19
<implementation name="com.sun.star.comp.io.stm.DataOutputStream">
20
<service name="com.sun.star.io.DataOutputStream" />
21
</implementation>
22
<implementation name="com.sun.star.comp.io.stm.MarkableInputStream">
23
<service name="com.sun.star.io.MarkableInputStream" />
24
</implementation>
25
<implementation name="com.sun.star.comp.io.stm.MarkableOutputStream">
26
<service name="com.sun.star.io.MarkableOutputStream" />
27
</implementation>
28
<implementation name="com.sun.star.comp.io.stm.ObjectInputStream">
29
<service name="com.sun.star.io.ObjectInputStream" />
30
</implementation>
31
<implementation name="com.sun.star.comp.io.stm.ObjectOutputStream">
32
<service name="com.sun.star.io.ObjectOutputStream" />
33
</implementation>
34
<implementation name="com.sun.star.comp.io.stm.Pipe">
35
<service name="com.sun.star.io.Pipe" />
36
</implementation>
37
<implementation name="com.sun.star.comp.io.Acceptor">
38
<service name="com.sun.star.connection.Acceptor" />
39
</implementation>
40
<implementation name="com.sun.star.comp.io.Connector">
41
<service name="com.sun.star.connection.Connector" />
42
</implementation>
43
<implementation name="com.sun.star.comp.io.TextInputStream">
44
<service name="com.sun.star.io.TextInputStream" />
45
</implementation>
46
<implementation name="com.sun.star.comp.io.TextOutputStream">
47
<service name="com.sun.star.io.TextOutputStream" />
48
</implementation>
49
</component>
Copied!
The Service Manager needs the following to manage each component:
  • Loader: specifies what loads the component,
  • Environment: it is loaded in (e.g. Java, gcc3, etc.)
  • Module URI: what the service is implemented in.
  • Service implementations: this provides an implementation name, in a namespace, and can provide an optional contructor function to initialize the service (there must, however, be an environment provided in the component)
    • an implementation can have a Service, which is defined by a grouping of interfaces
    • an implementation can further be defined as a Singleton, which defines a global name for a UNO object and determines that there can only be one instance of this object that must be reachable under this name
Copy link
Edit on GitHub