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