Kaydet (Commit) c2fd9b53 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

New cppu::defaultBootstrap_InitialComponentContext implementation

...that no longer uses XSimpleRegistry structures for the service data and thus
is potentially more performant.

* Registry-based functions from cppuhelper/bootstrap are deprecated now, client
  code should always use defaultBootstrap_InitialComponentContext.

* References to the obsolete UNO_WRITERDB have been removed.

* Some of the functions in cppuhelper/source that are used from multiple .cxx
  but had not been properly placed into .hxx have been cleaned up.

* css.lang.ServiceManager XSet insert/remove now support special
  sequence<NamedValue> to improve live deployment/removal of XML-based extension
  components data.

* 09524d41 "stoc: accelerate opening of multiple
  XML .rdb files in a directory" and its follow-up
  cb5c881a "avoid using the new rdb reading
  logic for empty/non-existent directories" have been obsoleted by this change
  and have been reverted again.
üst b2fdaed4
...@@ -44,8 +44,10 @@ $(eval $(call gb_Library_add_defs,cppuhelper,\ ...@@ -44,8 +44,10 @@ $(eval $(call gb_Library_add_defs,cppuhelper,\
$(eval $(call gb_Library_use_libraries,cppuhelper,\ $(eval $(call gb_Library_use_libraries,cppuhelper,\
cppu \ cppu \
reg \
sal \ sal \
salhelper \ salhelper \
xmlreader \
$(gb_STDLIBS) \ $(gb_STDLIBS) \
)) ))
...@@ -58,6 +60,7 @@ $(eval $(call gb_Library_add_exception_objects,cppuhelper,\ ...@@ -58,6 +60,7 @@ $(eval $(call gb_Library_add_exception_objects,cppuhelper,\
cppuhelper/source/bootstrap \ cppuhelper/source/bootstrap \
cppuhelper/source/component_context \ cppuhelper/source/component_context \
cppuhelper/source/component \ cppuhelper/source/component \
cppuhelper/source/defaultbootstrap \
cppuhelper/source/exc_thrower \ cppuhelper/source/exc_thrower \
cppuhelper/source/factory \ cppuhelper/source/factory \
cppuhelper/source/implbase \ cppuhelper/source/implbase \
...@@ -65,6 +68,7 @@ $(eval $(call gb_Library_add_exception_objects,cppuhelper,\ ...@@ -65,6 +68,7 @@ $(eval $(call gb_Library_add_exception_objects,cppuhelper,\
cppuhelper/source/implementationentry \ cppuhelper/source/implementationentry \
cppuhelper/source/interfacecontainer \ cppuhelper/source/interfacecontainer \
cppuhelper/source/macro_expander \ cppuhelper/source/macro_expander \
cppuhelper/source/paths \
cppuhelper/source/propertysetmixin \ cppuhelper/source/propertysetmixin \
cppuhelper/source/propshlp \ cppuhelper/source/propshlp \
cppuhelper/source/servicefactory \ cppuhelper/source/servicefactory \
......
...@@ -48,6 +48,10 @@ namespace cppu ...@@ -48,6 +48,10 @@ namespace cppu
@rBootstrapPath optional bootstrap path for initial components @rBootstrapPath optional bootstrap path for initial components
@return simple registry service instance @return simple registry service instance
@deprecated Registry-based type/service information is successively
replaced with more modern formats; client code should exclusively use
::cppu::defaultBootstrap_InitialComponentContext (or ::cppu::bootstrap).
*/ */
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::registry::XSimpleRegistry > CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::registry::XSimpleRegistry >
SAL_CALL createSimpleRegistry( SAL_CALL createSimpleRegistry(
...@@ -58,6 +62,10 @@ SAL_CALL createSimpleRegistry( ...@@ -58,6 +62,10 @@ SAL_CALL createSimpleRegistry(
@rBootstrapPath optional bootstrap path for initial components @rBootstrapPath optional bootstrap path for initial components
@return nested registry service instance @return nested registry service instance
@deprecated Registry-based type/service information is successively
replaced with more modern formats; client code should exclusively use
::cppu::defaultBootstrap_InitialComponentContext (or ::cppu::bootstrap).
*/ */
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::registry::XSimpleRegistry > CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::registry::XSimpleRegistry >
SAL_CALL createNestedRegistry( SAL_CALL createNestedRegistry(
...@@ -83,6 +91,10 @@ CPPUHELPER_DLLPUBLIC sal_Bool SAL_CALL installTypeDescriptionManager( ...@@ -83,6 +91,10 @@ CPPUHELPER_DLLPUBLIC sal_Bool SAL_CALL installTypeDescriptionManager(
@param xRegistry registry for service manager and singleton objects of context (may be null) @param xRegistry registry for service manager and singleton objects of context (may be null)
@param rBootstrapPath optional bootstrap path for initial components @param rBootstrapPath optional bootstrap path for initial components
@return component context @return component context
@deprecated Registry-based type/service information is successively
replaced with more modern formats; client code should exclusively use
::cppu::defaultBootstrap_InitialComponentContext (or ::cppu::bootstrap).
*/ */
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > SAL_CALL CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > SAL_CALL
bootstrap_InitialComponentContext( bootstrap_InitialComponentContext(
...@@ -91,19 +103,13 @@ bootstrap_InitialComponentContext( ...@@ -91,19 +103,13 @@ bootstrap_InitialComponentContext(
SAL_THROW( (::com::sun::star::uno::Exception) ); SAL_THROW( (::com::sun::star::uno::Exception) );
/** Bootstraps an initial component context with service manager upon default types and /** Bootstraps an initial component context with service manager upon
services registry. information from bootstrap variables.
This includes insertion of initial services:
- (registry) service manager, shared lib loader,
- simple registry, nested registry,
- implementation registration
- registry typedescription provider, typedescription manager (also installs it into cppu core)
This function tries to find its parameters via these bootstrap variables: This function tries to find its parameters via these bootstrap variables:
- UNO_TYPES -- a space separated list of file urls of type rdbs - UNO_TYPES -- a space separated list of file urls of type rdbs
- UNO_SERVICES -- a space separated list of file urls of service rdbs - UNO_SERVICES -- a space separated list of file urls of service rdbs
- UNO_WRITERDB -- a file url of a write rdb (e.g. user.rdb)
Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html
for further info. for further info.
...@@ -114,19 +120,13 @@ CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XC ...@@ -114,19 +120,13 @@ CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XC
defaultBootstrap_InitialComponentContext() SAL_THROW( (::com::sun::star::uno::Exception) ); defaultBootstrap_InitialComponentContext() SAL_THROW( (::com::sun::star::uno::Exception) );
/** Bootstraps an initial component context with service manager upon default types and /** Bootstraps an initial component context with service manager upon
services registry. information from an ini file.
This includes insertion of initial services:
- (registry) service manager, shared lib loader,
- simple registry, nested registry,
- implementation registration
- registry typedescription provider, typedescription manager (also installs it into cppu core)
This function tries to find its parameters via these bootstrap variables: This function tries to find its parameters via these bootstrap variables:
- UNO_TYPES -- a space separated list of file urls of type rdbs - UNO_TYPES -- a space separated list of file urls of type rdbs
- UNO_SERVICES -- a space separated list of file urls of service rdbs - UNO_SERVICES -- a space separated list of file urls of service rdbs
- UNO_WRITERDB -- a file url of a write rdb (e.g. user.rdb)
Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html
for further info. for further info.
......
ch cppuhelper : BOOST:boost LIBXSLT:libxslt DESKTOP:codemaker cppu offapi NULL ch cppuhelper : BOOST:boost LIBXSLT:libxslt DESKTOP:codemaker cppu offapi registry salhelper xmlreader NULL
ch cppuhelper\prj nmake - all ch_prj NULL ch cppuhelper\prj nmake - all ch_prj NULL
ch cppuhelper\qa\propertysetmixin nmake - all ch_qa_propertysetmixin ch_prj NULL ch cppuhelper\qa\propertysetmixin nmake - all ch_qa_propertysetmixin ch_prj NULL
This diff is collapsed.
This diff is collapsed.
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "macro_expander.hxx" #include "macro_expander.hxx"
#include "paths.hxx"
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
#define SERVICE_NAME_A "com.sun.star.lang.MacroExpander" #define SERVICE_NAME_A "com.sun.star.lang.MacroExpander"
...@@ -54,8 +55,29 @@ using namespace ::com::sun::star::uno; ...@@ -54,8 +55,29 @@ using namespace ::com::sun::star::uno;
namespace cppu namespace cppu
{ {
//---- private forward -----------------------------------------------------------------------------
Bootstrap const & get_unorc() SAL_THROW(()); Bootstrap const & get_unorc() SAL_THROW(())
{
static rtlBootstrapHandle s_bstrap = 0;
if (! s_bstrap)
{
OUString iniName(getUnoIniUri());
rtlBootstrapHandle bstrap = rtl_bootstrap_args_open( iniName.pData );
ClearableMutexGuard guard( Mutex::getGlobalMutex() );
if (s_bstrap)
{
guard.clear();
rtl_bootstrap_args_close( bstrap );
}
else
{
s_bstrap = bstrap;
}
}
return *(Bootstrap const *)&s_bstrap;
}
} }
namespace cppuhelper { namespace detail { namespace cppuhelper { namespace detail {
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "sal/config.h"
#include "com/sun/star/uno/DeploymentException.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/XInterface.hpp"
#include "osl/module.hxx"
#include "osl/mutex.hxx"
#include "rtl/ustring.hxx"
#include "sal/types.h"
#include "paths.hxx"
namespace {
namespace css = com::sun::star;
}
rtl::OUString cppu::get_this_libpath() {
static rtl::OUString s_uri;
if (s_uri.isEmpty()) {
rtl::OUString uri;
osl::Module::getUrlFromAddress(
reinterpret_cast< oslGenericFunction >(get_this_libpath), uri);
sal_Int32 i = uri.lastIndexOf('/');
if (i == -1) {
throw css::uno::DeploymentException(
"URI " + uri + " is expected to contain a slash",
css::uno::Reference< css::uno::XInterface >());
}
uri = uri.copy(0, i);
osl::MutexGuard guard(osl::Mutex::getGlobalMutex());
if (s_uri.isEmpty()) {
s_uri = uri;
}
}
return s_uri;
}
rtl::OUString cppu::getUnoIniUri() {
#if defined ANDROID
// Wouldn't it be lovely to avoid this fugly hard-coding.
// The problem is that the 'create_bootstrap_macro_expander_factory()'
// required for bootstrapping services, calls cppu::get_unorc directly
// instead of re-using the BoostrapHandle from:
// defaultBootstrap_InitialComponentContext
// and since rtlBootstrapHandle is not ref-counted doing anything
// clean here is hardish.
rtl::OUString uri("file:///assets/program");
#else
rtl::OUString uri(get_this_libpath());
#endif
return uri + "/" SAL_CONFIGFILE("uno");
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef CPPUHELPER_SOURCE_PATHS_HXX
#define CPPUHELPER_SOURCE_PATHS_HXX
#include "sal/config.h"
namespace rtl { class OUString; }
namespace cppu {
rtl::OUString get_this_libpath();
rtl::OUString getUnoIniUri();
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -59,6 +59,8 @@ ...@@ -59,6 +59,8 @@
#endif #endif
#include "macro_expander.hxx" #include "macro_expander.hxx"
#include "paths.hxx"
#include "servicefactory_detail.hxx"
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
...@@ -75,9 +77,6 @@ namespace cppu ...@@ -75,9 +77,6 @@ namespace cppu
Reference< security::XAccessController > Reference< security::XAccessController >
createDefaultAccessController() SAL_THROW(()); createDefaultAccessController() SAL_THROW(());
OUString const & get_this_libpath();
static Reference< XInterface > SAL_CALL createInstance( static Reference< XInterface > SAL_CALL createInstance(
Reference< XInterface > const & xFactory, Reference< XInterface > const & xFactory,
Reference< XComponentContext > const & xContext = Reference< XComponentContext > const & xContext =
...@@ -182,7 +181,7 @@ Reference< registry::XSimpleRegistry > SAL_CALL createNestedRegistry( ...@@ -182,7 +181,7 @@ Reference< registry::XSimpleRegistry > SAL_CALL createNestedRegistry(
UNO_AC_POLICYFILE=<file_url> [optional] UNO_AC_POLICYFILE=<file_url> [optional]
-- read policy out of simple text file -- read policy out of simple text file
*/ */
static void add_access_control_entries( void add_access_control_entries(
::std::vector< ContextEntry_Init > * values, ::std::vector< ContextEntry_Init > * values,
Bootstrap const & bootstrap ) Bootstrap const & bootstrap )
SAL_THROW( (Exception) ) SAL_THROW( (Exception) )
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef INCLUDED_CPPUHELPER_SOURCE_SERVICEFACTORY_DETAIL_HXX
#define INCLUDED_CPPUHELPER_SOURCE_SERVICEFACTORY_DETAIL_HXX
#include "sal/config.h"
#include <vector>
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "sal/types.h"
namespace com { namespace sun { namespace star { namespace lang {
class XMultiComponentFactory;
} } } }
namespace cppu { struct ContextEntry_Init; }
namespace rtl {
class Bootstrap;
class OUString;
}
namespace cppu {
void add_access_control_entries(
std::vector< cppu::ContextEntry_Init > * values,
rtl::Bootstrap const & bootstrap)
SAL_THROW((com::sun::star::uno::Exception));
com::sun::star::uno::Reference< com::sun::star::lang::XMultiComponentFactory >
bootstrapInitialSF(rtl::OUString const & rBootstrapPath)
SAL_THROW((com::sun::star::uno::Exception));
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include "cppuhelper/implbase2.hxx" #include "cppuhelper/implbase2.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include "osl/file.hxx"
#include "registry/registry.hxx" #include "registry/registry.hxx"
#include "registry/regtype.h" #include "registry/regtype.h"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
...@@ -85,12 +84,6 @@ public: ...@@ -85,12 +84,6 @@ public:
private: private:
virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException); virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException);
virtual void SAL_CALL openRdb(
rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
throw (
css::registry::InvalidRegistryException,
css::uno::RuntimeException);
virtual void SAL_CALL open( virtual void SAL_CALL open(
rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate) rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
throw ( throw (
...@@ -1137,17 +1130,27 @@ rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName) ...@@ -1137,17 +1130,27 @@ rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName)
return resolved; return resolved;
} }
rtl::OUString SimpleRegistry::getURL() throw (css::uno::RuntimeException) rtl::OUString SimpleRegistry::getURL() throw (css::uno::RuntimeException) {
{
osl::MutexGuard guard(mutex_); osl::MutexGuard guard(mutex_);
return textual_.get() == 0 ? registry_.getName() : textual_->getUri(); return textual_.get() == 0 ? registry_.getName() : textual_->getUri();
} }
void SimpleRegistry::openRdb( void SimpleRegistry::open(
rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate) rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{ {
osl::MutexGuard guard(mutex_); osl::MutexGuard guard(mutex_);
if (textual_.get() != 0) {
throw css::registry::InvalidRegistryException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.registry.SimpleRegistry.open(")) +
rURL +
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"): instance already open"))),
static_cast< OWeakObject * >(this));
}
RegError err = (rURL.isEmpty() && bCreate) RegError err = (rURL.isEmpty() && bCreate)
? REG_REGISTRY_NOT_EXISTS ? REG_REGISTRY_NOT_EXISTS
: registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE); : registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE);
...@@ -1159,10 +1162,7 @@ void SimpleRegistry::openRdb( ...@@ -1159,10 +1162,7 @@ void SimpleRegistry::openRdb(
break; break;
case REG_INVALID_REGISTRY: case REG_INVALID_REGISTRY:
if (bReadOnly && !bCreate) { if (bReadOnly && !bCreate) {
if (!textual_.get()) textual_.reset(new stoc::simpleregistry::TextualServices(rURL));
textual_.reset(new stoc::simpleregistry::TextualServices(rURL));
else
textual_->merge(rURL);
break; break;
} }
// fall through // fall through
...@@ -1180,72 +1180,6 @@ void SimpleRegistry::openRdb( ...@@ -1180,72 +1180,6 @@ void SimpleRegistry::openRdb(
} }
} }
void SimpleRegistry::open(
rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
osl::MutexGuard guard(mutex_);
osl::DirectoryItem aItem;
osl::FileBase::RC eErr;
osl::FileStatus aStatus(osl_FileStatus_Mask_Type);
// FIXME: busts the 'create' mode ...
if ((eErr = osl::DirectoryItem::get( rURL, aItem )) != osl::FileBase::E_None ||
(eErr = aItem.getFileStatus( aStatus )) != osl::FileBase::E_None ||
!aStatus.isDirectory())
{
if (textual_.get() != 0)
throw css::registry::InvalidRegistryException(
(rtl::OUString("com.sun.star.registry.SimpleRegistry.open(") +
rURL + rtl::OUString("): instance already open")),
static_cast< OWeakObject * >(this));
openRdb (rURL, bReadOnly, bCreate);
}
else
{
osl::Directory dir(rURL);
eErr = dir.open();
if (eErr != osl::FileBase::E_None)
goto err_throw;
for (;;) {
osl::DirectoryItem i;
if (dir.getNextItem(i, SAL_MAX_UINT32) != osl::FileBase::E_None)
break;
osl::FileStatus stat(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName |
osl_FileStatus_Mask_FileURL);
if (i.getFileStatus(stat) != osl::FileBase::E_None)
throw css::uno::RuntimeException(
(rtl::OUString("cannot stat in directory ") + rURL ),
css::uno::Reference< css::uno::XInterface >());
rtl::OUString aName = stat.getFileName();
// Ignore backup files - to allow people to edit their
// services/ without extremely confusing behaviour
if (aName.toChar() == '.' || aName.endsWithAsciiL("~", 1))
continue;
if (stat.getFileType() != osl::FileStatus::Directory)
openRdb(stat.getFileURL(), bReadOnly, bCreate);
}
}
return;
err_throw:
throw css::registry::InvalidRegistryException(
(rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.registry.SimpleRegistry.open(")) +
rURL +
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"): error statting url = ")) +
rtl::OUString::valueOf(static_cast< sal_Int32 >(eErr))),
static_cast< OWeakObject * >(this));
}
sal_Bool SimpleRegistry::isValid() throw (css::uno::RuntimeException) { sal_Bool SimpleRegistry::isValid() throw (css::uno::RuntimeException) {
osl::MutexGuard guard(mutex_); osl::MutexGuard guard(mutex_);
return textual_.get() != 0 || registry_.isValid(); return textual_.get() != 0 || registry_.isValid();
......
...@@ -1235,15 +1235,6 @@ css::uno::Sequence< rtl::OUString > Key::getChildren() { ...@@ -1235,15 +1235,6 @@ css::uno::Sequence< rtl::OUString > Key::getChildren() {
TextualServices::TextualServices(rtl::OUString const & uri): TextualServices::TextualServices(rtl::OUString const & uri):
uri_(uri), data_(new Data) uri_(uri), data_(new Data)
{
merge(uri);
}
TextualServices::~TextualServices() {}
// load and merge registry contents from uri
void TextualServices::merge(const rtl::OUString &uri)
throw (com::sun::star::registry::InvalidRegistryException)
{ {
try { try {
Parser(uri, data_); Parser(uri, data_);
...@@ -1256,6 +1247,8 @@ void TextualServices::merge(const rtl::OUString &uri) ...@@ -1256,6 +1247,8 @@ void TextualServices::merge(const rtl::OUString &uri)
} }
} }
TextualServices::~TextualServices() {}
css::uno::Reference< css::registry::XRegistryKey > TextualServices::getRootKey() css::uno::Reference< css::registry::XRegistryKey > TextualServices::getRootKey()
{ {
return new Key(data_, std::vector< rtl::OUString >()); return new Key(data_, std::vector< rtl::OUString >());
......
...@@ -53,9 +53,6 @@ public: ...@@ -53,9 +53,6 @@ public:
virtual ~TextualServices(); virtual ~TextualServices();
void merge(const rtl::OUString &uri)
throw (com::sun::star::registry::InvalidRegistryException);
inline rtl::OUString getUri() { return uri_; } inline rtl::OUString getUri() { return uri_; }
com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey >
......
...@@ -75,6 +75,21 @@ module com { module sun { module star { module lang { ...@@ -75,6 +75,21 @@ module com { module sun { module star { module lang {
on the factory when going down (i.e. it is commonly disposed by the component context).</dd> on the factory when going down (i.e. it is commonly disposed by the component context).</dd>
</dl> </dl>
<p>Since LibreOffice 3.6, in addition to instances of
<type>XServiceInfo</type> et al, the
<type scope="com::sun::star::container">XSet</type> of at least the default
C++ service manager implementation now also supports sequences of
<type scope="com::sun::star::beans">NamedValue</type> in <code>insert</code>
and <code>remove</code>. The sequence elements must each have a
<code>Name</code> of <code>uri</code> and a string <code>Value</code> that
is the URI of a service rdb. It is legal for there to be no such
<code>uri</code> elements. For <code>insert</code>, there can additionally
be an optional element with a <code>Name</code> of
<code>component-context</code> and a value that is a non-null reference of
type <type scope="com::sun::star::uno">XComponentContext</type> that shall
be used instead of this service manager's default component context when
loading the corresponding implementations.
@see com::sun::star::uno::XComponentContext @see com::sun::star::uno::XComponentContext
*/ */
published service ServiceManager published service ServiceManager
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment