1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ConfigurationProvider.idl,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef __com_sun_star_configuration_ConfigurationProvider_idl__
31 #define __com_sun_star_configuration_ConfigurationProvider_idl__
33 #ifndef __com_sun_star_lang_XMultiServiceFactory_idl__
34 #include
<com
/sun
/star
/lang
/XMultiServiceFactory.idl
>
37 #ifndef __com_sun_star_lang_XComponent_idl__
38 #include
<com
/sun
/star
/lang
/XComponent.idl
>
41 //=============================================================================
43 module com
{ module sun
{ module star
{ module configuration
{
45 //=============================================================================
46 /** manages one, or more, complete sets of configuration data and serves as a
47 factory for objects that provide access to a subset of the configuration.
49 <p>An implementation is usually obtained from a
50 <type scope="com::sun::star::lang">ServiceManager</type>. The arguments passed to
51 <member scope="com::sun::star::lang">XMultiComponentFactory::createInstanceWithContextAndArguments()</member>
52 select the configuration data source. Arguments must be provided as
53 <type scope="com::sun::star::beans">NamedValue</type>
54 or <type scope="com::sun::star::beans">PropertyValue</type>.
55 If the parameters given are incomplete missing values are taken
56 from the context or the environment. If an instance already exists for the
57 given set of arguments, the existing instance may be reused.
58 In particular, instantiating a provider without explicit arguments to access
59 the default configuration data will always yield the same
60 <type scope="com::sun::star::configuration">DefaultProvider</type> object.
63 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
64 may be given default values during creation of this service. In particular
65 this applies to the parameters <code>"Locale"</code> and <code>"EnableAsync"</code>.
68 published service ConfigurationProvider
70 /** allows creating access objects for specific views such as subsets and fragments
73 <p>The parameter <var>aServiceSpecifier</var> passed to
74 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
75 supports at least the service specifiers
76 <code>"com.sun.star.configuration.ConfigurationAccess"</code> and
77 <code>"com.sun.star.configuration.ConfigurationUpdateAccess"</code>.
80 <p>Using the first of these service specifiers requests a read-only view of
82 The object that is created implements service <type>ConfigurationAccess</type>.
83 To reflect its <em>element role</em> as root of the view, it implements
84 service <type>AccessRootElement</type>.
87 <p>Using the second form requests an updatable view of the configuration.
88 The object that is created should implement service
89 <type>ConfigurationUpdateAccess</type>. To reflect its <em>element role</em>
90 which includes controlling updates for the whole view, it implements
91 service <type>UpdateRootElement</type>.
92 <BR />If the root element of the view is marked read-only (as indicated
93 by <const scope="com::sun::star::beans">PropertyAttributes::READONLY</const>),
94 the implementation may either raise an exception or return a (read-only)
95 <type>ConfigurationAccess</type>/<type>AccessRootElement</type> instead.
98 <p>The arguments passed to
99 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
100 in parameter <var>aArguments</var> specify the view of the configuration that
101 should be created. That is, they determine the subset of elements that can be
102 accessed starting from the returned object. Each element of the argument
103 sequence should be a <type scope="com::sun::star::beans">PropertyValue</type>
104 or a <type scope="com::sun::star::beans">NamedValue</type>,
105 so that the parameters can be identified by name rather than by position.
108 <p>What combinations of arguments are supported depends on the service name.
111 <p>With both of the standard service-specifiers above, an implementation must
112 accept a single argument named <code>nodepath</code> of type <atom>string</atom>.
113 This argument must contain the absolute path to an element of the
114 configuration. The view that is selected consists of the named element and
118 <p>Other arguments can be used to control the behavior of the view. These
119 are different for different implementations. Whether and how they are used
120 may also depend on the configuration store and configuration that were
121 selected when the provider was created.
124 <p>An implementation must ignore unknown arguments.</p>
126 <p>Some parameters that are commonly supported are:</p>
130 <strong>Selecting data into a view:</strong>
132 <dt><code>"nodepath"</code> : <atom>string</atom></dt>
133 <dd>specifies the location of the view root in the configuration.</dd>
134 <dt><code>"depth"</code> : <atom>short</atom></dt>
135 <dd>specifies that elements of the hierarchy that are more than the given
136 number of nesting levels away from the root need not be included in the
139 <dt><code>"locale"</code> : <type scope="com::sun::star::lang">Locale</type></dt>
140 <dd>specifies the locale for which localized values should be
145 <p><strong>Example:</strong> In the hierarchy
149 - B2 - C2 (localized: de, en, fr, ..)
155 | - C4 - D3 - E2 - F1
166 <BR />selecting a view with <code>nodepath = "/A/B2"</code>,
167 <code>depth = 2</code> and <code>locale = <Locale for en_US></code>
168 would result in the tree fragment
185 <strong>Controlling cache behavior:</strong> (with providers that
186 cache configuration data)
188 <dt><code>"enableasync"</code> : <atom>boolean</atom></dt>
189 <dd>controls how updates are handled in the cache. If <TRUE/>, the
190 cache may operate in <em>write-back</em> mode, where updates at
191 first only affect the cache and are written to persistent storage
192 at some later time. If <FALSE/>, the cache must operate in
193 <em>write-through</em> mode, where updates are written to persistent
194 storage at once - that is before
195 <member scope="com::sun::star::util">XChangesBatch::commitChanges()</member>
197 <p><em>This parameter was formerly called <code>"lazywrite"</code>.
198 The old name should still be supported for compatibility.
202 <dt><code>"nocache"</code> : <atom>boolean</atom></dt>
203 <dd>This deprecated parameter
204 specifies that data for the view is not taken from the cache, but
205 read directly from storage. This may entail that future changes that
206 become visible in the cache are not reflected in this view and that
207 changes done through this view are not reflected in the cache.
208 <BR /><strong>Use with caution !</strong>
209 <p><em>This parameter is not supported by all implementations and may be
217 <p><member scope="com::sun::star::lang">XMultiServiceFactory::createInstance()</member>
218 may be unusable. Only an implementation that supports service names that can be
219 used with no further arguments support this method. It should return the
221 <member scope="com::sun::star::lang">XMultiServiceFactory::createInstanceWithArguments()</member>
222 had been called using an empty sequence of arguments.
225 interface com
::sun
::star
::lang
::XMultiServiceFactory
;
228 /** allows controlling or observing the lifetime of the configuration.
230 <p>The owner of the provider may dispose of this object
231 using <member scope="com::sun::star::lang">XComponent::dispose()</member>.
232 Note that the default provider is owned by the
233 <type scope="com::sun::star::lang">ServiceManager</type> and should not be
234 disposed of by user code.
237 <p>Views created by the provider generally refer to data that is managed by
238 the provider. Therefore, disposing of the provider will cause all objects
239 belonging to these views to be disposed of as well. This does not apply to
240 <em>snapshot</em> views that have their own copy of the data, if available.
244 interface com
::sun
::star
::lang
::XComponent
;
248 //=============================================================================