Bug Summary

File:stoc/source/defaultregistry/defaultregistry.cxx
Location:line 485, column 9
Description:Called C++ object pointer is null

Annotated Source Code

1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <osl/mutex.hxx>
21#include <osl/diagnose.h>
22#include <cppuhelper/queryinterface.hxx>
23#include <cppuhelper/weak.hxx>
24#include <cppuhelper/factory.hxx>
25#include <cppuhelper/implbase1.hxx>
26#include <cppuhelper/implbase4.hxx>
27#include <cppuhelper/implbase3.hxx>
28#include <cppuhelper/implementationentry.hxx>
29#include <registry/registry.hxx>
30
31#include <com/sun/star/registry/XSimpleRegistry.hpp>
32#include <com/sun/star/lang/XMultiServiceFactory.hpp>
33#include <com/sun/star/lang/XServiceInfo.hpp>
34#include <com/sun/star/lang/XTypeProvider.hpp>
35#include <com/sun/star/lang/XSingleServiceFactory.hpp>
36#include <com/sun/star/lang/XInitialization.hpp>
37#include <com/sun/star/container/XEnumerationAccess.hpp>
38
39#include <bootstrapservices.hxx>
40
41using namespace com::sun::star::uno;
42using namespace com::sun::star::registry;
43using namespace com::sun::star::lang;
44using namespace com::sun::star::container;
45using namespace cppu;
46using namespace osl;
47using ::rtl::OUString;
48
49#define SERVICENAME"com.sun.star.registry.NestedRegistry" "com.sun.star.registry.NestedRegistry"
50#define IMPLNAME"com.sun.star.comp.stoc.NestedRegistry" "com.sun.star.comp.stoc.NestedRegistry"
51
52extern rtl_StandardModuleCount g_moduleCount;
53
54namespace stoc_bootstrap
55{
56Sequence< OUString > defreg_getSupportedServiceNames()
57{
58 Sequence< OUString > seqNames(1);
59 seqNames.getArray()[0] = OUString(SERVICENAME"com.sun.star.registry.NestedRegistry");
60 return seqNames;
61}
62
63OUString defreg_getImplementationName()
64{
65 return OUString(IMPLNAME"com.sun.star.comp.stoc.NestedRegistry");
66}
67}
68
69namespace stoc_defreg
70{
71//*************************************************************************
72// NestedRegistryImpl
73//*************************************************************************
74class NestedKeyImpl;
75
76class NestedRegistryImpl : public WeakAggImplHelper4 < XSimpleRegistry, XInitialization, XServiceInfo, XEnumerationAccess >
77{
78public:
79 NestedRegistryImpl( );
80
81 ~NestedRegistryImpl();
82
83 // XServiceInfo
84 virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
85 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
86 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
87
88 // XInitialization
89 virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
90 throw(Exception, RuntimeException);
91
92 // XSimpleRegistry
93 virtual OUString SAL_CALL getURL() throw(RuntimeException);
94 virtual void SAL_CALL open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) throw(InvalidRegistryException, RuntimeException);
95 virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException);
96 virtual void SAL_CALL close( ) throw(InvalidRegistryException, RuntimeException);
97 virtual void SAL_CALL destroy( ) throw(InvalidRegistryException, RuntimeException);
98 virtual Reference< XRegistryKey > SAL_CALL getRootKey( ) throw(InvalidRegistryException, RuntimeException);
99 virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException);
100 virtual void SAL_CALL mergeKey( const OUString& aKeyName, const OUString& aUrl ) throw(InvalidRegistryException, MergeConflictException, RuntimeException);
101
102 // XEnumerationAccess
103 virtual Reference< XEnumeration > SAL_CALL createEnumeration( ) throw (RuntimeException);
104 virtual Type SAL_CALL getElementType( ) throw (RuntimeException);
105 virtual sal_Bool SAL_CALL hasElements( ) throw (RuntimeException);
106
107 friend class NestedKeyImpl;
108protected:
109 Mutex m_mutex;
110 sal_uInt32 m_state;
111 Reference<XSimpleRegistry> m_localReg;
112 Reference<XSimpleRegistry> m_defaultReg;
113
114};
115
116//*************************************************************************
117// class NestedKeyImpl the implenetation of interface XRegistryKey
118//*************************************************************************
119class NestedKeyImpl : public WeakImplHelper1< XRegistryKey >
120{
121public:
122 NestedKeyImpl( NestedRegistryImpl* pDefaultRegistry,
123 Reference<XRegistryKey>& localKey,
124 Reference<XRegistryKey>& defaultKey);
125
126 NestedKeyImpl( const OUString& aKeyName,
127 NestedKeyImpl* pKey);
128
129 ~NestedKeyImpl();
130
131 // XRegistryKey
132 virtual OUString SAL_CALL getKeyName() throw(RuntimeException);
133 virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException);
134 virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException);
135 virtual RegistryKeyType SAL_CALL getKeyType( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException);
136 virtual RegistryValueType SAL_CALL getValueType( ) throw(InvalidRegistryException, RuntimeException);
137 virtual sal_Int32 SAL_CALL getLongValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
138 virtual void SAL_CALL setLongValue( sal_Int32 value ) throw(InvalidRegistryException, RuntimeException);
139 virtual Sequence< sal_Int32 > SAL_CALL getLongListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
140 virtual void SAL_CALL setLongListValue( const ::com::sun::star::uno::Sequence< sal_Int32 >& seqValue ) throw(InvalidRegistryException, RuntimeException);
141 virtual OUString SAL_CALL getAsciiValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
142 virtual void SAL_CALL setAsciiValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException);
143 virtual Sequence< OUString > SAL_CALL getAsciiListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
144 virtual void SAL_CALL setAsciiListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException);
145 virtual OUString SAL_CALL getStringValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
146 virtual void SAL_CALL setStringValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException);
147 virtual Sequence< OUString > SAL_CALL getStringListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
148 virtual void SAL_CALL setStringListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException);
149 virtual Sequence< sal_Int8 > SAL_CALL getBinaryValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
150 virtual void SAL_CALL setBinaryValue( const ::com::sun::star::uno::Sequence< sal_Int8 >& value ) throw(InvalidRegistryException, RuntimeException);
151 virtual Reference< XRegistryKey > SAL_CALL openKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
152 virtual Reference< XRegistryKey > SAL_CALL createKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
153 virtual void SAL_CALL closeKey( ) throw(InvalidRegistryException, RuntimeException);
154 virtual void SAL_CALL deleteKey( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException);
155 virtual Sequence< Reference< XRegistryKey > > SAL_CALL openKeys( ) throw(InvalidRegistryException, RuntimeException);
156 virtual Sequence< OUString > SAL_CALL getKeyNames( ) throw(InvalidRegistryException, RuntimeException);
157 virtual sal_Bool SAL_CALL createLink( const OUString& aLinkName, const OUString& aLinkTarget ) throw(InvalidRegistryException, RuntimeException);
158 virtual void SAL_CALL deleteLink( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException);
159 virtual OUString SAL_CALL getLinkTarget( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException);
160 virtual OUString SAL_CALL getResolvedName( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
161
162protected:
163 void computeChanges();
164 OUString computeName(const OUString& name);
165
166 OUString m_name;
167 sal_uInt32 m_state;
168 NestedRegistryImpl* m_pRegistry;
169 Reference<XRegistryKey> m_localKey;
170 Reference<XRegistryKey> m_defaultKey;
171};
172
173
174//*************************************************************************
175NestedKeyImpl::NestedKeyImpl( NestedRegistryImpl* pDefaultRegistry,
176 Reference<XRegistryKey>& localKey,
177 Reference<XRegistryKey>& defaultKey )
178 : m_pRegistry(pDefaultRegistry)
179{
180 m_pRegistry->acquire();
181
182 m_localKey = localKey;
183 m_defaultKey = defaultKey;
184
185 if (m_localKey.is())
186 {
187 m_name = m_localKey->getKeyName();
188 } else
189 if (m_defaultKey.is())
190 {
191 m_name = m_defaultKey->getKeyName();
192 }
193
194 m_state = m_pRegistry->m_state;
195}
196
197//*************************************************************************
198NestedKeyImpl::NestedKeyImpl( const OUString& rKeyName,
199 NestedKeyImpl* pKey)
200 : m_pRegistry(pKey->m_pRegistry)
201{
202 m_pRegistry->acquire();
203
204 if (pKey->m_localKey.is() && pKey->m_localKey->isValid())
205 {
206 m_localKey = pKey->m_localKey->openKey(rKeyName);
207 }
208 if (pKey->m_defaultKey.is() && pKey->m_defaultKey->isValid())
209 {
210 m_defaultKey = pKey->m_defaultKey->openKey(rKeyName);
211 }
212
213 if (m_localKey.is())
214 {
215 m_name = m_localKey->getKeyName();
216 } else
217 if (m_defaultKey.is())
218 {
219 m_name = m_defaultKey->getKeyName();
220 }
221
222 m_state = m_pRegistry->m_state;
223}
224
225//*************************************************************************
226NestedKeyImpl::~NestedKeyImpl()
227{
228 if ( m_pRegistry )
229 m_pRegistry->release();
230}
231
232//*************************************************************************
233void NestedKeyImpl::computeChanges()
234{
235 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
236 if ( m_state != m_pRegistry->m_state )
237 {
238 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
239
240 Reference<XRegistryKey> tmpKey = rootKey->openKey(m_name);
241
242 if ( tmpKey.is() )
243 {
244 m_localKey = rootKey->openKey(m_name);
245 }
246
247 m_state = m_pRegistry->m_state;
248 }
249}
250
251//*************************************************************************
252// NestedKey_Impl::computeName()
253//
254OUString NestedKeyImpl::computeName(const OUString& name)
255{
256 OUString resLocalName, resDefaultName;
257
258 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
259 try
260 {
261 if ( m_localKey.is() && m_localKey->isValid() )
262 {
263 resLocalName = m_localKey->getResolvedName(name);
264 } else
265 {
266 if ( m_defaultKey.is() && m_defaultKey->isValid() )
267 return m_defaultKey->getResolvedName(name);
268 }
269
270 if ( !resLocalName.isEmpty() && m_pRegistry->m_defaultReg->isValid() )
271 {
272 Reference<XRegistryKey> localRoot(m_pRegistry->m_localReg->getRootKey());
273 Reference<XRegistryKey> defaultRoot(m_pRegistry->m_defaultReg->getRootKey());
274
275 resDefaultName = defaultRoot->getResolvedName(resLocalName);
276
277 sal_uInt32 count = 100;
278
279 while (resLocalName != resDefaultName && count > 0)
280 {
281 count--;
282
283 if (resLocalName.isEmpty() || resDefaultName.isEmpty())
284 throw InvalidRegistryException();
285
286 resLocalName = localRoot->getResolvedName(resDefaultName);
287 resDefaultName = defaultRoot->getResolvedName(resLocalName);
288 }
289 }
290 }
291 catch(InvalidRegistryException& )
292 {
293 }
294
295 return resLocalName;
296}
297
298//*************************************************************************
299OUString SAL_CALL NestedKeyImpl::getKeyName() throw(RuntimeException)
300{
301 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
302 return m_name;
303}
304
305//*************************************************************************
306sal_Bool SAL_CALL NestedKeyImpl::isReadOnly( )
307 throw(InvalidRegistryException, RuntimeException)
308{
309 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
310 computeChanges();
311
312 if ( m_localKey.is() && m_localKey->isValid() )
313 return m_localKey->isReadOnly();
314 else
315 throw InvalidRegistryException();
316}
317
318//*************************************************************************
319sal_Bool SAL_CALL NestedKeyImpl::isValid( ) throw(RuntimeException)
320{
321 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
322 return ((m_localKey.is() && m_localKey->isValid()) ||
323 (m_defaultKey.is() && m_defaultKey->isValid()) );
324}
325
326//*************************************************************************
327RegistryKeyType SAL_CALL NestedKeyImpl::getKeyType( const OUString& rKeyName )
328 throw(InvalidRegistryException, RuntimeException)
329{
330 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
331 computeChanges();
332
333 if ( m_localKey.is() && m_localKey->isValid() )
334 {
335 return m_localKey->getKeyType(rKeyName);
336 } else
337 if ( m_defaultKey.is() && m_defaultKey->isValid() )
338 {
339 return m_defaultKey->getKeyType(rKeyName);
340 }
341
342 return RegistryKeyType_KEY;
343}
344
345//*************************************************************************
346RegistryValueType SAL_CALL NestedKeyImpl::getValueType( )
347 throw(InvalidRegistryException, RuntimeException)
348{
349 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
350 computeChanges();
351
352 if ( m_localKey.is() && m_localKey->isValid() )
353 {
354 return m_localKey->getValueType();
355 } else
356 if ( m_defaultKey.is() && m_defaultKey->isValid() )
357 {
358 return m_defaultKey->getValueType();
359 }
360
361 return RegistryValueType_NOT_DEFINED;
362}
363
364//*************************************************************************
365sal_Int32 SAL_CALL NestedKeyImpl::getLongValue( )
366 throw(InvalidRegistryException, InvalidValueException, RuntimeException)
367{
368 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
369 computeChanges();
370
371 if ( m_localKey.is() && m_localKey->isValid() )
372 {
373 return m_localKey->getLongValue();
374 } else
375 if ( m_defaultKey.is() && m_defaultKey->isValid() )
376 {
377 return m_defaultKey->getLongValue();
378 } else
379 {
380 throw InvalidRegistryException();
381 }
382}
383
384//*************************************************************************
385void SAL_CALL NestedKeyImpl::setLongValue( sal_Int32 value )
386 throw(InvalidRegistryException, RuntimeException)
387{
388 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
389 computeChanges();
390
391 if ( m_localKey.is() && m_localKey->isValid() )
392 {
393 m_localKey->setLongValue(value);
394 } else
395 if ( m_defaultKey.is() && m_defaultKey->isValid() )
396 {
397 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
398 m_localKey = rootKey->createKey(m_name);
399 m_localKey->setLongValue(value);
400 m_state = m_pRegistry->m_state++;
401 } else
402 {
403 throw InvalidRegistryException();
404 }
405}
406
407//*************************************************************************
408Sequence< sal_Int32 > SAL_CALL NestedKeyImpl::getLongListValue( )
409 throw(InvalidRegistryException, InvalidValueException, RuntimeException)
410{
411 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
412 computeChanges();
413
414 if ( m_localKey.is() && m_localKey->isValid() )
415 {
416 return m_localKey->getLongListValue();
417 } else
418 if ( m_defaultKey.is() && m_defaultKey->isValid() )
419 {
420 return m_defaultKey->getLongListValue();
421 } else
422 {
423 throw InvalidRegistryException();
424 }
425}
426
427//*************************************************************************
428void SAL_CALL NestedKeyImpl::setLongListValue( const Sequence< sal_Int32 >& seqValue )
429 throw(InvalidRegistryException, RuntimeException)
430{
431 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
432 computeChanges();
433
434 if ( m_localKey.is() && m_localKey->isValid() )
435 {
436 m_localKey->setLongListValue(seqValue);
437 } else
438 if ( m_defaultKey.is() && m_defaultKey->isValid() )
439 {
440 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
441 m_localKey = rootKey->createKey(m_name);
442 m_localKey->setLongListValue(seqValue);
443 m_state = m_pRegistry->m_state++;
444 } else
445 {
446 throw InvalidRegistryException();
447 }
448}
449
450//*************************************************************************
451OUString SAL_CALL NestedKeyImpl::getAsciiValue( )
452 throw(InvalidRegistryException, InvalidValueException, RuntimeException)
453{
454 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
455 computeChanges();
456
457 if ( m_localKey.is() && m_localKey->isValid() )
458 {
459 return m_localKey->getAsciiValue();
460 } else
461 if ( m_defaultKey.is() && m_defaultKey->isValid() )
462 {
463 return m_defaultKey->getAsciiValue();
464 } else
465 {
466 throw InvalidRegistryException();
467 }
468}
469
470//*************************************************************************
471void SAL_CALL NestedKeyImpl::setAsciiValue( const OUString& value )
472 throw(InvalidRegistryException, RuntimeException)
473{
474 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
475 computeChanges();
476
477 if ( m_localKey.is() && m_localKey->isValid() )
478 {
479 m_localKey->setAsciiValue(value);
480 } else
481 if ( m_defaultKey.is() && m_defaultKey->isValid() )
1
Taking true branch
482 {
483 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
484 m_localKey = rootKey->createKey(m_name);
485 m_localKey->setAsciiValue(value);
2
Called C++ object pointer is null
486 m_state = m_pRegistry->m_state++;
487 } else
488 {
489 throw InvalidRegistryException();
490 }
491}
492
493//*************************************************************************
494Sequence< OUString > SAL_CALL NestedKeyImpl::getAsciiListValue( )
495 throw(InvalidRegistryException, InvalidValueException, RuntimeException)
496{
497 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
498 computeChanges();
499
500 if ( m_localKey.is() && m_localKey->isValid() )
501 {
502 return m_localKey->getAsciiListValue();
503 } else
504 if ( m_defaultKey.is() && m_defaultKey->isValid() )
505 {
506 return m_defaultKey->getAsciiListValue();
507 } else
508 {
509 throw InvalidRegistryException();
510 }
511}
512
513//*************************************************************************
514void SAL_CALL NestedKeyImpl::setAsciiListValue( const Sequence< OUString >& seqValue )
515 throw(InvalidRegistryException, RuntimeException)
516{
517 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
518 computeChanges();
519
520 if ( m_localKey.is() && m_localKey->isValid() )
521 {
522 m_localKey->setAsciiListValue(seqValue);
523 } else
524 if ( m_defaultKey.is() && m_defaultKey->isValid() )
525 {
526 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
527 m_localKey = rootKey->createKey(m_name);
528 m_localKey->setAsciiListValue(seqValue);
529 m_state = m_pRegistry->m_state++;
530 } else
531 {
532 throw InvalidRegistryException();
533 }
534}
535
536//*************************************************************************
537OUString SAL_CALL NestedKeyImpl::getStringValue( )
538 throw(InvalidRegistryException, InvalidValueException, RuntimeException)
539{
540 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
541 computeChanges();
542
543 if ( m_localKey.is() && m_localKey->isValid() )
544 {
545 return m_localKey->getStringValue();
546 } else
547 if ( m_defaultKey.is() && m_defaultKey->isValid() )
548 {
549 return m_defaultKey->getStringValue();
550 } else
551 {
552 throw InvalidRegistryException();
553 }
554}
555
556//*************************************************************************
557void SAL_CALL NestedKeyImpl::setStringValue( const OUString& value )
558 throw(InvalidRegistryException, RuntimeException)
559{
560 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
561 computeChanges();
562
563 if ( m_localKey.is() && m_localKey->isValid() )
564 {
565 m_localKey->setStringValue(value);
566 } else
567 if ( m_defaultKey.is() && m_defaultKey->isValid() )
568 {
569 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
570 m_localKey = rootKey->createKey(m_name);
571 m_localKey->setStringValue(value);
572 m_state = m_pRegistry->m_state++;
573 } else
574 {
575 throw InvalidRegistryException();
576 }
577}
578
579//*************************************************************************
580Sequence< OUString > SAL_CALL NestedKeyImpl::getStringListValue( )
581 throw(InvalidRegistryException, InvalidValueException, RuntimeException)
582{
583 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
584 computeChanges();
585
586 if ( m_localKey.is() && m_localKey->isValid() )
587 {
588 return m_localKey->getStringListValue();
589 } else
590 if ( m_defaultKey.is() && m_defaultKey->isValid() )
591 {
592 return m_defaultKey->getStringListValue();
593 } else
594 {
595 throw InvalidRegistryException();
596 }
597}
598
599//*************************************************************************
600void SAL_CALL NestedKeyImpl::setStringListValue( const Sequence< OUString >& seqValue )
601 throw(InvalidRegistryException, RuntimeException)
602{
603 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
604 computeChanges();
605
606 if ( m_localKey.is() && m_localKey->isValid() )
607 {
608 m_localKey->setStringListValue(seqValue);
609 } else
610 if ( m_defaultKey.is() && m_defaultKey->isValid() )
611 {
612 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
613 m_localKey = rootKey->createKey(m_name);
614 m_localKey->setStringListValue(seqValue);
615 m_state = m_pRegistry->m_state++;
616 } else
617 {
618 throw InvalidRegistryException();
619 }
620}
621
622//*************************************************************************
623Sequence< sal_Int8 > SAL_CALL NestedKeyImpl::getBinaryValue( )
624 throw(InvalidRegistryException, InvalidValueException, RuntimeException)
625{
626 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
627 computeChanges();
628
629 if ( m_localKey.is() && m_localKey->isValid() )
630 {
631 return m_localKey->getBinaryValue();
632 } else
633 if ( m_defaultKey.is() && m_defaultKey->isValid() )
634 {
635 return m_defaultKey->getBinaryValue();
636 } else
637 {
638 throw InvalidRegistryException();
639 }
640}
641
642//*************************************************************************
643void SAL_CALL NestedKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value )
644 throw(InvalidRegistryException, RuntimeException)
645{
646 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
647 computeChanges();
648
649 if ( m_localKey.is() && m_localKey->isValid() )
650 {
651 m_localKey->setBinaryValue(value);
652 } else
653 if ( m_defaultKey.is() && m_defaultKey->isValid() )
654 {
655 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
656 m_localKey = rootKey->createKey(m_name);
657 m_localKey->setBinaryValue(value);
658 m_state = m_pRegistry->m_state++;
659 } else
660 {
661 throw InvalidRegistryException();
662 }
663}
664
665//*************************************************************************
666Reference< XRegistryKey > SAL_CALL NestedKeyImpl::openKey( const OUString& aKeyName )
667 throw(InvalidRegistryException, RuntimeException)
668{
669 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
670 if ( !m_localKey.is() && !m_defaultKey.is() )
671 {
672 throw InvalidRegistryException();
673 }
674
675 OUString resolvedName = computeName(aKeyName);
676
677 if ( resolvedName.isEmpty() )
678 throw InvalidRegistryException();
679
680 Reference<XRegistryKey> localKey, defaultKey;
681
682 if ( m_localKey.is() && m_localKey->isValid() )
683 {
684 localKey = m_pRegistry->m_localReg->getRootKey()->openKey(resolvedName);
685 }
686 if ( m_defaultKey.is() && m_defaultKey->isValid() )
687 {
688 defaultKey = m_pRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
689 }
690
691 if ( localKey.is() || defaultKey.is() )
692 {
693 return ((XRegistryKey*)new NestedKeyImpl(m_pRegistry, localKey, defaultKey));
694 } else
695 {
696 return Reference<XRegistryKey>();
697 }
698}
699
700//*************************************************************************
701Reference< XRegistryKey > SAL_CALL NestedKeyImpl::createKey( const OUString& aKeyName )
702 throw(InvalidRegistryException, RuntimeException)
703{
704 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
705 if ( (!m_localKey.is() && !m_defaultKey.is()) ||
706 (m_localKey.is() && m_localKey->isReadOnly()) )
707 {
708 throw InvalidRegistryException();
709 }
710
711 OUString resolvedName = computeName(aKeyName);
712
713 if ( resolvedName.isEmpty() )
714 throw InvalidRegistryException();
715
716 if ( m_localKey.is() && m_localKey->isValid() )
717 {
718 Reference<XRegistryKey> localKey, defaultKey;
719
720 localKey = m_pRegistry->m_localReg->getRootKey()->createKey(resolvedName);
721 if ( localKey.is() )
722 {
723 if ( m_defaultKey.is() && m_defaultKey->isValid() )
724 {
725 defaultKey = m_pRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
726 }
727
728 m_state = m_pRegistry->m_state++;
729
730 return ((XRegistryKey*)new NestedKeyImpl(m_pRegistry, localKey, defaultKey));
731 }
732 } else
733 {
734 Reference<XRegistryKey> localKey, defaultKey;
735
736 if ( m_defaultKey.is() && m_defaultKey->isValid() )
737 {
738 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
739 m_localKey = rootKey->createKey(m_name);
740
741 localKey = m_pRegistry->m_localReg->getRootKey()->createKey(resolvedName);
742
743 if ( localKey.is() )
744 {
745 defaultKey = m_pRegistry->m_defaultReg->getRootKey()->openKey(resolvedName);
746
747 m_state = m_pRegistry->m_state++;
748
749 return ((XRegistryKey*)new NestedKeyImpl(m_pRegistry, localKey, defaultKey));
750 }
751 }
752 }
753
754 return Reference<XRegistryKey>();
755}
756
757//*************************************************************************
758void SAL_CALL NestedKeyImpl::closeKey( )
759 throw(InvalidRegistryException, RuntimeException)
760{
761 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
762 if ( m_localKey.is() && m_localKey->isValid() )
763 {
764 m_localKey->closeKey();
765 }
766 if ( m_defaultKey.is() && m_defaultKey->isValid() )
767 {
768 m_defaultKey->closeKey();
769 }
770}
771
772//*************************************************************************
773void SAL_CALL NestedKeyImpl::deleteKey( const OUString& rKeyName )
774 throw(InvalidRegistryException, RuntimeException)
775{
776 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
777 if ( m_localKey.is() && m_localKey->isValid() &&
778 !m_localKey->isReadOnly() )
779 {
780 OUString resolvedName = computeName(rKeyName);
781
782 if ( resolvedName.isEmpty() )
783 {
784 throw InvalidRegistryException();
785 }
786
787 m_pRegistry->m_localReg->getRootKey()->deleteKey(resolvedName);
788 } else
789 {
790 throw InvalidRegistryException();
791 }
792}
793
794//*************************************************************************
795Sequence< Reference< XRegistryKey > > SAL_CALL NestedKeyImpl::openKeys( )
796 throw(InvalidRegistryException, RuntimeException)
797{
798 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
799 if ( !m_localKey.is() && !m_defaultKey.is() )
800 {
801 throw InvalidRegistryException();
802 }
803
804 Sequence<OUString> localSeq, defaultSeq;
805
806 if ( m_localKey.is() && m_localKey->isValid() )
807 {
808 localSeq = m_localKey->getKeyNames();
809 }
810 if ( m_defaultKey.is() && m_defaultKey->isValid() )
811 {
812 defaultSeq = m_defaultKey->getKeyNames();
813 }
814
815 sal_uInt32 local = localSeq.getLength();
816 sal_uInt32 def = defaultSeq.getLength();
817 sal_uInt32 len = 0;
818
819 sal_uInt32 i, j;
820 for (i=0; i < local; i++)
821 {
822 for (j=0 ; j < def; j++)
823 {
824 if ( localSeq.getConstArray()[i] == defaultSeq.getConstArray()[j] )
825 {
826 len++;
827 break;
828 }
829 }
830 }
831
832 Sequence< Reference<XRegistryKey> > retSeq(local + def - len);
833 sal_Bool insert = sal_True((sal_Bool)1);
834 OUString name;
835 sal_Int32 lastIndex;
836
837 for (i=0; i < local; i++)
838 {
839 name = localSeq.getConstArray()[i];
840 lastIndex = name.lastIndexOf('/');
841 name = name.copy(lastIndex);
842 retSeq.getArray()[i] =
843 (XRegistryKey*)new NestedKeyImpl(name, this);
844 }
845
846 sal_uInt32 k = local;
847 for (i=0; i < def; i++)
848 {
849 insert = sal_True((sal_Bool)1);
850
851 for (j=0 ; j < local; j++)
852 {
853 if ( retSeq.getConstArray()[j]->getKeyName()
854 == defaultSeq.getConstArray()[i] )
855 {
856 insert = sal_False((sal_Bool)0);
857 break;
858 }
859 }
860
861 if ( insert )
862 {
863 name = defaultSeq.getConstArray()[i];
864 lastIndex = name.lastIndexOf('/');
865 name = name.copy(lastIndex);
866 retSeq.getArray()[k++] =
867 (XRegistryKey*)new NestedKeyImpl(name, this);
868 }
869 }
870
871 return retSeq;
872}
873
874//*************************************************************************
875Sequence< OUString > SAL_CALL NestedKeyImpl::getKeyNames( )
876 throw(InvalidRegistryException, RuntimeException)
877{
878 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
879 if ( !m_localKey.is() && !m_defaultKey.is() )
880 {
881 throw InvalidRegistryException();
882 }
883
884 Sequence<OUString> localSeq, defaultSeq;
885
886 if ( m_localKey.is() && m_localKey->isValid() )
887 {
888 localSeq = m_localKey->getKeyNames();
889 }
890 if ( m_defaultKey.is() && m_defaultKey->isValid() )
891 {
892 defaultSeq = m_defaultKey->getKeyNames();
893 }
894
895 sal_uInt32 local = localSeq.getLength();
896 sal_uInt32 def = defaultSeq.getLength();
897 sal_uInt32 len = 0;
898
899 sal_uInt32 i, j;
900 for (i=0; i < local; i++)
901 {
902 for (j=0 ; j < def; j++)
903 {
904 if ( localSeq.getConstArray()[i] == defaultSeq.getConstArray()[j] )
905 {
906 len++;
907 break;
908 }
909 }
910 }
911
912 Sequence<OUString> retSeq(local + def - len);
913 sal_Bool insert = sal_True((sal_Bool)1);
914
915 for (i=0; i < local; i++)
916 {
917 retSeq.getArray()[i] = localSeq.getConstArray()[i];
918 }
919
920 sal_uInt32 k = local;
921 for (i=0; i < def; i++)
922 {
923 insert = sal_True((sal_Bool)1);
924
925 for (j=0 ; j < local; j++)
926 {
927 if ( retSeq.getConstArray()[j] == defaultSeq.getConstArray()[i] )
928 {
929 insert = sal_False((sal_Bool)0);
930 break;
931 }
932 }
933
934 if ( insert )
935 retSeq.getArray()[k++] = defaultSeq.getConstArray()[i];
936 }
937
938 return retSeq;
939}
940
941//*************************************************************************
942sal_Bool SAL_CALL NestedKeyImpl::createLink( const OUString& aLinkName, const OUString& aLinkTarget )
943 throw(InvalidRegistryException, RuntimeException)
944{
945 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
946
947 sal_Bool isCreated = sal_False((sal_Bool)0);
948 if ( !m_localKey.is() && !m_defaultKey.is() )
949 {
950 throw InvalidRegistryException();
951 }
952
953 OUString linkName;
954 OUString resolvedName;
955 sal_Int32 lastIndex = aLinkName.lastIndexOf('/');
956
957 if ( lastIndex > 0 )
958 {
959 linkName = aLinkName.copy(0, lastIndex);
960
961 resolvedName = computeName(linkName);
962
963 if ( resolvedName.isEmpty() )
964 {
965 throw InvalidRegistryException();
966 }
967
968 resolvedName = resolvedName + aLinkName.copy(lastIndex);
969 } else
970 {
971 if ( lastIndex == 0 )
972 resolvedName = m_name + aLinkName;
973 else
974 resolvedName = m_name + OUString( "/" ) + aLinkName;
975 }
976
977 if ( m_localKey.is() && m_localKey->isValid() )
978 {
979 isCreated = m_pRegistry->m_localReg->getRootKey()->createLink(resolvedName, aLinkTarget);
980 } else
981 {
982 if ( m_defaultKey.is() && m_defaultKey->isValid() )
983 {
984 Reference<XRegistryKey> rootKey(m_pRegistry->m_localReg->getRootKey());
985 m_localKey = rootKey->createKey(m_name);
986
987 isCreated = m_pRegistry->m_localReg->getRootKey()->createLink(resolvedName, aLinkTarget);
988 }
989 }
990
991 if ( isCreated )
992 m_state = m_pRegistry->m_state++;
993
994 return isCreated;
995}
996
997//*************************************************************************
998void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName )
999 throw(InvalidRegistryException, RuntimeException)
1000{
1001 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
1002 if ( !m_localKey.is() && !m_defaultKey.is() )
1003 {
1004 throw InvalidRegistryException();
1005 }
1006
1007 OUString linkName;
1008 OUString resolvedName;
1009 sal_Int32 lastIndex = rLinkName.lastIndexOf('/');
1010
1011 if ( lastIndex > 0 )
1012 {
1013 linkName = rLinkName.copy(0, lastIndex);
1014
1015 resolvedName = computeName(linkName);
1016
1017 if ( resolvedName.isEmpty() )
1018 {
1019 throw InvalidRegistryException();
1020 }
1021
1022 resolvedName = resolvedName + rLinkName.copy(lastIndex);
1023 } else
1024 {
1025 if ( lastIndex == 0 )
1026 resolvedName = m_name + rLinkName;
1027 else
1028 resolvedName = m_name + OUString( "/" ) + rLinkName;
1029 }
1030
1031 if ( m_localKey.is() && m_localKey->isValid() &&
1032 !m_localKey->isReadOnly() )
1033 {
1034 m_pRegistry->m_localReg->getRootKey()->deleteLink(resolvedName);
1035 } else
1036 {
1037 throw InvalidRegistryException();
1038 }
1039}
1040
1041//*************************************************************************
1042OUString SAL_CALL NestedKeyImpl::getLinkTarget( const OUString& rLinkName )
1043 throw(InvalidRegistryException, RuntimeException)
1044{
1045 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
1046 if ( !m_localKey.is() && !m_defaultKey.is() )
1047 {
1048 throw InvalidRegistryException();
1049 }
1050
1051 OUString linkName;
1052 OUString resolvedName;
1053 sal_Int32 lastIndex = rLinkName.lastIndexOf('/');
1054
1055 if ( lastIndex > 0 )
1056 {
1057 linkName = rLinkName.copy(0, lastIndex);
1058
1059 resolvedName = computeName(linkName);
1060
1061 if ( resolvedName.isEmpty() )
1062 {
1063 throw InvalidRegistryException();
1064 }
1065
1066 resolvedName = resolvedName + rLinkName.copy(lastIndex);
1067 } else
1068 {
1069 if ( lastIndex == 0 )
1070 resolvedName = m_name + rLinkName;
1071 else
1072 resolvedName = m_name + OUString( "/" ) + rLinkName;
1073 }
1074
1075 OUString linkTarget;
1076 if ( m_localKey.is() && m_localKey->isValid() )
1077 {
1078 try
1079 {
1080 linkTarget = m_pRegistry->m_localReg->getRootKey()->getLinkTarget(resolvedName);
1081 return linkTarget;
1082 }
1083 catch(InvalidRegistryException& )
1084 {
1085 }
1086 }
1087
1088 if ( m_defaultKey.is() && m_defaultKey->isValid() )
1089 linkTarget = m_pRegistry->m_defaultReg->getRootKey()->getLinkTarget(resolvedName);
1090
1091 return linkTarget;
1092}
1093
1094//*************************************************************************
1095OUString SAL_CALL NestedKeyImpl::getResolvedName( const OUString& aKeyName )
1096 throw(InvalidRegistryException, RuntimeException)
1097{
1098 Guard< Mutex > aGuard( m_pRegistry->m_mutex );
1099 if ( !m_localKey.is() && !m_defaultKey.is() )
1100 {
1101 throw InvalidRegistryException();
1102 }
1103
1104 OUString resolvedName = computeName(aKeyName);
1105
1106 if ( resolvedName.isEmpty() )
1107 {
1108 throw InvalidRegistryException();
1109 }
1110
1111 return resolvedName;
1112}
1113
1114//*************************************************************************
1115//
1116// DefaultRegistry Implementation
1117//
1118//*************************************************************************
1119NestedRegistryImpl::NestedRegistryImpl( )
1120 : m_state(0)
1121{
1122 g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
1123}
1124
1125//*************************************************************************
1126NestedRegistryImpl::~NestedRegistryImpl()
1127{
1128 g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
1129}
1130
1131
1132class RegistryEnumueration : public WeakImplHelper1< XEnumeration >
1133{
1134public:
1135 RegistryEnumueration(
1136 const Reference< XSimpleRegistry > &r1,
1137 const Reference< XSimpleRegistry > &r2 )
1138 : m_xReg1( r1 ) , m_xReg2( r2 )
1139 {}
1140public:
1141 virtual sal_Bool SAL_CALL hasMoreElements( ) throw (RuntimeException);
1142 virtual Any SAL_CALL nextElement( ) throw (NoSuchElementException, WrappedTargetException, RuntimeException);
1143
1144private:
1145 Reference< XSimpleRegistry > m_xReg1;
1146 Reference< XSimpleRegistry > m_xReg2;
1147};
1148
1149sal_Bool RegistryEnumueration::hasMoreElements( ) throw (RuntimeException)
1150{
1151 return m_xReg1.is() || m_xReg2.is();
1152}
1153
1154Any RegistryEnumueration::nextElement( )
1155 throw (NoSuchElementException, WrappedTargetException, RuntimeException)
1156{
1157 Any a;
1158 if( m_xReg1.is() )
1159 {
1160 a <<= m_xReg1;
1161 m_xReg1.clear();
1162 }
1163 else if( m_xReg2.is() )
1164 {
1165 a <<= m_xReg2;
1166 m_xReg2.clear();
1167 }
1168 else
1169 {
1170 throw NoSuchElementException( OUString(
1171 "NestedRegistry: no nextElement() !" ),Reference< XInterface > () );
1172 }
1173 return a;
1174}
1175
1176
1177Reference< XEnumeration > NestedRegistryImpl::createEnumeration( ) throw (RuntimeException)
1178{
1179 MutexGuard guard( m_mutex );
1180 return new RegistryEnumueration( m_localReg, m_defaultReg );
1181}
1182
1183Type NestedRegistryImpl::getElementType( ) throw (RuntimeException)
1184{
1185 return getCppuType( &m_localReg );
1186}
1187
1188sal_Bool SAL_CALL NestedRegistryImpl::hasElements( ) throw (RuntimeException)
1189{
1190 MutexGuard guard( m_mutex );
1191 return m_localReg.is() || m_defaultReg.is();
1192}
1193
1194
1195
1196//*************************************************************************
1197OUString SAL_CALL NestedRegistryImpl::getImplementationName( )
1198 throw(RuntimeException)
1199{
1200 return stoc_bootstrap::defreg_getImplementationName();
1201}
1202
1203//*************************************************************************
1204sal_Bool SAL_CALL NestedRegistryImpl::supportsService( const OUString& ServiceName )
1205 throw(RuntimeException)
1206{
1207 Guard< Mutex > aGuard( m_mutex );
1208 Sequence< OUString > aSNL = getSupportedServiceNames();
1209 const OUString * pArray = aSNL.getArray();
1210 for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
1211 if( pArray[i] == ServiceName )
1212 return sal_True((sal_Bool)1);
1213 return sal_False((sal_Bool)0);
1214}
1215
1216//*************************************************************************
1217Sequence<OUString> SAL_CALL NestedRegistryImpl::getSupportedServiceNames( )
1218 throw(RuntimeException)
1219{
1220 return stoc_bootstrap::defreg_getSupportedServiceNames();
1221}
1222
1223//*************************************************************************
1224void SAL_CALL NestedRegistryImpl::initialize( const Sequence< Any >& aArguments )
1225 throw( Exception, RuntimeException )
1226{
1227 Guard< Mutex > aGuard( m_mutex );
1228 if ( (aArguments.getLength() == 2) &&
1229 (aArguments[0].getValueType().getTypeClass() == TypeClass_INTERFACE) &&
1230 (aArguments[1].getValueType().getTypeClass() == TypeClass_INTERFACE) )
1231 {
1232 aArguments[0] >>= m_localReg;
1233 aArguments[1] >>= m_defaultReg;
1234 if ( m_localReg == m_defaultReg )
1235 m_defaultReg = Reference< XSimpleRegistry >();
1236 }
1237}
1238
1239//*************************************************************************
1240OUString SAL_CALL NestedRegistryImpl::getURL() throw(RuntimeException)
1241{
1242 Guard< Mutex > aGuard( m_mutex );
1243 try
1244 {
1245 if ( m_localReg.is() && m_localReg->isValid() )
1246 return m_localReg->getURL();
1247 }
1248 catch(InvalidRegistryException& )
1249 {
1250 }
1251
1252 return OUString();
1253}
1254
1255//*************************************************************************
1256void SAL_CALL NestedRegistryImpl::open( const OUString&, sal_Bool, sal_Bool )
1257 throw(InvalidRegistryException, RuntimeException)
1258{
1259 throw InvalidRegistryException(
1260 OUString("the 'open' method is not specified for a nested registry"),
1261 Reference< XInterface >() );
1262}
1263
1264//*************************************************************************
1265sal_Bool SAL_CALL NestedRegistryImpl::isValid( ) throw(RuntimeException)
1266{
1267 Guard< Mutex > aGuard( m_mutex );
1268 try
1269 {
1270 if ( (m_localReg.is() && m_localReg->isValid()) ||
1271 (m_defaultReg.is() && m_defaultReg->isValid()) )
1272 return sal_True((sal_Bool)1);
1273 }
1274 catch(InvalidRegistryException& )
1275 {
1276 }
1277
1278 return sal_False((sal_Bool)0);
1279}
1280
1281//*************************************************************************
1282void SAL_CALL NestedRegistryImpl::close( )
1283 throw(InvalidRegistryException, RuntimeException)
1284{
1285 Guard< Mutex > aGuard( m_mutex );
1286 if ( m_localReg.is() && m_localReg->isValid() )
1287 {
1288 m_localReg->close();
1289 }
1290 if ( m_defaultReg.is() && m_defaultReg->isValid() )
1291 {
1292 m_defaultReg->close();
1293 }
1294}
1295
1296//*************************************************************************
1297void SAL_CALL NestedRegistryImpl::destroy( )
1298 throw(InvalidRegistryException, RuntimeException)
1299{
1300 throw InvalidRegistryException(
1301 OUString("the 'destroy' method is not specified for a nested registry"),
1302 Reference< XInterface >() );
1303}
1304
1305//*************************************************************************
1306Reference< XRegistryKey > SAL_CALL NestedRegistryImpl::getRootKey( )
1307 throw(InvalidRegistryException, RuntimeException)
1308{
1309 Reference<XRegistryKey> tmpKey;
1310
1311 Guard< Mutex > aGuard( m_mutex );
1312 if ( m_localReg.is() && m_localReg->isValid() )
1313 {
1314 Reference<XRegistryKey> localKey, defaultKey;
1315
1316 localKey = m_localReg->getRootKey();
1317
1318 if ( localKey.is() )
1319 {
1320 if ( m_defaultReg.is() && m_defaultReg->isValid() )
1321 {
1322 defaultKey = m_defaultReg->getRootKey();
1323 }
1324
1325 return ((XRegistryKey*)new NestedKeyImpl(this, localKey, defaultKey));
1326 }
1327 } else
1328 {
1329 throw InvalidRegistryException();
1330 }
1331
1332 return Reference<XRegistryKey>();
1333}
1334
1335//*************************************************************************
1336sal_Bool SAL_CALL NestedRegistryImpl::isReadOnly( )
1337 throw(InvalidRegistryException, RuntimeException)
1338{
1339 Guard< Mutex > aGuard( m_mutex );
1340 try
1341 {
1342 if ( m_localReg.is() && m_localReg->isValid() )
1343 return m_localReg->isReadOnly();
1344 }
1345 catch(InvalidRegistryException& )
1346 {
1347 }
1348
1349 return sal_False((sal_Bool)0);
1350}
1351
1352//*************************************************************************
1353void SAL_CALL NestedRegistryImpl::mergeKey( const OUString& aKeyName, const OUString& aUrl )
1354 throw(InvalidRegistryException, MergeConflictException, RuntimeException)
1355{
1356 Guard< Mutex > aGuard( m_mutex );
1357 if ( m_localReg.is() && m_localReg->isValid() )
1358 {
1359 m_localReg->mergeKey(aKeyName, aUrl);
1360
1361 m_state++;
1362 }
1363}
1364} // namespace stco_defreg
1365
1366namespace stoc_bootstrap
1367{
1368//*************************************************************************
1369Reference<XInterface> SAL_CALL NestedRegistry_CreateInstance(
1370 SAL_UNUSED_PARAMETER__attribute__ ((unused)) const Reference<XComponentContext>& )
1371 throw(Exception)
1372{
1373 Reference<XInterface> xRet;
1374 XSimpleRegistry *pRegistry = (XSimpleRegistry*) new stoc_defreg::NestedRegistryImpl;
1375
1376 if (pRegistry)
1377 {
1378 xRet = Reference<XInterface>::query(pRegistry);
1379 }
1380
1381 return xRet;
1382}
1383
1384}
1385
1386/* vim:set shiftwidth=4 softtabstop=4 expandtab: */