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