From 1183e1e81b5f2c1aedb70a89b77cb5c51e6ebfcd Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:09:33 +0200 Subject: sb129: #i113189# clean up stoc/source/simpleregistry so that subsequent changes can better modify it --- stoc/source/implementationregistration/implreg.cxx | 25 +- stoc/source/simpleregistry/simpleregistry.cxx | 2341 ++++++++++---------- 2 files changed, 1172 insertions(+), 1194 deletions(-) mode change 100644 => 100755 stoc/source/simpleregistry/simpleregistry.cxx (limited to 'stoc') diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index d803bd44c..eb3e6dc34 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -628,9 +628,9 @@ static void deleteUserLink(const Reference < XRegistryKey >& xRootKey, } else { oldImpl = implEntries.getConstArray()[0]; - + rtl::OUString path(xOldKey->getKeyName()); xOldKey->closeKey(); - xRootKey->deleteKey(xOldKey->getKeyName()); + xRootKey->deleteKey(path); } OUString oldTarget = searchLinkTargetForImpl(xRootKey, linkName, oldImpl); @@ -644,8 +644,9 @@ static void deleteUserLink(const Reference < XRegistryKey >& xRootKey, { bClean = sal_True; hasNoImplementations = sal_False; + rtl::OUString path(xOldKey->getKeyName()); xOldKey->closeKey(); - xRootKey->deleteKey(xOldKey->getKeyName()); + xRootKey->deleteKey(path); } } } else @@ -808,21 +809,24 @@ static void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg, if (hasLocationUrl) { hasLocationUrl = sal_False; + rtl::OUString path(xImplKey->getKeyName()); xImplKey->closeKey(); - xReg->getRootKey()->deleteKey(xImplKey->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } subKeys = xSource->openKeys(); if (subKeys.getLength() == 0) { + rtl::OUString path(xSource->getKeyName()); xSource->closeKey(); - xReg->getRootKey()->deleteKey(xSource->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } else { + rtl::OUString path(xSource->getKeyName()); xSource->closeKey(); - xReg->getRootKey()->deleteKey(xSource->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } @@ -947,21 +951,24 @@ static void deleteAllServiceEntries( const Reference < XSimpleRegistry >& xReg, if (hasNoImplementations) { hasNoImplementations = sal_False; + rtl::OUString path(xServiceKey->getKeyName()); xServiceKey->closeKey(); - xReg->getRootKey()->deleteKey(xServiceKey->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } subKeys = xSource->openKeys(); if (subKeys.getLength() == 0) { + rtl::OUString path(xSource->getKeyName()); xSource->closeKey(); - xReg->getRootKey()->deleteKey(xSource->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } else { + rtl::OUString path(xSource->getKeyName()); xSource->closeKey(); - xReg->getRootKey()->deleteKey(xSource->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx old mode 100644 new mode 100755 index 03faa9a2c..5a7c6f9cd --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -1,1306 +1,1277 @@ /************************************************************************* - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove +* +* 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 +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + #include "precompiled_stoc.hxx" -#include -#include -#include -#ifndef _RTL_USTRBUF_H_ -#include -#endif -#include -#include -#include -#include -#include -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ -#include -#endif -#include - -#include -#include -#include -#include - -using namespace com::sun::star::uno; -using namespace com::sun::star::registry; -using namespace com::sun::star::lang; -using namespace cppu; -using namespace osl; -using namespace rtl; - -#define SERVICENAME "com.sun.star.registry.SimpleRegistry" -#define IMPLNAME "com.sun.star.comp.stoc.SimpleRegistry" +#include "sal/config.h" + +#include +#include + +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/registry/InvalidRegistryException.hpp" +#include "com/sun/star/registry/InvalidValueException.hpp" +#include "com/sun/star/registry/MergeConflictException.hpp" +#include "com/sun/star/registry/RegistryKeyType.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/registry/XSimpleRegistry.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/mutex.hxx" +#include "registry/registry.hxx" +#include "registry/regtype.h" +#include "rtl/ref.hxx" +#include "rtl/string.h" +#include "rtl/string.hxx" +#include "rtl/textcvt.h" +#include "rtl/textenc.h" +#include "rtl/unload.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#include "bootstrapservices.hxx" extern rtl_StandardModuleCount g_moduleCount; -namespace stoc_bootstrap -{ -Sequence< OUString > simreg_getSupportedServiceNames() -{ - static Sequence < OUString > *pNames = 0; - if( ! pNames ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME)); - pNames = &seqNames; - } - } - return *pNames; -} +namespace { -OUString simreg_getImplementationName() -{ - static OUString *pImplName = 0; - if( ! pImplName ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pImplName ) - { - static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) ); - pImplName = &implName; - } - } - return *pImplName; -} -} - -namespace stoc_simreg { - -//************************************************************************* -// class RegistryKeyImpl the implenetation of interface XRegistryKey -//************************************************************************* -class RegistryKeyImpl; - -//************************************************************************* -// SimpleRegistryImpl -//************************************************************************* -class SimpleRegistryImpl : public WeakImplHelper2< XSimpleRegistry, XServiceInfo > +namespace css = com::sun::star; + +class SimpleRegistry: + public cppu::WeakImplHelper2< + css::registry::XSimpleRegistry, css::lang::XServiceInfo > { public: - SimpleRegistryImpl( const Registry& rRegistry ); - - ~SimpleRegistryImpl(); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException); - - // XSimpleRegistry - virtual OUString SAL_CALL getURL() throw(RuntimeException); - virtual void SAL_CALL open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException); - virtual void SAL_CALL close( ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL destroy( ) throw(InvalidRegistryException, RuntimeException); - virtual Reference< XRegistryKey > SAL_CALL getRootKey( ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL mergeKey( const OUString& aKeyName, const OUString& aUrl ) throw(InvalidRegistryException, MergeConflictException, RuntimeException); - - friend class RegistryKeyImpl; -protected: - Mutex m_mutex; - OUString m_url; - Registry m_registry; -}; + SimpleRegistry() { g_moduleCount.modCnt.acquire(&g_moduleCount.modCnt); } + ~SimpleRegistry() { g_moduleCount.modCnt.release(&g_moduleCount.modCnt); } -class RegistryKeyImpl : public WeakImplHelper1< XRegistryKey > -{ -public: - RegistryKeyImpl( const RegistryKey& rKey, SimpleRegistryImpl* pRegistry ); - - RegistryKeyImpl( const OUString& rKeyName, SimpleRegistryImpl* pRegistry ); - - ~RegistryKeyImpl(); - - // XRegistryKey - virtual OUString SAL_CALL getKeyName() throw(RuntimeException); - virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException); - virtual RegistryKeyType SAL_CALL getKeyType( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException); - virtual RegistryValueType SAL_CALL getValueType( ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Int32 SAL_CALL getLongValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setLongValue( sal_Int32 value ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< sal_Int32 > SAL_CALL getLongListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setLongListValue( const ::com::sun::star::uno::Sequence< sal_Int32 >& seqValue ) throw(InvalidRegistryException, RuntimeException); - virtual OUString SAL_CALL getAsciiValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setAsciiValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< OUString > SAL_CALL getAsciiListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setAsciiListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException); - virtual OUString SAL_CALL getStringValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setStringValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< OUString > SAL_CALL getStringListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setStringListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< sal_Int8 > SAL_CALL getBinaryValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setBinaryValue( const ::com::sun::star::uno::Sequence< sal_Int8 >& value ) throw(InvalidRegistryException, RuntimeException); - virtual Reference< XRegistryKey > SAL_CALL openKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException); - virtual Reference< XRegistryKey > SAL_CALL createKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL closeKey( ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL deleteKey( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< Reference< XRegistryKey > > SAL_CALL openKeys( ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< OUString > SAL_CALL getKeyNames( ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Bool SAL_CALL createLink( const OUString& aLinkName, const OUString& aLinkTarget ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL deleteLink( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException); - virtual OUString SAL_CALL getLinkTarget( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException); - virtual OUString SAL_CALL getResolvedName( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException); - -protected: - OUString m_name; - RegistryKey m_key; - SimpleRegistryImpl* m_pRegistry; -}; - -//************************************************************************* -RegistryKeyImpl::RegistryKeyImpl( const RegistryKey& key, SimpleRegistryImpl* pRegistry ) - : m_key(key) - , m_pRegistry(pRegistry) -{ - m_pRegistry->acquire(); - m_name = m_key.getName(); -} + osl::Mutex mutex_; -//************************************************************************* -RegistryKeyImpl::RegistryKeyImpl( const OUString& rKeyName, - SimpleRegistryImpl* pRegistry ) - : m_pRegistry(pRegistry) -{ - m_pRegistry->acquire(); +private: + virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException); - RegistryKey rootKey; - if (!pRegistry->m_registry.isValid() || - pRegistry->m_registry.openRootKey(rootKey)) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - if ( rootKey.openKey(rKeyName, m_key) ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - m_name = rKeyName; - } - } + virtual void SAL_CALL open( + rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException); + + virtual void SAL_CALL close() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL destroy() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL + getRootKey() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isReadOnly() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL mergeKey( + rtl::OUString const & aKeyName, rtl::OUString const & aUrl) + throw ( + css::registry::InvalidRegistryException, + css::registry::MergeConflictException, css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return stoc_bootstrap::simreg_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return stoc_bootstrap::simreg_getSupportedServiceNames(); } + + Registry registry_; +}; + +class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > { +public: + Key( + rtl::Reference< SimpleRegistry > const & registry, + RegistryKey const & key): + registry_(registry), key_(key) {} + +private: + virtual rtl::OUString SAL_CALL getKeyName() + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isReadOnly() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isValid() throw(css::uno::RuntimeException); + + virtual css::registry::RegistryKeyType SAL_CALL getKeyType( + rtl::OUString const & rKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::registry::RegistryValueType SAL_CALL getValueType() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getLongValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setLongValue(sal_Int32 value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() throw( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setLongListValue( + com::sun::star::uno::Sequence< sal_Int32 > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getAsciiValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setAsciiValue(rtl::OUString const & value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setAsciiListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getStringValue() throw( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setStringValue(rtl::OUString const & value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setStringListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setBinaryValue( + css::uno::Sequence< sal_Int8 > const & value) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey( + rtl::OUString const & aKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL + createKey(rtl::OUString const & aKeyName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL closeKey() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL deleteKey(rtl::OUString const & rKeyName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual + css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > + SAL_CALL openKeys() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL createLink( + rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual void SAL_CALL deleteLink(rtl::OUString const & rLinkName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getLinkTarget( + rtl::OUString const & rLinkName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getResolvedName( + rtl::OUString const & aKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + rtl::Reference< SimpleRegistry > registry_; + RegistryKey key_; +}; + +rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) { + osl::MutexGuard guard(registry_->mutex_); + return key_.getName(); } -//************************************************************************* -RegistryKeyImpl::~RegistryKeyImpl() +sal_Bool Key::isReadOnly() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - m_pRegistry->release(); + osl::MutexGuard guard(registry_->mutex_); + return key_.isReadOnly(); } -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getKeyName() throw(RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - return m_name; -} +sal_Bool Key::isValid() throw (css::uno::RuntimeException) { + osl::MutexGuard guard(registry_->mutex_); + return key_.isValid(); +} -//************************************************************************* -sal_Bool SAL_CALL RegistryKeyImpl::isReadOnly( ) - throw(InvalidRegistryException, RuntimeException) +css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if (m_key.isValid()) - { - return(m_key.isReadOnly()); - } else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegKeyType type; + RegError err = key_.getKeyType(rKeyName, &type); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getKeyType:" + " underlying RegistryKey::getKeyType() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} - -//************************************************************************* -sal_Bool SAL_CALL RegistryKeyImpl::isValid( ) throw(RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - return m_key.isValid(); -} + switch (type) { + default: + std::abort(); // this cannot happen + // pseudo-fall-through to avoid warnings on MSC + case RG_KEYTYPE: + return css::registry::RegistryKeyType_KEY; + case RG_LINKTYPE: + return css::registry::RegistryKeyType_LINK; + } +} -//************************************************************************* -RegistryKeyType SAL_CALL RegistryKeyImpl::getKeyType( const OUString& rKeyName ) - throw(InvalidRegistryException, RuntimeException) +css::registry::RegistryValueType Key::getValueType() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( m_key.isValid() ) - { - RegKeyType keyType; - if ( !m_key.getKeyType(rKeyName, &keyType) ) - { - switch (keyType) - { - case RG_KEYTYPE: - return RegistryKeyType_KEY; - case RG_LINKTYPE: - return RegistryKeyType_LINK; - } - } else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegValueType type; + sal_uInt32 size; + RegError err = key_.getValueInfo(rtl::OUString(), &type, &size); + switch (err) { + case REG_NO_ERROR: + break; + case REG_INVALID_VALUE: + type = RG_VALUETYPE_NOT_DEFINED; + break; + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getValueType:" + " underlying RegistryKey::getValueInfo() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + switch (type) { + default: + std::abort(); // this cannot happen + // pseudo-fall-through to avoid warnings on MSC + case RG_VALUETYPE_NOT_DEFINED: + return css::registry::RegistryValueType_NOT_DEFINED; + case RG_VALUETYPE_LONG: + return css::registry::RegistryValueType_LONG; + case RG_VALUETYPE_STRING: + return css::registry::RegistryValueType_ASCII; + case RG_VALUETYPE_UNICODE: + return css::registry::RegistryValueType_STRING; + case RG_VALUETYPE_BINARY: + return css::registry::RegistryValueType_BINARY; + case RG_VALUETYPE_LONGLIST: + return css::registry::RegistryValueType_LONGLIST; + case RG_VALUETYPE_STRINGLIST: + return css::registry::RegistryValueType_ASCIILIST; + case RG_VALUETYPE_UNICODELIST: + return css::registry::RegistryValueType_STRINGLIST; } - - return RegistryKeyType_KEY; -} +} -//************************************************************************* -RegistryValueType SAL_CALL RegistryKeyImpl::getValueType( ) - throw(InvalidRegistryException, RuntimeException) +sal_Int32 Key::getLongValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if (!m_key.isValid()) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if (m_key.getValueInfo(OUString(), &type, &size)) - { - return RegistryValueType_NOT_DEFINED; - } else - { - switch (type) - { - case RG_VALUETYPE_LONG: return RegistryValueType_LONG; - case RG_VALUETYPE_STRING: return RegistryValueType_ASCII; - case RG_VALUETYPE_UNICODE: return RegistryValueType_STRING; - case RG_VALUETYPE_BINARY: return RegistryValueType_BINARY; - case RG_VALUETYPE_LONGLIST: return RegistryValueType_LONGLIST; - case RG_VALUETYPE_STRINGLIST: return RegistryValueType_ASCIILIST; - case RG_VALUETYPE_UNICODELIST: return RegistryValueType_STRINGLIST; - default: return RegistryValueType_NOT_DEFINED; - } - } + osl::MutexGuard guard(registry_->mutex_); + sal_Int32 value; + RegError err = key_.getValue(rtl::OUString(), &value); + switch (err) { + case REG_NO_ERROR: + break; + case REG_INVALID_VALUE: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongValue:" + " underlying RegistryKey::getValue() = REG_INVALID_VALUE")), + static_cast< OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongValue:" + " underlying RegistryKey::getValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } - - return RegistryValueType_NOT_DEFINED; -} + return value; +} -//************************************************************************* -sal_Int32 SAL_CALL RegistryKeyImpl::getLongValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +void Key::setLongValue(sal_Int32 value) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if (!m_key.isValid()) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_LONG) - { - sal_Int32 value; - if ( !m_key.getValue(OUString(), (RegValue)&value) ) - { - return value; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.setValue( + rtl::OUString(), RG_VALUETYPE_LONG, &value, sizeof (sal_Int32)); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setLongValue:" + " underlying RegistryKey::setValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setLongValue( sal_Int32 value ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Sequence< sal_Int32 > Key::getLongListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - if (m_key.setValue(OUString(), RG_VALUETYPE_LONG, &value, sizeof(sal_Int32))) - { - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } + osl::MutexGuard guard(registry_->mutex_); + RegistryValueList< sal_Int32 > list; + RegError err = key_.getLongListValue(rtl::OUString(), list); + switch (err) { + case REG_NO_ERROR: + break; + case REG_VALUE_NOT_EXISTS: + return css::uno::Sequence< sal_Int32 >(); + case REG_INVALID_VALUE: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongListValue:" + " underlying RegistryKey::getLongListValue() =" + " REG_INVALID_VALUE")), + static_cast< OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongListValue:" + " underlying RegistryKey::getLongListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongListValue:" + " underlying RegistryKey::getLongListValue() too large")), + static_cast< OWeakObject * >(this)); } -} + css::uno::Sequence< sal_Int32 > value(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + value[static_cast< sal_Int32 >(i)] = list.getElement(i); + } + return value; +} -//************************************************************************* -Sequence< sal_Int32 > SAL_CALL RegistryKeyImpl::getLongListValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_LONGLIST) - { - RegistryValueList tmpValue; - if ( !m_key.getLongListValue(OUString(), tmpValue) ) - { - Sequence seqValue(size); - - for (sal_uInt32 i=0; i < size; i++) - { - seqValue.getArray()[i] = tmpValue.getElement(i); - } - - return seqValue; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + std::vector< sal_Int32 > list; + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + list.push_back(seqValue[i]); + } + RegError err = key_.setLongListValue( + rtl::OUString(), list.empty() ? 0 : &list[0], + static_cast< sal_uInt32 >(list.size())); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setLongListValue:" + " underlying RegistryKey::setLongListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } } - -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setLongListValue( const Sequence< sal_Int32 >& seqValue ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 length = seqValue.getLength(); - sal_Int32* tmpValue = new sal_Int32[length]; - - for (sal_uInt32 i=0; i < length; i++) - { - tmpValue[i] = seqValue.getConstArray()[i]; - } - - if ( m_key.setLongListValue(OUString(), tmpValue, length) ) - { - delete[] tmpValue; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } - - delete[] tmpValue; - } -} -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getAsciiValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +rtl::OUString Key::getAsciiValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if (!m_key.isValid()) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if ( type == RG_VALUETYPE_STRING ) - { - char* value = new char[size]; - if ( m_key.getValue(OUString(), (RegValue)value) ) - { - delete [] value; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } else - { - OUString ret(OStringToOUString(value, RTL_TEXTENCODING_UTF8)); - delete [] value; - return ret; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegValueType type; + sal_uInt32 size; + RegError err = key_.getValueInfo(rtl::OUString(), &type, &size); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey::getValueInfo() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (type != RG_VALUETYPE_STRING) { + throw css::registry::InvalidValueException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey type = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(type))), + static_cast< OWeakObject * >(this)); } -} + // size contains terminating null (error in underlying registry.cxx): + if (size == 0) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey size 0 cannot happen due to" + " design error")), + static_cast< OWeakObject * >(this)); + } + if (size > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey size too large")), + static_cast< OWeakObject * >(this)); + } + std::vector< char > list(size); + err = key_.getValue(rtl::OUString(), &list[0]); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey::getValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (list[size - 1] != '\0') { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey value must be null-terminated due" + " to design error")), + static_cast< OWeakObject * >(this)); + } + rtl::OUString value; + if (!rtl_convertStringToUString( + &value.pData, &list[0], + static_cast< sal_Int32 >(size - 1), RTL_TEXTENCODING_UTF8, + (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) + { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey not UTF-8")), + static_cast< OWeakObject * >(this)); + } + return value; +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setAsciiValue( const OUString& value ) - throw(InvalidRegistryException, RuntimeException) +void Key::setAsciiValue(rtl::OUString const & value) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - OString sValue = OUStringToOString(value, RTL_TEXTENCODING_UTF8); - sal_uInt32 size = sValue.getLength()+1; - if ( m_key.setValue(OUString(), RG_VALUETYPE_STRING, - (RegValue)(sValue.getStr()), size) ) - { - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } + osl::MutexGuard guard(registry_->mutex_); + rtl::OString utf8; + if (!value.convertToString( + &utf8, RTL_TEXTENCODING_UTF8, + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | + RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) + { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setAsciiValue:" + " value not UTF-16")), + static_cast< OWeakObject * >(this)); + } + RegError err = key_.setValue( + rtl::OUString(), RG_VALUETYPE_STRING, + const_cast< char * >(utf8.getStr()), utf8.getLength() + 1); + // +1 for terminating null (error in underlying registry.cxx) + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setAsciiValue:" + " underlying RegistryKey::setValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} +} -//************************************************************************* -Sequence< OUString > SAL_CALL RegistryKeyImpl::getAsciiListValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) + osl::MutexGuard guard(registry_->mutex_); + RegistryValueList< char * > list; + RegError err = key_.getStringListValue(rtl::OUString(), list); + switch (err) { + case REG_NO_ERROR: + break; + case REG_VALUE_NOT_EXISTS: + return css::uno::Sequence< rtl::OUString >(); + case REG_INVALID_VALUE: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getAsciiListValue: underlying" + " RegistryKey::getStringListValue() = REG_INVALID_VALUE")), + static_cast< OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getAsciiListValue: underlying" + " RegistryKey::getStringListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getAsciiListValue: underlying" + " RegistryKey::getStringListValue() too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + char * el = list.getElement(i); + sal_Int32 size = rtl_str_getLength(el); + if (!rtl_convertStringToUString( + &value[static_cast< sal_Int32 >(i)].pData, el, size, + RTL_TEXTENCODING_UTF8, + (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) { - if (type == RG_VALUETYPE_STRINGLIST) - { - RegistryValueList tmpValue; - if ( !m_key.getStringListValue(OUString(), tmpValue) ) - { - Sequence seqValue(size); - - for (sal_uInt32 i=0; i < size; i++) - { - seqValue.getArray()[i] = - OStringToOUString(tmpValue.getElement(i), RTL_TEXTENCODING_UTF8); - } - - return seqValue; - } - } + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getAsciiListValue: underlying RegistryKey not" + " UTF-8")), + static_cast< OWeakObject * >(this)); } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); } + return value; } - -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setAsciiListValue( const Sequence< OUString >& seqValue ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 length = seqValue.getLength(); - OString* pSValue = new OString[length]; - char** tmpValue = new char*[length]; - for (sal_uInt32 i=0; i < length; i++) - { - pSValue[i] = OUStringToOString(seqValue.getConstArray()[i], RTL_TEXTENCODING_UTF8); - tmpValue[i] = (char*)pSValue[i].getStr(); - } - - if ( m_key.setStringListValue(OUString(), tmpValue, length) ) +void Key::setAsciiListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + osl::MutexGuard guard(registry_->mutex_); + std::vector< rtl::OString > list; + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + rtl::OString utf8; + if (!seqValue[i].convertToString( + &utf8, RTL_TEXTENCODING_UTF8, + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | + RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) { - delete[] pSValue; - delete[] tmpValue; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " setAsciiListValue: value not UTF-16")), + static_cast< OWeakObject * >(this)); } - - delete[] pSValue; - delete[] tmpValue; + list.push_back(utf8); } -} - -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getStringValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else + std::vector< char * > list2; + for (std::vector< rtl::OString >::iterator i(list.begin()); i != list.end(); + ++i) { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_UNICODE) - { - sal_Unicode* value = new sal_Unicode[size]; - if ( m_key.getValue(OUString(), (RegValue)value) ) - { - delete [] value; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } else - { - OUString ret(value); - delete [] value; - return ret; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + list2.push_back(const_cast< char * >(i->getStr())); + } + RegError err = key_.setStringListValue( + rtl::OUString(), list2.empty() ? 0 : &list2[0], + static_cast< sal_uInt32 >(list2.size())); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " setAsciiListValue: underlying" + " RegistryKey::setStringListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setStringValue( const OUString& value ) - throw(InvalidRegistryException, RuntimeException) +rtl::OUString Key::getStringValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 size = (value.getLength() + 1) * sizeof(sal_Unicode); - if ( m_key.setValue(OUString(), RG_VALUETYPE_UNICODE, - (RegValue)(value.getStr()), size) ) - { - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegValueType type; + sal_uInt32 size; + RegError err = key_.getValueInfo(rtl::OUString(), &type, &size); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey::getValueInfo() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (type != RG_VALUETYPE_UNICODE) { + throw css::registry::InvalidValueException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey type = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(type))), + static_cast< OWeakObject * >(this)); + } + // size contains terminating null and is *2 (error in underlying + // registry.cxx): + if (size == 0 || (size & 1) == 1) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey size 0 or odd cannot happen due to" + " design error")), + static_cast< OWeakObject * >(this)); + } + if (size > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey size too large")), + static_cast< OWeakObject * >(this)); + } + std::vector< sal_Unicode > list(size); + err = key_.getValue(rtl::OUString(), &list[0]); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey::getValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (list[size/2 - 1] != 0) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey value must be null-terminated due" + " to design error")), + static_cast< OWeakObject * >(this)); + } + return rtl::OUString(&list[0], static_cast< sal_Int32 >(size/2 - 1)); +} -//************************************************************************* -Sequence< OUString > SAL_CALL RegistryKeyImpl::getStringListValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +void Key::setStringValue(rtl::OUString const & value) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_UNICODELIST) - { - RegistryValueList tmpValue; - if ( !m_key.getUnicodeListValue(OUString(), tmpValue) ) - { - Sequence seqValue(size); - - for (sal_uInt32 i=0; i < size; i++) - { - seqValue.getArray()[i] = OUString(tmpValue.getElement(i)); - } - - return seqValue; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.setValue( + rtl::OUString(), RG_VALUETYPE_UNICODE, + const_cast< sal_Unicode * >(value.getStr()), + (value.getLength() + 1) * sizeof (sal_Unicode)); + // +1 for terminating null (error in underlying registry.cxx) + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setStringValue:" + " underlying RegistryKey::setValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } } - -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setStringListValue( const Sequence< OUString >& seqValue ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 length = seqValue.getLength(); - sal_Unicode** tmpValue = new sal_Unicode*[length]; - - for (sal_uInt32 i=0; i < length; i++) - { - tmpValue[i] = (sal_Unicode*)seqValue.getConstArray()[i].getStr(); - } - if (m_key.setUnicodeListValue(OUString(), tmpValue, length)) - { - delete[] tmpValue; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } - - delete[] tmpValue; - } -} - -//************************************************************************* -Sequence< sal_Int8 > SAL_CALL RegistryKeyImpl::getBinaryValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +css::uno::Sequence< rtl::OUString > Key::getStringListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_BINARY) - { - sal_Int8* value = new sal_Int8[size]; - if (m_key.getValue(OUString(), (RegValue)value)) - { - delete [] value; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } else - { - Sequence seqBytes(value, size); - delete [] value; - return seqBytes; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegistryValueList< sal_Unicode * > list; + RegError err = key_.getUnicodeListValue(rtl::OUString(), list); + switch (err) { + case REG_NO_ERROR: + break; + case REG_VALUE_NOT_EXISTS: + return css::uno::Sequence< rtl::OUString >(); + case REG_INVALID_VALUE: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getStringListValue: underlying" + " RegistryKey::getUnicodeListValue() = REG_INVALID_VALUE")), + static_cast< OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getStringListValue: underlying" + " RegistryKey::getUnicodeListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getStringListValue: underlying" + " RegistryKey::getUnicodeListValue() too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + value[static_cast< sal_Int32 >(i)] = list.getElement(i); + } + return value; +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value ) - throw(InvalidRegistryException, RuntimeException) +void Key::setStringListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 size = value.getLength(); - if ( m_key.setValue(OUString(), RG_VALUETYPE_BINARY, - (RegValue)(value.getConstArray()), size) ) - { - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } - } -} + osl::MutexGuard guard(registry_->mutex_); + std::vector< sal_Unicode * > list; + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + list.push_back(const_cast< sal_Unicode * >(seqValue[i].getStr())); + } + RegError err = key_.setUnicodeListValue( + rtl::OUString(), list.empty() ? 0 : &list[0], + static_cast< sal_uInt32 >(list.size())); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " setStringListValue: underlying" + " RegistryKey::setUnicodeListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::openKey( const OUString& aKeyName ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Sequence< sal_Int8 > Key::getBinaryValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - RegistryKey newKey; - - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError _ret = m_key.openKey(aKeyName, newKey); - if ( _ret ) - { - if ( _ret == REG_INVALID_KEY ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - - return Reference(); - } else - { - return ((XRegistryKey*)new RegistryKeyImpl(newKey, m_pRegistry)); - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegValueType type; + sal_uInt32 size; + RegError err = key_.getValueInfo(rtl::OUString(), &type, &size); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getBinaryValue:" + " underlying RegistryKey::getValueInfo() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (type != RG_VALUETYPE_BINARY) { + throw css::registry::InvalidValueException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getBinaryValue:" + " underlying RegistryKey type = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(type))), + static_cast< OWeakObject * >(this)); + } + if (size > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getBinaryValue:" + " underlying RegistryKey size too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< sal_Int8 > value(static_cast< sal_Int32 >(size)); + err = key_.getValue(rtl::OUString(), value.getArray()); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getBinaryValue:" + " underlying RegistryKey::getValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + return value; +} -//************************************************************************* -Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::createKey( const OUString& aKeyName ) - throw(InvalidRegistryException, RuntimeException) +void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - RegistryKey newKey; - - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError _ret = m_key.createKey(aKeyName, newKey); - if ( _ret ) - { - if (_ret == REG_INVALID_KEY) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - - return Reference(); - } else - { - return ((XRegistryKey*)new RegistryKeyImpl(newKey, m_pRegistry)); - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.setValue( + rtl::OUString(), RG_VALUETYPE_BINARY, + const_cast< sal_Int8 * >(value.getConstArray()), + static_cast< sal_uInt32 >(value.getLength())); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setBinaryValue:" + " underlying RegistryKey::setValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::closeKey( ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Reference< css::registry::XRegistryKey > Key::openKey( + rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( m_key.isValid() ) - { - if ( !m_key.closeKey() ) - return; - } - - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} - -//************************************************************************* -void SAL_CALL RegistryKeyImpl::deleteKey( const OUString& rKeyName ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( m_key.isValid() ) - { - if ( !m_key.deleteKey(rKeyName) ) - return; - } - - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} - -//************************************************************************* -Sequence< Reference< XRegistryKey > > SAL_CALL RegistryKeyImpl::openKeys( ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegistryKeyArray subKeys; - RegError _ret = REG_NO_ERROR; - if ( (_ret = m_key.openSubKeys(OUString(), subKeys)) ) - { - if ( _ret == REG_INVALID_KEY ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - - return Sequence< Reference >(); - } else - { - sal_uInt32 length = subKeys.getLength(); - Sequence< Reference > seqKeys(length); - - for (sal_uInt32 i=0; i < length; i++) - { - seqKeys.getArray()[i] = - (XRegistryKey*) new RegistryKeyImpl(subKeys.getElement(i), m_pRegistry); - } - return seqKeys; - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegistryKey key; + RegError err = key_.openKey(aKeyName, key); + switch (err) { + case REG_NO_ERROR: + return new Key(registry_, key); + case REG_KEY_NOT_EXISTS: + return css::uno::Reference< css::registry::XRegistryKey >(); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key openKey:" + " underlying RegistryKey::openKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -Sequence< OUString > SAL_CALL RegistryKeyImpl::getKeyNames( ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Reference< css::registry::XRegistryKey > Key::createKey( + rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegistryKeyNames subKeys; - RegError _ret = REG_NO_ERROR; - if ( (_ret = m_key.getKeyNames(OUString(), subKeys)) ) - { - if ( _ret == REG_INVALID_KEY ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - - return Sequence(); - } else - { - sal_uInt32 length = subKeys.getLength(); - Sequence seqKeys(length); - - for (sal_uInt32 i=0; i < length; i++) - { - seqKeys.getArray()[i] = subKeys.getElement(i); - } - return seqKeys; - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegistryKey key; + RegError err = key_.createKey(aKeyName, key); + switch (err) { + case REG_NO_ERROR: + return new Key(registry_, key); + case REG_INVALID_KEYNAME: + return css::uno::Reference< css::registry::XRegistryKey >(); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key createKey:" + " underlying RegistryKey::createKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -sal_Bool SAL_CALL RegistryKeyImpl::createLink( const OUString& aLinkName, const OUString& aLinkTarget ) - throw(InvalidRegistryException, RuntimeException) +void Key::closeKey() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError ret = m_key.createLink(aLinkName, aLinkTarget); - if ( ret ) - { - if ( ret == REG_DETECT_RECURSION || - ret == REG_INVALID_KEY ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - return sal_False; - } - } + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.closeKey(); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key closeKey:" + " underlying RegistryKey::closeKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } - return sal_True; } -//************************************************************************* -void SAL_CALL RegistryKeyImpl::deleteLink( const OUString& rLinkName ) - throw(InvalidRegistryException, RuntimeException) +void Key::deleteKey(rtl::OUString const & rKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - if ( m_key.deleteLink(rLinkName) ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.deleteKey(rKeyName); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key deleteKey:" + " underlying RegistryKey::deleteKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } } - -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getLinkTarget( const OUString& rLinkName ) - throw(InvalidRegistryException, RuntimeException) -{ - OUString linkTarget; - - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError ret = m_key.getLinkTarget(rLinkName, linkTarget); - if ( ret ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } - - return linkTarget; -} -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getResolvedName( const OUString& aKeyName ) - throw(InvalidRegistryException, RuntimeException) -{ - OUString resolvedName; - - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError ret = m_key.getResolvedKeyName( - aKeyName, sal_True, resolvedName); - if ( ret ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } - - return resolvedName; -} - -//************************************************************************* -SimpleRegistryImpl::SimpleRegistryImpl( const Registry& rRegistry ) - : m_registry(rRegistry) +css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > +Key::openKeys() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); -} + osl::MutexGuard guard(registry_->mutex_); + RegistryKeyArray list; + RegError err = key_.openSubKeys(rtl::OUString(), list); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key openKeys:" + " underlying RegistryKey::openSubKeys() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getKeyNames:" + " underlying RegistryKey::getKeyNames() too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > + keys(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + keys[static_cast< sal_Int32 >(i)] = new Key( + registry_, list.getElement(i)); + } + return keys; +} -//************************************************************************* -SimpleRegistryImpl::~SimpleRegistryImpl() +css::uno::Sequence< rtl::OUString > Key::getKeyNames() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); + osl::MutexGuard guard(registry_->mutex_); + RegistryKeyNames list; + RegError err = key_.getKeyNames(rtl::OUString(), list); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getKeyNames:" + " underlying RegistryKey::getKeyNames() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getKeyNames:" + " underlying RegistryKey::getKeyNames() too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > names(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + names[static_cast< sal_Int32 >(i)] = list.getElement(i); + } + return names; } -//************************************************************************* -OUString SAL_CALL SimpleRegistryImpl::getImplementationName( ) - throw(RuntimeException) +sal_Bool Key::createLink( + rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - return stoc_bootstrap::simreg_getImplementationName(); -} + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.createLink(aLinkName, aLinkTarget); + switch (err) { + case REG_NO_ERROR: + return true; + case REG_INVALID_KEY: + case REG_DETECT_RECURSION: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key createLink:" + " underlying RegistryKey::createLink() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + default: + return false; + } +} -//************************************************************************* -sal_Bool SAL_CALL SimpleRegistryImpl::supportsService( const OUString& ServiceName ) - throw(RuntimeException) -{ - Guard< Mutex > aGuard( m_mutex ); - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; -} - -//************************************************************************* -Sequence SAL_CALL SimpleRegistryImpl::getSupportedServiceNames( ) - throw(RuntimeException) +void Key::deleteLink(rtl::OUString const & rLinkName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - return stoc_bootstrap::simreg_getSupportedServiceNames(); -} + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.deleteLink(rLinkName); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key deleteLink:" + " underlying RegistryKey::deleteLink() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -OUString SAL_CALL SimpleRegistryImpl::getURL() throw(RuntimeException) +rtl::OUString Key::getLinkTarget(rtl::OUString const & rLinkName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - return m_url; -} + osl::MutexGuard guard(registry_->mutex_); + rtl::OUString target; + RegError err = key_.getLinkTarget(rLinkName, target); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLinkTarget:" + " underlying RegistryKey::getLinkTarget() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + return target; +} -//************************************************************************* -void SAL_CALL SimpleRegistryImpl::open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) - throw(InvalidRegistryException, RuntimeException) +rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - { - m_registry.close(); + osl::MutexGuard guard(registry_->mutex_); + rtl::OUString resolved; + RegError err = key_.getResolvedKeyName(aKeyName, true, resolved); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getResolvedName:" + " underlying RegistryKey::getResolvedName() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } + return resolved; +} - RegAccessMode accessMode = REG_READWRITE; - - if ( bReadOnly ) - accessMode = REG_READONLY; - - if ( !m_registry.open(rURL, accessMode) ) - { - m_url = rURL; - return; - } - - if ( bCreate ) - { - if ( !m_registry.create(rURL) ) - { - m_url = rURL; - return; - } - } - - m_url = OUString(); +rtl::OUString SimpleRegistry::getURL() throw (css::uno::RuntimeException) { + osl::MutexGuard guard(mutex_); + return registry_.getName(); +} - OUStringBuffer reason( 128 ); - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("Couldn't ") ); - if( bCreate ) - { - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("create") ); +void SimpleRegistry::open( + rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + osl::MutexGuard guard(mutex_); + RegError err = (rURL.getLength() == 0 && bCreate) + ? REG_REGISTRY_NOT_EXISTS + : registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE); + if (err == REG_REGISTRY_NOT_EXISTS && bCreate) { + err = registry_.create(rURL); } - else - { - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("open") ); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.open(")) + + rURL + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "): underlying Registry::open/create() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" registry ") ); - reason.append( rURL ); - if( bReadOnly ) - { - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" for reading") ); - } - else - { - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" for writing" ) ); - } - throw InvalidRegistryException( reason.makeStringAndClear() , Reference< XInterface >() ); -} +} -//************************************************************************* -sal_Bool SAL_CALL SimpleRegistryImpl::isValid( ) throw(RuntimeException) -{ - Guard< Mutex > aGuard( m_mutex ); - return m_registry.isValid(); -} +sal_Bool SimpleRegistry::isValid() throw (css::uno::RuntimeException) { + osl::MutexGuard guard(mutex_); + return registry_.isValid(); +} -//************************************************************************* -void SAL_CALL SimpleRegistryImpl::close( ) - throw(InvalidRegistryException, RuntimeException) +void SimpleRegistry::close() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - { - if ( !m_registry.close() ) - { - m_url = OUString(); - return; - } + osl::MutexGuard guard(mutex_); + RegError err = registry_.close(); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.close:" + " underlying Registry::close() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } - - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} +} -//************************************************************************* -void SAL_CALL SimpleRegistryImpl::destroy( ) - throw(InvalidRegistryException, RuntimeException) +void SimpleRegistry::destroy() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - { - if ( !m_registry.destroy(OUString()) ) - { - m_url = OUString(); - return; - } + osl::MutexGuard guard(mutex_); + RegError err = registry_.destroy(rtl::OUString()); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.destroy:" + " underlying Registry::destroy() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } +} - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} - -//************************************************************************* -Reference< XRegistryKey > SAL_CALL SimpleRegistryImpl::getRootKey( ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - return ((XRegistryKey*)new RegistryKeyImpl(OUString( RTL_CONSTASCII_USTRINGPARAM("/") ), this)); - else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(mutex_); + RegistryKey root; + RegError err = registry_.openRootKey(root); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.getRootKey:" + " underlying Registry::getRootKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} + return new Key(this, root); +} -//************************************************************************* -sal_Bool SAL_CALL SimpleRegistryImpl::isReadOnly( ) - throw(InvalidRegistryException, RuntimeException) +sal_Bool SimpleRegistry::isReadOnly() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - return m_registry.isReadOnly(); - else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } -} + osl::MutexGuard guard(mutex_); + return registry_.isReadOnly(); +} -//************************************************************************* -void SAL_CALL SimpleRegistryImpl::mergeKey( const OUString& aKeyName, const OUString& aUrl ) - throw(InvalidRegistryException, MergeConflictException, RuntimeException) +void SimpleRegistry::mergeKey( + rtl::OUString const & aKeyName, rtl::OUString const & aUrl) + throw ( + css::registry::InvalidRegistryException, + css::registry::MergeConflictException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - { - RegistryKey rootKey; - if ( !m_registry.openRootKey(rootKey) ) - { - RegError ret = m_registry.mergeKey(rootKey, aKeyName, aUrl, sal_False, sal_False); - if (ret) - { - if ( ret == REG_MERGE_CONFLICT ) - return; - if ( ret == REG_MERGE_ERROR ) - { - throw MergeConflictException( - OUString( RTL_CONSTASCII_USTRINGPARAM("MergeConflictException") ), - (OWeakObject *)this ); - } - else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } - - return; - } + osl::MutexGuard guard(mutex_); + RegistryKey root; + RegError err = registry_.openRootKey(root); + if (err == REG_NO_ERROR) { + err = registry_.mergeKey(root, aKeyName, aUrl, false, false); + } + switch (err) { + case REG_NO_ERROR: + case REG_MERGE_CONFLICT: + break; + case REG_MERGE_ERROR: + throw css::registry::MergeConflictException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.mergeKey:" + " underlying Registry::mergeKey() = REG_MERGE_ERROR")), + static_cast< cppu::OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.mergeKey:" + " underlying Registry::getRootKey/mergeKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } +} - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} } -namespace stoc_bootstrap -{ -//************************************************************************* -Reference SAL_CALL SimpleRegistry_CreateInstance( const Reference& ) -{ - Reference xRet; +namespace stoc_bootstrap { - Registry reg; - - XSimpleRegistry *pRegistry = (XSimpleRegistry*) new stoc_simreg::SimpleRegistryImpl(reg); +css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance( + css::uno::Reference< css::uno::XComponentContext > const &) +{ + return static_cast< cppu::OWeakObject * >(new SimpleRegistry); +} - if (pRegistry) - { - xRet = Reference::query(pRegistry); - } - - return xRet; +css::uno::Sequence< rtl::OUString > simreg_getSupportedServiceNames() { + css::uno::Sequence< rtl::OUString > names(1); + names[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry")); + return names; } + +rtl::OUString simreg_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.SimpleRegistry")); } +} -- cgit v1.2.3 From 9297efd2835ce6a46918ff6f603e4da95b4c4a12 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:09:39 +0200 Subject: sb129: #i113189# support XML-based services.rdb in com.sun.star.registry.SimpleRegistry --- stoc/prj/build.lst | 2 +- stoc/source/simpleregistry/makefile.mk | 3 +- stoc/source/simpleregistry/simpleregistry.cxx | 51 +- stoc/source/simpleregistry/textualservices.cxx | 1224 ++++++++++++++++++++++++ stoc/source/simpleregistry/textualservices.hxx | 67 ++ stoc/util/makefile.mk | 3 +- 6 files changed, 1343 insertions(+), 7 deletions(-) create mode 100755 stoc/source/simpleregistry/textualservices.cxx create mode 100644 stoc/source/simpleregistry/textualservices.hxx (limited to 'stoc') diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst index 1fb7d34ee..b671e0a62 100644 --- a/stoc/prj/build.lst +++ b/stoc/prj/build.lst @@ -1,4 +1,4 @@ -tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk NULL +tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader NULL tc stoc usr1 - all tc_mkout NULL tc stoc\inc nmake - all tc_inc NULL tc stoc\source\defaultregistry nmake - all tc_defr tc_boot tc_inc NULL diff --git a/stoc/source/simpleregistry/makefile.mk b/stoc/source/simpleregistry/makefile.mk index 510e7b466..bc0ddf7cc 100644 --- a/stoc/source/simpleregistry/makefile.mk +++ b/stoc/source/simpleregistry/makefile.mk @@ -39,7 +39,8 @@ UNOUCROUT=$(OUT)$/inc$/bootstrap # ------------------------------------------------------------------ SLOFILES= \ - $(SLO)$/simpleregistry.obj + $(SLO)/simpleregistry.obj \ + $(SLO)/textualservices.obj # --- Targets ------------------------------------------------------ diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index 5a7c6f9cd..9c6b71bc6 100755 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -29,6 +29,7 @@ #include "sal/config.h" #include +#include #include #include "com/sun/star/lang/XServiceInfo.hpp" @@ -61,6 +62,8 @@ #include "bootstrapservices.hxx" +#include "textualservices.hxx" + extern rtl_StandardModuleCount g_moduleCount; namespace { @@ -121,6 +124,7 @@ private: { return stoc_bootstrap::simreg_getSupportedServiceNames(); } Registry registry_; + std::auto_ptr< stoc::simpleregistry::TextualServices > textual_; }; class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > { @@ -1128,7 +1132,7 @@ rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName) rtl::OUString SimpleRegistry::getURL() throw (css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); - return registry_.getName(); + return textual_.get() == 0 ? registry_.getName() : textual_->getUri(); } void SimpleRegistry::open( @@ -1136,13 +1140,33 @@ void SimpleRegistry::open( throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { 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.getLength() == 0 && bCreate) ? REG_REGISTRY_NOT_EXISTS : registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE); if (err == REG_REGISTRY_NOT_EXISTS && bCreate) { err = registry_.create(rURL); } - if (err != REG_NO_ERROR) { + switch (err) { + case REG_NO_ERROR: + break; + case REG_INVALID_REGISTRY: + if (bReadOnly && !bCreate) { + textual_.reset(new stoc::simpleregistry::TextualServices(rURL)); + break; + } + // fall through + default: throw css::registry::InvalidRegistryException( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -1158,13 +1182,17 @@ void SimpleRegistry::open( sal_Bool SimpleRegistry::isValid() throw (css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); - return registry_.isValid(); + return textual_.get() != 0 || registry_.isValid(); } void SimpleRegistry::close() throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); + if (textual_.get() != 0) { + textual_.reset(); + return; + } RegError err = registry_.close(); if (err != REG_NO_ERROR) { throw css::registry::InvalidRegistryException( @@ -1181,6 +1209,10 @@ void SimpleRegistry::destroy() throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); + if (textual_.get() != 0) { + textual_.reset(); + return; + } RegError err = registry_.destroy(rtl::OUString()); if (err != REG_NO_ERROR) { throw css::registry::InvalidRegistryException( @@ -1197,6 +1229,9 @@ css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey() throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); + if (textual_.get() != 0) { + return textual_->getRootKey(); + } RegistryKey root; RegError err = registry_.openRootKey(root); if (err != REG_NO_ERROR) { @@ -1215,7 +1250,7 @@ sal_Bool SimpleRegistry::isReadOnly() throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); - return registry_.isReadOnly(); + return textual_.get() != 0 || registry_.isReadOnly(); } void SimpleRegistry::mergeKey( @@ -1225,6 +1260,14 @@ void SimpleRegistry::mergeKey( css::registry::MergeConflictException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); + if (textual_.get() != 0) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.mergeKey: not" + " supported for textual representation")), + static_cast< cppu::OWeakObject * >(this)); + } RegistryKey root; RegError err = registry_.openRootKey(root); if (err == REG_NO_ERROR) { diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx new file mode 100755 index 000000000..11196b76a --- /dev/null +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -0,0 +1,1224 @@ +/************************************************************************* +* +* 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 +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_stoc.hxx" +#include "sal/config.h" + +#include +#include + +#include "boost/noncopyable.hpp" +#include "com/sun/star/container/NoSuchElementException.hpp" +#include "com/sun/star/registry/InvalidRegistryException.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/implbase1.hxx" +#include "osl/diagnose.h" +#include "rtl/ref.hxx" +#include "rtl/string.h" +#include "rtl/ustrbuf.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "salhelper/simplereferenceobject.hxx" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" + +#include "textualservices.hxx" + +namespace stoc { namespace simpleregistry { + +namespace { + +namespace css = com::sun::star; + +struct Implementation { + rtl::OUString uri; + rtl::OUString loader; + std::vector< rtl::OUString > services; + std::vector< rtl::OUString > singletons; +}; + +typedef std::map< rtl::OUString, Implementation > Implementations; + +struct Service { + std::vector< rtl::OUString > implementations; +}; + +typedef std::map< rtl::OUString, Service > Services; + +struct Singleton { + rtl::OUString service; + std::vector< rtl::OUString > implementations; +}; + +typedef std::map< rtl::OUString, Singleton > Singletons; + +} + +class Data: public salhelper::SimpleReferenceObject, private boost::noncopyable +{ +public: + Implementations implementations; + Services services; + Singletons singletons; +}; + +namespace { + +class Parser: private boost::noncopyable { +public: + Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data); + +private: + void handleComponent(); + + void handleImplementation(); + + void handleService(); + + void handleSingleton(); + + rtl::OUString getNameAttribute(); + + xmlreader::XmlReader reader_; + rtl::Reference< Data > data_; + rtl::OUString attrUri_; + rtl::OUString attrLoader_; + rtl::OUString attrImplementation_; +}; + +Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): + reader_(uri), data_(data) +{ + OSL_ASSERT(data.is()); + int ucNsId = reader_.registerNamespaceIri( + xmlreader::Span( + RTL_CONSTASCII_STRINGPARAM( + "http://openoffice.org/2010/uno-components"))); + enum State { + STATE_BEGIN, STATE_END, STATE_COMPONENTS, STATE_COMPONENT_INITIAL, + STATE_COMPONENT, STATE_IMPLEMENTATION_INITIAL, + STATE_IMPLEMENTATION_SERVICE, STATE_IMPLEMENTATION_SINGLETON, + STATE_SERVICE, STATE_SINGLETON }; + for (State state = STATE_BEGIN;;) { + xmlreader::Span name; + int nsId; + xmlreader::XmlReader::Result res = reader_.nextItem( + xmlreader::XmlReader::TEXT_NONE, &name, &nsId); + switch (state) { + case STATE_BEGIN: + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("components"))) + { + state = STATE_COMPONENTS; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in outer level"))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_END: + if (res == xmlreader::XmlReader::RESULT_DONE) { + return; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in outer level"))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_COMPONENTS: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_END; + break; + } + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("component"))) + { + handleComponent(); + state = STATE_COMPONENT_INITIAL; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_COMPONENT: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_COMPONENTS; + break; + } + // fall through + case STATE_COMPONENT_INITIAL: + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("implementation"))) + { + handleImplementation(); + state = STATE_IMPLEMENTATION_INITIAL; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_IMPLEMENTATION_SERVICE: + case STATE_IMPLEMENTATION_SINGLETON: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_COMPONENT; + break; + } + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("singleton"))) + { + handleSingleton(); + state = STATE_SINGLETON; + break; + } + // fall through + case STATE_IMPLEMENTATION_INITIAL: + if (state != STATE_IMPLEMENTATION_SINGLETON && + res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("service"))) + { + handleService(); + state = STATE_SERVICE; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_SERVICE: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_IMPLEMENTATION_SERVICE; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_SINGLETON: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_IMPLEMENTATION_SINGLETON; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + } + } +} + +void Parser::handleComponent() { + attrUri_ = rtl::OUString(); + attrLoader_ = rtl::OUString(); + xmlreader::Span name; + int nsId; + while (reader_.nextAttribute(&nsId, &name)) { + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && + name.equals(RTL_CONSTASCII_STRINGPARAM("uri"))) + { + if (attrUri_.getLength() != 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": has multiple \"uri\" attributes"))), + css::uno::Reference< css::uno::XInterface >()); + } + attrUri_ = reader_.getAttributeValue(false).convertFromUtf8(); + if (attrUri_.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": has empty \"uri\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && + name.equals(RTL_CONSTASCII_STRINGPARAM("loader"))) + { + if (attrLoader_.getLength() != 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": has multiple \"loader\"" + " attributes"))), + css::uno::Reference< css::uno::XInterface >()); + } + attrLoader_ = reader_.getAttributeValue(false).convertFromUtf8(); + if (attrLoader_.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": has empty \"loader\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + } else { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": expected attribute \"uri\" or" + " \"loader\""))), + css::uno::Reference< css::uno::XInterface >()); + } + } + if (attrUri_.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": is missing \"uri\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + if (attrLoader_.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": is missing \"loader\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } +} + +void Parser::handleImplementation() { + attrImplementation_ = getNameAttribute(); + if (data_->implementations.find(attrImplementation_) != + data_->implementations.end()) + { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": duplicate "))), + css::uno::Reference< css::uno::XInterface >()); + } + data_->implementations[attrImplementation_].uri = attrUri_; + data_->implementations[attrImplementation_].loader = attrLoader_; +} + +void Parser::handleService() { + rtl::OUString name = getNameAttribute(); + data_->implementations[attrImplementation_].services.push_back(name); + data_->services[name].implementations.push_back(attrImplementation_); +} + +void Parser::handleSingleton() { + rtl::OUString name = getNameAttribute(); + data_->implementations[attrImplementation_].singletons.push_back(name); + data_->singletons[name].service = + data_->implementations[attrImplementation_].services[0]; + data_->singletons[name].implementations.push_back(attrImplementation_); +} + +rtl::OUString Parser::getNameAttribute() { + rtl::OUString attrName; + xmlreader::Span name; + int nsId; + while (reader_.nextAttribute(&nsId, &name)) { + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && + name.equals(RTL_CONSTASCII_STRINGPARAM("name"))) + { + if (attrName.getLength() != 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": element has multiple \"name\" attributes"))), + css::uno::Reference< css::uno::XInterface >()); + } + attrName = reader_.getAttributeValue(false).convertFromUtf8(); + if (attrName.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": element has empty \"name\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + } else { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": expected element attribute \"name\""))), + css::uno::Reference< css::uno::XInterface >()); + } + } + if (attrName.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": element is missing \"name\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + return attrName; +} + +rtl::OUString pathToString(std::vector< rtl::OUString > const & path) { + rtl::OUStringBuffer buf; + for (std::vector< rtl::OUString >::const_iterator i(path.begin()); + i != path.end(); ++i) + { + buf.append(sal_Unicode('/')); + buf.append(*i); + } + if (buf.getLength() == 0) { + buf.append(sal_Unicode('/')); + } + return buf.makeStringAndClear(); +} + +class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > { +public: + Key( + rtl::Reference< Data > const & data, + std::vector< rtl::OUString > const & path): + data_(data), path_(path) { OSL_ASSERT(data.is()); + } + +private: + /* + / + IMPLEMENTATIONS + + UNO + LOCATION utf-8 + ACTIVATOR utf-8 + SERVICES + + ... + SINGLETONS + utf-16 + ... + ... + SERVICES + utf-8-list + ... + SINGLETONS + utf-16 + REGISTERED_BY utf-8-list + ... + */ + enum State { + STATE_ROOT, STATE_IMPLEMENTATIONS, STATE_IMPLEMENTATION, STATE_UNO, + STATE_LOCATION, STATE_ACTIVATOR, STATE_IMPLEMENTATION_SERVICES, + STATE_IMPLEMENTATION_SERVICE, STATE_IMPLEMENTATION_SINGLETONS, + STATE_IMPLEMENTATION_SINGLETON, STATE_SERVICES, STATE_SERVICE, + STATE_SINGLETONS, STATE_SINGLETON, STATE_REGISTEREDBY }; + + virtual rtl::OUString SAL_CALL getKeyName() + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isReadOnly() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isValid() throw(css::uno::RuntimeException); + + virtual css::registry::RegistryKeyType SAL_CALL getKeyType( + rtl::OUString const & rKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::registry::RegistryValueType SAL_CALL getValueType() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getLongValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setLongValue(sal_Int32 value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() throw( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setLongListValue( + com::sun::star::uno::Sequence< sal_Int32 > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getAsciiValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setAsciiValue(rtl::OUString const & value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setAsciiListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getStringValue() throw( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setStringValue(rtl::OUString const & value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setStringListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setBinaryValue( + css::uno::Sequence< sal_Int8 > const & value) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey( + rtl::OUString const & aKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL + createKey(rtl::OUString const & aKeyName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL closeKey() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL deleteKey(rtl::OUString const & rKeyName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual + css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > + SAL_CALL openKeys() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL createLink( + rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual void SAL_CALL deleteLink(rtl::OUString const & rLinkName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getLinkTarget( + rtl::OUString const & rLinkName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getResolvedName( + rtl::OUString const & aKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + bool find( + rtl::OUString const & relative, std::vector< rtl::OUString > * path, + State * state, css::registry::RegistryValueType * type) const; + + css::uno::Sequence< rtl::OUString > getChildren(); + + rtl::Reference< Data > data_; + std::vector< rtl::OUString > path_; +}; + +rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) { + return pathToString(path_); +} + +sal_Bool Key::isReadOnly() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + return true; +} + +sal_Bool Key::isValid() throw(css::uno::RuntimeException) { + return true; +} + +css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + if (!find(rtl::OUString(), 0, 0, 0)) { + throw css::registry::InvalidRegistryException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unknown key ")) + + rKeyName), + static_cast< cppu::OWeakObject * >(this)); + } + return css::registry::RegistryKeyType_KEY; +} + +css::registry::RegistryValueType Key::getValueType() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + css::registry::RegistryValueType type = + css::registry::RegistryValueType_NOT_DEFINED; + OSL_VERIFY(find(rtl::OUString(), 0, 0, &type)); + return type; +} + +sal_Int32 Key::getLongValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getLongValue not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::setLongValue(sal_Int32) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setLongValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< sal_Int32 > Key::getLongListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getLongListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setLongListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +rtl::OUString Key::getAsciiValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + State state = STATE_ROOT; + OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); + switch (state) { + case STATE_LOCATION: + return data_->implementations[path_[1]].uri; + case STATE_ACTIVATOR: + return data_->implementations[path_[1]].loader; + default: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getAsciiValue: wrong type")), + static_cast< OWeakObject * >(this)); + } +} + +void Key::setAsciiValue(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setAsciiValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + State state = STATE_ROOT; + OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); + std::vector< rtl::OUString > const * list; + switch (state) { + case STATE_SERVICE: + list = &data_->services[path_[1]].implementations; + break; + case STATE_REGISTEREDBY: + list = &data_->singletons[path_[1]].implementations; + break; + default: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getAsciiListValue: wrong type")), + static_cast< OWeakObject * >(this)); + } + if (list->size() > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getAsciiListValue: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >(list->size())); + sal_Int32 i = 0; + for (std::vector< rtl::OUString >::const_iterator j(list->begin()); + j != list->end(); ++j) + { + seq[i++] = *j; + } + return seq; +} + +void Key::setAsciiListValue(css::uno::Sequence< rtl::OUString > const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setAsciiListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +rtl::OUString Key::getStringValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + State state = STATE_ROOT; + OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); + switch (state) { + case STATE_IMPLEMENTATION_SINGLETON: + return data_->implementations[path_[1]].services[0]; + case STATE_SINGLETON: + return data_->singletons[path_[1]].service; + default: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getStringValue: wrong type")), + static_cast< OWeakObject * >(this)); + } +} + +void Key::setStringValue(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setStringValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< rtl::OUString > Key::getStringListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getStringListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::setStringListValue(css::uno::Sequence< rtl::OUString > const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setStringListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< sal_Int8 > Key::getBinaryValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getBinarValue not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setBinaryValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Reference< css::registry::XRegistryKey > Key::openKey( + rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + std::vector< rtl::OUString > path; + if (!find(aKeyName, &path, 0, 0)) { + return css::uno::Reference< css::registry::XRegistryKey >(); + } + return new Key(data_, path); +} + +css::uno::Reference< css::registry::XRegistryKey > Key::createKey( + rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " createKey not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::closeKey() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{} + +void Key::deleteKey(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " deleteKey not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > +Key::openKeys() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + css::uno::Sequence< rtl::OUString > names(getChildren()); + css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > + keys(names.getLength()); + for (sal_Int32 i = 0; i < keys.getLength(); ++i) { + keys[i] = openKey(names[i]); + OSL_ASSERT(keys[i].is()); + } + return keys; +} + +css::uno::Sequence< rtl::OUString > Key::getKeyNames() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + css::uno::Sequence< rtl::OUString > names(getChildren()); + rtl::OUString prefix(pathToString(path_)); + prefix += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + for (sal_Int32 i = 0; i < names.getLength(); ++i) { + names[i] = prefix + names[i]; + } + return names; +} + +sal_Bool Key::createLink(rtl::OUString const &, rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " createLink not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::deleteLink(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " deleteLink not supported")), + static_cast< OWeakObject * >(this)); +} + +rtl::OUString Key::getLinkTarget(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getLinkTarget not supported")), + static_cast< OWeakObject * >(this)); +} + +rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + std::vector< rtl::OUString > path; + find(aKeyName, &path, 0, 0); + return pathToString(path); +} + +bool Key::find( + rtl::OUString const & relative, std::vector< rtl::OUString > * path, + State * state, css::registry::RegistryValueType * type) const +{ + std::vector< rtl::OUString > p(path_); + sal_Int32 i = 0; + do { + rtl::OUString seg(relative.getToken(0, '/', i)); + if (seg.getLength() != 0) { + p.push_back(seg); + } + } while (i >= 0); + if (path != 0) { + *path = p; + } + std::size_t const MAX_TRANSITIONS = 4; + struct StateInfo { + css::registry::RegistryValueType type; + std::size_t count; + struct { char const * segment; State state; } + transitions[MAX_TRANSITIONS]; + }; + static StateInfo const info[] = { + // STATE_ROOT: + { css::registry::RegistryValueType_NOT_DEFINED, 3, + { { "IMPLEMENTATIONS", STATE_IMPLEMENTATIONS }, + { "SERVICES", STATE_SERVICES }, + { "SINGLETONS", STATE_SINGLETONS } } }, + // STATE_IMPLEMENTATIONS: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_IMPLEMENTATION } } }, + // STATE_IMPLEMENTATION: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { "UNO", STATE_UNO } } }, + // STATE_UNO: + { css::registry::RegistryValueType_NOT_DEFINED, 4, + { { "LOCATION", STATE_LOCATION }, + { "ACTIVATOR", STATE_ACTIVATOR }, + { "SERVICES", STATE_IMPLEMENTATION_SERVICES }, + { "SINGLETONS", STATE_IMPLEMENTATION_SINGLETONS } } }, + // STATE_LOCATION: + { css::registry::RegistryValueType_ASCII, 0, {} }, + // STATE_ACTIVATOR: + { css::registry::RegistryValueType_ASCII, 0, {} }, + // STATE_IMPLEMENTATION_SERVICES: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_IMPLEMENTATION_SERVICE } } }, + // STATE_IMPLEMENTATION_SERVICE: + { css::registry::RegistryValueType_NOT_DEFINED, 0, {} }, + // STATE_IMPLEMENTATION_SINGLETONS: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_IMPLEMENTATION_SINGLETON } } }, + // STATE_IMPLEMENTATION_SINGLETON: + { css::registry::RegistryValueType_STRING, 0, {} }, + // STATE_SERVICES: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_SERVICE } } }, + // STATE_SERVICE: + { css::registry::RegistryValueType_ASCIILIST, 0, {} }, + // STATE_SINGLETONS: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_SINGLETON } } }, + // STATE_SINGLETON: + { css::registry::RegistryValueType_STRING, 1, + { { "REGISTERED_BY", STATE_REGISTEREDBY } } }, + // STATE_REGISTEREDBY: + { css::registry::RegistryValueType_ASCIILIST, 0, {} } }; + State s = STATE_ROOT; + for (std::vector< rtl::OUString >::iterator j(p.begin()); j != p.end(); ++j) + { + bool found = false; + for (std::size_t k = 0; k < info[s].count; ++k) { + if (info[s].transitions[k].segment == 0) { + switch (info[s].transitions[k].state) { + case STATE_IMPLEMENTATION: + found = data_->implementations.find(*j) != + data_->implementations.end(); + break; + case STATE_IMPLEMENTATION_SERVICE: + case STATE_IMPLEMENTATION_SINGLETON: + found = true; //TODO + break; + case STATE_SERVICE: + found = data_->services.find(*j) != data_->services.end(); + break; + case STATE_SINGLETON: + found = data_->singletons.find(*j) != + data_->singletons.end(); + break; + default: + std::abort(); // this cannot happen + } + } else { + found = j->equalsAscii(info[s].transitions[k].segment); + } + if (found) { + s = info[s].transitions[k].state; + break; + } + } + if (!found) { + return false; + } + } + if (state != 0) { + *state = s; + } + if (type != 0) { + *type = info[s].type; + } + return true; +} + +css::uno::Sequence< rtl::OUString > Key::getChildren() { + State state = STATE_ROOT; + OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); + switch (state) { + default: + std::abort(); // this cannot happen + // pseudo-fall-through to avoid warnings on MSC + case STATE_ROOT: + { + css::uno::Sequence< rtl::OUString > seq(3); + seq[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("IMPLEMENTATIONS")); + seq[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SERVICES")); + seq[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SINGLETONS")); + return seq; + } + case STATE_IMPLEMENTATIONS: + { + if (data_->implementations.size() > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >(data_->implementations.size())); + sal_Int32 i = 0; + for (Implementations::iterator j(data_->implementations.begin()); + j != data_->implementations.end(); ++j) + { + seq[i++] = j->first; + } + return seq; + } + case STATE_UNO: + { + css::uno::Sequence< rtl::OUString > seq(4); + seq[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOCATION")); + seq[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ACTIVATOR")); + seq[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SERVICES")); + seq[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SINGLETONS")); + return seq; + } + case STATE_LOCATION: + case STATE_ACTIVATOR: + case STATE_IMPLEMENTATION_SERVICE: + case STATE_IMPLEMENTATION_SINGLETON: + case STATE_SERVICE: + case STATE_REGISTEREDBY: + return css::uno::Sequence< rtl::OUString >(); + case STATE_IMPLEMENTATION_SERVICES: + { + if (data_->implementations[path_[1]].services.size() > + SAL_MAX_INT32) + { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >( + data_->implementations[path_[1]].services.size())); + sal_Int32 i = 0; + for (std::vector< rtl::OUString >::iterator j( + data_->implementations[path_[1]].services.begin()); + j != data_->implementations[path_[1]].services.end(); ++j) + { + seq[i++] = *j; + } + return seq; + } + case STATE_IMPLEMENTATION_SINGLETONS: + { + if (data_->implementations[path_[1]].singletons.size() > + SAL_MAX_INT32) + { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >( + data_->implementations[path_[1]].singletons.size())); + sal_Int32 i = 0; + for (std::vector< rtl::OUString >::iterator j( + data_->implementations[path_[1]].singletons.begin()); + j != data_->implementations[path_[1]].singletons.end(); ++j) + { + seq[i++] = *j; + } + return seq; + } + case STATE_SERVICES: + { + if (data_->services.size() > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >(data_->services.size())); + sal_Int32 i = 0; + for (Services::iterator j(data_->services.begin()); + j != data_->services.end(); ++j) + { + seq[i++] = j->first; + } + return seq; + } + case STATE_SINGLETONS: + { + if (data_->singletons.size() > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >(data_->singletons.size())); + sal_Int32 i = 0; + for (Singletons::iterator j(data_->singletons.begin()); + j != data_->singletons.end(); ++j) + { + seq[i++] = j->first; + } + return seq; + } + case STATE_SINGLETON: + { + css::uno::Sequence< rtl::OUString > seq(1); + seq[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("REGISTERED_BY")); + return seq; + } + } +} + +} + +TextualServices::TextualServices(rtl::OUString const & uri): + uri_(uri), data_(new Data) +{ + try { + Parser(uri, data_); + } catch (css::container::NoSuchElementException &) { + throw css::registry::InvalidRegistryException( + (uri + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM(": no such file"))), + css::uno::Reference< css::uno::XInterface >()); + } +} + +TextualServices::~TextualServices() {} + +css::uno::Reference< css::registry::XRegistryKey > TextualServices::getRootKey() +{ + return new Key(data_, std::vector< rtl::OUString >()); +} + +} } diff --git a/stoc/source/simpleregistry/textualservices.hxx b/stoc/source/simpleregistry/textualservices.hxx new file mode 100644 index 000000000..0261e2604 --- /dev/null +++ b/stoc/source/simpleregistry/textualservices.hxx @@ -0,0 +1,67 @@ +/************************************************************************* +* +* 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 +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef INCLUDED_STOC_SOURCE_SIMPLEREGISTRY_TEXTUALSERVICES_HXX +#define INCLUDED_STOC_SOURCE_SIMPLEREGISTRY_TEXTUALSERVICES_HXX + +#include "sal/config.h" + +#include + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" + +namespace com { namespace sun { namespace star { namespace registry { + class XRegistryKey; +} } } } + +namespace stoc { namespace simpleregistry { + +class Data; + +class TextualServices: private boost::noncopyable { +public: + explicit TextualServices(rtl::OUString const & uri); + // throws com::sun::star::registry::InvalidRegistryException + + virtual ~TextualServices(); + + inline rtl::OUString getUri() { return uri_; } + + com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > + getRootKey(); + +private: + rtl::OUString uri_; + rtl::Reference< Data > data_; +}; + +} } + +#endif diff --git a/stoc/util/makefile.mk b/stoc/util/makefile.mk index 4243d4551..54232aa4c 100644 --- a/stoc/util/makefile.mk +++ b/stoc/util/makefile.mk @@ -57,7 +57,8 @@ SHL1STDLIBS= \ $(SALHELPERLIB) \ $(CPPUHELPERLIB) \ $(SALLIB) \ - $(REGLIB) + $(REGLIB) \ + $(XMLREADERLIB) SHL1DEPN= SHL1IMPLIB= i$(TARGET) -- cgit v1.2.3 From 0cff1ed2867962c27db50752adaa41dba6dfc41a Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:10:07 +0200 Subject: sb129: #i113189# change UNO components to use passive registration --- cppuhelper/inc/cppuhelper/factory.hxx | 3 + cppuhelper/inc/cppuhelper/implementationentry.hxx | 6 +- cppuhelper/inc/cppuhelper/shlib.hxx | 4 +- cpputools/prj/build.lst | 1 - cpputools/prj/d.lst | 2 - cpputools/source/regcomplazy/makefile.mk | 54 ---- cpputools/source/regcomplazy/regcomplazy.cxx | 282 --------------------- io/prj/d.lst | 5 + io/source/TextInputStream/TextInputStream.cxx | 6 - io/source/TextInputStream/makefile.mk | 8 + io/source/TextInputStream/textinstream.component | 34 +++ io/source/TextOutputStream/TextOutputStream.cxx | 6 - io/source/TextOutputStream/makefile.mk | 8 + io/source/TextOutputStream/textoutstream.component | 34 +++ io/source/acceptor/acceptor.component | 34 +++ io/source/acceptor/acceptor.cxx | 6 - io/source/acceptor/makefile.mk | 8 + io/source/connector/connector.component | 34 +++ io/source/connector/connector.cxx | 6 - io/source/connector/makefile.mk | 8 + io/source/stm/factreg.cxx | 6 - io/source/stm/makefile.mk | 7 + io/source/stm/streams.component | 55 ++++ .../com/sun/star/comp/JavaUNOHelperServices.java | 17 -- javaunohelper/prj/d.lst | 1 + javaunohelper/util/juh.component | 34 +++ javaunohelper/util/makefile.mk | 5 + .../sun/star/comp/bridgefactory/BridgeFactory.java | 12 - jurt/com/sun/star/comp/connections/Acceptor.java | 15 -- jurt/com/sun/star/comp/connections/Connector.java | 15 -- .../comp/connections/ConstantInstanceProvider.java | 14 - .../sun/star/comp/connections/PipedConnection.java | 13 - .../com/sun/star/comp/urlresolver/UrlResolver.java | 14 - .../star/lib/connections/pipe/pipeAcceptor.java | 15 -- .../star/lib/connections/pipe/pipeConnector.java | 15 -- .../lib/connections/socket/socketAcceptor.java | 15 -- .../lib/connections/socket/socketConnector.java | 15 -- pyuno/prj/d.lst | 3 +- pyuno/source/loader/makefile.mk | 34 +-- pyuno/source/loader/pythonloader.component | 34 +++ pyuno/source/loader/pyuno_loader.cxx | 6 - remotebridges/prj/d.lst | 3 + remotebridges/source/bridge/makefile.mk | 8 + remotebridges/source/bridge/remote_bridge.cxx | 6 - remotebridges/source/bridge/remotebridge.component | 36 +++ .../source/dynamicloader/dynamicloader.cxx | 28 -- remotebridges/source/factory/bridgefac.component | 34 +++ remotebridges/source/factory/bridgefactory.cxx | 6 - remotebridges/source/factory/makefile.mk | 7 + remotebridges/source/unourl_resolver/makefile.mk | 8 + .../source/unourl_resolver/unourl_resolver.cxx | 6 - .../source/unourl_resolver/uuresolver.component | 34 +++ stoc/prj/d.lst | 10 + stoc/source/bootstrap/services.cxx | 6 - stoc/source/corereflection/base.hxx | 3 - stoc/source/corereflection/crefl.cxx | 30 --- stoc/source/corereflection/makefile.mk | 7 + stoc/source/corereflection/reflection.component | 35 +++ stoc/source/inspect/introspection.component | 34 +++ stoc/source/inspect/introspection.cxx | 27 -- stoc/source/inspect/makefile.mk | 7 + stoc/source/invocation/invocation.component | 34 +++ stoc/source/invocation/invocation.cxx | 6 - stoc/source/invocation/makefile.mk | 6 + .../source/invocation_adapterfactory/iafactory.cxx | 8 - .../invocation_adapterfactory/invocadapt.component | 34 +++ stoc/source/invocation_adapterfactory/makefile.mk | 8 + stoc/source/javaloader/javaloader.component | 35 +++ stoc/source/javaloader/javaloader.cxx | 6 - stoc/source/javaloader/makefile.mk | 7 + stoc/source/javavm/javavm.component | 35 +++ stoc/source/javavm/javavm.cxx | 37 +-- stoc/source/javavm/makefile.mk | 7 + stoc/source/namingservice/makefile.mk | 7 + stoc/source/namingservice/namingservice.component | 34 +++ stoc/source/namingservice/namingservice.cxx | 6 - stoc/source/proxy_factory/makefile.mk | 8 + stoc/source/proxy_factory/proxyfac.component | 34 +++ stoc/source/proxy_factory/proxyfac.cxx | 7 - stoc/source/stocservices/stocservices.cxx | 6 - stoc/util/bootstrap.component | 66 +++++ stoc/util/makefile.mk | 13 + stoc/util/stocservices.component | 51 ++++ ure/prj/build.lst | 2 +- ure/prj/d.lst | 16 +- ure/source/makefile.mk | 77 +++--- 86 files changed, 978 insertions(+), 801 deletions(-) delete mode 100755 cpputools/source/regcomplazy/makefile.mk delete mode 100755 cpputools/source/regcomplazy/regcomplazy.cxx create mode 100644 io/source/TextInputStream/textinstream.component create mode 100644 io/source/TextOutputStream/textoutstream.component create mode 100644 io/source/acceptor/acceptor.component create mode 100644 io/source/connector/connector.component create mode 100644 io/source/stm/streams.component create mode 100644 javaunohelper/util/juh.component create mode 100644 pyuno/source/loader/pythonloader.component create mode 100644 remotebridges/source/bridge/remotebridge.component create mode 100644 remotebridges/source/factory/bridgefac.component create mode 100644 remotebridges/source/unourl_resolver/uuresolver.component create mode 100644 stoc/source/corereflection/reflection.component create mode 100644 stoc/source/inspect/introspection.component create mode 100644 stoc/source/invocation/invocation.component create mode 100644 stoc/source/invocation_adapterfactory/invocadapt.component create mode 100644 stoc/source/javaloader/javaloader.component create mode 100644 stoc/source/javavm/javavm.component create mode 100644 stoc/source/namingservice/namingservice.component create mode 100644 stoc/source/proxy_factory/proxyfac.component create mode 100644 stoc/util/bootstrap.component create mode 100644 stoc/util/stocservices.component (limited to 'stoc') diff --git a/cppuhelper/inc/cppuhelper/factory.hxx b/cppuhelper/inc/cppuhelper/factory.hxx index 4320acb98..1dd04173c 100644 --- a/cppuhelper/inc/cppuhelper/factory.hxx +++ b/cppuhelper/inc/cppuhelper/factory.hxx @@ -87,6 +87,9 @@ typedef void (SAL_CALL * component_getImplementationEnvironmentExtFunc)( typedef const sal_Char * (SAL_CALL * component_getDescriptionFunc)(void); /** Function pointer declaration. + + @obsolete component_writeInfo should no longer be used in new components + Function writes component registry info, at least writing the supported service names. @param pServiceManager diff --git a/cppuhelper/inc/cppuhelper/implementationentry.hxx b/cppuhelper/inc/cppuhelper/implementationentry.hxx index f74493210..e52e658d8 100644 --- a/cppuhelper/inc/cppuhelper/implementationentry.hxx +++ b/cppuhelper/inc/cppuhelper/implementationentry.hxx @@ -72,6 +72,8 @@ struct ImplementationEntry /** Helper function for implementation of the component_writeInfo()-function. + @obsolete component_writeInfo should no longer be used in new components + @param pServiceManager The first parameter passed to component_writeInfo()-function (This is an instance of the service manager, that creates the factory). @param pRegistryKey The second parameter passed to the component_writeInfo()-function. @@ -90,9 +92,9 @@ sal_Bool component_writeInfoHelper( @param pImplName The implementation-name to be instantiated ( This is the first parameter passed to the component_getFactory - @param pServiceManager The first parameter passed to component_writeInfo()-function + @param pServiceManager The second parameter passed to component_getFactory()-function (This is a of the service manager, that creates the factory). - @param pRegistryKey The second parameter passed to the component_writeInfo()-function. + @param pRegistryKey The third parameter passed to the component_getFactory()-function. This is a reference to the registry key, where the implementation data has been written to. @param entries Each element of the entries-array must contains a function pointer diff --git a/cppuhelper/inc/cppuhelper/shlib.hxx b/cppuhelper/inc/cppuhelper/shlib.hxx index 044b30758..42299fa08 100644 --- a/cppuhelper/inc/cppuhelper/shlib.hxx +++ b/cppuhelper/inc/cppuhelper/shlib.hxx @@ -64,7 +64,9 @@ SAL_CALL loadSharedLibComponentFactory( (e.g. xxx.dll). You can give parameter rPath to force lookup of the library in a specific directory. The resulting path of the library will be checked against environment variable CPLD_ACCESSPATH if set. - + + @obsolete component_writeInfo should no longer be used in new components + @param rLibName name of the library @param rPath optional path @param xMgr service manager to be provided to the component diff --git a/cpputools/prj/build.lst b/cpputools/prj/build.lst index 7cd9053c5..ca820871b 100644 --- a/cpputools/prj/build.lst +++ b/cpputools/prj/build.lst @@ -2,7 +2,6 @@ pt cpputools : cppuhelper offuh LIBXML2:libxml2 NULL pt cpputools usr1 - all pt_mkout NULL pt cpputools\prj get - all pt_prj NULL pt cpputools\source\registercomponent nmake - all pt_regcomp NULL -pt cpputools\source\regcomplazy nmake - all pt_regcomplazy NULL pt cpputools\source\regsingleton nmake - all pt_regsingleton NULL pt cpputools\source\unoexe nmake - all pt_unoexe NULL pt cpputools\source\sp2bv nmake - all pt_sp2bv NULL diff --git a/cpputools/prj/d.lst b/cpputools/prj/d.lst index fa029cc4d..14de5e78a 100644 --- a/cpputools/prj/d.lst +++ b/cpputools/prj/d.lst @@ -1,8 +1,6 @@ ..\%__SRC%\bin\regcomp.exe %_DEST%\bin%_EXT%\regcomp.exe ..\%__SRC%\bin\regcomp %_DEST%\bin%_EXT%\regcomp ..\%__SRC%\bin\regcomp %_DEST%\bin%_EXT%\regcomp.bin -..\%__SRC%\bin\regcomplazy.exe %_DEST%\bin%_EXT%\regcomplazy.exe -..\%__SRC%\bin\regcomplazy %_DEST%\bin%_EXT%\regcomplazy ..\%__SRC%\bin\uno.exe %_DEST%\bin%_EXT%\uno.exe ..\%__SRC%\bin\uno %_DEST%\bin%_EXT%\uno ..\%__SRC%\bin\uno %_DEST%\bin%_EXT%\uno.bin diff --git a/cpputools/source/regcomplazy/makefile.mk b/cpputools/source/regcomplazy/makefile.mk deleted file mode 100755 index 0a4fe8477..000000000 --- a/cpputools/source/regcomplazy/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=cpputools -TARGET=regcomplazy -TARGETTYPE=CUI -LIBTARGET=NO - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -DEPOBJFILES= \ - $(OBJ)$/regcomplazy.obj - -APP1TARGET=$(TARGET) -APP1OBJS=$(DEPOBJFILES) - -APP1STDLIBS= \ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(REGLIB) - -.INCLUDE : target.mk - diff --git a/cpputools/source/regcomplazy/regcomplazy.cxx b/cpputools/source/regcomplazy/regcomplazy.cxx deleted file mode 100755 index 00907602f..000000000 --- a/cpputools/source/regcomplazy/regcomplazy.cxx +++ /dev/null @@ -1,282 +0,0 @@ -/************************************************************************* - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#include "sal/main.h" -#include -#include -#include -#include -#include - -#include - -#include - - -#define OUSTR(x) ::rtl::OUString::createFromAscii( x ) -#define OSToOUS(x) ::rtl::OStringToOUString(x, osl_getThreadTextEncoding()) -#define OUSToOS(x) ::rtl::OUStringToOString(x, osl_getThreadTextEncoding()) -using namespace ::rtl; - -typedef ::std::vector< ::rtl::OString > OSVector; - -struct CompDescriptor { - OString sImplementationName; - OString sComponentName; - OString sLoaderName; - OSVector vSupportedServices; -}; - -typedef ::std::vector< CompDescriptor > CDescrVector; - -static void print_options() SAL_THROW( () ) -{ - printf( - "\nusage: regcomplazy [-v]registry_file cmp_descr_file ...\n\n" - "Register a cmponent using a comp description file.\n" - "Option -v prints verbose output on stdout.\n" ); -} - -static bool checkImplValue(RegistryValueList* pValueList, OString sImplName) { - for (sal_uInt32 i=0; i < pValueList->getLength(); i++) { - if (sImplName.equals(pValueList->getElement(i))) - return true; - } - - return false; -} - -//================================================================================================== -SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) -{ - if (argc < 3) - { - print_options(); - return 1; - } - - bool bVerbose = false; - int nPos = 1; - if ('-' == argv[ nPos ][ 0 ] && 'v' == argv[ nPos ][ 1 ]) - { - if ('\0' != argv[ nPos ][ 2 ]) - { - print_options(); - return 1; - } - bVerbose = true; - ++nPos; - } - - OUString sys_path( OUSTR( argv[ nPos ] ) ); - OUString reg_url; - oslFileError rc = osl_getFileURLFromSystemPath( sys_path.pData, ®_url.pData ); - if (osl_File_E_None != rc) - { - if (bVerbose) - fprintf( stderr, "\nERROR: cannot make file url out of %s\n", argv[nPos]); - return 1; - } - - FILE* fDescr = fopen(argv[ ++nPos ], "r"); - OStringBuffer sBuffer(512); - - if ( fDescr) { - size_t totalSize = 0; - size_t readSize = 0; - char pBuffer[513]; - - while ( !feof(fDescr) ) - { - if ( (readSize = fread(pBuffer, 1, 512, fDescr)) > 0 - && !ferror(fDescr) ) { - totalSize += readSize; - if (totalSize >= 512) - sBuffer.ensureCapacity(totalSize * 2); - - sBuffer.append(pBuffer, readSize); - } - } - fclose(fDescr); - fDescr = 0; // just to be sure noone tries to use the file ever after - } - - OString sDescr = sBuffer.makeStringAndClear(); - sal_Int32 nTokenIndex = 0; - - CDescrVector vDescr; - CompDescriptor descr; - bool bFirst = true; - - do { - OString sTmp = sDescr.getToken(0, '\x0A', nTokenIndex); - OString sToken(sTmp); - if (sTmp.pData->buffer[sTmp.getLength()-1] == '\x0D') - sToken = sTmp.copy(0, sTmp.getLength()-1); - if ( sToken.indexOf("[ComponentDescriptor]") >= 0) { - if (bFirst) - bFirst = false; - else - vDescr.push_back(descr); - - descr = CompDescriptor(); - } - else if ( sToken.indexOf("ImplementationName=") >= 0) { - descr.sImplementationName = sToken.copy(19); - } - else if ( sToken.indexOf("ComponentName=") >= 0) { - descr.sComponentName = sToken.copy(14); - } - else if ( sToken.indexOf("LoaderName=") >= 0) { - descr.sLoaderName = sToken.copy(11); - } - else if ( (sToken.indexOf("[SupportedServices]") < 0) && - (sToken.getLength() > 0) && - (sToken.pData->buffer[0] != '[') ) { - descr.vSupportedServices.push_back(sToken); - } - } while (nTokenIndex >= 0 ); - // insert the last descriptor - vDescr.push_back(descr); - - Registry *pReg = new Registry; - - RegistryKey rootKey, key, subKey, serviceKey; - - if (pReg->open(reg_url, REG_READWRITE)) - { - if (pReg->create(reg_url)) - { - if (bVerbose) - fprintf(stderr, "ERROR: open registry \"%s\" failed\n", argv[1]); - return 1; - } - } - if (pReg->openRootKey(rootKey)) { - if (bVerbose) - fprintf(stderr, "ERROR: open root key failed\n"); - return 1; - } - - CDescrVector::const_iterator comp_iter = vDescr.begin(); - do { - OString sImplName = (*comp_iter).sImplementationName; - OUStringBuffer sbImpl; - sbImpl.appendAscii("/IMPLEMENTATIONS/"); - sbImpl.append(OSToOUS(sImplName)); - OUString sImplKeyName = sbImpl.makeStringAndClear(); - - if (rootKey.openKey(sImplKeyName, key) == REG_NO_ERROR) { - if (bVerbose) { - fprintf(stderr, "WARNING: implementation entry for \"%s\" already exists, existing entries are overwritten\n", sImplName.getStr()); - } - } else { - if (rootKey.createKey(sImplKeyName, key)) { - if (bVerbose) { - fprintf(stderr, "ERROR: can't create new implementation entry \"%s\".\n", sImplName.getStr()); - } - return 1; - } - } - - OString sLoaderName = (*comp_iter).sLoaderName; - OUString usKeyName(OUSTR("UNO/ACTIVATOR")); - key.createKey(usKeyName, subKey); - subKey.setValue(OUString(), RG_VALUETYPE_STRING, - (sal_Char*)sLoaderName.getStr(), sLoaderName.getLength()+1); - - OString sCompName = (*comp_iter).sComponentName; - usKeyName = OUSTR("UNO/LOCATION"); - key.createKey(usKeyName, subKey); - subKey.setValue(OUString(), RG_VALUETYPE_STRING, - (sal_Char*)sCompName.getStr(), sCompName.getLength()+1); - - usKeyName = OUSTR("UNO/SERVICES"); - key.createKey(usKeyName, subKey); - - rootKey.createKey(OUSTR("/SERVICES"), serviceKey); - - OSVector::const_iterator serv_iter = ((*comp_iter).vSupportedServices).begin(); - OUString usServiceKeyName; - do { - usServiceKeyName = OSToOUS(*serv_iter); - // write service key in impl section - subKey.createKey(usServiceKeyName, key); - - if (serviceKey.openKey(usServiceKeyName, key) == REG_NO_ERROR) { - RegistryValueList valueList; - serviceKey.getStringListValue(usServiceKeyName, valueList); - if ( checkImplValue(&valueList, sImplName) ) { - serv_iter++; - continue; - } - - sal_uInt32 nServices = valueList.getLength()+1; - sal_Char** pImplList = (sal_Char**)rtl_allocateZeroMemory( - nServices * sizeof(sal_Char*)); - pImplList[0] = (sal_Char*)rtl_allocateZeroMemory( - sImplName.getLength()+1 * sizeof(sal_Char)); - rtl_copyMemory(pImplList[0], (sal_Char*)sImplName.getStr(), - sImplName.getLength()+1); - for (sal_uInt32 i=0; i < valueList.getLength(); i++) { - pImplList[i+1]=valueList.getElement(i); - } - key.setStringListValue(OUString(), pImplList, nServices); - - // free memory - rtl_freeMemory(pImplList[0]); - rtl_freeMemory(pImplList); - - } else { - serviceKey.createKey(usServiceKeyName, key); - - sal_Char* pImplList[1]; - pImplList[0] = (sal_Char*)rtl_allocateZeroMemory( - sImplName.getLength()+1 * sizeof(sal_Char)); - rtl_copyMemory(pImplList[0], (sal_Char*)sImplName.getStr(), - sImplName.getLength()+1); - key.setStringListValue(OUString(), pImplList, 1); - - // free memory - rtl_freeMemory(pImplList[0]); - } - serv_iter++; - } while (serv_iter != (*comp_iter).vSupportedServices.end()); - - comp_iter++; - } while (comp_iter != vDescr.end()); - - key.closeKey(); - subKey.closeKey(); - serviceKey.closeKey(); - rootKey.closeKey(); - pReg->close(); - - return 0; -} diff --git a/io/prj/d.lst b/io/prj/d.lst index 9d19e5f8e..eaadf64db 100644 --- a/io/prj/d.lst +++ b/io/prj/d.lst @@ -5,3 +5,8 @@ ..\source\stm\stm.xml %_DEST%\xml%_EXT%\streams.uno.xml ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* +..\%__SRC%\misc\acceptor.component %_DEST%\xml%_EXT%\acceptor.component +..\%__SRC%\misc\connector.component %_DEST%\xml%_EXT%\connector.component +..\%__SRC%\misc\streams.component %_DEST%\xml%_EXT%\streams.component +..\%__SRC%\misc\textinstream.component %_DEST%\xml%_EXT%\textinstream.component +..\%__SRC%\misc\textoutstream.component %_DEST%\xml%_EXT%\textoutstream.component diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx index 3fa833139..c7ea60d7d 100644 --- a/io/source/TextInputStream/TextInputStream.cxx +++ b/io/source/TextInputStream/TextInputStream.cxx @@ -521,12 +521,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/TextInputStream/makefile.mk b/io/source/TextInputStream/makefile.mk index 3c0cd5c57..ea476c57c 100644 --- a/io/source/TextInputStream/makefile.mk +++ b/io/source/TextInputStream/makefile.mk @@ -59,3 +59,11 @@ DEF1NAME= $(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/textinstream.component + +$(MISC)/textinstream.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt textinstream.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt textinstream.component diff --git a/io/source/TextInputStream/textinstream.component b/io/source/TextInputStream/textinstream.component new file mode 100644 index 000000000..6ac7d2a98 --- /dev/null +++ b/io/source/TextInputStream/textinstream.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/io/source/TextOutputStream/TextOutputStream.cxx b/io/source/TextOutputStream/TextOutputStream.cxx index b0a70f55c..3232d43cc 100644 --- a/io/source/TextOutputStream/TextOutputStream.cxx +++ b/io/source/TextOutputStream/TextOutputStream.cxx @@ -319,12 +319,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/TextOutputStream/makefile.mk b/io/source/TextOutputStream/makefile.mk index ad78178f8..2c9d4eb2e 100644 --- a/io/source/TextOutputStream/makefile.mk +++ b/io/source/TextOutputStream/makefile.mk @@ -60,3 +60,11 @@ DEF1NAME= $(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/textoutstream.component + +$(MISC)/textoutstream.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt textoutstream.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt textoutstream.component diff --git a/io/source/TextOutputStream/textoutstream.component b/io/source/TextOutputStream/textoutstream.component new file mode 100644 index 000000000..afbc50ab8 --- /dev/null +++ b/io/source/TextOutputStream/textoutstream.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/io/source/acceptor/acceptor.component b/io/source/acceptor/acceptor.component new file mode 100644 index 000000000..81e0399b2 --- /dev/null +++ b/io/source/acceptor/acceptor.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx index 9cc2d0ebd..a21b05ddb 100644 --- a/io/source/acceptor/acceptor.cxx +++ b/io/source/acceptor/acceptor.cxx @@ -366,12 +366,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/acceptor/makefile.mk b/io/source/acceptor/makefile.mk index 3da3fbe18..bbc7ac6d3 100644 --- a/io/source/acceptor/makefile.mk +++ b/io/source/acceptor/makefile.mk @@ -71,3 +71,11 @@ DEF1NAME= $(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/acceptor.component + +$(MISC)/acceptor.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + acceptor.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt acceptor.component diff --git a/io/source/connector/connector.component b/io/source/connector/connector.component new file mode 100644 index 000000000..95fa72aa5 --- /dev/null +++ b/io/source/connector/connector.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx index a9a69a351..49b6c860b 100644 --- a/io/source/connector/connector.cxx +++ b/io/source/connector/connector.cxx @@ -278,12 +278,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/connector/makefile.mk b/io/source/connector/makefile.mk index 7f12b850f..e3a67abe6 100644 --- a/io/source/connector/makefile.mk +++ b/io/source/connector/makefile.mk @@ -71,3 +71,11 @@ DEF1NAME= $(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/connector.component + +$(MISC)/connector.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + connector.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt connector.component diff --git a/io/source/stm/factreg.cxx b/io/source/stm/factreg.cxx index 50a2f673b..24c858efa 100644 --- a/io/source/stm/factreg.cxx +++ b/io/source/stm/factreg.cxx @@ -110,12 +110,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/stm/makefile.mk b/io/source/stm/makefile.mk index a6a163eca..52dd0c492 100644 --- a/io/source/stm/makefile.mk +++ b/io/source/stm/makefile.mk @@ -75,3 +75,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/streams.component + +$(MISC)/streams.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + streams.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt streams.component diff --git a/io/source/stm/streams.component b/io/source/stm/streams.component new file mode 100644 index 000000000..76890d360 --- /dev/null +++ b/io/source/stm/streams.component @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java index 411779faf..7df6497a1 100644 --- a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java +++ b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java @@ -28,7 +28,6 @@ package com.sun.star.comp; import com.sun.star.lib.uno.helper.Factory; import com.sun.star.lang.XSingleComponentFactory; -import com.sun.star.registry.XRegistryKey; import com.sun.star.comp.juhtest.SmoketestCommandEnvironment; @@ -62,20 +61,4 @@ public class JavaUNOHelperServices { return xFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return Factory.writeRegistryServiceInfo(SmoketestCommandEnvironment.class.getName(), - SmoketestCommandEnvironment.getServiceNames(), - regKey); - } } - - diff --git a/javaunohelper/prj/d.lst b/javaunohelper/prj/d.lst index 1fbd9c223..d58290843 100644 --- a/javaunohelper/prj/d.lst +++ b/javaunohelper/prj/d.lst @@ -2,5 +2,6 @@ ..\%__SRC%\bin\juh*.dll %_DEST%\bin%_EXT%\juh*.dll ..\%__SRC%\lib\libjuh*.so %_DEST%\lib%_EXT%\libjuh*.so ..\%__SRC%\lib\libjuh*.dylib %_DEST%\lib%_EXT%\libjuh*.dylib +..\%__SRC%\misc\juh.component %_DEST%\xml%_EXT%\juh.component ..\%__SRC%\bin\juh_src.zip %COMMON_DEST%\bin%_EXT%\juh_src.zip diff --git a/javaunohelper/util/juh.component b/javaunohelper/util/juh.component new file mode 100644 index 000000000..790a2a2b1 --- /dev/null +++ b/javaunohelper/util/juh.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/javaunohelper/util/makefile.mk b/javaunohelper/util/makefile.mk index 22b3a72be..796280eb3 100644 --- a/javaunohelper/util/makefile.mk +++ b/javaunohelper/util/makefile.mk @@ -50,4 +50,9 @@ ZIP1LIST=com -x "*makefile.mk" .INCLUDE : target.mk +ALLTAR : $(MISC)/juh.component +$(MISC)/juh.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + juh.component + $(XSLTPROC) --nonet --stringparam uri '$(COMPONENTPREFIX_URE_JAVA)juh.jar' \ + -o $@ $(SOLARENV)/bin/createcomponent.xslt juh.component diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java index 89174467a..23516fef0 100644 --- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java +++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java @@ -92,18 +92,6 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(BridgeFactory.class.getName(), __serviceName, regKey); - } /** * Creates a remote bridge and memorizes it under sName. diff --git a/jurt/com/sun/star/comp/connections/Acceptor.java b/jurt/com/sun/star/comp/connections/Acceptor.java index 2539bb528..1b0cf9c6e 100644 --- a/jurt/com/sun/star/comp/connections/Acceptor.java +++ b/jurt/com/sun/star/comp/connections/Acceptor.java @@ -83,21 +83,6 @@ public final class Acceptor implements XAcceptor { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(Acceptor.class.getName(), - __serviceName, regKey); - } - /** * Constructs a new Acceptor that uses the given service * factory to create a specific XAcceptor. diff --git a/jurt/com/sun/star/comp/connections/Connector.java b/jurt/com/sun/star/comp/connections/Connector.java index 6f0f351e2..3e0c38aed 100644 --- a/jurt/com/sun/star/comp/connections/Connector.java +++ b/jurt/com/sun/star/comp/connections/Connector.java @@ -83,21 +83,6 @@ public class Connector implements XConnector { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(Connector.class.getName(), - __serviceName, regKey); - } - /** * Constructs a new Connector that uses the given service * factory to create a specific XConnector. diff --git a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java index d3e188f3f..ce64cb95d 100644 --- a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java +++ b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java @@ -84,20 +84,6 @@ public class ConstantInstanceProvider implements XInstanceProvider { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(ConstantInstanceProvider.class.getName(), __serviceName, regKey); - } - - protected XMultiServiceFactory _serviceManager; protected String _serviceName; diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java index ee772124e..719e24b15 100644 --- a/jurt/com/sun/star/comp/connections/PipedConnection.java +++ b/jurt/com/sun/star/comp/connections/PipedConnection.java @@ -84,19 +84,6 @@ public class PipedConnection implements XConnection { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(PipedConnection.class.getName(), __serviceName, regKey); - } - /** * The amount of time in milliseconds, to wait to diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java index a73b24098..7b8dce558 100644 --- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java +++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java @@ -154,18 +154,4 @@ public class UrlResolver { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(_UrlResolver.class.getName(), _UrlResolver.__serviceName, regKey); - } - } - diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java index f9e2a43bc..63a3fb3a6 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java @@ -83,21 +83,6 @@ public final class pipeAcceptor implements XAcceptor { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - pipeAcceptor.class.getName(), __serviceName, regKey); - } - /** * Accepts a connection request via the described pipe. * diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java index 7128a5b3f..2f631a788 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java @@ -83,21 +83,6 @@ public final class pipeConnector implements XConnector { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - pipeConnector.class.getName(), __serviceName, regKey); - } - /** * Connects via the described pipe to a waiting server. * diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java index 930eeecf4..1f64d16c8 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java +++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java @@ -88,21 +88,6 @@ public final class socketAcceptor implements XAcceptor { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - socketAcceptor.class.getName(), __serviceName, regKey); - } - /** * Accepts a connection request via the described socket. * diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java index 287274356..11ffcb174 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java +++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java @@ -88,21 +88,6 @@ public final class socketConnector implements XConnector { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - socketConnector.class.getName(), __serviceName, regKey); - } - /** * Connects via the described socket to a waiting server. * diff --git a/pyuno/prj/d.lst b/pyuno/prj/d.lst index 5fe7400a8..1dd212ea9 100644 --- a/pyuno/prj/d.lst +++ b/pyuno/prj/d.lst @@ -9,12 +9,11 @@ mkdir: %_DEST%\lib%_EXT%\pyuno ..\%__SRC%\lib\unohelper.py %_DEST%\lib%_EXT%\pyuno\unohelper.py ..\%__SRC%\lib\pythonloader.py %_DEST%\lib%_EXT%\pyuno\pythonloader.py ..\%__SRC%\lib\uno.py %_DEST%\lib%_EXT%\pyuno\uno.py -..\%__SRC%\lib\pyuno_services.rdb %_DEST%\bin%_EXT%\pyuno_services.rdb +..\%__SRC%\misc\pythonloader.component %_DEST%\xml\pythonloader.component ..\%__SRC%\bin\unohelper.py %_DEST%\bin%_EXT%\pyuno\unohelper.py ..\%__SRC%\bin\pythonloader.py %_DEST%\bin%_EXT%\pyuno\pythonloader.py ..\%__SRC%\bin\uno.py %_DEST%\bin%_EXT%\pyuno\uno.py -..\%__SRC%\bin\pyuno_services.rdb %_DEST%\bin%_EXT%\pyuno_services.rdb ..\%__SRC%\bin\pyuno.pyd %_DEST%\bin%_EXT%\pyuno.pyd ..\%__SRC%\bin\pyuno.dll %_DEST%\bin%_EXT%\pyuno.dll ..\%__SRC%\bin\pythonl*.dll %_DEST%\bin%_EXT%\pythonl*.dll diff --git a/pyuno/source/loader/makefile.mk b/pyuno/source/loader/makefile.mk index 6f8648ce5..65ec8116f 100644 --- a/pyuno/source/loader/makefile.mk +++ b/pyuno/source/loader/makefile.mk @@ -73,40 +73,22 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) SLOFILES= $(SLO)$/pyuno_loader.obj -#COMPONENTS= \ -# tcv \ -# inv \ -# corefl \ -# insp \ -# invadp \ -# proxyfac \ -# pythonloader.uno \ - - -COMPONENTS= \ - stocservices.uno \ - invocation.uno \ - introspection.uno \ - invocadapt.uno \ - proxyfac.uno \ - reflection.uno \ - .$/pythonloader.uno - # --- Targets ------------------------------------------------------ ALL : ALLTAR \ - $(DLLDEST)$/pythonloader.py \ - $(DLLDEST)$/pyuno_services.rdb + $(DLLDEST)$/pythonloader.py .ENDIF # L10N_framework .INCLUDE : target.mk .IF "$(L10N_framework)"=="" $(DLLDEST)$/%.py: %.py cp $? $@ - -$(DLLDEST)$/pyuno_services.rdb : makefile.mk $(DLLDEST)$/$(DLLPRE)$(TARGET)$(DLLPOST) - -rm -f $@ $(DLLDEST)$/pyuno_services.tmp $(DLLDEST)$/pyuno_services.rdb - cd $(DLLDEST) && $(REGCOMP) -register -r pyuno_services.tmp -wop $(foreach,i,$(COMPONENTS) -c $(i)) - cd $(DLLDEST) && mv pyuno_services.tmp pyuno_services.rdb .ENDIF # L10N_framework +ALLTAR : $(MISC)/pythonloader.component + +$(MISC)/pythonloader.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt pythonloader.component + $(XSLTPROC) --nonet --stringparam uri \ + 'vnd.sun.star.expand:$$OOO_BASE_DIR/program/$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt pythonloader.component diff --git a/pyuno/source/loader/pythonloader.component b/pyuno/source/loader/pythonloader.component new file mode 100644 index 000000000..583b6ed38 --- /dev/null +++ b/pyuno/source/loader/pythonloader.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index cddb42f63..f94b4ea51 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -229,12 +229,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/remotebridges/prj/d.lst b/remotebridges/prj/d.lst index 04b8bf4f7..b304680e2 100644 --- a/remotebridges/prj/d.lst +++ b/remotebridges/prj/d.lst @@ -15,3 +15,6 @@ ..\%__SRC%\lib\dynamicloader.uno.so %_DEST%\lib%_EXT%\dynamicloader.uno.so ..\%__SRC%\lib\uuresolver.uno.so %_DEST%\lib%_EXT%\uuresolver.uno.so ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* +..\%__SRC%\misc\bridgefac.component %_DEST%\xml%_EXT%\bridgefac.component +..\%__SRC%\misc\remotebridge.component %_DEST%\xml%_EXT%\remotebridge.component +..\%__SRC%\misc\uuresolver.component %_DEST%\xml%_EXT%\uuresolver.component diff --git a/remotebridges/source/bridge/makefile.mk b/remotebridges/source/bridge/makefile.mk index 1b712bef1..2a5ea130d 100644 --- a/remotebridges/source/bridge/makefile.mk +++ b/remotebridges/source/bridge/makefile.mk @@ -62,3 +62,11 @@ DEF1NAME= $(SHL1TARGET) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/remotebridge.component + +$(MISC)/remotebridge.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt remotebridge.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt remotebridge.component diff --git a/remotebridges/source/bridge/remote_bridge.cxx b/remotebridges/source/bridge/remote_bridge.cxx index 40f233625..67272df80 100644 --- a/remotebridges/source/bridge/remote_bridge.cxx +++ b/remotebridges/source/bridge/remote_bridge.cxx @@ -457,12 +457,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/remotebridges/source/bridge/remotebridge.component b/remotebridges/source/bridge/remotebridge.component new file mode 100644 index 000000000..bbc6bede1 --- /dev/null +++ b/remotebridges/source/bridge/remotebridge.component @@ -0,0 +1,36 @@ + + + + + + + + + + diff --git a/remotebridges/source/dynamicloader/dynamicloader.cxx b/remotebridges/source/dynamicloader/dynamicloader.cxx index ec87b5212..08001cb0b 100644 --- a/remotebridges/source/dynamicloader/dynamicloader.cxx +++ b/remotebridges/source/dynamicloader/dynamicloader.cxx @@ -381,34 +381,6 @@ extern "C" { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - sal_Bool SAL_CALL component_writeInfo(XMultiServiceFactory *, XRegistryKey * pRegistryKey) { - sal_Bool bRes = sal_False; - - if (pRegistryKey) { - try { - OUString x = OUString::createFromAscii("/"); - x += ::dynamic_loader::DynamicLoader::implname; - x += OUString::createFromAscii("/UNO/SERVICES"); - - - Reference xNewKey(pRegistryKey->createKey(x)); - - const Sequence rSNL = ::dynamic_loader::DynamicLoader::getSupportedServiceNames_Static(); - const OUString * pArray = rSNL.getConstArray(); - for (sal_Int32 nPos = rSNL.getLength(); nPos--;) - xNewKey->createKey(pArray[nPos]); - - - bRes = sal_True; - } - catch (InvalidRegistryException &) { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - - return bRes; - } - void * SAL_CALL component_getFactory(const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, XRegistryKey *) { void * pRet = 0; diff --git a/remotebridges/source/factory/bridgefac.component b/remotebridges/source/factory/bridgefac.component new file mode 100644 index 000000000..e20bc3425 --- /dev/null +++ b/remotebridges/source/factory/bridgefac.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/remotebridges/source/factory/bridgefactory.cxx b/remotebridges/source/factory/bridgefactory.cxx index e9e183525..fbe39339c 100644 --- a/remotebridges/source/factory/bridgefactory.cxx +++ b/remotebridges/source/factory/bridgefactory.cxx @@ -481,12 +481,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/remotebridges/source/factory/makefile.mk b/remotebridges/source/factory/makefile.mk index 7cd3875bc..b47207077 100644 --- a/remotebridges/source/factory/makefile.mk +++ b/remotebridges/source/factory/makefile.mk @@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/bridgefac.component + +$(MISC)/bridgefac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + bridgefac.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt bridgefac.component diff --git a/remotebridges/source/unourl_resolver/makefile.mk b/remotebridges/source/unourl_resolver/makefile.mk index a3e4af7f0..edf5aa72c 100644 --- a/remotebridges/source/unourl_resolver/makefile.mk +++ b/remotebridges/source/unourl_resolver/makefile.mk @@ -62,3 +62,11 @@ DEF1NAME= $(SHL1TARGET) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/uuresolver.component + +$(MISC)/uuresolver.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + uuresolver.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt uuresolver.component diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx index f7d8b92ec..bdddf783d 100644 --- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx +++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx @@ -239,12 +239,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/remotebridges/source/unourl_resolver/uuresolver.component b/remotebridges/source/unourl_resolver/uuresolver.component new file mode 100644 index 000000000..f9dcd71d8 --- /dev/null +++ b/remotebridges/source/unourl_resolver/uuresolver.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/prj/d.lst b/stoc/prj/d.lst index 1f01434bf..79b2d7734 100644 --- a/stoc/prj/d.lst +++ b/stoc/prj/d.lst @@ -4,6 +4,16 @@ mkdir: %_DEST%\inc%_EXT%\stoc ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\%__SRC%\bin\*.rdb %_DEST%\rdb%_EXT%\* +..\%__SRC%\misc\bootstrap.component %_DEST%\xml%_EXT%\bootstrap.component +..\%__SRC%\misc\introspection.component %_DEST%\xml%_EXT%\introspection.component +..\%__SRC%\misc\invocadapt.component %_DEST%\xml%_EXT%\invocadapt.component +..\%__SRC%\misc\invocation.component %_DEST%\xml%_EXT%\invocation.component +..\%__SRC%\misc\javaloader.component %_DEST%\xml%_EXT%\javaloader.component +..\%__SRC%\misc\javavm.component %_DEST%\xml%_EXT%\javavm.component +..\%__SRC%\misc\namingservice.component %_DEST%\xml%_EXT%\namingservice.component +..\%__SRC%\misc\proxyfac.component %_DEST%\xml%_EXT%\proxyfac.component +..\%__SRC%\misc\reflection.component %_DEST%\xml%_EXT%\reflection.component +..\%__SRC%\misc\stocservices.component %_DEST%\xml%_EXT%\stocservices.component ..\source\module-description.dtd %_DEST%\xml%_EXT%\module-description.dtd ..\source\corereflection\corefl.xml %_DEST%\xml%_EXT%\reflection.uno.xml diff --git a/stoc/source/bootstrap/services.cxx b/stoc/source/bootstrap/services.cxx index 2fb68a0cc..d5ce619c6 100644 --- a/stoc/source/bootstrap/services.cxx +++ b/stoc/source/bootstrap/services.cxx @@ -132,12 +132,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index ba35d4f80..faf3e56bc 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -55,9 +55,6 @@ #include #include -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) - - using namespace std; using namespace osl; using namespace rtl; diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx index c706e233a..dac197e6f 100644 --- a/stoc/source/corereflection/crefl.cxx +++ b/stoc/source/corereflection/crefl.cxx @@ -32,7 +32,6 @@ #include #endif -#include #include #include #include "com/sun/star/uno/RuntimeException.hpp" @@ -509,35 +508,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - if (component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries )) - { - try - { - // register singleton - registry::XRegistryKey * pKey = - reinterpret_cast< registry::XRegistryKey * >( pRegistryKey ); - Reference< registry::XRegistryKey > xKey( - pKey->createKey( - OUSTR(IMPLNAME "/UNO/SINGLETONS/com.sun.star.reflection.theCoreReflection") ) ); - xKey->setStringValue( OUSTR("com.sun.star.reflection.CoreReflection") ); - return sal_True; - } - catch (Exception & exc) - { -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_ENSURE( 0, cstr.getStr() ); -#else - (void) exc; // unused -#endif - } - } - return sal_False; -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/corereflection/makefile.mk b/stoc/source/corereflection/makefile.mk index b61eb13aa..7156f6d63 100644 --- a/stoc/source/corereflection/makefile.mk +++ b/stoc/source/corereflection/makefile.mk @@ -73,3 +73,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/reflection.component + +$(MISC)/reflection.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + reflection.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt reflection.component diff --git a/stoc/source/corereflection/reflection.component b/stoc/source/corereflection/reflection.component new file mode 100644 index 000000000..00772a448 --- /dev/null +++ b/stoc/source/corereflection/reflection.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/stoc/source/inspect/introspection.component b/stoc/source/inspect/introspection.component new file mode 100644 index 000000000..349fb0c9d --- /dev/null +++ b/stoc/source/inspect/introspection.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index b8ae012d2..0b9857abe 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -71,7 +71,6 @@ #include #include #include -#include #include #include @@ -3065,32 +3064,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); - - const Sequence< OUString > & rSNL = - stoc_inspect::ImplIntrospection::getSupportedServiceNames_Static(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) { diff --git a/stoc/source/inspect/makefile.mk b/stoc/source/inspect/makefile.mk index 80e87dbf7..60864eea2 100644 --- a/stoc/source/inspect/makefile.mk +++ b/stoc/source/inspect/makefile.mk @@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/introspection.component + +$(MISC)/introspection.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt introspection.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt introspection.component diff --git a/stoc/source/invocation/invocation.component b/stoc/source/invocation/invocation.component new file mode 100644 index 000000000..67178ef2e --- /dev/null +++ b/stoc/source/invocation/invocation.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index b321d97cd..c5813efac 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -1251,12 +1251,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/invocation/makefile.mk b/stoc/source/invocation/makefile.mk index c170bf6b6..72eeea37c 100644 --- a/stoc/source/invocation/makefile.mk +++ b/stoc/source/invocation/makefile.mk @@ -62,4 +62,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/invocation.component +$(MISC)/invocation.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + invocation.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt invocation.component diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index e42aae68d..4c2bc37b5 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -1015,14 +1015,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//============================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, g_entries ); -} - //============================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) diff --git a/stoc/source/invocation_adapterfactory/invocadapt.component b/stoc/source/invocation_adapterfactory/invocadapt.component new file mode 100644 index 000000000..64f7b2b36 --- /dev/null +++ b/stoc/source/invocation_adapterfactory/invocadapt.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/invocation_adapterfactory/makefile.mk b/stoc/source/invocation_adapterfactory/makefile.mk index 66568af03..4c3450ac8 100644 --- a/stoc/source/invocation_adapterfactory/makefile.mk +++ b/stoc/source/invocation_adapterfactory/makefile.mk @@ -63,3 +63,11 @@ DEF1NAME= $(SHL1TARGET) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/invocadapt.component + +$(MISC)/invocadapt.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + invocadapt.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt invocadapt.component diff --git a/stoc/source/javaloader/javaloader.component b/stoc/source/javaloader/javaloader.component new file mode 100644 index 000000000..bdd3b82d5 --- /dev/null +++ b/stoc/source/javaloader/javaloader.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx index 069c9b1ea..ee4f5c8b4 100644 --- a/stoc/source/javaloader/javaloader.cxx +++ b/stoc/source/javaloader/javaloader.cxx @@ -472,12 +472,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/javaloader/makefile.mk b/stoc/source/javaloader/makefile.mk index 60eea6a23..e53b90d5e 100644 --- a/stoc/source/javaloader/makefile.mk +++ b/stoc/source/javaloader/makefile.mk @@ -70,3 +70,10 @@ all: .INCLUDE : target.mk +ALLTAR : $(MISC)/javaloader.component + +$(MISC)/javaloader.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + javaloader.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt javaloader.component diff --git a/stoc/source/javavm/javavm.component b/stoc/source/javavm/javavm.component new file mode 100644 index 000000000..f78d8af3a --- /dev/null +++ b/stoc/source/javavm/javavm.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index f2c018418..ba1c3cf17 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -226,15 +226,10 @@ rtl::OUString serviceGetImplementationName() "com.sun.star.comp.stoc.JavaVirtualMachine")); } -rtl::OUString serviceGetServiceName() -{ - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.java.JavaVirtualMachine")); -} - css::uno::Sequence< rtl::OUString > serviceGetSupportedServiceNames() { - rtl::OUString aServiceName = serviceGetServiceName(); + rtl::OUString aServiceName( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine")); return css::uno::Sequence< rtl::OUString >(&aServiceName, 1); } @@ -619,34 +614,6 @@ component_getImplementationEnvironment(sal_Char const ** pEnvTypeName, *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, - void * pRegistryKey) -{ - if (cppu::component_writeInfoHelper(pServiceManager, pRegistryKey, - aServiceImplementation)) - { - try - { - css::uno::Reference< css::registry::XRegistryKey >( - reinterpret_cast< css::registry::XRegistryKey * >( - pRegistryKey)-> - createKey( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.stoc.JavaVirtualMachine" - "/UNO/SINGLETONS/" - "com.sun.star.java.theJavaVirtualMachine"))))-> - setStringValue(serviceGetServiceName()); - return true; - } - catch (css::uno::Exception &) - { - OSL_ENSURE(false, "com.sun.star.uno.Exception caught"); - } - } - return false; -} - extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName, void * pServiceManager, void * pRegistryKey) diff --git a/stoc/source/javavm/makefile.mk b/stoc/source/javavm/makefile.mk index 96908d10d..bcd36e696 100644 --- a/stoc/source/javavm/makefile.mk +++ b/stoc/source/javavm/makefile.mk @@ -85,3 +85,10 @@ all: .INCLUDE : target.mk +ALLTAR : $(MISC)/javavm.component + +$(MISC)/javavm.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + javavm.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt javavm.component diff --git a/stoc/source/namingservice/makefile.mk b/stoc/source/namingservice/makefile.mk index 424180e11..cc98cdfc3 100644 --- a/stoc/source/namingservice/makefile.mk +++ b/stoc/source/namingservice/makefile.mk @@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/namingservice.component + +$(MISC)/namingservice.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt namingservice.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt namingservice.component diff --git a/stoc/source/namingservice/namingservice.component b/stoc/source/namingservice/namingservice.component new file mode 100644 index 000000000..8450cdee6 --- /dev/null +++ b/stoc/source/namingservice/namingservice.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx index 761fccf64..e5aae9a74 100644 --- a/stoc/source/namingservice/namingservice.cxx +++ b/stoc/source/namingservice/namingservice.cxx @@ -238,12 +238,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/proxy_factory/makefile.mk b/stoc/source/proxy_factory/makefile.mk index b38dac146..23146e678 100644 --- a/stoc/source/proxy_factory/makefile.mk +++ b/stoc/source/proxy_factory/makefile.mk @@ -63,3 +63,11 @@ DEF1NAME=$(SHL1TARGET) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/proxyfac.component + +$(MISC)/proxyfac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + proxyfac.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt proxyfac.component diff --git a/stoc/source/proxy_factory/proxyfac.component b/stoc/source/proxy_factory/proxyfac.component new file mode 100644 index 000000000..bfe2c9c42 --- /dev/null +++ b/stoc/source/proxy_factory/proxyfac.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx index 4b69487f3..8547900b1 100644 --- a/stoc/source/proxy_factory/proxyfac.cxx +++ b/stoc/source/proxy_factory/proxyfac.cxx @@ -526,13 +526,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, g_entries ); -} - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/stocservices/stocservices.cxx b/stoc/source/stocservices/stocservices.cxx index 7b8cfdb90..73787a5f3 100644 --- a/stoc/source/stocservices/stocservices.cxx +++ b/stoc/source/stocservices/stocservices.cxx @@ -102,12 +102,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component new file mode 100644 index 000000000..a77b21ede --- /dev/null +++ b/stoc/util/bootstrap.component @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stoc/util/makefile.mk b/stoc/util/makefile.mk index 54232aa4c..32f229cc3 100644 --- a/stoc/util/makefile.mk +++ b/stoc/util/makefile.mk @@ -95,3 +95,16 @@ DEF2NAME= $(SHL2TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/bootstrap.component $(MISC)/stocservices.component + +$(MISC)/bootstrap.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + bootstrap.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt bootstrap.component + +$(MISC)/stocservices.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt stocservices.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL2TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt stocservices.component diff --git a/stoc/util/stocservices.component b/stoc/util/stocservices.component new file mode 100644 index 000000000..fb3528728 --- /dev/null +++ b/stoc/util/stocservices.component @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ure/prj/build.lst b/ure/prj/build.lst index 07fbfc484..7d3e23edc 100644 --- a/ure/prj/build.lst +++ b/ure/prj/build.lst @@ -1,2 +1,2 @@ -ur ure : cli_ure solenv NULL +ur ure : cli_ure io javaunohelper remotebridges solenv stoc NULL ur ure\source nmake - all ur_source NULL diff --git a/ure/prj/d.lst b/ure/prj/d.lst index 23524c981..22cfb161c 100644 --- a/ure/prj/d.lst +++ b/ure/prj/d.lst @@ -1,9 +1,11 @@ mkdir: %_DEST%\bin%_EXT%\ure -..\%__SRC%\bin\ure\README %_DEST%\bin%_EXT%\ure\README -..\%__SRC%\bin\ure\THIRDPARTYLICENSEREADME.html %_DEST%\bin%_EXT%\ure\THIRDPARTYLICENSEREADME.html -..\%__SRC%\bin\ure\jvmfwk3.ini %_DEST%\bin%_EXT%\ure\jvmfwk3.ini -..\%__SRC%\bin\ure\jvmfwk3rc %_DEST%\bin%_EXT%\ure\jvmfwk3rc -..\%__SRC%\bin\ure\startup.sh %_DEST%\bin%_EXT%\ure\startup.sh -..\%__SRC%\bin\ure\uno.ini %_DEST%\bin%_EXT%\ure\uno.ini -..\%__SRC%\bin\ure\unorc %_DEST%\bin%_EXT%\ure\unorc +mkdir: %_DEST%\xml%_EXT%\ure ..\%__SRC%\bin\uretest.zip %COMMON_DEST%\bin%_EXT%\uretest.zip +..\%__SRC%\misc\services.rdb %_DEST%\xml%_EXT%\ure\services.rdb +..\source\README %_DEST%\bin%_EXT%\ure\README +..\source\THIRDPARTYLICENSEREADME.html %_DEST%\bin%_EXT%\ure\THIRDPARTYLICENSEREADME.html +..\source\jvmfwk3.ini %_DEST%\bin%_EXT%\ure\jvmfwk3.ini +..\source\jvmfwk3rc %_DEST%\bin%_EXT%\ure\jvmfwk3rc +..\source\startup.sh %_DEST%\bin%_EXT%\ure\startup.sh +..\source\uno.ini %_DEST%\bin%_EXT%\ure\uno.ini +..\source\unorc %_DEST%\bin%_EXT%\ure\unorc diff --git a/ure/source/makefile.mk b/ure/source/makefile.mk index a1728b277..d10e276c4 100644 --- a/ure/source/makefile.mk +++ b/ure/source/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -25,52 +25,47 @@ # #************************************************************************* -PRJ := .. -PRJNAME := ure -TARGET := $(PRJNAME) - -.INCLUDE: settings.mk - -.IF "$(OS)" == "WNT" || "$(OS)" == "OS2" -MY_RC = .ini -.ELSE -MY_RC = rc -.ENDIF +PRJ = .. +PRJNAME = ure +TARGET = source ZIP1TARGET = uretest ZIP1FLAGS = -r ZIP1LIST = uretest -.INCLUDE: target.mk - -ALLTAR: \ - $(BIN)$/ure$/README \ - $(BIN)$/ure$/THIRDPARTYLICENSEREADME.html \ - $(BIN)$/ure$/jvmfwk3$(MY_RC) \ - $(BIN)$/ure$/uno$(MY_RC) +my_components = \ + acceptor \ + bootstrap \ + bridgefac \ + connector \ + introspection \ + invocadapt \ + invocation \ + javaloader \ + javavm \ + juh \ + namingservice \ + proxyfac \ + reflection \ + remotebridge \ + stocservices \ + streams \ + textinstream \ + textoutstream \ + uuresolver -$(BIN)$/ure$/README: README - -$(MKDIR) $(@:d) - $(COPY) $< $@ - -$(BIN)$/ure$/THIRDPARTYLICENSEREADME.html: THIRDPARTYLICENSEREADME.html - - $(MKDIR) $(@:d) - $(COPY) $< $@ - -$(BIN)$/ure$/jvmfwk3$(MY_RC): jvmfwk3$(MY_RC) - -$(MKDIR) $(@:d) - $(COPY) $< $@ - -$(BIN)$/ure$/uno$(MY_RC): uno$(MY_RC) - -$(MKDIR) $(@:d) - $(COPY) $< $@ - -.IF "$(OS)" != "WNT" +.INCLUDE: settings.mk +.INCLUDE: target.mk -ALLTAR: $(BIN)$/ure$/startup.sh +ALLTAR : $(MISC)/services.rdb -$(BIN)$/ure$/startup.sh: startup.sh - -$(MKDIR) $(@:d) - $(COPY) $< $@ +$(MISC)/services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/services.input $(my_components:^"$(SOLARXMLDIR)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/services.input -.ENDIF +$(MISC)/services.input .ERRREMOVE : + - $(RM) $@ + echo \ + '$(my_components:^"":+".component")' \ + > $@ -- cgit v1.2.3 From 85826e325f865679e95d17cfeaf94e0c161f946f Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:41:49 +0200 Subject: sb123: #i113189# missing includes --- stoc/source/simpleregistry/textualservices.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stoc') diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index 11196b76a..a3e44d643 100755 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -28,6 +28,8 @@ #include "precompiled_stoc.hxx" #include "sal/config.h" +#include +#include #include #include -- cgit v1.2.3 From f93a859e5c7b42bc7f3a5ccc0e6a063f87869505 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 14 Sep 2010 09:15:02 +0200 Subject: sb129: #i113189# adapted tests; improved subsequenttests --- cppuhelper/qa/propertysetmixin/JavaSupplier.java | 5 -- .../qa/propertysetmixin/comp_propertysetmixin.cxx | 7 --- cppuhelper/qa/propertysetmixin/makefile.mk | 60 +++++++++++++--------- .../qa_propertysetmixin.cpp.component | 34 ++++++++++++ .../qa_propertysetmixin.java.component | 34 ++++++++++++ .../qa/propertysetmixin/test_propertysetmixin.cxx | 40 +++------------ cppuhelper/source/bootstrap.cxx | 10 +++- stoc/test/uriproc/makefile.mk | 21 +++++--- 8 files changed, 134 insertions(+), 77 deletions(-) create mode 100644 cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component create mode 100644 cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component (limited to 'stoc') diff --git a/cppuhelper/qa/propertysetmixin/JavaSupplier.java b/cppuhelper/qa/propertysetmixin/JavaSupplier.java index 513f207ab..834e448c6 100644 --- a/cppuhelper/qa/propertysetmixin/JavaSupplier.java +++ b/cppuhelper/qa/propertysetmixin/JavaSupplier.java @@ -75,11 +75,6 @@ public final class JavaSupplier extends WeakBase implements XSupplier { : null; } - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - implementationName, serviceName, regKey); - } - private static final String implementationName = JavaSupplier.class.getName(); private static final String serviceName diff --git a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx index 67571e82c..c6eccecb4 100644 --- a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx +++ b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx @@ -427,10 +427,3 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( { *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * serviceManager, void * registryKey) -{ - return cppu::component_writeInfoHelper( - serviceManager, registryKey, entries); -} diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk index edd4795fc..41b72d8a8 100644 --- a/cppuhelper/qa/propertysetmixin/makefile.mk +++ b/cppuhelper/qa/propertysetmixin/makefile.mk @@ -37,6 +37,8 @@ PACKAGE = test/cppuhelper/propertysetmixin/comp ENABLE_EXCEPTIONS := TRUE +my_components = $(TARGET).cpp $(TARGET).java + .INCLUDE: settings.mk .IF "$(OS)" == "WNT" @@ -75,51 +77,63 @@ JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar ALLTAR: test $(MISC)/$(TARGET)/types.urd: types.idl - - $(MKDIR) $(@:d) + $(MKDIRHIER) $(@:d) $(IDLC) -O$(@:d) -I$(SOLARIDLDIR) -cid -we $< $(MISC)/$(TARGET)/types.rdb: $(MISC)/$(TARGET)/types.urd - $(RM) $@ $(REGMERGE) $@ /UCR $< -$(MISC)/$(TARGET)/uno.rdb: $(MISC)/$(TARGET)/types.rdb $(SHL2TARGETN) \ - $(MISC)/$(TARGET)/$(TARGET).uno.jar $(MISC)/$(TARGET)/bootstrap.rdb - - $(MKDIR) $(@:d) - $(COPY) $(SOLARBINDIR)/types.rdb $@ - $(REGMERGE) $@ / $(MISC)/$(TARGET)/types.rdb - $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \ - -c reflection.uno -c stocservices.uno -c $(SHL2TARGETN) - $(REGCOMP) -register -br $(MISC)/$(TARGET)/bootstrap.rdb -r $@ \ - -c $(my_file)$(PWD)/$(MISC)/$(TARGET)/$(TARGET).uno.jar \ - -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) - -$(MISC)/$(TARGET)/bootstrap.rdb: - - $(MKDIR) $(@:d) - $(COPY) $(SOLARBINDIR)/types.rdb $@ - $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \ - -c stocservices.uno - $(MISC)/$(TARGET)/cppumaker.flag: $(MISC)/$(TARGET)/types.rdb $(CPPUMAKER) -O$(MISC)/$(TARGET)/inc -BUCR -Gc \ - -X$(SOLARBINDIR)/types.rdb $< + -X$(SOLARBINDIR)/udkapi.rdb $< $(TOUCH) $@ $(SLOFILES): $(MISC)/$(TARGET)/cppumaker.flag $(MISC)/$(TARGET)/javamaker.flag: $(MISC)/$(TARGET)/types.rdb - $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/types.rdb $< + $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/udkapi.rdb $< $(TOUCH) $@ $(JAVATARGET): $(MISC)/$(TARGET)/javamaker.flag +$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/services.input \ + $(my_components:^"$(MISC)/$(TARGET)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input + +$(MISC)/$(TARGET)/services.input .ERRREMOVE: + $(MKDIRHIER) $(@:d) + - $(RM) $@ + echo \ + '$(my_components:^"":+".component")' \ + > $@ + +$(MISC)/$(TARGET)/$(TARGET).cpp.component .ERRREMOVE: \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_INBUILD_NATIVE)$(SHL2TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component + +$(MISC)/$(TARGET)/$(TARGET).java.component .ERRREMOVE: \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_INBUILD_JAVA)$(TARGET).uno.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component + $(MISC)/$(TARGET)/$(TARGET).uno.jar: $(JAVATARGET) \ $(MISC)/$(TARGET)/javamaker.flag manifest jar cfm $@ manifest -C $(CLASSDIR) test/cppuhelper/propertysetmixin -test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/uno.rdb +test .PHONY: $(SHL1TARGETN) $(SHL2TARGETN) $(MISC)/$(TARGET)/$(TARGET).uno.jar \ + $(MISC)/$(TARGET)/types.rdb $(MISC)/$(TARGET)/services.rdb $(CPPUNITTESTER) $(SHL1TARGETN) \ - -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \ + '-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/types.rdb' \ + '-env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb'\ -env:URE_INTERNAL_LIB_DIR=$(my_file)$(SOLARSHAREDBIN) \ - -env:arg-reg=$(MISC)/$(TARGET)/uno.rdb -env:arg-path=$(SOLARSHAREDBIN) + -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \ + -env:OOO_INBUILD_SHAREDLIB_DIR=$(my_file)$(PWD)/$(DLLDEST) \ + -env:OOO_INBUILD_JAR_DIR=$(my_file)$(PWD)/$(MISC)/$(TARGET) .END diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component new file mode 100644 index 000000000..a654e0758 --- /dev/null +++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component new file mode 100644 index 000000000..9711563b7 --- /dev/null +++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx index 82256c634..9a25e9885 100644 --- a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx +++ b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx @@ -52,21 +52,19 @@ #include "com/sun/star/beans/XPropertySetInfo.hpp" #include "com/sun/star/beans/XVetoableChangeListener.hpp" #include "com/sun/star/lang/XComponent.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Type.hxx" #include "com/sun/star/uno/XComponentContext.hpp" +#include "cppuhelper/bootstrap.hxx" #include "cppuhelper/implbase1.hxx" -#include "cppuhelper/servicefactory.hxx" #include "cppunit/TestAssert.h" #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" #include "cppunit/plugin/TestPlugIn.h" #include "osl/mutex.hxx" -#include "rtl/bootstrap.hxx" #include "rtl/ref.hxx" #include "rtl/string.h" #include "rtl/textenc.h" @@ -98,14 +96,6 @@ std::ostream & operator <<(std::ostream & out, css::uno::Any const & value) { out << "com::sun::star::uno::Any[" << value.getValueType() << ", ...]"; } -rtl::OUString getArgument(rtl::OUString const & name) { - rtl::OUString val; - CPPUNIT_ASSERT( - rtl::Bootstrap::get( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("arg-")) + name, val)); - return val; -} - class BoundListener: public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener > { @@ -178,7 +168,7 @@ class Test: public CppUnit::TestFixture { public: virtual void setUp(); - void finish(); + virtual void tearDown(); void testCppEmpty1() { testEmpty1(getCppSupplier()); } @@ -199,7 +189,6 @@ public: CPPUNIT_TEST(testJavaEmpty1); CPPUNIT_TEST(testJavaEmpty2); CPPUNIT_TEST(testJavaFull); - CPPUNIT_TEST(finish); CPPUNIT_TEST_SUITE_END(); private: @@ -221,30 +210,15 @@ private: css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > const & supplier) const; - static css::uno::Reference< css::uno::XComponentContext > m_context; + css::uno::Reference< css::uno::XComponentContext > m_context; }; void Test::setUp() { - // For whatever reason, on W32 it does not work to create/destroy a fresh - // component context for each test in Test::setUp/tearDown; therefore, a - // single component context is used for all tests and destroyed in the last - // pseudo-test "finish": - if (!m_context.is()) { - css::uno::Reference< css::lang::XMultiComponentFactory > factory( - cppu::createRegistryServiceFactory( - getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reg"))), - sal_False, - getArgument( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("path")))), - css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::beans::XPropertySet >( - factory, css::uno::UNO_QUERY_THROW)->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))) - >>= m_context; - } + m_context = cppu::defaultBootstrap_InitialComponentContext(); + CPPUNIT_ASSERT(m_context.is()); } -void Test::finish() { +void Test::tearDown() { css::uno::Reference< css::lang::XComponent >( m_context, css::uno::UNO_QUERY_THROW)->dispose(); } @@ -671,8 +645,6 @@ void Test::testFull( } catch (css::beans::UnknownPropertyException &) {} } -css::uno::Reference< css::uno::XComponentContext > Test::m_context; - CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx index 0dcb24b5a..b8af92fed 100644 --- a/cppuhelper/source/bootstrap.cxx +++ b/cppuhelper/source/bootstrap.cxx @@ -380,9 +380,15 @@ SAL_CALL defaultBootstrap_InitialComponentContext( Bootstrap const & bootstrap ) SAL_THROW( (Exception) ) { - OUString bootstrapPath( get_this_libpath() ); - OUString iniDir; + OUString bootstrapPath; + if (!bootstrap.getFrom( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URE_INTERNAL_LIB_DIR")), + bootstrapPath)) + { + bootstrapPath = get_this_libpath(); + } + OUString iniDir; osl_getProcessWorkingDir(&iniDir.pData); Reference smgr_XMultiComponentFactory( diff --git a/stoc/test/uriproc/makefile.mk b/stoc/test/uriproc/makefile.mk index cfdc33e75..84f852689 100644 --- a/stoc/test/uriproc/makefile.mk +++ b/stoc/test/uriproc/makefile.mk @@ -35,6 +35,8 @@ TARGET := test_uriproc ENABLE_EXCEPTIONS := TRUE +my_components = stocservices + .INCLUDE: settings.mk CFLAGSCXX += $(CPPUNIT_CFLAGS) @@ -62,14 +64,21 @@ ALLTAR: test test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb $(CPPUNITTESTER) $(SHL1TARGETN) \ - -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \ -env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb \ - -env:OOO_TEST_PREFIX=$(my_file)$(PWD)/$(DLLDEST)/ + -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \ + -env:URE_INTERNAL_LIB_DIR=$(my_file)$(PWD)/$(DLLDEST) + +$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/services.input \ + $(my_components:^"$(MISC)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input -$(MISC)/$(TARGET)/services.rdb: +$(MISC)/$(TARGET)/services.input .ERRREMOVE: $(MKDIRHIER) $(@:d) - $(RM) $@ - $(REGCOMP) -register -r $@ -wop=vnd.sun.star.expand:\$${{OOO_TEST_PREFIX}} \ - -c $(DLLDEST)/stocservices.uno$(DLLPOST) + - $(RM) $@ + echo \ + '$(my_components:^"":+".component")' \ + > $@ .END -- cgit v1.2.3 From adc2e2b2a5a56667a5dc2bad91390caf24c68327 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 14 Sep 2010 15:14:56 +0200 Subject: sb129: #i113189# removed obviously unnecessary service registrations; allow empty --- stoc/source/simpleregistry/textualservices.cxx | 18 +++++++++--------- stoc/util/bootstrap.component | 6 +----- 2 files changed, 10 insertions(+), 14 deletions(-) (limited to 'stoc') diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index a3e44d643..44315b689 100755 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -194,21 +194,13 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): RTL_CONSTASCII_USTRINGPARAM( ": unexpected item in "))), css::uno::Reference< css::uno::XInterface >()); + case STATE_IMPLEMENTATION_INITIAL: case STATE_IMPLEMENTATION_SERVICE: case STATE_IMPLEMENTATION_SINGLETON: if (res == xmlreader::XmlReader::RESULT_END) { state = STATE_COMPONENT; break; } - if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && - name.equals(RTL_CONSTASCII_STRINGPARAM("singleton"))) - { - handleSingleton(); - state = STATE_SINGLETON; - break; - } - // fall through - case STATE_IMPLEMENTATION_INITIAL: if (state != STATE_IMPLEMENTATION_SINGLETON && res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && name.equals(RTL_CONSTASCII_STRINGPARAM("service"))) @@ -217,6 +209,14 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): state = STATE_SERVICE; break; } + if (state != STATE_IMPLEMENTATION_INITIAL && + res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("singleton"))) + { + handleSingleton(); + state = STATE_SINGLETON; + break; + } throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component index a77b21ede..ccc131b4a 100644 --- a/stoc/util/bootstrap.component +++ b/stoc/util/bootstrap.component @@ -38,16 +38,12 @@ - - - - - + -- cgit v1.2.3 From 24e2ed8b250b2f4f85b1c839fee1004cdc3e6d3e Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 15 Sep 2010 10:30:26 +0200 Subject: mib19: #163566# do not fire exceptions when calling 'hasByHierarchicalName' --- stoc/source/registry_tdprovider/tdprovider.cxx | 33 ++++++++++++-------------- 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'stoc') diff --git a/stoc/source/registry_tdprovider/tdprovider.cxx b/stoc/source/registry_tdprovider/tdprovider.cxx index c6e841390..0a3e16753 100644 --- a/stoc/source/registry_tdprovider/tdprovider.cxx +++ b/stoc/source/registry_tdprovider/tdprovider.cxx @@ -172,6 +172,8 @@ public: virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); // XHierarchicalNameAccess + Any getByHierarchicalNameImpl( const OUString & rName ); + virtual Any SAL_CALL getByHierarchicalName( const OUString & rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL hasByHierarchicalName( const OUString & rName ) throw(::com::sun::star::uno::RuntimeException); @@ -223,14 +225,7 @@ Any ProviderImpl::TypeDescriptionManagerWrapper::getByHierarchicalName( sal_Bool ProviderImpl::TypeDescriptionManagerWrapper::hasByHierarchicalName( OUString const & name ) throw (RuntimeException) { - try - { - return getByHierarchicalName( name ).hasValue(); - } - catch (container::NoSuchElementException &) - { - return false; - } + return m_xTDMgr->hasByHierarchicalName( name ) || m_xThisProvider->hasByHierarchicalName( name ); } //______________________________________________________________________________ @@ -344,8 +339,7 @@ Sequence< OUString > ProviderImpl::getSupportedServiceNames() // XHierarchicalNameAccess //__________________________________________________________________________________________________ -Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName ) - throw(::com::sun::star::uno::RuntimeException, com::sun::star::container::NoSuchElementException) +Any ProviderImpl::getByHierarchicalNameImpl( const OUString & rName ) { Any aRet; @@ -432,7 +426,17 @@ Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName ) // Don't stop iteration in this case. } + catch ( NoSuchElementException const & ) + { + } } + return aRet; +} + +Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName ) + throw(::com::sun::star::uno::RuntimeException, com::sun::star::container::NoSuchElementException) +{ + Any aRet( getByHierarchicalNameImpl( rName ) ); if ( !aRet.hasValue() ) throw NoSuchElementException( @@ -445,14 +449,7 @@ Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName ) sal_Bool ProviderImpl::hasByHierarchicalName( const OUString & rName ) throw(::com::sun::star::uno::RuntimeException) { - try - { - return getByHierarchicalName( rName ).hasValue(); - } - catch (NoSuchElementException &) - { - } - return sal_False; + return getByHierarchicalNameImpl( rName ).hasValue(); } // XTypeDescriptionEnumerationAccess -- cgit v1.2.3 From 559c8fc2d7fdec9216b739bced674521a10120db Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 15 Sep 2010 11:45:04 +0200 Subject: sb129: #i113189# cleaned up makefile rules; deliver services.input to have it modifiable for special one-off products --- cppuhelper/qa/propertysetmixin/makefile.mk | 3 +-- stoc/test/uriproc/makefile.mk | 3 +-- ure/source/makefile.mk | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'stoc') diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk index 41b72d8a8..04aa2479c 100644 --- a/cppuhelper/qa/propertysetmixin/makefile.mk +++ b/cppuhelper/qa/propertysetmixin/makefile.mk @@ -103,9 +103,8 @@ $(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input -$(MISC)/$(TARGET)/services.input .ERRREMOVE: +$(MISC)/$(TARGET)/services.input: $(MKDIRHIER) $(@:d) - - $(RM) $@ echo \ '$(my_components:^"":+".component")' \ > $@ diff --git a/stoc/test/uriproc/makefile.mk b/stoc/test/uriproc/makefile.mk index 84f852689..05ffd5fdd 100644 --- a/stoc/test/uriproc/makefile.mk +++ b/stoc/test/uriproc/makefile.mk @@ -74,9 +74,8 @@ $(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input -$(MISC)/$(TARGET)/services.input .ERRREMOVE: +$(MISC)/$(TARGET)/services.input: $(MKDIRHIER) $(@:d) - - $(RM) $@ echo \ '$(my_components:^"":+".component")' \ > $@ diff --git a/ure/source/makefile.mk b/ure/source/makefile.mk index d10e276c4..cd6fab210 100644 --- a/ure/source/makefile.mk +++ b/ure/source/makefile.mk @@ -64,8 +64,7 @@ $(MISC)/services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \ $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/services.input -$(MISC)/services.input .ERRREMOVE : - - $(RM) $@ +$(MISC)/services.input : echo \ '$(my_components:^"":+".component")' \ > $@ -- cgit v1.2.3 From 07c1dd42867925dfec98cc724d354c9bc93cc2e4 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 15 Sep 2010 16:35:54 +0200 Subject: sb129: #i113189# textualservices no longer associates singletons with services, adapted bootstrapInitialContext accordingly --- cppuhelper/source/servicefactory.cxx | 73 +++++++++++++------------- stoc/source/simpleregistry/textualservices.cxx | 68 ++++++++++-------------- 2 files changed, 65 insertions(+), 76 deletions(-) (limited to 'stoc') diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx index d1ae7f1a9..3dcea15c7 100644 --- a/cppuhelper/source/servicefactory.cxx +++ b/cppuhelper/source/servicefactory.cxx @@ -28,13 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cppuhelper.hxx" -#if OSL_DEBUG_LEVEL > 0 -#include -#endif #include #include "rtl/string.hxx" -#include "rtl/ustrbuf.hxx" #include "rtl/bootstrap.hxx" #include "osl/diagnose.h" #include "osl/file.h" @@ -46,6 +42,7 @@ #include "cppuhelper/servicefactory.hxx" #include "cppuhelper/bootstrap.hxx" +#include "com/sun/star/uno/DeploymentException.hpp" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/lang/XInitialization.hpp" #include "com/sun/star/lang/XSingleServiceFactory.hpp" @@ -64,6 +61,7 @@ using namespace ::rtl; using namespace ::osl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +namespace css = com::sun::star; namespace cppu { @@ -417,39 +415,42 @@ Reference< XComponentContext > bootstrapInitialContext( keys.getConstArray(); for ( sal_Int32 nPos = keys.getLength(); nPos--; ) { - Reference< registry::XRegistryKey > const & xKey2 = - pKeys[ nPos ]; - try - { - OUStringBuffer buf( 32 ); - buf.appendAscii( - RTL_CONSTASCII_STRINGPARAM("/singletons/") ); - buf.append( - xKey2->getKeyName().copy( - sizeof("/SINGLETONS") /* -\0 +'/' */ ) ); - entry.name = buf.makeStringAndClear(); - entry.value <<= xKey2->getStringValue(); - context_values.push_back( entry ); - } - catch (Exception & rExc) - { -#if OSL_DEBUG_LEVEL > 0 - OString aStr( - OUStringToOString( - xKey2->getKeyName().copy( 11 ), - RTL_TEXTENCODING_ASCII_US ) ); - OString aStr2( - OUStringToOString( - rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); - fprintf( - stderr, - "### failed reading singleton [%s]" - " service name from registry: %s\n", - aStr.getStr(), aStr2.getStr() ); -#else - (void) rExc; // avoid warning about unused variable -#endif + css::uno::Sequence< rtl::OUString > impls( + css::uno::Reference< css::registry::XRegistryKey >( + pKeys[nPos]->openKey( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "REGISTERED_BY"))), + css::uno::UNO_SET_THROW)->getAsciiListValue()); + switch (impls.getLength()) { + case 0: + throw css::uno::DeploymentException( + (pKeys[nPos]->getKeyName() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/REGISTERED_BY is empty"))), + css::uno::Reference< css::uno::XInterface >()); + case 1: + break; + default: + OSL_TRACE( + ("arbitrarily chosing \"%s\" among multiple" + " implementations for \"%s\""), + rtl::OUStringToOString( + impls[0], RTL_TEXTENCODING_UTF8).getStr(), + rtl::OUStringToOString( + pKeys[nPos]->getKeyName(), + RTL_TEXTENCODING_UTF8).getStr()); + break; } + context_values.push_back( + ContextEntry_Init( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("/singletons/")) + + pKeys[nPos]->getKeyName().copy( + RTL_CONSTASCII_LENGTH("/SINGLETONS/"))), + css::uno::makeAny(impls[0]), + true)); } } } diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index 44315b689..462007b6c 100755 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -67,18 +67,8 @@ struct Implementation { typedef std::map< rtl::OUString, Implementation > Implementations; -struct Service { - std::vector< rtl::OUString > implementations; -}; - -typedef std::map< rtl::OUString, Service > Services; - -struct Singleton { - rtl::OUString service; - std::vector< rtl::OUString > implementations; -}; - -typedef std::map< rtl::OUString, Singleton > Singletons; +typedef std::map< rtl::OUString, std::vector< rtl::OUString > > + ImplementationMap; } @@ -86,8 +76,8 @@ class Data: public salhelper::SimpleReferenceObject, private boost::noncopyable { public: Implementations implementations; - Services services; - Singletons singletons; + ImplementationMap services; + ImplementationMap singletons; }; namespace { @@ -124,9 +114,7 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): "http://openoffice.org/2010/uno-components"))); enum State { STATE_BEGIN, STATE_END, STATE_COMPONENTS, STATE_COMPONENT_INITIAL, - STATE_COMPONENT, STATE_IMPLEMENTATION_INITIAL, - STATE_IMPLEMENTATION_SERVICE, STATE_IMPLEMENTATION_SINGLETON, - STATE_SERVICE, STATE_SINGLETON }; + STATE_COMPONENT, STATE_IMPLEMENTATION, STATE_SERVICE, STATE_SINGLETON }; for (State state = STATE_BEGIN;;) { xmlreader::Span name; int nsId; @@ -185,7 +173,7 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): name.equals(RTL_CONSTASCII_STRINGPARAM("implementation"))) { handleImplementation(); - state = STATE_IMPLEMENTATION_INITIAL; + state = STATE_IMPLEMENTATION; break; } throw css::registry::InvalidRegistryException( @@ -194,23 +182,19 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): RTL_CONSTASCII_USTRINGPARAM( ": unexpected item in "))), css::uno::Reference< css::uno::XInterface >()); - case STATE_IMPLEMENTATION_INITIAL: - case STATE_IMPLEMENTATION_SERVICE: - case STATE_IMPLEMENTATION_SINGLETON: + case STATE_IMPLEMENTATION: if (res == xmlreader::XmlReader::RESULT_END) { state = STATE_COMPONENT; break; } - if (state != STATE_IMPLEMENTATION_SINGLETON && - res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && name.equals(RTL_CONSTASCII_STRINGPARAM("service"))) { handleService(); state = STATE_SERVICE; break; } - if (state != STATE_IMPLEMENTATION_INITIAL && - res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && name.equals(RTL_CONSTASCII_STRINGPARAM("singleton"))) { handleSingleton(); @@ -225,7 +209,7 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): css::uno::Reference< css::uno::XInterface >()); case STATE_SERVICE: if (res == xmlreader::XmlReader::RESULT_END) { - state = STATE_IMPLEMENTATION_SERVICE; + state = STATE_IMPLEMENTATION; break; } throw css::registry::InvalidRegistryException( @@ -236,7 +220,7 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): css::uno::Reference< css::uno::XInterface >()); case STATE_SINGLETON: if (res == xmlreader::XmlReader::RESULT_END) { - state = STATE_IMPLEMENTATION_SINGLETON; + state = STATE_IMPLEMENTATION; break; } throw css::registry::InvalidRegistryException( @@ -345,15 +329,13 @@ void Parser::handleImplementation() { void Parser::handleService() { rtl::OUString name = getNameAttribute(); data_->implementations[attrImplementation_].services.push_back(name); - data_->services[name].implementations.push_back(attrImplementation_); + data_->services[name].push_back(attrImplementation_); } void Parser::handleSingleton() { rtl::OUString name = getNameAttribute(); data_->implementations[attrImplementation_].singletons.push_back(name); - data_->singletons[name].service = - data_->implementations[attrImplementation_].services[0]; - data_->singletons[name].implementations.push_back(attrImplementation_); + data_->singletons[name].push_back(attrImplementation_); } rtl::OUString Parser::getNameAttribute() { @@ -710,10 +692,10 @@ css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw ( std::vector< rtl::OUString > const * list; switch (state) { case STATE_SERVICE: - list = &data_->services[path_[1]].implementations; + list = &data_->services[path_[1]]; break; case STATE_REGISTEREDBY: - list = &data_->singletons[path_[1]].implementations; + list = &data_->singletons[path_[1]]; break; default: throw css::registry::InvalidValueException( @@ -761,17 +743,23 @@ rtl::OUString Key::getStringValue() throw ( OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); switch (state) { case STATE_IMPLEMENTATION_SINGLETON: - return data_->implementations[path_[1]].services[0]; case STATE_SINGLETON: - return data_->singletons[path_[1]].service; - default: - throw css::registry::InvalidValueException( + throw css::registry::InvalidRegistryException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.registry.SimpleRegistry textual services key" - " getStringValue: wrong type")), + " getStringValue: does not associate singletons with" + " services")), static_cast< OWeakObject * >(this)); } + // default case extracted from switch to avoid erroneous compiler warnings + // on Solaris: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getStringValue: wrong type")), + static_cast< OWeakObject * >(this)); } void Key::setStringValue(rtl::OUString const &) @@ -1163,7 +1151,7 @@ css::uno::Sequence< rtl::OUString > Key::getChildren() { css::uno::Sequence< rtl::OUString > seq( static_cast< sal_Int32 >(data_->services.size())); sal_Int32 i = 0; - for (Services::iterator j(data_->services.begin()); + for (ImplementationMap::iterator j(data_->services.begin()); j != data_->services.end(); ++j) { seq[i++] = j->first; @@ -1183,7 +1171,7 @@ css::uno::Sequence< rtl::OUString > Key::getChildren() { css::uno::Sequence< rtl::OUString > seq( static_cast< sal_Int32 >(data_->singletons.size())); sal_Int32 i = 0; - for (Singletons::iterator j(data_->singletons.begin()); + for (ImplementationMap::iterator j(data_->singletons.begin()); j != data_->singletons.end(); ++j) { seq[i++] = j->first; -- cgit v1.2.3 From edcb1e681fca71d303f615265b2cabec1e870d83 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 16 Sep 2010 09:56:55 +0200 Subject: sb129: #i113189# work around unhelpful compiler warnings --- stoc/source/simpleregistry/textualservices.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stoc') diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index 462007b6c..932c63912 100755 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -751,6 +751,8 @@ rtl::OUString Key::getStringValue() throw ( " getStringValue: does not associate singletons with" " services")), static_cast< OWeakObject * >(this)); + default: + break; } // default case extracted from switch to avoid erroneous compiler warnings // on Solaris: -- cgit v1.2.3 From 91f3af66ded34183b3d573e53916a48f82ffb7a2 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 6 Oct 2010 17:43:02 +0200 Subject: sb131: #i114962# first step of passive extension component registration (no live deployment yet) --- stoc/source/simpleregistry/textualservices.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'stoc') diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index 932c63912..5a50a5aa6 100755 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -41,8 +41,10 @@ #include "com/sun/star/uno/XInterface.hpp" #include "cppuhelper/implbase1.hxx" #include "osl/diagnose.h" +#include "rtl/malformeduriexception.hxx" #include "rtl/ref.hxx" #include "rtl/string.h" +#include "rtl/uri.hxx" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" @@ -306,6 +308,16 @@ void Parser::handleComponent() { ": is missing \"loader\" attribute"))), css::uno::Reference< css::uno::XInterface >()); } + try { + attrUri_ = rtl::Uri::convertRelToAbs(reader_.getUrl(), attrUri_); + } catch (rtl::MalformedUriException & e) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM(": bad \"uri\" attribute: ")) + + e.getMessage()), + css::uno::Reference< css::uno::XInterface >()); + } } void Parser::handleImplementation() { -- cgit v1.2.3 From b79c9285a5c28237367d91214b567face76df206 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Mon, 18 Oct 2010 14:50:08 +0200 Subject: #i114924# --- stoc/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'stoc') diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst index b671e0a62..256f09474 100644 --- a/stoc/prj/build.lst +++ b/stoc/prj/build.lst @@ -1,4 +1,4 @@ -tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader NULL +tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader LIBXSTL:libxslt NULL tc stoc usr1 - all tc_mkout NULL tc stoc\inc nmake - all tc_inc NULL tc stoc\source\defaultregistry nmake - all tc_defr tc_boot tc_inc NULL -- cgit v1.2.3 From 1396960977d9c7f734b8a6325571c84505311c78 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 21 Oct 2010 15:41:41 +0200 Subject: sb131: #i114962# singleton implementations need not have a .../UNO/SERVICES rdb key --- stoc/source/implementationregistration/implreg.cxx | 92 ++++++++++------------ 1 file changed, 40 insertions(+), 52 deletions(-) (limited to 'stoc') diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index eb3e6dc34..f874c1d46 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -1153,36 +1153,24 @@ static void prepareRegistry( { // update entries in SERVICES section Sequence< Reference < XRegistryKey > > serviceKeys = xKey->openKeys(); - OUString implName; + const Reference < XRegistryKey > * pServiceKeys = serviceKeys.getConstArray(); - if (serviceKeys.getLength()) - { - const Reference < XRegistryKey > * pServiceKeys = serviceKeys.getConstArray(); - - implName = OUString(xImplKey->getKeyName().getStr() + 1); - sal_Int32 firstDot = implName.indexOf('/'); - - if (firstDot >= 0) - implName = implName.copy(firstDot + 1); + OUString implName = OUString(xImplKey->getKeyName().getStr() + 1); + sal_Int32 firstDot = implName.indexOf('/'); - sal_Int32 offset = xKey->getKeyName().getLength() + 1; - - for (sal_Int32 j = 0; j < serviceKeys.getLength(); j++) - { - OUString serviceName = pServiceKeys[j]->getKeyName().copy(offset); + if (firstDot >= 0) + implName = implName.copy(firstDot + 1); - createUniqueSubEntry( - xDest->getRootKey()->createKey( - pool.slash_SERVICES + serviceName ), - implName); - } + sal_Int32 offset = xKey->getKeyName().getLength() + 1; - } - else + for (sal_Int32 j = 0; j < serviceKeys.getLength(); j++) { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "prepareRegistry(): no service names given by component" ) ), - Reference< XInterface > () ); + OUString serviceName = pServiceKeys[j]->getKeyName().copy(offset); + + createUniqueSubEntry( + xDest->getRootKey()->createKey( + pool.slash_SERVICES + serviceName ), + implName); } xKey = xImplKey->openKey( pool.slash_UNO ); @@ -1205,42 +1193,42 @@ static void prepareRegistry( } } } + } - // update LOCATION entry - xKey = xImplKey->createKey( pool.slash_UNO_slash_LOCATION ); + // update LOCATION entry + xKey = xImplKey->createKey( pool.slash_UNO_slash_LOCATION ); - if (xKey.is()) - { - xKey->setAsciiValue(locationUrl); - } + if (xKey.is()) + { + xKey->setAsciiValue(locationUrl); + } - // update ACTIVATOR entry - xKey = xImplKey->createKey( pool.slash_UNO_slash_ACTIVATOR ); + // update ACTIVATOR entry + xKey = xImplKey->createKey( pool.slash_UNO_slash_ACTIVATOR ); - if (xKey.is()) - { - xKey->setAsciiValue(implementationLoaderUrl); - } + if (xKey.is()) + { + xKey->setAsciiValue(implementationLoaderUrl); + } - xKey = xImplKey->openKey( pool.slash_UNO_slash_SERVICES ); + xKey = xImplKey->openKey( pool.slash_UNO_slash_SERVICES ); + + if (xKey.is() && (xKey->getValueType() == RegistryValueType_ASCIILIST)) + { + // update link entries in REGISTRY_LINKS section + Sequence linkNames = xKey->getAsciiListValue(); - if (xKey.is() && (xKey->getValueType() == RegistryValueType_ASCIILIST)) + if (linkNames.getLength()) { - // update link entries in REGISTRY_LINKS section - Sequence linkNames = xKey->getAsciiListValue(); - - if (linkNames.getLength()) - { - const OUString* pLinkNames = linkNames.getConstArray(); + const OUString* pLinkNames = linkNames.getConstArray(); - for (sal_Int32 j = 0; j < linkNames.getLength(); j++) - { - prepareLink(xDest, xImplKey, pLinkNames[j]); - } - } - } + for (sal_Int32 j = 0; j < linkNames.getLength(); j++) + { + prepareLink(xDest, xImplKey, pLinkNames[j]); + } + } } - + insert_singletons( xDest, xImplKey, xContext ); } } -- cgit v1.2.3 From 5656457c77e63713e8b202adfee0e1e98e9055c6 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 7 Jan 2011 14:53:16 +0100 Subject: sb139: #i113686# let LRU_Cache::setValue nop after LRU_Cache::clear (so that IdlReflectionServiceImpl does not leak ring-referenced _aElements members after dispose) --- stoc/source/corereflection/lrucache.hxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'stoc') diff --git a/stoc/source/corereflection/lrucache.hxx b/stoc/source/corereflection/lrucache.hxx index e4f6e6855..3cf8f0899 100644 --- a/stoc/source/corereflection/lrucache.hxx +++ b/stoc/source/corereflection/lrucache.hxx @@ -177,9 +177,9 @@ template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::setValue( const t_Key & rKey, const t_Val & rValue ) { + ::osl::MutexGuard aGuard( _aCacheMutex ); if (_nCachedElements > 0) { - ::osl::MutexGuard aGuard( _aCacheMutex ); const typename t_Key2Element::const_iterator iFind( _aKey2Element.find( rKey ) ); CacheEntry * pEntry; @@ -221,6 +221,7 @@ inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::clear() _pBlock[nPos].aKey = t_Key(); _pBlock[nPos].aVal = t_Val(); } + _nCachedElements = 0; #ifdef __CACHE_DIAGNOSE OSL_TRACE( "> cleared cache <\n" ); #endif -- cgit v1.2.3 From b156838266bd49fbf461d64bc6943f669735fd6a Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 7 Jan 2011 15:14:58 +0100 Subject: sb139: #i113686# do not clear IdlReflectionServiceImpl::_x[TD]Mgr to avoid null pointer dereferentiation --- stoc/source/corereflection/crefl.cxx | 2 -- 1 file changed, 2 deletions(-) (limited to 'stoc') diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx index dac197e6f..2ea9bb228 100644 --- a/stoc/source/corereflection/crefl.cxx +++ b/stoc/source/corereflection/crefl.cxx @@ -179,8 +179,6 @@ void IdlReflectionServiceImpl::dispose() MutexGuard aGuard( _aComponentMutex ); _aElements.clear(); - _xTDMgr.clear(); - _xMgr.clear(); #ifdef TEST_LIST_CLASSES OSL_ENSURE( g_aClassNames.size() == 0, "### idl classes still alive!" ); ClassNameList::const_iterator iPos( g_aClassNames.begin() ); -- cgit v1.2.3 From 7b5d43a9621b4783135588eba193b0d7ae6489f8 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 10 Jan 2011 15:01:04 +0100 Subject: sb139: #i112929# removed unused s_semi (patch by cmc) --- stoc/source/security/file_policy.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'stoc') diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 747d9dc0d..393f01d80 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -444,7 +444,6 @@ static OUString s_user = OUSTR("user"); static OUString s_permission = OUSTR("permission"); static OUString s_openBrace = OUSTR("{"); static OUString s_closingBrace = OUSTR("}"); -static OUString s_semi = OUSTR(";"); static OUString s_filePermission = OUSTR("com.sun.star.io.FilePermission"); static OUString s_socketPermission = OUSTR("com.sun.star.connection.SocketPermission"); -- cgit v1.2.3