Difference between revisions of "Documentation/DevGuide/Config/Connecting to a Data Source"
OOoWikiBot (talk | contribs) m (FINAL VERSION FOR L10N) |
(adapted to configmgr re-write) |
||
| Line 29: | Line 29: | ||
The <idl>com.sun.star.configuration.ConfigurationProvider</idl> always operates in the user mode, accessing data on behalf of the current user and directing updates to the user's personal layer. | The <idl>com.sun.star.configuration.ConfigurationProvider</idl> always operates in the user mode, accessing data on behalf of the current user and directing updates to the user's personal layer. | ||
| − | + | The backend data store has several shared layers. One of these layers is used to store shared default data. The files for this layer are located in the share directory of the {{PRODUCTNAME}} installation. Additionally there are special layers that are used by the Extension Manager for deploying configuration data associated with extensions. For details, see [[Documentation/DevGuide/Extensions/Extensions|Extensions]]. | |
| − | + | Arguments can be provided that determine the default behavior of views created through this <idl>com.sun.star.configuration.ConfigurationProvider</idl>. The following parameter may be used for this purpose: | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | Arguments can be provided that determine the default behavior of views created through this <idl>com.sun.star.configuration.ConfigurationProvider</idl>. The following | ||
{|border="1" cellpadding=4 style="border-collapse:collapse;" | {|border="1" cellpadding=4 style="border-collapse:collapse;" | ||
| Line 165: | Line 44: | ||
|The user's locale. | |The user's locale. | ||
|This parameter was called "<code>locale</code>" in a former version. The old name is still supported for compatibility. | |This parameter was called "<code>locale</code>" in a former version. The old name is still supported for compatibility. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|} | |} | ||
Revision as of 14:57, 22 June 2010
The first step to access the configuration database is to connect to a configuration data source.
To obtain a provider instance ask the global com.sun.star.lang.ServiceManager for a com.sun.star.configuration.ConfigurationProvider. Typically the first lines of code to get access to configuration data look similar to the following:
// get my global service manager
XMultiServiceFactory xServiceManager = (XMultiServiceFactory)UnoRuntime.queryInterface(
XMultiServiceFactory.class, this.getRemoteServiceManager(
"uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager"));
final String sProviderService = "com.sun.star.configuration.ConfigurationProvider";
// create the provider and remember it as a XMultiServiceFactory
XMultiServiceFactory xProvider = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class,
xServiceManager.createInstance(sProviderService));
This code creates a default com.sun.star.configuration.ConfigurationProvider. The most important interface a com.sun.star.configuration.ConfigurationProvider implements is com.sun.star.lang.XMultiServiceFactory that is used to create further configuration objects.
The com.sun.star.configuration.ConfigurationProvider always operates in the user mode, accessing data on behalf of the current user and directing updates to the user's personal layer.
The backend data store has several shared layers. One of these layers is used to store shared default data. The files for this layer are located in the share directory of the OpenOffice.org installation. Additionally there are special layers that are used by the Extension Manager for deploying configuration data associated with extensions. For details, see Extensions.
Arguments can be provided that determine the default behavior of views created through this com.sun.star.configuration.ConfigurationProvider. The following parameter may be used for this purpose:
| Parameter Name | Type | Default | Comments |
|---|---|---|---|
Locale
|
string
|
The user's locale. | This parameter was called "locale" in a former version. The old name is still supported for compatibility.
|
| The default configuration provider obtained when no arguments are given will always be the same object. Be careful not to call <idlml>com.sun.star.lang.XComponent:dispose</idlml>() on this shared com.sun.star.configuration.ConfigurationProvider.
If you provide any arguments, then a new instance is created. You must then call <idlml>com.sun.star.lang.XComponent:dispose</idlml>() on this com.sun.star.configuration.ConfigurationProvider. |
| Content on this page is licensed under the Public Documentation License (PDL). |