1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3*cdf0e10cSrcweir * 4*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 5*cdf0e10cSrcweir * 6*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 7*cdf0e10cSrcweir * 8*cdf0e10cSrcweir * This file is part of OpenOffice.org. 9*cdf0e10cSrcweir * 10*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 11*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 12*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 13*cdf0e10cSrcweir * 14*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 15*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 16*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 18*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 19*cdf0e10cSrcweir * 20*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 21*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 22*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 23*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 24*cdf0e10cSrcweir ************************************************************************/ 25*cdf0e10cSrcweir 26*cdf0e10cSrcweir #include "precompiled_configmgr.hxx" 27*cdf0e10cSrcweir #include "sal/config.h" 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir #include "boost/noncopyable.hpp" 30*cdf0e10cSrcweir #include "com/sun/star/beans/NamedValue.hpp" 31*cdf0e10cSrcweir #include "com/sun/star/beans/Property.hpp" 32*cdf0e10cSrcweir #include "com/sun/star/beans/XProperty.hpp" 33*cdf0e10cSrcweir #include "com/sun/star/container/NoSuchElementException.hpp" 34*cdf0e10cSrcweir #include "com/sun/star/container/XHierarchicalNameAccess.hpp" 35*cdf0e10cSrcweir #include "com/sun/star/container/XNamed.hpp" 36*cdf0e10cSrcweir #include "com/sun/star/lang/XMultiComponentFactory.hpp" 37*cdf0e10cSrcweir #include "com/sun/star/lang/XMultiServiceFactory.hpp" 38*cdf0e10cSrcweir #include "com/sun/star/lang/XServiceInfo.hpp" 39*cdf0e10cSrcweir #include "com/sun/star/registry/InvalidRegistryException.hpp" 40*cdf0e10cSrcweir #include "com/sun/star/registry/InvalidValueException.hpp" 41*cdf0e10cSrcweir #include "com/sun/star/registry/MergeConflictException.hpp" 42*cdf0e10cSrcweir #include "com/sun/star/registry/RegistryKeyType.hpp" 43*cdf0e10cSrcweir #include "com/sun/star/registry/RegistryValueType.hpp" 44*cdf0e10cSrcweir #include "com/sun/star/registry/XRegistryKey.hpp" 45*cdf0e10cSrcweir #include "com/sun/star/registry/XSimpleRegistry.hpp" 46*cdf0e10cSrcweir #include "com/sun/star/uno/Any.hxx" 47*cdf0e10cSrcweir #include "com/sun/star/uno/DeploymentException.hpp" 48*cdf0e10cSrcweir #include "com/sun/star/uno/Exception.hpp" 49*cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx" 50*cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp" 51*cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.hxx" 52*cdf0e10cSrcweir #include "com/sun/star/uno/Type.hxx" 53*cdf0e10cSrcweir #include "com/sun/star/uno/TypeClass.hpp" 54*cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp" 55*cdf0e10cSrcweir #include "com/sun/star/uno/XInterface.hpp" 56*cdf0e10cSrcweir #include "com/sun/star/util/XFlushable.hpp" 57*cdf0e10cSrcweir #include "cppu/unotype.hxx" 58*cdf0e10cSrcweir #include "cppuhelper/implbase1.hxx" 59*cdf0e10cSrcweir #include "cppuhelper/implbase3.hxx" 60*cdf0e10cSrcweir #include "cppuhelper/weak.hxx" 61*cdf0e10cSrcweir #include "osl/diagnose.h" 62*cdf0e10cSrcweir #include "osl/mutex.hxx" 63*cdf0e10cSrcweir #include "rtl/ustring.h" 64*cdf0e10cSrcweir #include "rtl/ustring.hxx" 65*cdf0e10cSrcweir #include "sal/types.h" 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir #include "configurationregistry.hxx" 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace util { 70*cdf0e10cSrcweir class XFlushListener; 71*cdf0e10cSrcweir } } } } 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir namespace configmgr { namespace configuration_registry { 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir namespace { 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir namespace css = com::sun::star; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir class Service: 80*cdf0e10cSrcweir public cppu::WeakImplHelper3< 81*cdf0e10cSrcweir css::lang::XServiceInfo, css::registry::XSimpleRegistry, 82*cdf0e10cSrcweir css::util::XFlushable >, 83*cdf0e10cSrcweir private boost::noncopyable 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir public: 86*cdf0e10cSrcweir Service(css::uno::Reference< css::uno::XComponentContext > const & context); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir private: 89*cdf0e10cSrcweir virtual ~Service() {} 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getImplementationName() 92*cdf0e10cSrcweir throw (css::uno::RuntimeException) 93*cdf0e10cSrcweir { return configuration_registry::getImplementationName(); } 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) 96*cdf0e10cSrcweir throw (css::uno::RuntimeException) 97*cdf0e10cSrcweir { return ServiceName == getSupportedServiceNames()[0]; } //TODO 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir virtual css::uno::Sequence< rtl::OUString > SAL_CALL 100*cdf0e10cSrcweir getSupportedServiceNames() throw (css::uno::RuntimeException) 101*cdf0e10cSrcweir { return configuration_registry::getSupportedServiceNames(); } 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir virtual void SAL_CALL open( 106*cdf0e10cSrcweir rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool) 107*cdf0e10cSrcweir throw ( 108*cdf0e10cSrcweir css::registry::InvalidRegistryException, 109*cdf0e10cSrcweir css::uno::RuntimeException); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir virtual void SAL_CALL close() 114*cdf0e10cSrcweir throw ( 115*cdf0e10cSrcweir css::registry::InvalidRegistryException, 116*cdf0e10cSrcweir css::uno::RuntimeException); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir virtual void SAL_CALL destroy() 119*cdf0e10cSrcweir throw ( 120*cdf0e10cSrcweir css::registry::InvalidRegistryException, 121*cdf0e10cSrcweir css::uno::RuntimeException); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL 124*cdf0e10cSrcweir getRootKey() 125*cdf0e10cSrcweir throw ( 126*cdf0e10cSrcweir css::registry::InvalidRegistryException, 127*cdf0e10cSrcweir css::uno::RuntimeException); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isReadOnly() throw (css::uno::RuntimeException); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir virtual void SAL_CALL mergeKey(rtl::OUString const &, rtl::OUString const &) 132*cdf0e10cSrcweir throw ( 133*cdf0e10cSrcweir css::registry::InvalidRegistryException, 134*cdf0e10cSrcweir css::registry::MergeConflictException, css::uno::RuntimeException); 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir virtual void SAL_CALL flush() throw (css::uno::RuntimeException); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir virtual void SAL_CALL addFlushListener( 139*cdf0e10cSrcweir css::uno::Reference< css::util::XFlushListener > const &) 140*cdf0e10cSrcweir throw (css::uno::RuntimeException); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir virtual void SAL_CALL removeFlushListener( 143*cdf0e10cSrcweir css::uno::Reference< css::util::XFlushListener > const &) 144*cdf0e10cSrcweir throw (css::uno::RuntimeException); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir void checkValid(); 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir void checkValid_RuntimeException(); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir void doClose(); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > provider_; 153*cdf0e10cSrcweir osl::Mutex mutex_; 154*cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > access_; 155*cdf0e10cSrcweir rtl::OUString url_; 156*cdf0e10cSrcweir bool readOnly_; 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir friend class RegistryKey; 159*cdf0e10cSrcweir }; 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir class RegistryKey: 162*cdf0e10cSrcweir public cppu::WeakImplHelper1< css::registry::XRegistryKey >, 163*cdf0e10cSrcweir private boost::noncopyable 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir public: 166*cdf0e10cSrcweir RegistryKey(Service & service, css::uno::Any const & value): 167*cdf0e10cSrcweir service_(service), value_(value) {} 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir private: 170*cdf0e10cSrcweir virtual ~RegistryKey() {} 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getKeyName() 173*cdf0e10cSrcweir throw (css::uno::RuntimeException); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isReadOnly() 176*cdf0e10cSrcweir throw ( 177*cdf0e10cSrcweir css::registry::InvalidRegistryException, 178*cdf0e10cSrcweir css::uno::RuntimeException); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir virtual css::registry::RegistryKeyType SAL_CALL getKeyType( 183*cdf0e10cSrcweir rtl::OUString const &) 184*cdf0e10cSrcweir throw ( 185*cdf0e10cSrcweir css::registry::InvalidRegistryException, 186*cdf0e10cSrcweir css::uno::RuntimeException); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir virtual css::registry::RegistryValueType SAL_CALL getValueType() 189*cdf0e10cSrcweir throw ( 190*cdf0e10cSrcweir css::registry::InvalidRegistryException, 191*cdf0e10cSrcweir css::uno::RuntimeException); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getLongValue() 194*cdf0e10cSrcweir throw ( 195*cdf0e10cSrcweir css::registry::InvalidRegistryException, 196*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir virtual void SAL_CALL setLongValue(sal_Int32) 199*cdf0e10cSrcweir throw ( 200*cdf0e10cSrcweir css::registry::InvalidRegistryException, 201*cdf0e10cSrcweir css::uno::RuntimeException); 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() 204*cdf0e10cSrcweir throw ( 205*cdf0e10cSrcweir css::registry::InvalidRegistryException, 206*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir virtual void SAL_CALL setLongListValue( 209*cdf0e10cSrcweir css::uno::Sequence< sal_Int32 > const &) 210*cdf0e10cSrcweir throw ( 211*cdf0e10cSrcweir css::registry::InvalidRegistryException, 212*cdf0e10cSrcweir css::uno::RuntimeException); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getAsciiValue() 215*cdf0e10cSrcweir throw ( 216*cdf0e10cSrcweir css::registry::InvalidRegistryException, 217*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir virtual void SAL_CALL setAsciiValue(rtl::OUString const &) 220*cdf0e10cSrcweir throw ( 221*cdf0e10cSrcweir css::registry::InvalidRegistryException, 222*cdf0e10cSrcweir css::uno::RuntimeException); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue() 225*cdf0e10cSrcweir throw ( 226*cdf0e10cSrcweir css::registry::InvalidRegistryException, 227*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException); 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir virtual void SAL_CALL setAsciiListValue( 230*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > const &) 231*cdf0e10cSrcweir throw ( 232*cdf0e10cSrcweir css::registry::InvalidRegistryException, 233*cdf0e10cSrcweir css::uno::RuntimeException); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getStringValue() 236*cdf0e10cSrcweir throw ( 237*cdf0e10cSrcweir css::registry::InvalidRegistryException, 238*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir virtual void SAL_CALL setStringValue(rtl::OUString const &) 241*cdf0e10cSrcweir throw ( 242*cdf0e10cSrcweir css::registry::InvalidRegistryException, 243*cdf0e10cSrcweir css::uno::RuntimeException); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue() 246*cdf0e10cSrcweir throw ( 247*cdf0e10cSrcweir css::registry::InvalidRegistryException, 248*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir virtual void SAL_CALL setStringListValue( 251*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > const &) 252*cdf0e10cSrcweir throw ( 253*cdf0e10cSrcweir css::registry::InvalidRegistryException, 254*cdf0e10cSrcweir css::uno::RuntimeException); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() 257*cdf0e10cSrcweir throw ( 258*cdf0e10cSrcweir css::registry::InvalidRegistryException, 259*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir virtual void SAL_CALL setBinaryValue(css::uno::Sequence< sal_Int8 > const &) 262*cdf0e10cSrcweir throw ( 263*cdf0e10cSrcweir css::registry::InvalidRegistryException, 264*cdf0e10cSrcweir css::uno::RuntimeException); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey( 267*cdf0e10cSrcweir rtl::OUString const & aKeyName) 268*cdf0e10cSrcweir throw ( 269*cdf0e10cSrcweir css::registry::InvalidRegistryException, 270*cdf0e10cSrcweir css::uno::RuntimeException); 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL 273*cdf0e10cSrcweir createKey(rtl::OUString const &) 274*cdf0e10cSrcweir throw ( 275*cdf0e10cSrcweir css::registry::InvalidRegistryException, 276*cdf0e10cSrcweir css::uno::RuntimeException); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir virtual void SAL_CALL closeKey() 279*cdf0e10cSrcweir throw ( 280*cdf0e10cSrcweir css::registry::InvalidRegistryException, 281*cdf0e10cSrcweir css::uno::RuntimeException); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir virtual void SAL_CALL deleteKey(rtl::OUString const &) 284*cdf0e10cSrcweir throw ( 285*cdf0e10cSrcweir css::registry::InvalidRegistryException, 286*cdf0e10cSrcweir css::uno::RuntimeException); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir virtual 289*cdf0e10cSrcweir css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > 290*cdf0e10cSrcweir SAL_CALL openKeys() 291*cdf0e10cSrcweir throw ( 292*cdf0e10cSrcweir css::registry::InvalidRegistryException, 293*cdf0e10cSrcweir css::uno::RuntimeException); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() 296*cdf0e10cSrcweir throw ( 297*cdf0e10cSrcweir css::registry::InvalidRegistryException, 298*cdf0e10cSrcweir css::uno::RuntimeException); 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir virtual sal_Bool SAL_CALL createLink( 301*cdf0e10cSrcweir rtl::OUString const &, rtl::OUString const &) 302*cdf0e10cSrcweir throw ( 303*cdf0e10cSrcweir css::registry::InvalidRegistryException, 304*cdf0e10cSrcweir css::uno::RuntimeException); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir virtual void SAL_CALL deleteLink(rtl::OUString const &) 307*cdf0e10cSrcweir throw ( 308*cdf0e10cSrcweir css::registry::InvalidRegistryException, 309*cdf0e10cSrcweir css::uno::RuntimeException); 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getLinkTarget(rtl::OUString const &) 312*cdf0e10cSrcweir throw ( 313*cdf0e10cSrcweir css::registry::InvalidRegistryException, 314*cdf0e10cSrcweir css::uno::RuntimeException); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getResolvedName( 317*cdf0e10cSrcweir rtl::OUString const & aKeyName) 318*cdf0e10cSrcweir throw ( 319*cdf0e10cSrcweir css::registry::InvalidRegistryException, 320*cdf0e10cSrcweir css::uno::RuntimeException); 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir Service & service_; 323*cdf0e10cSrcweir css::uno::Any value_; 324*cdf0e10cSrcweir }; 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir Service::Service( 327*cdf0e10cSrcweir css::uno::Reference< css::uno::XComponentContext > const & context) 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir OSL_ASSERT(context.is()); 330*cdf0e10cSrcweir try { 331*cdf0e10cSrcweir provider_ = css::uno::Reference< css::lang::XMultiServiceFactory >( 332*cdf0e10cSrcweir (css::uno::Reference< css::lang::XMultiComponentFactory >( 333*cdf0e10cSrcweir context->getServiceManager(), css::uno::UNO_SET_THROW)-> 334*cdf0e10cSrcweir createInstanceWithContext( 335*cdf0e10cSrcweir rtl::OUString( 336*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 337*cdf0e10cSrcweir "com.sun.star.configuration.DefaultProvider")), 338*cdf0e10cSrcweir context)), 339*cdf0e10cSrcweir css::uno::UNO_QUERY_THROW); 340*cdf0e10cSrcweir } catch (css::uno::RuntimeException &) { 341*cdf0e10cSrcweir throw; 342*cdf0e10cSrcweir } catch (css::uno::Exception & e) { 343*cdf0e10cSrcweir throw css::uno::DeploymentException( 344*cdf0e10cSrcweir (rtl::OUString( 345*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 346*cdf0e10cSrcweir "component context fails to supply service" 347*cdf0e10cSrcweir " com.sun.star.configuration.DefaultProvider of type" 348*cdf0e10cSrcweir " com.sun.star.lang.XMultiServiceFactory: ")) + 349*cdf0e10cSrcweir e.Message), 350*cdf0e10cSrcweir context); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir rtl::OUString Service::getURL() throw (css::uno::RuntimeException) { 355*cdf0e10cSrcweir osl::MutexGuard g(mutex_); 356*cdf0e10cSrcweir checkValid_RuntimeException(); 357*cdf0e10cSrcweir return url_; 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir void Service::open(rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool) 361*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir //TODO: bCreate 364*cdf0e10cSrcweir osl::MutexGuard g(mutex_); 365*cdf0e10cSrcweir if (access_.is()) { 366*cdf0e10cSrcweir doClose(); 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir css::uno::Sequence< css::uno::Any > args(1); 369*cdf0e10cSrcweir args[0] <<= css::beans::NamedValue( 370*cdf0e10cSrcweir rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 371*cdf0e10cSrcweir css::uno::makeAny(rURL)); 372*cdf0e10cSrcweir try { 373*cdf0e10cSrcweir access_ = provider_->createInstanceWithArguments( 374*cdf0e10cSrcweir (bReadOnly 375*cdf0e10cSrcweir ? rtl::OUString( 376*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 377*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationAccess")) 378*cdf0e10cSrcweir : rtl::OUString( 379*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 380*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationUpdateAccess"))), 381*cdf0e10cSrcweir args); 382*cdf0e10cSrcweir } catch (css::uno::RuntimeException &) { 383*cdf0e10cSrcweir throw; 384*cdf0e10cSrcweir } catch (css::uno::Exception & e) { 385*cdf0e10cSrcweir throw css::uno::RuntimeException( 386*cdf0e10cSrcweir (rtl::OUString( 387*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 388*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: open" 389*cdf0e10cSrcweir " failed: ")) + 390*cdf0e10cSrcweir e.Message), 391*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir url_ = rURL; 394*cdf0e10cSrcweir readOnly_ = bReadOnly; 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir sal_Bool Service::isValid() throw (css::uno::RuntimeException) { 398*cdf0e10cSrcweir osl::MutexGuard g(mutex_); 399*cdf0e10cSrcweir return access_.is(); 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir void Service::close() 403*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir osl::MutexGuard g(mutex_); 406*cdf0e10cSrcweir checkValid(); 407*cdf0e10cSrcweir doClose(); 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir void Service::destroy() 411*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir throw css::uno::RuntimeException( 414*cdf0e10cSrcweir rtl::OUString( 415*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 416*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 417*cdf0e10cSrcweir " implemented")), 418*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir css::uno::Reference< css::registry::XRegistryKey > Service::getRootKey() 422*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir osl::MutexGuard g(mutex_); 425*cdf0e10cSrcweir checkValid(); 426*cdf0e10cSrcweir return new RegistryKey(*this, css::uno::makeAny(access_)); 427*cdf0e10cSrcweir } 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir sal_Bool Service::isReadOnly() throw (css::uno::RuntimeException) { 430*cdf0e10cSrcweir osl::MutexGuard g(mutex_); 431*cdf0e10cSrcweir checkValid_RuntimeException(); 432*cdf0e10cSrcweir return readOnly_; 433*cdf0e10cSrcweir } 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir void Service::mergeKey(rtl::OUString const &, rtl::OUString const &) 436*cdf0e10cSrcweir throw ( 437*cdf0e10cSrcweir css::registry::InvalidRegistryException, 438*cdf0e10cSrcweir css::registry::MergeConflictException, css::uno::RuntimeException) 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir throw css::uno::RuntimeException( 441*cdf0e10cSrcweir rtl::OUString( 442*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 443*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 444*cdf0e10cSrcweir " implemented")), 445*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir void Service::flush() throw (css::uno::RuntimeException) 449*cdf0e10cSrcweir { 450*cdf0e10cSrcweir throw css::uno::RuntimeException( 451*cdf0e10cSrcweir rtl::OUString( 452*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 453*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 454*cdf0e10cSrcweir " implemented")), 455*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir void Service::addFlushListener( 459*cdf0e10cSrcweir css::uno::Reference< css::util::XFlushListener > const &) 460*cdf0e10cSrcweir throw (css::uno::RuntimeException) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir throw css::uno::RuntimeException( 463*cdf0e10cSrcweir rtl::OUString( 464*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 465*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 466*cdf0e10cSrcweir " implemented")), 467*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir void Service::removeFlushListener( 471*cdf0e10cSrcweir css::uno::Reference< css::util::XFlushListener > const &) 472*cdf0e10cSrcweir throw (css::uno::RuntimeException) 473*cdf0e10cSrcweir { 474*cdf0e10cSrcweir throw css::uno::RuntimeException( 475*cdf0e10cSrcweir rtl::OUString( 476*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 477*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 478*cdf0e10cSrcweir " implemented")), 479*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir void Service::checkValid() { 483*cdf0e10cSrcweir if (!access_.is()) { 484*cdf0e10cSrcweir throw css::registry::InvalidRegistryException( 485*cdf0e10cSrcweir rtl::OUString( 486*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 487*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 488*cdf0e10cSrcweir " valid")), 489*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir void Service::checkValid_RuntimeException() { 494*cdf0e10cSrcweir if (!access_.is()) { 495*cdf0e10cSrcweir throw css::uno::RuntimeException( 496*cdf0e10cSrcweir rtl::OUString( 497*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 498*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 499*cdf0e10cSrcweir " valid")), 500*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 501*cdf0e10cSrcweir } 502*cdf0e10cSrcweir } 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir void Service::doClose() { 505*cdf0e10cSrcweir access_.clear(); 506*cdf0e10cSrcweir } 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir rtl::OUString RegistryKey::getKeyName() throw (css::uno::RuntimeException) { 509*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 510*cdf0e10cSrcweir service_.checkValid_RuntimeException(); 511*cdf0e10cSrcweir css::uno::Reference< css::container::XNamed > named; 512*cdf0e10cSrcweir if (value_ >>= named) { 513*cdf0e10cSrcweir return named->getName(); 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir throw css::uno::RuntimeException( 516*cdf0e10cSrcweir rtl::OUString( 517*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 518*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 519*cdf0e10cSrcweir " implemented")), 520*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir sal_Bool RegistryKey::isReadOnly() 524*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 525*cdf0e10cSrcweir { 526*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 527*cdf0e10cSrcweir service_.checkValid_RuntimeException(); 528*cdf0e10cSrcweir return service_.readOnly_; //TODO: read-only sub-nodes in update access? 529*cdf0e10cSrcweir } 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir sal_Bool RegistryKey::isValid() throw (css::uno::RuntimeException) { 532*cdf0e10cSrcweir return service_.isValid(); 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir css::registry::RegistryKeyType RegistryKey::getKeyType(rtl::OUString const &) 536*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 539*cdf0e10cSrcweir service_.checkValid(); 540*cdf0e10cSrcweir return css::registry::RegistryKeyType_KEY; 541*cdf0e10cSrcweir } 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir css::registry::RegistryValueType RegistryKey::getValueType() 544*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 547*cdf0e10cSrcweir service_.checkValid(); 548*cdf0e10cSrcweir css::uno::Type t(value_.getValueType()); 549*cdf0e10cSrcweir switch (t.getTypeClass()) { 550*cdf0e10cSrcweir case css::uno::TypeClass_LONG: 551*cdf0e10cSrcweir return css::registry::RegistryValueType_LONG; 552*cdf0e10cSrcweir case css::uno::TypeClass_STRING: 553*cdf0e10cSrcweir return css::registry::RegistryValueType_STRING; 554*cdf0e10cSrcweir case css::uno::TypeClass_SEQUENCE: 555*cdf0e10cSrcweir if (t == cppu::UnoType< css::uno::Sequence< sal_Int8 > >::get()) { 556*cdf0e10cSrcweir return css::registry::RegistryValueType_BINARY; 557*cdf0e10cSrcweir } else if (t == cppu::UnoType< css::uno::Sequence< sal_Int32 > >::get()) 558*cdf0e10cSrcweir { 559*cdf0e10cSrcweir return css::registry::RegistryValueType_LONGLIST; 560*cdf0e10cSrcweir } else if (t == 561*cdf0e10cSrcweir cppu::UnoType< css::uno::Sequence< rtl::OUString > >::get()) 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir return css::registry::RegistryValueType_STRINGLIST; 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir // fall through 566*cdf0e10cSrcweir default: 567*cdf0e10cSrcweir return css::registry::RegistryValueType_NOT_DEFINED; 568*cdf0e10cSrcweir } 569*cdf0e10cSrcweir } 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir sal_Int32 RegistryKey::getLongValue() 572*cdf0e10cSrcweir throw ( 573*cdf0e10cSrcweir css::registry::InvalidRegistryException, 574*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException) 575*cdf0e10cSrcweir { 576*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 577*cdf0e10cSrcweir service_.checkValid(); 578*cdf0e10cSrcweir sal_Int32 v = 0; 579*cdf0e10cSrcweir if (value_ >>= v) { 580*cdf0e10cSrcweir return v; 581*cdf0e10cSrcweir } 582*cdf0e10cSrcweir throw css::registry::InvalidValueException( 583*cdf0e10cSrcweir rtl::OUString( 584*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 585*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry")), 586*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir void RegistryKey::setLongValue(sal_Int32) 590*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir throw css::uno::RuntimeException( 593*cdf0e10cSrcweir rtl::OUString( 594*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 595*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 596*cdf0e10cSrcweir " implemented")), 597*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 598*cdf0e10cSrcweir } 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir css::uno::Sequence< sal_Int32 > RegistryKey::getLongListValue() 601*cdf0e10cSrcweir throw ( 602*cdf0e10cSrcweir css::registry::InvalidRegistryException, 603*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException) 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 606*cdf0e10cSrcweir service_.checkValid(); 607*cdf0e10cSrcweir css::uno::Sequence< sal_Int32 > v; 608*cdf0e10cSrcweir if (value_ >>= v) { 609*cdf0e10cSrcweir return v; 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir throw css::registry::InvalidValueException( 612*cdf0e10cSrcweir rtl::OUString( 613*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 614*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry")), 615*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir void RegistryKey::setLongListValue(css::uno::Sequence< sal_Int32 > const &) 619*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 620*cdf0e10cSrcweir { 621*cdf0e10cSrcweir throw css::uno::RuntimeException( 622*cdf0e10cSrcweir rtl::OUString( 623*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 624*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 625*cdf0e10cSrcweir " implemented")), 626*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 627*cdf0e10cSrcweir } 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir rtl::OUString RegistryKey::getAsciiValue() 630*cdf0e10cSrcweir throw ( 631*cdf0e10cSrcweir css::registry::InvalidRegistryException, 632*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException) 633*cdf0e10cSrcweir { 634*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 635*cdf0e10cSrcweir service_.checkValid(); 636*cdf0e10cSrcweir rtl::OUString v; 637*cdf0e10cSrcweir if (value_ >>= v) { 638*cdf0e10cSrcweir return v; 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir throw css::registry::InvalidValueException( 641*cdf0e10cSrcweir rtl::OUString( 642*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 643*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry")), 644*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir void RegistryKey::setAsciiValue(rtl::OUString const &) 648*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir throw css::uno::RuntimeException( 651*cdf0e10cSrcweir rtl::OUString( 652*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 653*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 654*cdf0e10cSrcweir " implemented")), 655*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > RegistryKey::getAsciiListValue() 659*cdf0e10cSrcweir throw ( 660*cdf0e10cSrcweir css::registry::InvalidRegistryException, 661*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException) 662*cdf0e10cSrcweir { 663*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 664*cdf0e10cSrcweir service_.checkValid(); 665*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > v; 666*cdf0e10cSrcweir if (value_ >>= v) { 667*cdf0e10cSrcweir return v; 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir throw css::registry::InvalidValueException( 670*cdf0e10cSrcweir rtl::OUString( 671*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 672*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry")), 673*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir void RegistryKey::setAsciiListValue(css::uno::Sequence< rtl::OUString > const &) 677*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 678*cdf0e10cSrcweir { 679*cdf0e10cSrcweir throw css::uno::RuntimeException( 680*cdf0e10cSrcweir rtl::OUString( 681*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 682*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 683*cdf0e10cSrcweir " implemented")), 684*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 685*cdf0e10cSrcweir } 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir rtl::OUString RegistryKey::getStringValue() 688*cdf0e10cSrcweir throw ( 689*cdf0e10cSrcweir css::registry::InvalidRegistryException, 690*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException) 691*cdf0e10cSrcweir { 692*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 693*cdf0e10cSrcweir service_.checkValid(); 694*cdf0e10cSrcweir rtl::OUString v; 695*cdf0e10cSrcweir if (value_ >>= v) { 696*cdf0e10cSrcweir return v; 697*cdf0e10cSrcweir } 698*cdf0e10cSrcweir throw css::registry::InvalidValueException( 699*cdf0e10cSrcweir rtl::OUString( 700*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 701*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry")), 702*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 703*cdf0e10cSrcweir } 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir void RegistryKey::setStringValue(rtl::OUString const &) 706*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 707*cdf0e10cSrcweir { 708*cdf0e10cSrcweir throw css::uno::RuntimeException( 709*cdf0e10cSrcweir rtl::OUString( 710*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 711*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 712*cdf0e10cSrcweir " implemented")), 713*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 714*cdf0e10cSrcweir } 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > RegistryKey::getStringListValue() 717*cdf0e10cSrcweir throw ( 718*cdf0e10cSrcweir css::registry::InvalidRegistryException, 719*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException) 720*cdf0e10cSrcweir { 721*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 722*cdf0e10cSrcweir service_.checkValid(); 723*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > v; 724*cdf0e10cSrcweir if (value_ >>= v) { 725*cdf0e10cSrcweir return v; 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir throw css::registry::InvalidValueException( 728*cdf0e10cSrcweir rtl::OUString( 729*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 730*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry")), 731*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 732*cdf0e10cSrcweir } 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir void RegistryKey::setStringListValue( 735*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > const &) 736*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 737*cdf0e10cSrcweir { 738*cdf0e10cSrcweir throw css::uno::RuntimeException( 739*cdf0e10cSrcweir rtl::OUString( 740*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 741*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 742*cdf0e10cSrcweir " implemented")), 743*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 744*cdf0e10cSrcweir } 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir css::uno::Sequence< sal_Int8 > RegistryKey::getBinaryValue() 747*cdf0e10cSrcweir throw ( 748*cdf0e10cSrcweir css::registry::InvalidRegistryException, 749*cdf0e10cSrcweir css::registry::InvalidValueException, css::uno::RuntimeException) 750*cdf0e10cSrcweir { 751*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 752*cdf0e10cSrcweir service_.checkValid(); 753*cdf0e10cSrcweir css::uno::Sequence< sal_Int8 > v; 754*cdf0e10cSrcweir if (value_ >>= v) { 755*cdf0e10cSrcweir return v; 756*cdf0e10cSrcweir } 757*cdf0e10cSrcweir throw css::registry::InvalidValueException( 758*cdf0e10cSrcweir rtl::OUString( 759*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 760*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry")), 761*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 762*cdf0e10cSrcweir } 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir void RegistryKey::setBinaryValue(css::uno::Sequence< sal_Int8 > const &) 765*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 766*cdf0e10cSrcweir { 767*cdf0e10cSrcweir throw css::uno::RuntimeException( 768*cdf0e10cSrcweir rtl::OUString( 769*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 770*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 771*cdf0e10cSrcweir " implemented")), 772*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 773*cdf0e10cSrcweir } 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir css::uno::Reference< css::registry::XRegistryKey > RegistryKey::openKey( 776*cdf0e10cSrcweir rtl::OUString const & aKeyName) 777*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 778*cdf0e10cSrcweir { 779*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 780*cdf0e10cSrcweir service_.checkValid_RuntimeException(); 781*cdf0e10cSrcweir css::uno::Reference< css::container::XHierarchicalNameAccess > access; 782*cdf0e10cSrcweir if (value_ >>= access) { 783*cdf0e10cSrcweir try { 784*cdf0e10cSrcweir return new RegistryKey( 785*cdf0e10cSrcweir service_, access->getByHierarchicalName(aKeyName)); 786*cdf0e10cSrcweir } catch (css::container::NoSuchElementException &) {} 787*cdf0e10cSrcweir } 788*cdf0e10cSrcweir return css::uno::Reference< css::registry::XRegistryKey >(); 789*cdf0e10cSrcweir } 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir css::uno::Reference< css::registry::XRegistryKey > RegistryKey::createKey( 792*cdf0e10cSrcweir rtl::OUString const &) 793*cdf0e10cSrcweir throw ( 794*cdf0e10cSrcweir css::registry::InvalidRegistryException, css::uno::RuntimeException) 795*cdf0e10cSrcweir { 796*cdf0e10cSrcweir throw css::uno::RuntimeException( 797*cdf0e10cSrcweir rtl::OUString( 798*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 799*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 800*cdf0e10cSrcweir " implemented")), 801*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 802*cdf0e10cSrcweir } 803*cdf0e10cSrcweir 804*cdf0e10cSrcweir void RegistryKey::closeKey() 805*cdf0e10cSrcweir throw ( 806*cdf0e10cSrcweir css::registry::InvalidRegistryException, css::uno::RuntimeException) 807*cdf0e10cSrcweir { 808*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 809*cdf0e10cSrcweir service_.checkValid_RuntimeException(); 810*cdf0e10cSrcweir } 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir void RegistryKey::deleteKey(rtl::OUString const &) 813*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 814*cdf0e10cSrcweir { 815*cdf0e10cSrcweir throw css::uno::RuntimeException( 816*cdf0e10cSrcweir rtl::OUString( 817*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 818*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 819*cdf0e10cSrcweir " implemented")), 820*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > 824*cdf0e10cSrcweir RegistryKey::openKeys() 825*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir throw css::uno::RuntimeException( 828*cdf0e10cSrcweir rtl::OUString( 829*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 830*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 831*cdf0e10cSrcweir " implemented")), 832*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 833*cdf0e10cSrcweir } 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > RegistryKey::getKeyNames() 836*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 837*cdf0e10cSrcweir { 838*cdf0e10cSrcweir throw css::uno::RuntimeException( 839*cdf0e10cSrcweir rtl::OUString( 840*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 841*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry: not" 842*cdf0e10cSrcweir " implemented")), 843*cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this)); 844*cdf0e10cSrcweir } 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir sal_Bool RegistryKey::createLink(rtl::OUString const &, rtl::OUString const &) 847*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 848*cdf0e10cSrcweir { 849*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 850*cdf0e10cSrcweir service_.checkValid_RuntimeException(); 851*cdf0e10cSrcweir return false; 852*cdf0e10cSrcweir } 853*cdf0e10cSrcweir 854*cdf0e10cSrcweir void RegistryKey::deleteLink(rtl::OUString const &) 855*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 856*cdf0e10cSrcweir { 857*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 858*cdf0e10cSrcweir service_.checkValid_RuntimeException(); 859*cdf0e10cSrcweir } 860*cdf0e10cSrcweir 861*cdf0e10cSrcweir rtl::OUString RegistryKey::getLinkTarget(rtl::OUString const &) 862*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 863*cdf0e10cSrcweir { 864*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 865*cdf0e10cSrcweir service_.checkValid_RuntimeException(); 866*cdf0e10cSrcweir return rtl::OUString(); 867*cdf0e10cSrcweir } 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir rtl::OUString RegistryKey::getResolvedName(rtl::OUString const & aKeyName) 870*cdf0e10cSrcweir throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) 871*cdf0e10cSrcweir { 872*cdf0e10cSrcweir osl::MutexGuard g(service_.mutex_); 873*cdf0e10cSrcweir service_.checkValid_RuntimeException(); 874*cdf0e10cSrcweir return aKeyName; 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir 877*cdf0e10cSrcweir } 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > create( 880*cdf0e10cSrcweir css::uno::Reference< css::uno::XComponentContext > const & context) 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir return static_cast< cppu::OWeakObject * >(new Service(context)); 883*cdf0e10cSrcweir } 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir rtl::OUString getImplementationName() { 886*cdf0e10cSrcweir return rtl::OUString( 887*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 888*cdf0e10cSrcweir "com.sun.star.comp.configuration.ConfigurationRegistry")); 889*cdf0e10cSrcweir } 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir css::uno::Sequence< rtl::OUString > getSupportedServiceNames() { 892*cdf0e10cSrcweir rtl::OUString name( 893*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( 894*cdf0e10cSrcweir "com.sun.star.configuration.ConfigurationRegistry")); 895*cdf0e10cSrcweir return css::uno::Sequence< rtl::OUString >(&name, 1); 896*cdf0e10cSrcweir } 897*cdf0e10cSrcweir 898*cdf0e10cSrcweir } } 899