merged tag ooo/OOO330_m14
[LibreOffice.git] / offapi / com / sun / star / configuration / ConfigurationProvider.idl
blobc6924acf6c6e0ffbe408fdf541563a6e995f04ff
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef __com_sun_star_configuration_ConfigurationProvider_idl__
28 #define __com_sun_star_configuration_ConfigurationProvider_idl__
30 #ifndef __com_sun_star_lang_XMultiServiceFactory_idl__
31 #include <com/sun/star/lang/XMultiServiceFactory.idl>
32 #endif
34 #ifndef __com_sun_star_lang_XComponent_idl__
35 #include <com/sun/star/lang/XComponent.idl>
36 #endif
38 //=============================================================================
40 module com { module sun { module star { module configuration {
42 //=============================================================================
43 /** manages one, or more, complete sets of configuration data and serves as a
44 factory for objects that provide access to a subset of the configuration.
46 <p>An implementation is usually obtained from a
47 <type scope="com::sun::star::lang">ServiceManager</type>. The arguments passed to
48 <member scope="com::sun::star::lang">XMultiComponentFactory::createInstanceWithContextAndArguments()</member>
49 select the configuration data source. Arguments must be provided as
50 <type scope="com::sun::star::beans">NamedValue</type>
51 or <type scope="com::sun::star::beans">PropertyValue</type>.
52 If the parameters given are incomplete missing values are taken
53 from the context or the environment. If an instance already exists for the
54 given set of arguments, the existing instance may be reused.
55 In particular, instantiating a provider without explicit arguments to access
56 the default configuration data will always yield the same
57 <type scope="com::sun::star::configuration">DefaultProvider</type> object.
58 </p>
59 <p>Some arguments for
60 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
61 may be given default values during creation of this service. In particular
62 this applies to the parameters <code>"Locale"</code> and <code>"EnableAsync"</code>.
63 </p>
65 published service ConfigurationProvider
67 /** allows creating access objects for specific views such as subsets and fragments
68 of the configuration.
70 <p>The parameter <var>aServiceSpecifier</var> passed to
71 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
72 supports at least the service specifiers
73 <code>"com.sun.star.configuration.ConfigurationAccess"</code> and
74 <code>"com.sun.star.configuration.ConfigurationUpdateAccess"</code>.
75 </p>
77 <p>Using the first of these service specifiers requests a read-only view of
78 the configuration.
79 The object that is created implements service <type>ConfigurationAccess</type>.
80 To reflect its <em>element role</em> as root of the view, it implements
81 service <type>AccessRootElement</type>.
82 </p>
84 <p>Using the second form requests an updatable view of the configuration.
85 The object that is created should implement service
86 <type>ConfigurationUpdateAccess</type>. To reflect its <em>element role</em>
87 which includes controlling updates for the whole view, it implements
88 service <type>UpdateRootElement</type>.
89 <BR />If the root element of the view is marked read-only (as indicated
90 by <const scope="com::sun::star::beans">PropertyAttributes::READONLY</const>),
91 the implementation may either raise an exception or return a (read-only)
92 <type>ConfigurationAccess</type>/<type>AccessRootElement</type> instead.
93 </p>
95 <p>The arguments passed to
96 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
97 in parameter <var>aArguments</var> specify the view of the configuration that
98 should be created. That is, they determine the subset of elements that can be
99 accessed starting from the returned object. Each element of the argument
100 sequence should be a <type scope="com::sun::star::beans">PropertyValue</type>
101 or a <type scope="com::sun::star::beans">NamedValue</type>,
102 so that the parameters can be identified by name rather than by position.
103 </p>
105 <p>What combinations of arguments are supported depends on the service name.
106 </p>
108 <p>With both of the standard service-specifiers above, an implementation must
109 accept a single argument named <code>nodepath</code> of type <atom>string</atom>.
110 This argument must contain the absolute path to an element of the
111 configuration. The view that is selected consists of the named element and
112 all its decendants.
113 </p>
115 <p>Other arguments can be used to control the behavior of the view. These
116 are different for different implementations. Whether and how they are used
117 may also depend on the configuration store and configuration that were
118 selected when the provider was created.
119 </p>
121 <p>An implementation must ignore unknown arguments.</p>
123 <p>Some parameters that are commonly supported are:</p>
125 <ul>
126 <li>
127 <strong>Selecting data into a view:</strong>
128 <dl>
129 <dt><code>"nodepath"</code> : <atom>string</atom></dt>
130 <dd>specifies the location of the view root in the configuration.</dd>
131 <dt><code>"depth"</code> : <atom>short</atom></dt>
132 <dd>specifies that elements of the hierarchy that are more than the given
133 number of nesting levels away from the root need not be included in the
134 view.
135 </dd>
136 <dt><code>"locale"</code> : <type scope="com::sun::star::lang">Locale</type></dt>
137 <dd>specifies the locale for which localized values should be
138 retrieved.
139 </dd>
140 </dl>
142 <p><strong>Example:</strong> In the hierarchy
143 <BR /><pre>
144 A - B1 - C1
146 - B2 - C2 (localized: de, en, fr, ..)
148 | - C3 - D1
149 | | |
150 | | - D2 - E1
152 | - C4 - D3 - E2 - F1
153 | | |
154 | | - F2
156 | - C5
158 - B3
160 - B4 - C6 - D4 - E3
162 </pre>
163 <BR />selecting a view with <code>nodepath = "/A/B2"</code>,
164 <code>depth = 2</code> and <code>locale = &lt;Locale for en_US&gt;</code>
165 would result in the tree fragment
166 <BR /><pre>
167 (A-) B2 - C2 (en)
169 - C3 - D1
171 | - D2 (..)
173 - C4 - D3 (..)
175 - C5
177 </pre>
178 </p>
179 </li>
181 <li>
182 <strong>Controlling cache behavior:</strong> (with providers that
183 cache configuration data)
184 <dl>
185 <dt><code>"enableasync"</code> : <atom>boolean</atom></dt>
186 <dd>controls how updates are handled in the cache. If <TRUE/>, the
187 cache may operate in <em>write-back</em> mode, where updates at
188 first only affect the cache and are written to persistent storage
189 at some later time. If <FALSE/>, the cache must operate in
190 <em>write-through</em> mode, where updates are written to persistent
191 storage at once - that is before
192 <member scope="com::sun::star::util">XChangesBatch::commitChanges()</member>
193 returns.
194 <p><em>This parameter was formerly called <code>"lazywrite"</code>.
195 The old name should still be supported for compatibility.
196 </em></p>
197 </dd>
199 <dt><code>"nocache"</code> : <atom>boolean</atom></dt>
200 <dd>This deprecated parameter
201 specifies that data for the view is not taken from the cache, but
202 read directly from storage. This may entail that future changes that
203 become visible in the cache are not reflected in this view and that
204 changes done through this view are not reflected in the cache.
205 <BR /><strong>Use with caution !</strong>
206 <p><em>This parameter is not supported by all implementations and may be
207 silently ignored !
208 </em></p>
209 </dd>
210 </dl>
211 </li>
212 </ul>
214 <p><member scope="com::sun::star::lang">XMultiServiceFactory::createInstance()</member>
215 may be unusable. Only an implementation that supports service names that can be
216 used with no further arguments support this method. It should return the
217 same result as if
218 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
219 had been called using an empty sequence of arguments.
220 </p>
222 interface com::sun::star::lang::XMultiServiceFactory;
225 /** allows controlling or observing the lifetime of the configuration.
227 <p>The owner of the provider may dispose of this object
228 using <member scope="com::sun::star::lang">XComponent::dispose()</member>.
229 Note that the default provider is owned by the
230 <type scope="com::sun::star::lang">ServiceManager</type> and should not be
231 disposed of by user code.
232 </p>
234 <p>Views created by the provider generally refer to data that is managed by
235 the provider. Therefore, disposing of the provider will cause all objects
236 belonging to these views to be disposed of as well. This does not apply to
237 <em>snapshot</em> views that have their own copy of the data, if available.
238 </p>
241 interface com::sun::star::lang::XComponent;
245 //=============================================================================
247 }; }; }; };
249 #endif