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