bump product version to 4.1.6.2
[LibreOffice.git] / configmgr / source / configurationregistry.cxx
bloba19f940bc17be8a27eaee493c4625febf0d346df
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "sal/config.h"
22 #include <cassert>
24 #include "boost/noncopyable.hpp"
25 #include "com/sun/star/beans/NamedValue.hpp"
26 #include "com/sun/star/beans/Property.hpp"
27 #include "com/sun/star/beans/XProperty.hpp"
28 #include "com/sun/star/container/NoSuchElementException.hpp"
29 #include "com/sun/star/container/XHierarchicalNameAccess.hpp"
30 #include "com/sun/star/container/XNamed.hpp"
31 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
32 #include "com/sun/star/lang/XServiceInfo.hpp"
33 #include "com/sun/star/registry/InvalidRegistryException.hpp"
34 #include "com/sun/star/registry/InvalidValueException.hpp"
35 #include "com/sun/star/registry/MergeConflictException.hpp"
36 #include "com/sun/star/registry/RegistryKeyType.hpp"
37 #include "com/sun/star/registry/RegistryValueType.hpp"
38 #include "com/sun/star/registry/XRegistryKey.hpp"
39 #include "com/sun/star/registry/XSimpleRegistry.hpp"
40 #include "com/sun/star/uno/Any.hxx"
41 #include "com/sun/star/uno/DeploymentException.hpp"
42 #include "com/sun/star/uno/Exception.hpp"
43 #include "com/sun/star/uno/Reference.hxx"
44 #include "com/sun/star/uno/RuntimeException.hpp"
45 #include "com/sun/star/uno/Sequence.hxx"
46 #include "com/sun/star/uno/Type.hxx"
47 #include "com/sun/star/uno/TypeClass.hpp"
48 #include "com/sun/star/uno/XComponentContext.hpp"
49 #include "com/sun/star/uno/XInterface.hpp"
50 #include "com/sun/star/util/XFlushable.hpp"
51 #include "cppu/unotype.hxx"
52 #include "cppuhelper/implbase1.hxx"
53 #include "cppuhelper/implbase3.hxx"
54 #include "cppuhelper/weak.hxx"
55 #include "osl/mutex.hxx"
56 #include "rtl/ustring.h"
57 #include "rtl/ustring.hxx"
58 #include "sal/types.h"
60 #include "configurationregistry.hxx"
62 namespace com { namespace sun { namespace star { namespace util {
63 class XFlushListener;
64 } } } }
66 namespace configmgr { namespace configuration_registry {
68 namespace {
70 class Service:
71 public cppu::WeakImplHelper3<
72 css::lang::XServiceInfo, css::registry::XSimpleRegistry,
73 css::util::XFlushable >,
74 private boost::noncopyable
76 public:
77 Service(css::uno::Reference< css::uno::XComponentContext > const & context);
79 private:
80 virtual ~Service() {}
82 virtual OUString SAL_CALL getImplementationName()
83 throw (css::uno::RuntimeException)
84 { return configuration_registry::getImplementationName(); }
86 virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
87 throw (css::uno::RuntimeException)
88 { return ServiceName == getSupportedServiceNames()[0]; } //TODO
90 virtual css::uno::Sequence< OUString > SAL_CALL
91 getSupportedServiceNames() throw (css::uno::RuntimeException)
92 { return configuration_registry::getSupportedServiceNames(); }
94 virtual OUString SAL_CALL getURL() throw (css::uno::RuntimeException);
96 virtual void SAL_CALL open(
97 OUString const & rURL, sal_Bool bReadOnly, sal_Bool)
98 throw (
99 css::registry::InvalidRegistryException,
100 css::uno::RuntimeException);
102 virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException);
104 virtual void SAL_CALL close()
105 throw (
106 css::registry::InvalidRegistryException,
107 css::uno::RuntimeException);
109 virtual void SAL_CALL destroy()
110 throw (
111 css::registry::InvalidRegistryException,
112 css::uno::RuntimeException);
114 virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
115 getRootKey()
116 throw (
117 css::registry::InvalidRegistryException,
118 css::uno::RuntimeException);
120 virtual sal_Bool SAL_CALL isReadOnly() throw (css::uno::RuntimeException);
122 virtual void SAL_CALL mergeKey(OUString const &, OUString const &)
123 throw (
124 css::registry::InvalidRegistryException,
125 css::registry::MergeConflictException, css::uno::RuntimeException);
127 virtual void SAL_CALL flush() throw (css::uno::RuntimeException);
129 virtual void SAL_CALL addFlushListener(
130 css::uno::Reference< css::util::XFlushListener > const &)
131 throw (css::uno::RuntimeException);
133 virtual void SAL_CALL removeFlushListener(
134 css::uno::Reference< css::util::XFlushListener > const &)
135 throw (css::uno::RuntimeException);
137 void checkValid();
139 void checkValid_RuntimeException();
141 void doClose();
143 css::uno::Reference< css::lang::XMultiServiceFactory > provider_;
144 osl::Mutex mutex_;
145 css::uno::Reference< css::uno::XInterface > access_;
146 OUString url_;
147 bool readOnly_;
149 friend class RegistryKey;
152 class RegistryKey:
153 public cppu::WeakImplHelper1< css::registry::XRegistryKey >,
154 private boost::noncopyable
156 public:
157 RegistryKey(Service & service, css::uno::Any const & value):
158 service_(service), value_(value) {}
160 private:
161 virtual ~RegistryKey() {}
163 virtual OUString SAL_CALL getKeyName()
164 throw (css::uno::RuntimeException);
166 virtual sal_Bool SAL_CALL isReadOnly()
167 throw (
168 css::registry::InvalidRegistryException,
169 css::uno::RuntimeException);
171 virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException);
173 virtual css::registry::RegistryKeyType SAL_CALL getKeyType(
174 OUString const &)
175 throw (
176 css::registry::InvalidRegistryException,
177 css::uno::RuntimeException);
179 virtual css::registry::RegistryValueType SAL_CALL getValueType()
180 throw (
181 css::registry::InvalidRegistryException,
182 css::uno::RuntimeException);
184 virtual sal_Int32 SAL_CALL getLongValue()
185 throw (
186 css::registry::InvalidRegistryException,
187 css::registry::InvalidValueException, css::uno::RuntimeException);
189 virtual void SAL_CALL setLongValue(sal_Int32)
190 throw (
191 css::registry::InvalidRegistryException,
192 css::uno::RuntimeException);
194 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue()
195 throw (
196 css::registry::InvalidRegistryException,
197 css::registry::InvalidValueException, css::uno::RuntimeException);
199 virtual void SAL_CALL setLongListValue(
200 css::uno::Sequence< sal_Int32 > const &)
201 throw (
202 css::registry::InvalidRegistryException,
203 css::uno::RuntimeException);
205 virtual OUString SAL_CALL getAsciiValue()
206 throw (
207 css::registry::InvalidRegistryException,
208 css::registry::InvalidValueException, css::uno::RuntimeException);
210 virtual void SAL_CALL setAsciiValue(OUString const &)
211 throw (
212 css::registry::InvalidRegistryException,
213 css::uno::RuntimeException);
215 virtual css::uno::Sequence< OUString > SAL_CALL getAsciiListValue()
216 throw (
217 css::registry::InvalidRegistryException,
218 css::registry::InvalidValueException, css::uno::RuntimeException);
220 virtual void SAL_CALL setAsciiListValue(
221 css::uno::Sequence< OUString > const &)
222 throw (
223 css::registry::InvalidRegistryException,
224 css::uno::RuntimeException);
226 virtual OUString SAL_CALL getStringValue()
227 throw (
228 css::registry::InvalidRegistryException,
229 css::registry::InvalidValueException, css::uno::RuntimeException);
231 virtual void SAL_CALL setStringValue(OUString const &)
232 throw (
233 css::registry::InvalidRegistryException,
234 css::uno::RuntimeException);
236 virtual css::uno::Sequence< OUString > SAL_CALL getStringListValue()
237 throw (
238 css::registry::InvalidRegistryException,
239 css::registry::InvalidValueException, css::uno::RuntimeException);
241 virtual void SAL_CALL setStringListValue(
242 css::uno::Sequence< OUString > const &)
243 throw (
244 css::registry::InvalidRegistryException,
245 css::uno::RuntimeException);
247 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue()
248 throw (
249 css::registry::InvalidRegistryException,
250 css::registry::InvalidValueException, css::uno::RuntimeException);
252 virtual void SAL_CALL setBinaryValue(css::uno::Sequence< sal_Int8 > const &)
253 throw (
254 css::registry::InvalidRegistryException,
255 css::uno::RuntimeException);
257 virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey(
258 OUString const & aKeyName)
259 throw (
260 css::registry::InvalidRegistryException,
261 css::uno::RuntimeException);
263 virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
264 createKey(OUString const &)
265 throw (
266 css::registry::InvalidRegistryException,
267 css::uno::RuntimeException);
269 virtual void SAL_CALL closeKey()
270 throw (
271 css::registry::InvalidRegistryException,
272 css::uno::RuntimeException);
274 virtual void SAL_CALL deleteKey(OUString const &)
275 throw (
276 css::registry::InvalidRegistryException,
277 css::uno::RuntimeException);
279 virtual
280 css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
281 SAL_CALL openKeys()
282 throw (
283 css::registry::InvalidRegistryException,
284 css::uno::RuntimeException);
286 virtual css::uno::Sequence< OUString > SAL_CALL getKeyNames()
287 throw (
288 css::registry::InvalidRegistryException,
289 css::uno::RuntimeException);
291 virtual sal_Bool SAL_CALL createLink(
292 OUString const &, OUString const &)
293 throw (
294 css::registry::InvalidRegistryException,
295 css::uno::RuntimeException);
297 virtual void SAL_CALL deleteLink(OUString const &)
298 throw (
299 css::registry::InvalidRegistryException,
300 css::uno::RuntimeException);
302 virtual OUString SAL_CALL getLinkTarget(OUString const &)
303 throw (
304 css::registry::InvalidRegistryException,
305 css::uno::RuntimeException);
307 virtual OUString SAL_CALL getResolvedName(
308 OUString const & aKeyName)
309 throw (
310 css::registry::InvalidRegistryException,
311 css::uno::RuntimeException);
313 Service & service_;
314 css::uno::Any value_;
317 Service::Service(
318 css::uno::Reference< css::uno::XComponentContext > const & context)
320 assert(context.is());
321 try {
322 provider_ = css::uno::Reference< css::lang::XMultiServiceFactory >(
323 context->getServiceManager()->createInstanceWithContext(
324 OUString("com.sun.star.configuration.DefaultProvider"),
325 context),
326 css::uno::UNO_QUERY_THROW);
327 } catch (css::uno::RuntimeException &) {
328 throw;
329 } catch (css::uno::Exception & e) {
330 throw css::uno::DeploymentException(
331 (OUString("component context fails to supply service"
332 " com.sun.star.configuration.DefaultProvider of type"
333 " com.sun.star.lang.XMultiServiceFactory: ") +
334 e.Message),
335 context);
339 OUString Service::getURL() throw (css::uno::RuntimeException) {
340 osl::MutexGuard g(mutex_);
341 checkValid_RuntimeException();
342 return url_;
345 void Service::open(OUString const & rURL, sal_Bool bReadOnly, sal_Bool)
346 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
348 //TODO: bCreate
349 osl::MutexGuard g(mutex_);
350 if (access_.is()) {
351 doClose();
353 css::uno::Sequence< css::uno::Any > args(1);
354 args[0] <<= css::beans::NamedValue(
355 OUString("nodepath"),
356 css::uno::makeAny(rURL));
357 try {
358 access_ = provider_->createInstanceWithArguments(
359 (bReadOnly
360 ? OUString("com.sun.star.configuration.ConfigurationAccess")
361 : OUString("com.sun.star.configuration.ConfigurationUpdateAccess")),
362 args);
363 } catch (css::uno::RuntimeException &) {
364 throw;
365 } catch (css::uno::Exception & e) {
366 throw css::uno::RuntimeException(
367 (OUString("com.sun.star.configuration.ConfigurationRegistry: open"
368 " failed: ") +
369 e.Message),
370 static_cast< cppu::OWeakObject * >(this));
372 url_ = rURL;
373 readOnly_ = bReadOnly;
376 sal_Bool Service::isValid() throw (css::uno::RuntimeException) {
377 osl::MutexGuard g(mutex_);
378 return access_.is();
381 void Service::close()
382 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
384 osl::MutexGuard g(mutex_);
385 checkValid();
386 doClose();
389 void Service::destroy()
390 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
392 throw css::uno::RuntimeException(
393 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
394 " implemented"),
395 static_cast< cppu::OWeakObject * >(this));
398 css::uno::Reference< css::registry::XRegistryKey > Service::getRootKey()
399 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
401 osl::MutexGuard g(mutex_);
402 checkValid();
403 return new RegistryKey(*this, css::uno::makeAny(access_));
406 sal_Bool Service::isReadOnly() throw (css::uno::RuntimeException) {
407 osl::MutexGuard g(mutex_);
408 checkValid_RuntimeException();
409 return readOnly_;
412 void Service::mergeKey(OUString const &, OUString const &)
413 throw (
414 css::registry::InvalidRegistryException,
415 css::registry::MergeConflictException, css::uno::RuntimeException)
417 throw css::uno::RuntimeException(
418 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
419 " implemented"),
420 static_cast< cppu::OWeakObject * >(this));
423 void Service::flush() throw (css::uno::RuntimeException)
425 throw css::uno::RuntimeException(
426 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
427 " implemented"),
428 static_cast< cppu::OWeakObject * >(this));
431 void Service::addFlushListener(
432 css::uno::Reference< css::util::XFlushListener > const &)
433 throw (css::uno::RuntimeException)
435 throw css::uno::RuntimeException(
436 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
437 " implemented"),
438 static_cast< cppu::OWeakObject * >(this));
441 void Service::removeFlushListener(
442 css::uno::Reference< css::util::XFlushListener > const &)
443 throw (css::uno::RuntimeException)
445 throw css::uno::RuntimeException(
446 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
447 " implemented"),
448 static_cast< cppu::OWeakObject * >(this));
451 void Service::checkValid() {
452 if (!access_.is()) {
453 throw css::registry::InvalidRegistryException(
454 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
455 " valid"),
456 static_cast< cppu::OWeakObject * >(this));
460 void Service::checkValid_RuntimeException() {
461 if (!access_.is()) {
462 throw css::uno::RuntimeException(
463 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
464 " valid"),
465 static_cast< cppu::OWeakObject * >(this));
469 void Service::doClose() {
470 access_.clear();
473 OUString RegistryKey::getKeyName() throw (css::uno::RuntimeException) {
474 osl::MutexGuard g(service_.mutex_);
475 service_.checkValid_RuntimeException();
476 css::uno::Reference< css::container::XNamed > named;
477 if (value_ >>= named) {
478 return named->getName();
480 throw css::uno::RuntimeException(
481 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
482 " implemented"),
483 static_cast< cppu::OWeakObject * >(this));
486 sal_Bool RegistryKey::isReadOnly()
487 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
489 osl::MutexGuard g(service_.mutex_);
490 service_.checkValid_RuntimeException();
491 return service_.readOnly_; //TODO: read-only sub-nodes in update access?
494 sal_Bool RegistryKey::isValid() throw (css::uno::RuntimeException) {
495 return service_.isValid();
498 css::registry::RegistryKeyType RegistryKey::getKeyType(OUString const &)
499 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
501 osl::MutexGuard g(service_.mutex_);
502 service_.checkValid();
503 return css::registry::RegistryKeyType_KEY;
506 css::registry::RegistryValueType RegistryKey::getValueType()
507 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
509 osl::MutexGuard g(service_.mutex_);
510 service_.checkValid();
511 css::uno::Type t(value_.getValueType());
512 switch (t.getTypeClass()) {
513 case css::uno::TypeClass_LONG:
514 return css::registry::RegistryValueType_LONG;
515 case css::uno::TypeClass_STRING:
516 return css::registry::RegistryValueType_STRING;
517 case css::uno::TypeClass_SEQUENCE:
518 if (t == cppu::UnoType< css::uno::Sequence< sal_Int8 > >::get()) {
519 return css::registry::RegistryValueType_BINARY;
520 } else if (t == cppu::UnoType< css::uno::Sequence< sal_Int32 > >::get())
522 return css::registry::RegistryValueType_LONGLIST;
523 } else if (t ==
524 cppu::UnoType< css::uno::Sequence< OUString > >::get())
526 return css::registry::RegistryValueType_STRINGLIST;
528 // fall through
529 default:
530 return css::registry::RegistryValueType_NOT_DEFINED;
534 sal_Int32 RegistryKey::getLongValue()
535 throw (
536 css::registry::InvalidRegistryException,
537 css::registry::InvalidValueException, css::uno::RuntimeException)
539 osl::MutexGuard g(service_.mutex_);
540 service_.checkValid();
541 sal_Int32 v = 0;
542 if (value_ >>= v) {
543 return v;
545 throw css::registry::InvalidValueException(
546 OUString("com.sun.star.configuration.ConfigurationRegistry"),
547 static_cast< cppu::OWeakObject * >(this));
550 void RegistryKey::setLongValue(sal_Int32)
551 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
553 throw css::uno::RuntimeException(
554 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
555 " implemented"),
556 static_cast< cppu::OWeakObject * >(this));
559 css::uno::Sequence< sal_Int32 > RegistryKey::getLongListValue()
560 throw (
561 css::registry::InvalidRegistryException,
562 css::registry::InvalidValueException, css::uno::RuntimeException)
564 osl::MutexGuard g(service_.mutex_);
565 service_.checkValid();
566 css::uno::Sequence< sal_Int32 > v;
567 if (value_ >>= v) {
568 return v;
570 throw css::registry::InvalidValueException(
571 OUString("com.sun.star.configuration.ConfigurationRegistry"),
572 static_cast< cppu::OWeakObject * >(this));
575 void RegistryKey::setLongListValue(css::uno::Sequence< sal_Int32 > const &)
576 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
578 throw css::uno::RuntimeException(
579 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
580 " implemented"),
581 static_cast< cppu::OWeakObject * >(this));
584 OUString RegistryKey::getAsciiValue()
585 throw (
586 css::registry::InvalidRegistryException,
587 css::registry::InvalidValueException, css::uno::RuntimeException)
589 osl::MutexGuard g(service_.mutex_);
590 service_.checkValid();
591 OUString v;
592 if (value_ >>= v) {
593 return v;
595 throw css::registry::InvalidValueException(
596 OUString("com.sun.star.configuration.ConfigurationRegistry"),
597 static_cast< cppu::OWeakObject * >(this));
600 void RegistryKey::setAsciiValue(OUString const &)
601 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
603 throw css::uno::RuntimeException(
604 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
605 " implemented"),
606 static_cast< cppu::OWeakObject * >(this));
609 css::uno::Sequence< OUString > RegistryKey::getAsciiListValue()
610 throw (
611 css::registry::InvalidRegistryException,
612 css::registry::InvalidValueException, css::uno::RuntimeException)
614 osl::MutexGuard g(service_.mutex_);
615 service_.checkValid();
616 css::uno::Sequence< OUString > v;
617 if (value_ >>= v) {
618 return v;
620 throw css::registry::InvalidValueException(
621 OUString("com.sun.star.configuration.ConfigurationRegistry"),
622 static_cast< cppu::OWeakObject * >(this));
625 void RegistryKey::setAsciiListValue(css::uno::Sequence< OUString > const &)
626 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
628 throw css::uno::RuntimeException(
629 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
630 " implemented"),
631 static_cast< cppu::OWeakObject * >(this));
634 OUString RegistryKey::getStringValue()
635 throw (
636 css::registry::InvalidRegistryException,
637 css::registry::InvalidValueException, css::uno::RuntimeException)
639 osl::MutexGuard g(service_.mutex_);
640 service_.checkValid();
641 OUString v;
642 if (value_ >>= v) {
643 return v;
645 throw css::registry::InvalidValueException(
646 OUString("com.sun.star.configuration.ConfigurationRegistry"),
647 static_cast< cppu::OWeakObject * >(this));
650 void RegistryKey::setStringValue(OUString const &)
651 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
653 throw css::uno::RuntimeException(
654 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
655 " implemented"),
656 static_cast< cppu::OWeakObject * >(this));
659 css::uno::Sequence< OUString > RegistryKey::getStringListValue()
660 throw (
661 css::registry::InvalidRegistryException,
662 css::registry::InvalidValueException, css::uno::RuntimeException)
664 osl::MutexGuard g(service_.mutex_);
665 service_.checkValid();
666 css::uno::Sequence< OUString > v;
667 if (value_ >>= v) {
668 return v;
670 throw css::registry::InvalidValueException(
671 OUString("com.sun.star.configuration.ConfigurationRegistry"),
672 static_cast< cppu::OWeakObject * >(this));
675 void RegistryKey::setStringListValue(
676 css::uno::Sequence< OUString > const &)
677 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
679 throw css::uno::RuntimeException(
680 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
681 " implemented"),
682 static_cast< cppu::OWeakObject * >(this));
685 css::uno::Sequence< sal_Int8 > RegistryKey::getBinaryValue()
686 throw (
687 css::registry::InvalidRegistryException,
688 css::registry::InvalidValueException, css::uno::RuntimeException)
690 osl::MutexGuard g(service_.mutex_);
691 service_.checkValid();
692 css::uno::Sequence< sal_Int8 > v;
693 if (value_ >>= v) {
694 return v;
696 throw css::registry::InvalidValueException(
697 OUString("com.sun.star.configuration.ConfigurationRegistry"),
698 static_cast< cppu::OWeakObject * >(this));
701 void RegistryKey::setBinaryValue(css::uno::Sequence< sal_Int8 > const &)
702 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
704 throw css::uno::RuntimeException(
705 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
706 " implemented"),
707 static_cast< cppu::OWeakObject * >(this));
710 css::uno::Reference< css::registry::XRegistryKey > RegistryKey::openKey(
711 OUString const & aKeyName)
712 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
714 osl::MutexGuard g(service_.mutex_);
715 service_.checkValid_RuntimeException();
716 css::uno::Reference< css::container::XHierarchicalNameAccess > access;
717 if (value_ >>= access) {
718 try {
719 return new RegistryKey(
720 service_, access->getByHierarchicalName(aKeyName));
721 } catch (css::container::NoSuchElementException &) {}
723 return css::uno::Reference< css::registry::XRegistryKey >();
726 css::uno::Reference< css::registry::XRegistryKey > RegistryKey::createKey(
727 OUString const &)
728 throw (
729 css::registry::InvalidRegistryException, css::uno::RuntimeException)
731 throw css::uno::RuntimeException(
732 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
733 " implemented"),
734 static_cast< cppu::OWeakObject * >(this));
737 void RegistryKey::closeKey()
738 throw (
739 css::registry::InvalidRegistryException, css::uno::RuntimeException)
741 osl::MutexGuard g(service_.mutex_);
742 service_.checkValid_RuntimeException();
745 void RegistryKey::deleteKey(OUString const &)
746 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
748 throw css::uno::RuntimeException(
749 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
750 " implemented"),
751 static_cast< cppu::OWeakObject * >(this));
754 css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
755 RegistryKey::openKeys()
756 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
758 throw css::uno::RuntimeException(
759 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
760 " implemented"),
761 static_cast< cppu::OWeakObject * >(this));
764 css::uno::Sequence< OUString > RegistryKey::getKeyNames()
765 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
767 throw css::uno::RuntimeException(
768 OUString("com.sun.star.configuration.ConfigurationRegistry: not"
769 " implemented"),
770 static_cast< cppu::OWeakObject * >(this));
773 sal_Bool RegistryKey::createLink(OUString const &, OUString const &)
774 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
776 osl::MutexGuard g(service_.mutex_);
777 service_.checkValid_RuntimeException();
778 return false;
781 void RegistryKey::deleteLink(OUString const &)
782 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
784 osl::MutexGuard g(service_.mutex_);
785 service_.checkValid_RuntimeException();
788 OUString RegistryKey::getLinkTarget(OUString const &)
789 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
791 osl::MutexGuard g(service_.mutex_);
792 service_.checkValid_RuntimeException();
793 return OUString();
796 OUString RegistryKey::getResolvedName(OUString const & aKeyName)
797 throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
799 osl::MutexGuard g(service_.mutex_);
800 service_.checkValid_RuntimeException();
801 return aKeyName;
806 css::uno::Reference< css::uno::XInterface > create(
807 css::uno::Reference< css::uno::XComponentContext > const & context)
809 return static_cast< cppu::OWeakObject * >(new Service(context));
812 OUString getImplementationName() {
813 return OUString("com.sun.star.comp.configuration.ConfigurationRegistry");
816 css::uno::Sequence< OUString > getSupportedServiceNames() {
817 OUString name("com.sun.star.configuration.ConfigurationRegistry");
818 return css::uno::Sequence< OUString >(&name, 1);
823 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */