diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 15:18:56 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 15:18:56 +0000 |
commit | cb1a7c1869062c789c65bc55285e6b18fcf378e0 (patch) | |
tree | a084b702d7cce826b3b68cb69be833eeedd6bedb /configmgr/source/registry |
initial import
Diffstat (limited to 'configmgr/source/registry')
-rw-r--r-- | configmgr/source/registry/cfgregistrykey.cxx | 783 | ||||
-rw-r--r-- | configmgr/source/registry/cfgregistrykey.hxx | 256 | ||||
-rw-r--r-- | configmgr/source/registry/configregistry.cxx | 344 | ||||
-rw-r--r-- | configmgr/source/registry/configregistry.hxx | 175 | ||||
-rw-r--r-- | configmgr/source/registry/makefile.mk | 82 |
5 files changed, 1640 insertions, 0 deletions
diff --git a/configmgr/source/registry/cfgregistrykey.cxx b/configmgr/source/registry/cfgregistrykey.cxx new file mode 100644 index 0000000000..20011b5fc1 --- /dev/null +++ b/configmgr/source/registry/cfgregistrykey.cxx @@ -0,0 +1,783 @@ +/************************************************************************* + * + * $RCSfile: cfgregistrykey.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ +#include "cfgregistrykey.hxx" +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif +#ifndef _TYPELIB_TYPEDESCRIPTION_HXX_ +#include <typelib/typedescription.hxx> +#endif + +#define THISREF() static_cast< ::cppu::OWeakObject* >(this) +#define UNISTRING(c) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(c) ) + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::container; +using namespace ::osl; +using namespace ::cppu; + +//========================================================================== +//= OConfigurationRegistryKey +//========================================================================== + +//-------------------------------------------------------------------------- +OConfigurationRegistryKey::OConfigurationRegistryKey + (const Reference< XNameAccess >& _rxContainerNode + ,sal_Bool _bWriteable + ,SubtreeRoot + ) + :m_xNodeAccess(_rxContainerNode) + ,m_bReadOnly(!_bWriteable) + ,m_xNodeDeepAccess(_rxContainerNode, UNO_QUERY) +{ + OSL_ENSHURE(m_xNodeAccess.is(), "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid config node param !"); +} + +//-------------------------------------------------------------------------- +OConfigurationRegistryKey::OConfigurationRegistryKey( + const Reference< XNameAccess >& _rxContainerNode, + const ::rtl::OUString& _rLocalName, + sal_Bool _bWriteable) + :m_xNodeAccess(_rxContainerNode) + ,m_bReadOnly(!_bWriteable) + ,m_xNodeDeepAccess(_rxContainerNode, UNO_QUERY) + ,m_sLocalName(_rLocalName) +{ + OSL_ENSHURE(m_xNodeAccess.is(), "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid config node param !"); + OSL_ENSHURE(m_sLocalName.getLength(), "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid relative name !"); +} + +//-------------------------------------------------------------------------- +OConfigurationRegistryKey::OConfigurationRegistryKey( + Any _rCurrentValue, + const Reference< XNameAccess >& _rxParentNode, + const ::rtl::OUString& _rRelativeName, + sal_Bool _bWriteable) + :m_aLeafElement(_rCurrentValue) + ,m_xLeafParent(_rxParentNode) + ,m_sLocalName(_rRelativeName) + ,m_bReadOnly(!_bWriteable) +{ + OSL_ENSHURE(_rxParentNode.is() && _rCurrentValue.hasValue(), + "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid value and/or parent !"); + OSL_ENSHURE(m_bReadOnly || Reference< XNameReplace >(_rxParentNode, UNO_QUERY).is(), + "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid parent (no value write access) !"); + OSL_ENSHURE(m_sLocalName.getLength(), "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid relative name !"); +} + +//-------------------------------------------------------------------------- +void OConfigurationRegistryKey::checkValid(KEY_ACCESS_TYPE _eIntentedAccess) throw (InvalidRegistryException) +{ + if (!isValid()) + throw InvalidRegistryException(UNISTRING("The registry is not bound to a configuration node anymore."), THISREF()); + // "anymore", because at the moment the ctor was called it probably was bound .... + switch (_eIntentedAccess) + { + case KAT_VALUE_WRITE: + if (m_bReadOnly) + throw InvalidRegistryException(UNISTRING("This configuration node is not writeable."), THISREF()); + // !!! NO !!! BREAK !!! + case KAT_VALUE: + if (!m_aLeafElement.hasValue()) + throw InvalidRegistryException(UNISTRING("This configuration node does not have a value, it is a container."), THISREF()); + if (!m_xLeafParent.is()) + throw InvalidRegistryException(UNISTRING("This configuration nodes parent is invalid."), THISREF()); + break; + case KAT_CHILD: + if (!m_xNodeAccess.is()) + throw InvalidRegistryException(UNISTRING("This configuration node does not have children, it is a value node."), THISREF()); + break; + } +} + +//-------------------------------------------------------------------------- +Any OConfigurationRegistryKey::getDescendant(const ::rtl::OUString& _rDescendantName) throw(InvalidRegistryException) +{ + Any aElementReturn; + + try + { + if (-1 != _rDescendantName.indexOf('/')) + { + if (m_xNodeDeepAccess.is()) + aElementReturn = m_xNodeDeepAccess->getByHierarchicalName(_rDescendantName); + else + throw InvalidRegistryException(UNISTRING("Nested element access not supported by this node."), THISREF()); + } + else + { + if (m_xNodeAccess.is()) + aElementReturn = m_xNodeAccess->getByName(_rDescendantName); + else + { + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getDescendant : invalid call !"); + // this method should not be called if the object does not represent a container node ... + throw InvalidRegistryException(UNISTRING("invalid object."), THISREF()); + } + } + } + catch(NoSuchElementException&) + { // not allowed to leave the method, wrap it + ::rtl::OUString sMessage(UNISTRING("There is no element named ")); + sMessage += _rDescendantName; + sMessage += UNISTRING("."); + throw InvalidRegistryException(sMessage, THISREF()); + } + catch(WrappedTargetException&) + { // allowed to be thrown by XNameAccess::getByName, but not allowed to leave this method + ::rtl::OUString sMessage(UNISTRING("The configuration node could not provide an element for ")); + sMessage += _rDescendantName; + sMessage += UNISTRING("."); + throw InvalidRegistryException(sMessage, THISREF()); + } + + if (!aElementReturn.hasValue()) + { // suspicious .... either there is an element, or there is none, but in the latter case an exception should + // have been thrown. + ::rtl::OUString sMessage(UNISTRING("There is no element named ")); + sMessage += _rDescendantName; + sMessage += UNISTRING("."); + throw InvalidRegistryException(sMessage, THISREF()); + } + + return aElementReturn; +} + +//-------------------------------------------------------------------------- +void OConfigurationRegistryKey::writeValueNode(const Any& _rValue) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE_WRITE); + + Reference< XNameReplace > xParentValueAccess(m_xLeafParent, UNO_QUERY); + if (!xParentValueAccess.is()) + throw InvalidRegistryException(UNISTRING("The parent configuration node does not allow write access to it's children."), THISREF()); + + try + { + xParentValueAccess->replaceByName(m_sLocalName, _rValue); + } + catch(IllegalArgumentException&) + { + throw InvalidRegistryException(UNISTRING("Unable to replace the old value. The configuration node threw an IllegalArgumentException."), THISREF()); + } + catch(NoSuchElementException&) + { + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::writeValueNode : a NoSuchElementException should be impossible !"); + throw InvalidRegistryException(UNISTRING("Unable to replace the old value. The configuration node threw an NoSuchElementException."), THISREF()); + } + catch(WrappedTargetException&) + { + throw InvalidRegistryException(UNISTRING("Unable to replace the old value. The configuration node threw an WrappedTargetException."), THISREF()); + } +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getKeyName() throw(RuntimeException) +{ + return m_sLocalName; +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistryKey::isReadOnly( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_META); + return m_bReadOnly; +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistryKey::isValid( ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + // TODO : perhaps if the registry we're a part of is closed .... + return m_xNodeAccess.is() || m_aLeafElement.hasValue(); +} + +//-------------------------------------------------------------------------- +RegistryKeyType SAL_CALL OConfigurationRegistryKey::getKeyType( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + + // no further checks are made (for performance reasons) ... + return RegistryKeyType_KEY; +} + +//-------------------------------------------------------------------------- +namespace { + inline + Type getBinaryDataType() { + Sequence<sal_Int8> const * const p= 0; + return ::getCppuType(p); + } +} +//-------------------------------------------------------------------------- +typedef typelib_TypeDescriptionReference ElementTypeDesc; + +RegistryValueType SAL_CALL OConfigurationRegistryKey::getValueType( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + switch (m_aLeafElement.getValueType().getTypeClass()) + { + case TypeClass_STRING: + return RegistryValueType_STRING; + case TypeClass_SHORT: + case TypeClass_UNSIGNED_SHORT: + case TypeClass_BYTE: + case TypeClass_LONG: + case TypeClass_UNSIGNED_LONG: + case TypeClass_BOOLEAN: + return RegistryValueType_LONG; + case TypeClass_SEQUENCE: + if (m_aLeafElement.getValueType() == getBinaryDataType()) + return RegistryValueType_BINARY; + else + { + TypeDescription aType( m_aLeafElement.getValueType() ); + typelib_IndirectTypeDescription* pSequenceType + = reinterpret_cast< typelib_IndirectTypeDescription* >(aType.get()); + ElementTypeDesc* pElementType = pSequenceType->pType; + + switch (pElementType->eTypeClass) + { + case TypeClass_SHORT: + case TypeClass_UNSIGNED_SHORT: + case TypeClass_BYTE: + case TypeClass_LONG: + case TypeClass_UNSIGNED_LONG: + case TypeClass_BOOLEAN: + return RegistryValueType_LONGLIST; + case TypeClass_STRING: + return RegistryValueType_STRINGLIST; + case TypeClass_DOUBLE: + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getValueType : registry does not support lists of floating point numebrs !"); + default: + if (Type(pElementType) == getBinaryDataType()) + OSL_ENSHURE(sal_False,"OConfigurationRegistryKey::getValueType : Registry cannot support LIST of BINARY"); + else + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getValueType : unknown sequence element type !"); + return RegistryValueType_NOT_DEFINED; + } + } + case TypeClass_DOUBLE: + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getValueType : registry does not support floating point numebrs !"); + return RegistryValueType_NOT_DEFINED; + default: + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getValueType : unknown entry type !"); + return RegistryValueType_NOT_DEFINED; + } +} + +//-------------------------------------------------------------------------- +sal_Int32 SAL_CALL OConfigurationRegistryKey::getLongValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + +#define EXTRACT(tcname, type) \ + case TypeClass_##tcname : { type nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } + + sal_Int32 nLongValue(0); + switch (m_aLeafElement.getValueTypeClass()) + { + case TypeClass_SHORT : { sal_Int16 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_UNSIGNED_SHORT : { sal_uInt16 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_BYTE : { sal_Int8 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_LONG : { sal_Int32 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_UNSIGNED_LONG : { sal_uInt32 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_BOOLEAN : { sal_Bool nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + default: + throw InvalidValueException(UNISTRING("This node does not contain a long (or a compatible) value."), THISREF()); + } + return nLongValue; +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setLongValue( sal_Int32 _nValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_nValue)); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int32 > SAL_CALL OConfigurationRegistryKey::getLongListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + Sequence< sal_Int32 > aReturn; + if (m_aLeafElement >>= aReturn) + return aReturn; + + // TODO : maybe it's a sequence of sal_Int8 or anything like that which we're able to convert .... + + throw InvalidValueException(UNISTRING("This configuration node does not contain a list of longs !"), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setLongListValue( const Sequence< sal_Int32 >& _seqValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_seqValue)); +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getAsciiValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + ::rtl::OUString sReturn = getStringValue(); + // TODO : check if it's really ascii ... + return sReturn; +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setAsciiValue( const ::rtl::OUString& _rValue ) throw(InvalidRegistryException, RuntimeException) +{ + setStringValue(_rValue); +} + +//-------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getAsciiListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + return getStringListValue(); + // TODO : it's not really an "ascii list" .... perhaps we should throw an exception here ... +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setAsciiListValue( const Sequence< ::rtl::OUString >& _seqValue ) throw(InvalidRegistryException, RuntimeException) +{ + setStringListValue(_seqValue); +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getStringValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + ::rtl::OUString sReturn; + if (!(m_aLeafElement >>= sReturn)) + throw InvalidValueException(UNISTRING("This node does not contain a string value."), THISREF()); + return sReturn; +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setStringValue( const ::rtl::OUString& _rValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_rValue)); +} + +//-------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getStringListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + Sequence< ::rtl::OUString > aReturn; + if (m_aLeafElement >>= aReturn) + return aReturn; + + throw InvalidValueException(UNISTRING("This configuration node does not contain a list of strings !"), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setStringListValue( const Sequence< ::rtl::OUString >& _seqValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_seqValue)); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > SAL_CALL OConfigurationRegistryKey::getBinaryValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + Sequence< sal_Int8 > aReturn; + if (m_aLeafElement >>= aReturn) + return aReturn; + + throw InvalidValueException(UNISTRING("This configuration node does not contain a list of strings !"), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setBinaryValue( const Sequence< sal_Int8 >& _rValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_rValue)); +} + +//-------------------------------------------------------------------------- +Reference< XRegistryKey > OConfigurationRegistryKey::implGetKey( const ::rtl::OUString& _rKeyName ) + throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString sDescRelativeName(_rKeyName); + // will be the name of the new key relative to it's parent + sal_Bool bDeepAccess = sal_False; + sal_Int32 nSeparatorPos = _rKeyName.lastIndexOf('/'); + if ((nSeparatorPos >= 0) && (nSeparatorPos == (_rKeyName.getLength() - 1))) + // recognize a trailing slashs + nSeparatorPos = _rKeyName.lastIndexOf('/', nSeparatorPos - 1); + if (nSeparatorPos >= 1) + { + sDescRelativeName = _rKeyName.copy(nSeparatorPos + 1); + bDeepAccess = sal_True; + } + + Any aDescendant = getDescendant(_rKeyName); + if (aDescendant.getValueType().getTypeClass() == TypeClass_INTERFACE) + { + Reference< XNameAccess > xContainerNode; + ::cppu::extractInterface(xContainerNode, aDescendant); + if (!xContainerNode.is()) + throw InvalidRegistryException(UNISTRING("invalid descendant node."), THISREF()); + return new OConfigurationRegistryKey(xContainerNode, sDescRelativeName, !m_bReadOnly); + } + else + { + Reference< XNameAccess > xDescParent(m_xNodeAccess); // the parent config node of the descandent + + OSL_ENSHURE(aDescendant.hasValue(), "OConfigurationRegistryKey::openKey : invalid return from getDescendant."); +#ifdef DEBUG + switch (aDescendant.getValueType().getTypeClass()) + { + case TypeClass_STRING: + case TypeClass_SHORT: + case TypeClass_UNSIGNED_SHORT: + case TypeClass_BYTE: + case TypeClass_LONG: + case TypeClass_UNSIGNED_LONG: + case TypeClass_BOOLEAN: + case TypeClass_SEQUENCE: + break; + default: + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::openKey : unknown or invalid descendant value type !"); + } +#endif + if (bDeepAccess) + { + Any aDescParent = getDescendant(_rKeyName.copy(0, nSeparatorPos)); + ::cppu::extractInterface(xDescParent, aDescParent); + if (!xDescParent.is()) + throw InvalidRegistryException(UNISTRING("The internal registry structure seems to be corrupt."), THISREF()); + } + + return new OConfigurationRegistryKey(aDescendant, xDescParent, sDescRelativeName, !m_bReadOnly); + } +} + +//-------------------------------------------------------------------------- +Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::openKey( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + + return implGetKey(_rKeyName); +} + +//-------------------------------------------------------------------------- +void OConfigurationRegistryKey::checkRelativeKeyName(::rtl::OUString& _rKeyName) throw(InvalidRegistryException, RuntimeException) +{ + // no empty names allowed + if (!_rKeyName.getLength()) + throw InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF()); + + // no absolute names ("/...") allowed + if (_rKeyName.getStr()[0] == '/') + throw InvalidRegistryException(UNISTRING("The key name is invalid. It must be a relative, not an absolute name."), THISREF()); + + // cut trailing slashes + while (_rKeyName.getLength() && (_rKeyName.getStr()[_rKeyName.getLength() - 1] == '/')) + _rKeyName = _rKeyName.copy(0, _rKeyName.getLength() - 1); + + if (!_rKeyName.getLength()) + // the original name consists of slashes only + throw InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF()); +} + +//-------------------------------------------------------------------------- +Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::createKey( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + + if (m_bReadOnly) + throw InvalidRegistryException(UNISTRING("The key is read only."), THISREF()); + + ::rtl::OUString sKeyName(_rKeyName); + checkRelativeKeyName(sKeyName); + + sal_Int32 nSeparatorPos = sKeyName.lastIndexOf('/'); + if (-1 != nSeparatorPos) + { + // deep access. delegate it to a registry key which is one level above the to-be-created one + ::rtl::OUString sSetNodeName = sKeyName.copy(0, nSeparatorPos); + sKeyName = sKeyName.copy(nSeparatorPos + 1); + + Reference< XRegistryKey > xSetNode = implGetKey(sSetNodeName); + if (!xSetNode.is()) + { + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::createKey : somebody changed the implGetKey behaviour !"); + throw InvalidRegistryException(UNISTRING("An internal error occured."), THISREF()); + } + return xSetNode->createKey(sKeyName); + } + + // The requested new key is one level below ourself. Can't delegate the creation. + Reference< XNameContainer > xContainer(m_xNodeAccess, UNO_QUERY); + Reference< XSingleServiceFactory > xChildFactory(xContainer, UNO_QUERY); + if (!xChildFactory.is()) + throw InvalidRegistryException(UNISTRING("The configuration node represented by this key is not a container node, you can't insert keys."), THISREF()); + + // In the configuration API, the creation of a new child is two-stage process : first you create a child which + // is "floating", i.e. does not belong to the configuration tree, yet. After filling it with values, you insert + // it into the container node which was used for the creation. + // We can't map this behaviour with the registry API, so we have to combine both steps + + // create a new floating child for the container node + Reference< XInterface > xFloatingChild; + try + { + xFloatingChild = xChildFactory->createInstance(); + } + catch (RuntimeException&) + { // allowed to leave this method + throw; + } + catch (Exception& e) + { // not allowed to leave this method + throw InvalidRegistryException(UNISTRING("Unable to create a new child for the configuration node. Original error message as provided by the configuration API : ") += e.Message, + THISREF()); + } + + // and immediately insert it into the container + try + { + xContainer->insertByName(sKeyName, makeAny(xFloatingChild)); + } + catch (IllegalArgumentException& e) + { + throw InvalidRegistryException(UNISTRING("illegal argument : ") += e.Message, THISREF()); + } + catch (ElementExistException& e) + { + if (e.Message.getLength()) + throw InvalidRegistryException(e.Message, THISREF()); + else + throw InvalidRegistryException((UNISTRING("There already is an element named ") += sKeyName) += UNISTRING("."), THISREF()); + } + catch (WrappedTargetException& e) + { + throw InvalidRegistryException(UNISTRING("Caught an WrappedTargetException. Original error message : ") += e.Message, THISREF()); + } + + Reference< XNameAccess > xInsertedChild(xFloatingChild, UNO_QUERY); + if (!xInsertedChild.is()) + throw InvalidRegistryException(UNISTRING("An internal error occured. The objects provided by the configuration API are invalid."), THISREF()); + + return new OConfigurationRegistryKey(xInsertedChild, sKeyName, !m_bReadOnly); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::closeKey( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + + m_xNodeAccess = NULL; + m_xNodeDeepAccess = NULL; + m_aLeafElement.clear(); + m_xLeafParent = NULL; + m_sLocalName = ::rtl::OUString(); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::deleteKey( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + + checkValid(KAT_CHILD); + if (m_bReadOnly) + throw InvalidRegistryException(UNISTRING("The key is read only."), THISREF()); + + ::rtl::OUString sKeyName(_rKeyName); + checkRelativeKeyName(sKeyName); + + sal_Int32 nSeparatorPos = sKeyName.lastIndexOf('/'); + if (-1 != nSeparatorPos) + { + // deep access. delegate it to a registry key which is one level above the to-be-created one + ::rtl::OUString sSetNodeName = sKeyName.copy(0, nSeparatorPos); + sKeyName = sKeyName.copy(nSeparatorPos + 1); + + Reference< XRegistryKey > xSetNode = implGetKey(sSetNodeName); + if (!xSetNode.is()) + { + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::createKey : somebody changed the implGetKey behaviour !"); + throw InvalidRegistryException(UNISTRING("An internal error occured."), THISREF()); + } + xSetNode->deleteKey(sKeyName); + return; + } + + // The requested new key is one level below ourself. Can't delegate the creation. + Reference< XNameContainer > xContainer(m_xNodeAccess, UNO_QUERY); + if (!xContainer.is()) + throw InvalidRegistryException(UNISTRING("The configuration node represented by this key is not a container node, you can't remove keys."), THISREF()); + + // and immediately insert it into the container + try + { + xContainer->removeByName(sKeyName); + } + catch (NoSuchElementException& e) + { + if (e.Message.getLength()) + throw InvalidRegistryException(e.Message, THISREF()); + else + throw InvalidRegistryException((UNISTRING("There is no element named ") += sKeyName) += UNISTRING("."), THISREF()); + } + catch (WrappedTargetException& e) + { + throw InvalidRegistryException(UNISTRING("Caught an WrappedTargetException. Original error message : ") += e.Message, THISREF()); + } +} + +//-------------------------------------------------------------------------- +Sequence< Reference< XRegistryKey > > SAL_CALL OConfigurationRegistryKey::openKeys( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + + Sequence< ::rtl::OUString > aNames(m_xNodeAccess->getElementNames()); + const ::rtl::OUString* pNames = aNames.getConstArray(); + Sequence< Reference< XRegistryKey > > aReturn(aNames.getLength()); + Reference< XRegistryKey >* pReturn = aReturn.getArray(); + for (sal_Int32 i=0; i<aNames.getLength(); ++i, ++pNames, ++pReturn) + *pReturn = implGetKey(*pNames); + + return aReturn; +} + +//-------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getKeyNames( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + return m_xNodeAccess->getElementNames(); +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistryKey::createLink( const ::rtl::OUString& aLinkName, const ::rtl::OUString& aLinkTarget ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::deleteLink( const ::rtl::OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF()); +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getLinkTarget( const ::rtl::OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF()); +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getResolvedName( const ::rtl::OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF()); +} + +//-------------------------------------------------------------------------- +//.......................................................................... +} // namespace configmgr +//.......................................................................... + + diff --git a/configmgr/source/registry/cfgregistrykey.hxx b/configmgr/source/registry/cfgregistrykey.hxx new file mode 100644 index 0000000000..947f27019b --- /dev/null +++ b/configmgr/source/registry/cfgregistrykey.hxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * $RCSfile: cfgregistrykey.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ +#define _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_ +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include <com/sun/star/registry/XRegistryKey.hpp> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/Mutex.hxx> +#endif + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +//========================================================================== +//= OConfigurationRegistryKey +//========================================================================== +typedef ::cppu::WeakImplHelper1 < ::com::sun::star::registry::XRegistryKey + > OConfigurationRegistryKey_Base; + +/** wraps the registry-like access to a single node of a configuration sub tree +*/ +class OConfigurationRegistryKey + :public OConfigurationRegistryKey_Base +{ + ::osl::Mutex m_aMutex; /// access safety + sal_Bool m_bReadOnly; /// is the key readonly ? + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > + m_xNodeAccess; /// the config node object, if it describes a container + ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess > + m_xNodeDeepAccess; /// for accessing elements which are grandchildren + + ::com::sun::star::uno::Any + m_aLeafElement; /// if the key represents a leaf, this is the value + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > + m_xLeafParent; /// if the key represents a leaf, this is it's parent. used for write access + + ::rtl::OUString m_sLocalName; /** the name of the element relative to the parent, which would be + m_xLeafParent in case the key represents a value node + */ + + // TODO : the current concept does not recognize any changes in the config tree, i.e. the values stored + // in a configuration key wrapper are not changed if the value in the corresponding config node changes. + // Possible solutions: + // 1. on each value (or even on each sub key) access, the node is read from the configuration hierarchy, again. + // sounds very expensive. + // 2. each registry key is a listener on the node it represents. + // sounds expensive, too. + // + // At the moment we ignore this restriction, but perhaps we can't do that forever .... + +public: + /// when used as ctor parameter, this indicates that the key wraps a config tree subtree root + struct SubtreeRoot { }; + + /** builds an registry key which wraps the root of a configuration node + */ + OConfigurationRegistryKey( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainerNode + ,sal_Bool _bWriteable + ,SubtreeRoot + ); + + /** builds an registry key for a configuration container node + @param _rxContainerNode the container the key should represent + @param _rLocalName the name of the node local to it's parent. Must be empty only if + the key represents the root node of a navigatable sub tree. + @param _bWriteable should the key be writeable ? + */ + OConfigurationRegistryKey( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainerNode + ,const ::rtl::OUString& _rLocalName + ,sal_Bool _bWriteable + ); + + /** builds an registry key for a configuration value container node. + @param _rCurrentValue the current value of the node. Must be the same as _rxParentNode->getByName(_rRelativeName) would provide + @param _rxParentNode the parent of the value node. Used for update access and for obtaining the initial value. + @param _rRelativeName te relative name within the parent + @param _bWriteable should the key be writeable ? + */ + OConfigurationRegistryKey( + ::com::sun::star::uno::Any _rCurrentValue + ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxParentNode + ,const ::rtl::OUString& _rRelativeName + ,sal_Bool _bWriteable + ); + + // XRegistryKey + virtual ::rtl::OUString SAL_CALL getKeyName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::registry::RegistryKeyType SAL_CALL getKeyType( const ::rtl::OUString& rKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::registry::RegistryValueType SAL_CALL getValueType( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getLongValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLongValue( sal_Int32 value ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLongListValue( const ::com::sun::star::uno::Sequence< sal_Int32 >& seqValue ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAsciiValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAsciiValue( const ::rtl::OUString& value ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAsciiListValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAsciiListValue( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqValue ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStringValue( const ::rtl::OUString& value ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getStringListValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStringListValue( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqValue ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryValue( const ::com::sun::star::uno::Sequence< sal_Int8 >& value ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > SAL_CALL openKey( const ::rtl::OUString& aKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > SAL_CALL createKey( const ::rtl::OUString& aKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeKey( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteKey( const ::rtl::OUString& rKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > > SAL_CALL openKeys( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getKeyNames( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL createLink( const ::rtl::OUString& aLinkName, const ::rtl::OUString& aLinkTarget ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteLink( const ::rtl::OUString& rLinkName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLinkTarget( const ::rtl::OUString& rLinkName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResolvedName( const ::rtl::OUString& aKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + +protected: + /** specifies the kind of access to the key. + */ + enum KEY_ACCESS_TYPE + { + KAT_META, /// access on a meta level, e.g. asking for the read-onyl flag + KAT_VALUE, /// read access to the value the node represents + KAT_VALUE_WRITE, /// write access to the value the node represents + KAT_CHILD /// access to one of the (grand-)children of the node + }; + + /** check if the registry key is valid + @param _eIntentedAccess type of access which the caller wants to perform on the object + @throws <type scope="com.sun.star.registry">InvalidRegistryException</type> if the key is invalid + */ + void checkValid(KEY_ACCESS_TYPE _eIntentedAccess) throw (::com::sun::star::registry::InvalidRegistryException); + + /** return an child element. + @param _rDescendantName the name of the descendant to open. May have a depth of more than 1, if + the node container support XHierarchicalNameAccess + @return the requested element. The caller can assume that the returned + <type scope="com.sun.star.uno">Any</type> always contains an object, all other cases are + handled with exceptions + @throws <type scope="com.sun.star.registry">InvalidRegistryException</type> if the key is invalid, + the element refered by _rName does not exist, the configuration node threw an exception, or + the name has a depth of more than one and the config node does not support this. + */ + ::com::sun::star::uno::Any getDescendant(const ::rtl::OUString& _rDescendantName) throw(::com::sun::star::registry::InvalidRegistryException); + + /** write the given value into the configuration node the object represents. + @throws <type scope="com.sun.star.registry">InvalidRegistryException</type> if the key is invalid, + not opened for write access or the configurations parent is not able to provide a value access + @throws <type scope="com.sun.star.uno">RuntimeException</type> if a fatal runtime error occurs + */ + void writeValueNode(const ::com::sun::star::uno::Any& _rValue) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + + /** open the sub key (depth 1 or more) determined by the given name + @param _rKeyName the name of the descendant node + @return a XRegistryKey wrapper for the requested configuration node + @throws <type scope="com.sun.star.registry">InvalidRegistryException</type> if the key is invalid, + the element refered by _rName does not exist, the configuration node threw an exception, or + the name has a depth of more than one and the config node does not support this. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > OConfigurationRegistryKey::implGetKey( const ::rtl::OUString& _rKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + + /** check the given (relative) key name syntactically. In particular, this means that no checks are made if a node + with the given name exists or something like that ... + <BR> + In addition, the given name will be normalized. Basically, this means that it does not contain trailing slashes. + @throws InvalidRegistryException if the name is not relative (i.e. if it starts with an slash) + @throws InvalidRegistryException if the name is empty or consists of slashes only + */ + void checkRelativeKeyName(::rtl::OUString& _rKeyName) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); +}; + + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + +#endif // _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ + + diff --git a/configmgr/source/registry/configregistry.cxx b/configmgr/source/registry/configregistry.cxx new file mode 100644 index 0000000000..5233bdf337 --- /dev/null +++ b/configmgr/source/registry/configregistry.cxx @@ -0,0 +1,344 @@ +/************************************************************************* + * + * $RCSfile: configregistry.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_ +#include "configregistry.hxx" +#endif +#ifndef _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ +#include "cfgregistrykey.hxx" +#endif + +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HPP_ +#include <com/sun/star/lang/ServiceNotRegisteredException.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif + +#define THISREF() static_cast< ::cppu::OWeakObject* >(this) +#define UNISTRING(c) ::rtl::OUString::createFromAscii(c) + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::container; +using namespace ::osl; +using namespace ::cppu; + +//========================================================================== +//= OConfigurationRegistry +//========================================================================== + + static const AsciiServiceName aConfigRegistryServices[] = + { + "com.sun.star.registry.SimpleRegistry", + "com.sun.star.configuration.ConfigurationRegistry", + NULL + }; + const ServiceInfo OConfigurationRegistry::s_aServiceInfo = + { + "com.sun.star.configuration.configmgr.OConfigurationRegistry", + aConfigRegistryServices + }; + + Reference< XInterface > SAL_CALL instantiateConfigRegistry(Reference< XMultiServiceFactory > const& _rServiceManager ) + { + return static_cast< ::cppu::OWeakObject* >(new OConfigurationRegistry(_rServiceManager)); + } + + const ServiceInfo* getConfigurationRegistryServiceInfo() + { + return &OConfigurationRegistry::s_aServiceInfo; + } + +//-------------------------------------------------------------------------- +OConfigurationRegistry::OConfigurationRegistry(const Reference< XMultiServiceFactory >& _rORB) throw(Exception, RuntimeException) + :ServiceComponentImpl(&s_aServiceInfo) + ,m_xORB(_rORB) + ,m_aFlushListeners(m_aMutex) +{ + // create the configuration provider used for accessing the configuration + OSL_ENSHURE(m_xORB.is(), "OConfigurationRegistry::OConfigurationRegistry : invalid service factory !"); + if (m_xORB.is()) + m_xConfigurationProvider = + Reference< XMultiServiceFactory > ( + m_xORB->createInstance(UNISTRING("com.sun.star.configuration.ConfigurationProvider")), + UNO_QUERY + ); + + if (!m_xConfigurationProvider.is()) + // it's heavily needed ... + throw ServiceNotRegisteredException(UNISTRING("Failed to instantiate the mandatory service com.sun.star.configuration.ConfigurationProvider."), + THISREF()); +} + +//-------------------------------------------------------------------------- +Any SAL_CALL OConfigurationRegistry::queryInterface( const Type& _rType ) throw(RuntimeException) +{ + Any aReturn = ServiceComponentImpl::queryInterface(_rType); + if (!aReturn.hasValue()) + aReturn = OConfigurationRegistry_Base::queryInterface(_rType); + return aReturn; +} + +//-------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OConfigurationRegistry::getTypes( ) throw(RuntimeException) +{ + return ::utl::concatSequences( + ServiceComponentImpl::getTypes(), + OConfigurationRegistry_Base::getTypes()); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > SAL_CALL OConfigurationRegistry::getImplementationId( ) throw(RuntimeException) +{ + static OImplementationId aId; + return aId.getImplementationId(); +} + +//-------------------------------------------------------------------------- +::rtl::OUString OConfigurationRegistry::getNodePathFromURL(const ::rtl::OUString& _rURL) +{ + // TODO + return _rURL; +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistry::getURL() throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + return m_sLocation; +} + +//-------------------------------------------------------------------------- +void OConfigurationRegistry::checkOpen() throw(InvalidRegistryException, RuntimeException) +{ + if (!isOpen()) + throw InvalidRegistryException(UNISTRING("The registry is not bound to a configuration node."), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::open( const ::rtl::OUString& _rURL, sal_Bool _bReadOnly, sal_Bool _bCreate ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + if (isOpen()) + close(); + + ::rtl::OUString sNodePath = getNodePathFromURL(_rURL); + + if (!m_xConfigurationProvider.is()) + throw RuntimeException(UNISTRING("invalid object. configuration provider is already disposed."), THISREF()); + + Reference< XInterface > xNodeAccess; + try + { + // the one and only parameter for creating the config access : the node path + Sequence< Any > aArguments(1); + aArguments[0] <<= sNodePath; + + if (_bReadOnly) + xNodeAccess = m_xConfigurationProvider->createInstanceWithArguments(UNISTRING("com.sun.star.configuration.ConfigurationAccess"), aArguments); + else + xNodeAccess = m_xConfigurationProvider->createInstanceWithArguments(UNISTRING("com.sun.star.configuration.ConfigurationUpdateAccess"), aArguments); + } + catch (RuntimeException&) + { // allowed to leave this method + throw; + } + catch (Exception& e) + { // not allowed to leave this method + ::rtl::OUString sMessage = UNISTRING("The configuration provider does not supply a registry access for the requested Node."); + sMessage += UNISTRING(" original error message of the provider : "); + sMessage += e.Message; + throw InvalidRegistryException(sMessage, THISREF()); + } + + Reference< XNameAccess > xReadRoot(xNodeAccess, UNO_QUERY); + if (!_bReadOnly) + m_xUpdateRoot = m_xUpdateRoot.query(xNodeAccess); + + if (!xReadRoot.is() || (!_bReadOnly && !m_xUpdateRoot.is())) + throw InvalidRegistryException(UNISTRING("The object supplied the by configuration provider is invalid."), THISREF()); + + m_xRootKey = new OConfigurationRegistryKey(xReadRoot, !_bReadOnly, OConfigurationRegistryKey::SubtreeRoot()); + m_xSubtreeRoot = xNodeAccess; +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistry::isValid( ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + return m_xRootKey.is(); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::close( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + + if (m_xRootKey.is()) + m_xRootKey->closeKey(); + m_xRootKey = NULL; + + Reference< XComponent > xRootComponent(m_xSubtreeRoot, UNO_QUERY); + if (xRootComponent.is()) + xRootComponent->dispose(); + m_xSubtreeRoot = NULL; + m_xUpdateRoot = NULL; + + m_sLocation = ::rtl::OUString(); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::destroy( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry is a wrapper for a configuration access. It can not be destroyed."), THISREF()); +} + +//-------------------------------------------------------------------------- +Reference< XRegistryKey > SAL_CALL OConfigurationRegistry::getRootKey( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkOpen(); + + return m_xRootKey; +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistry::isReadOnly( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkOpen(); + + return !m_xUpdateRoot.is(); + // if we don't have the update root, we're readonly +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::mergeKey( const ::rtl::OUString& aKeyName, const ::rtl::OUString& aUrl ) throw(InvalidRegistryException, MergeConflictException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + // not supported. but we can't throw an NoSupportException here ... + throw InvalidRegistryException(UNISTRING("You can't merge into this registry. It's just a wrapper for a configuration node, which has a fixed structure which can not be modified"), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::flush( ) throw(RuntimeException) +{ + { + MutexGuard aGuard(m_aMutex); + + try + { + m_xUpdateRoot->commitChanges(); + } + catch (WrappedTargetException& e) + { // not allowed to leave this method + // TODO : the specification of XFlushable has to be changed !!!!! + OSL_ENSHURE(sal_False, "OConfigurationRegistry::flush : caught an exception, could not flush the data !"); + return; +// ::rtl::OUString sMessage; +// sMessage = UNISTRING("The changes made could not be committed. Orginal exception message : "); +// sMessage += e.Message; +// throw RuntimeException(sMessage, THISREF()); + } + } + + EventObject aFlushed(THISREF()); + ::cppu::OInterfaceIteratorHelper aIter(m_aFlushListeners); + while (aIter.hasMoreElements()) + static_cast< XFlushListener* >(aIter.next())->flushed(aFlushed); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::addFlushListener( const Reference< XFlushListener >& _rxListener ) throw(RuntimeException) +{ + m_aFlushListeners.addInterface(_rxListener); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::removeFlushListener( const Reference< XFlushListener >& _rxListener ) throw(RuntimeException) +{ + m_aFlushListeners.removeInterface(_rxListener); +} + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + + diff --git a/configmgr/source/registry/configregistry.hxx b/configmgr/source/registry/configregistry.hxx new file mode 100644 index 0000000000..f0cce063ad --- /dev/null +++ b/configmgr/source/registry/configregistry.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * $RCSfile: configregistry.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_ +#define _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_ + +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef CONFIGMGR_API_SVCCOMPONENT_HXX_ +#include "confsvccomponent.hxx" +#endif + +#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_ +#include <com/sun/star/registry/XSimpleRegistry.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_ +#include <com/sun/star/util/XFlushable.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCHANGESBATCH_HPP_ +#include <com/sun/star/util/XChangesBatch.hpp> +#endif + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +//========================================================================== +//= OConfigurationRegistry +//========================================================================== +typedef ::cppu::ImplHelper2 < ::com::sun::star::registry::XSimpleRegistry + , ::com::sun::star::util::XFlushable + > OConfigurationRegistry_Base; + +/** an object implmenting the <service scope="com.sun.star.configuration">ConfigurationRegistry</service> + service. +*/ +class OConfigurationRegistry + :public ServiceComponentImpl + ,public OConfigurationRegistry_Base +{ +public: + static const ServiceInfo s_aServiceInfo; + +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xORB; /// the service provider used for creating the instance + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xConfigurationProvider; /// the configuration provider used for creating configuration accesses + + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > + m_xRootKey; /// the root key for the registry-like configuration access + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + m_xSubtreeRoot; /// the root of the sub tree the object wraps + ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch > + m_xUpdateRoot; /// the update access to the root of the sub tree, valid if opened for writing + ::rtl::OUString m_sLocation; /// URL of the configuration node we're representing, if any + + ::cppu::OInterfaceContainerHelper + m_aFlushListeners; + + +public: + OConfigurationRegistry( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rORB) + throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) throw() { ServiceComponentImpl::acquire(); } + virtual void SAL_CALL release( ) throw() { ServiceComponentImpl::release(); } + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + // XSimpleRegistry + virtual ::rtl::OUString SAL_CALL getURL() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL open( const ::rtl::OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL close( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL destroy( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > SAL_CALL getRootKey( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL mergeKey( const ::rtl::OUString& aKeyName, const ::rtl::OUString& aUrl ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::MergeConflictException, ::com::sun::star::uno::RuntimeException); + + // XFlushable + virtual void SAL_CALL flush( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw(::com::sun::star::uno::RuntimeException); + +protected: + virtual void SAL_CALL disposing() { ServiceComponentImpl::disposing(); } + /// translates the given URL into a nodepath which may be used with the configuration provider + ::rtl::OUString getNodePathFromURL(const ::rtl::OUString& _rURL); + + void checkOpen() throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + + sal_Bool isOpen() { return isValid(); } +}; + + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + +#endif // _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_ + + diff --git a/configmgr/source/registry/makefile.mk b/configmgr/source/registry/makefile.mk new file mode 100644 index 0000000000..70653bc4fe --- /dev/null +++ b/configmgr/source/registry/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=$(PRJ)$/source$/inc +PRJNAME=configmgr +TARGET=registry + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk +# --- Files ------------------------------------- + +SLOFILES= \ + $(SLO)$/configregistry.obj \ + $(SLO)$/cfgregistrykey.obj \ + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + |