diff options
Diffstat (limited to 'configmgr')
33 files changed, 40 insertions, 402 deletions
diff --git a/configmgr/qa/unit/makefile.mk b/configmgr/qa/unit/makefile.mk index 4b57dabac74d..a6a79ebdd0ca 100644 --- a/configmgr/qa/unit/makefile.mk +++ b/configmgr/qa/unit/makefile.mk @@ -54,10 +54,10 @@ ALLTAR: test $(MISC)$/$(TARGET).rdb .ERRREMOVE: $(COPY) $(SOLARBINDIR)$/types.rdb $@ - regcomp -register -r $@ -c $(subst,$/,/ $(DLLDEST)$/configmgr2.uno$(DLLPOST)) - regcomp -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/sax.uno$(DLLPOST)) - regcomp -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/stocservices.uno$(DLLPOST)) - regcomp -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/streams.uno$(DLLPOST)) + $(REGCOMP) -register -r $@ -c $(subst,$/,/ $(DLLDEST)$/configmgr2.uno$(DLLPOST)) + $(REGCOMP) -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/sax.uno$(DLLPOST)) + $(REGCOMP) -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/stocservices.uno$(DLLPOST)) + $(REGCOMP) -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/streams.uno$(DLLPOST)) test .PHONY: $(SHL1TARGETN) $(MISC)$/$(TARGET).rdb - testshl2 $(SHL1TARGETN) -forward "$(MISC)$/$(TARGET).rdb#$(PWD)$/$(MISC)$/$(TARGET).registry" + $(AUGMENT_LIBRARY_PATH) testshl2 $(SHL1TARGETN) -forward "$(MISC)$/$(TARGET).rdb#$(PWD)$/$(MISC)$/$(TARGET).registry" diff --git a/configmgr/source/api2/apiaccessobj.hxx b/configmgr/source/api2/apiaccessobj.hxx index 7e3354d7ef6e..2536dc5b7318 100644 --- a/configmgr/source/api2/apiaccessobj.hxx +++ b/configmgr/source/api2/apiaccessobj.hxx @@ -81,9 +81,6 @@ namespace configmgr mutable ApiTreeImpl m_aTree; public: - OSetElement(uno::XInterface* pUnoThis, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl& rParentTree) - : m_aTree(pUnoThis, aTree,rParentTree) - {} OSetElement(uno::XInterface* pUnoThis, rtl::Reference< configuration::Tree > const& aTree, ApiProvider& rProvider, ApiTreeImpl* pParentTree = 0) : m_aTree(pUnoThis, rProvider,aTree,pParentTree) {} diff --git a/configmgr/source/api2/apifactory.cxx b/configmgr/source/api2/apifactory.cxx index de5062e299c7..abbf068ee508 100644 --- a/configmgr/source/api2/apifactory.cxx +++ b/configmgr/source/api2/apifactory.cxx @@ -228,39 +228,6 @@ TreeElement* Factory::makeAccessRoot(rtl::Reference< configuration::Tree > const } //----------------------------------------------------------------------------- -uno::Reference< uno::XInterface > Factory::makeUnoGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode) -{ - return implToUno(makeGroupMember(aTree,aNode)); -} -//----------------------------------------------------------------------------- -NodeElement* Factory::makeGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode) -{ - OSL_PRECOND( !configuration::isEmpty(aTree.get()) , "ERROR: Configuration: Creating an object requires a valid tree"); - if (configuration::isEmpty(aTree.get())) return 0; - - OSL_PRECOND( aNode.isValid() , "ERROR: Configuration: Creating an object requires a valid node"); - OSL_PRECOND( aTree->isValidNode(aNode.getOffset()), "ERROR: Configuration: NodeRef does not match Tree"); - if (!aTree->isValidNode(aNode.getOffset())) return 0; - - OSL_PRECOND( configuration::isStructuralNode(aTree,aNode), "ERROR: Configuration: Cannot make object for value node"); - OSL_ENSURE(!aTree->isRootNode(aNode),"INTERNAL ERROR: Root of Tree should not be used for a group member object"); - - configuration::NodeID aNodeID(aTree,aNode); - NodeElement* pRet = findElement(aNodeID); - if (0 == pRet) - { - rtl::Reference<configuration::Template> aTemplate = implGetSetElementTemplate(aTree,aNode); - - pRet = doCreateGroupMember(aTree,aNode,aTemplate.get()); - - OSL_ENSURE( pRet,"WARNING: New API object could not be created"); - - implHaveNewElement(aNodeID,pRet); - } - return pRet; -} -//----------------------------------------------------------------------------- - uno::Reference< uno::XInterface > Factory::makeUnoSetElement(rtl::Reference< configuration::ElementTree > const& aElementTree) { uno::Reference< uno::XInterface > aRet = implToUno(makeSetElement(aElementTree)); diff --git a/configmgr/source/api2/apifactory.hxx b/configmgr/source/api2/apifactory.hxx index 9a7bfdd61b9e..8769f1f2100b 100644 --- a/configmgr/source/api2/apifactory.hxx +++ b/configmgr/source/api2/apifactory.hxx @@ -79,13 +79,11 @@ namespace configmgr uno::Reference< uno::XInterface > makeUnoElement(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode); uno::Reference< uno::XInterface > findUnoElement(configuration::NodeID const& aNode); - uno::Reference< uno::XInterface > makeUnoGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode); uno::Reference< uno::XInterface > makeUnoSetElement(rtl::Reference< configuration::ElementTree > const& aTree); NodeElement* makeElement(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode); NodeElement* findElement(configuration::NodeID const& aNode); - NodeElement* makeGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode); TreeElement* makeAccessRoot(rtl::Reference< configuration::Tree > const& aTree, RequestOptions const& _aOptions); SetElement* makeSetElement(rtl::Reference< configuration::ElementTree > const& aTree); diff --git a/configmgr/source/api2/apitreeimplobj.cxx b/configmgr/source/api2/apitreeimplobj.cxx index af75daa122cf..1795644ef3c3 100644 --- a/configmgr/source/api2/apitreeimplobj.cxx +++ b/configmgr/source/api2/apitreeimplobj.cxx @@ -356,19 +356,6 @@ configuration::DefaultProvider extractDefaultProvider(ApiTreeImpl* pParentTree) return configuration::DefaultProvider::createEmpty(); } //------------------------------------------------------------------------- -ApiTreeImpl::ApiTreeImpl(uno::XInterface* pInstance, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl& rParentTree) -: m_aTree(aTree) -, m_aNotifier(new NotifierImpl(aTree)) -, m_aDefaultProvider(rParentTree.getDefaultProvider()) -, m_xProvider() -, m_rProvider(rParentTree.getProvider()) -, m_pParentTree(0) -, m_pInstance(pInstance) -{ - setNodeInstance(aTree->getRootNode(), pInstance); - init(&rParentTree); -} -//------------------------------------------------------------------------- ApiTreeImpl::ApiTreeImpl(uno::XInterface* pInstance, ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl* pParentTree) : m_aTree(aTree) , m_aNotifier(new NotifierImpl(aTree)) diff --git a/configmgr/source/api2/apitreeimplobj.hxx b/configmgr/source/api2/apitreeimplobj.hxx index be4b22af03bd..8b17abc98102 100644 --- a/configmgr/source/api2/apitreeimplobj.hxx +++ b/configmgr/source/api2/apitreeimplobj.hxx @@ -100,7 +100,6 @@ namespace configmgr uno::XInterface* m_pInstance; public: - explicit ApiTreeImpl(uno::XInterface* pInstance, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl& rParentTree); explicit ApiTreeImpl(uno::XInterface* pInstance, ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl* pParentTree); explicit ApiTreeImpl(uno::XInterface* _pInstance, ApiProvider& _rProvider, rtl::Reference< configuration::Tree > const& _aTree, configuration::DefaultProvider const & _aDefaultProvider); ~ApiTreeImpl(); diff --git a/configmgr/source/api2/broadcaster.cxx b/configmgr/source/api2/broadcaster.cxx index 58525c5224e0..7db7b1090111 100644 --- a/configmgr/source/api2/broadcaster.cxx +++ b/configmgr/source/api2/broadcaster.cxx @@ -1112,12 +1112,6 @@ Broadcaster::Broadcaster(Notifier const& aNotifier, configuration::NodeChanges c OSL_ASSERT(m_pImpl.isValid()); } // --------------------------------------------------------------------------------------------------- -Broadcaster::Broadcaster(Notifier const& aNotifier, configuration::NodeChangeInformation const& aChange, bool bLocal) -: m_pImpl( Impl::create(aNotifier.m_aImpl,ApiTreeRef(aNotifier.m_pTree),aChange,bLocal) ) -{ - OSL_ASSERT(m_pImpl.isValid()); -} -// --------------------------------------------------------------------------------------------------- Broadcaster::Broadcaster(Notifier const& aNotifier, configuration::NodeChangesInformation const& aChanges, bool bLocal) : m_pImpl( Impl::create(aNotifier.m_aImpl,ApiTreeRef(aNotifier.m_pTree),aChanges,bLocal) ) { @@ -1184,16 +1178,6 @@ void Broadcaster::notifyListeners(configuration::NodeChange const& aChange) thro } // --------------------------------------------------------------------------------------------------- -void Broadcaster::notifyListeners(configuration::NodeChangeInformation const& aChange) throw() -{ - OSL_ENSURE(!aChange.isEmptyChange(),"Notifying without a change !"); - - configuration::NodeChangesInformation aChanges; - aChanges.push_back(aChange); - this->notifyListeners(aChanges, true); -} -// --------------------------------------------------------------------------------------------------- - void Broadcaster::notifyListeners(configuration::NodeChanges const& aChanges, bool bSingleBase) throw() { OSL_ENSURE(!aChanges.isEmpty(),"Notifying without a change !"); diff --git a/configmgr/source/api2/broadcaster.hxx b/configmgr/source/api2/broadcaster.hxx index ce4f5852605c..07dfbeba1b1c 100644 --- a/configmgr/source/api2/broadcaster.hxx +++ b/configmgr/source/api2/broadcaster.hxx @@ -60,7 +60,6 @@ namespace configmgr /// construct a broadcaster Broadcaster(Notifier const& aNotifier, configuration::NodeChange const& aChange, bool bLocal); Broadcaster(Notifier const& aNotifier, configuration::NodeChanges const& aChanges, bool bLocal); - Broadcaster(Notifier const& aNotifier, configuration::NodeChangeInformation const& aChange, bool bLocal); Broadcaster(Notifier const& aNotifier, configuration::NodeChangesInformation const& aChanges, bool bLocal); Broadcaster(Broadcaster const& aOther); ~Broadcaster(); @@ -74,8 +73,6 @@ namespace configmgr void notifyListeners(configuration::NodeChange const& aChange) throw(); /// notify all listeners which are affected by any of these changes (potentially from many different bases) void notifyListeners(configuration::NodeChanges const& aChanges, bool bSingleBase) throw(); - /// notify all listeners which are affected by this change - void notifyListeners(configuration::NodeChangeInformation const& aChange) throw(); /// notify all listeners which are affected by any of these changes (potentially from many different bases) void notifyListeners(configuration::NodeChangesInformation const& aChanges, bool bSingleBase = false) throw(); diff --git a/configmgr/source/api2/groupobjects.hxx b/configmgr/source/api2/groupobjects.hxx index 1a4f546c5636..b992c334c0f4 100644 --- a/configmgr/source/api2/groupobjects.hxx +++ b/configmgr/source/api2/groupobjects.hxx @@ -129,10 +129,6 @@ namespace configmgr { public: // Construction/Destruction - OSetElementGroupInfo(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree) - : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree) - { - } OSetElementGroupInfo(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0) : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree) { @@ -167,10 +163,6 @@ namespace configmgr { public: // Construction/Destruction - OSetElementGroupUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree) - : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree) - { - } OSetElementGroupUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0) : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree) { diff --git a/configmgr/source/api2/providerimpl.cxx b/configmgr/source/api2/providerimpl.cxx index 74b8467dccf8..b13b392f74d4 100644 --- a/configmgr/source/api2/providerimpl.cxx +++ b/configmgr/source/api2/providerimpl.cxx @@ -425,18 +425,6 @@ namespace configmgr m_pTreeManager->enableAsync(bEnableAsync); } //----------------------------------------------------------------------------- - void SAL_CALL OProviderImpl::acquire( ) throw () - { - m_pProvider->acquire(); - } - - //----------------------------------------------------------------------------- - void SAL_CALL OProviderImpl::release( ) throw () - { - m_pProvider->release(); - } - - //----------------------------------------------------------------------------- uno::XInterface* OProviderImpl::getProviderInstance() { return static_cast<com::sun::star::lang::XMultiServiceFactory*>(m_pProvider); diff --git a/configmgr/source/api2/providerimpl.hxx b/configmgr/source/api2/providerimpl.hxx index c6e3e4fb0815..62d0f6cd0b86 100644 --- a/configmgr/source/api2/providerimpl.hxx +++ b/configmgr/source/api2/providerimpl.hxx @@ -191,9 +191,6 @@ namespace configmgr virtual sal_Bool fetchDefaultData(configuration::AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions ) SAL_THROW((com::sun::star::uno::Exception)); - void SAL_CALL acquire( ) throw (); - void SAL_CALL release( ) throw (); - // DefaultProvider access rtl::Reference< TreeManager > getDefaultProvider() const SAL_THROW((com::sun::star::uno::RuntimeException)); diff --git a/configmgr/source/api2/setobjects.hxx b/configmgr/source/api2/setobjects.hxx index 1af12e80267c..a7c4b49cdfd0 100644 --- a/configmgr/source/api2/setobjects.hxx +++ b/configmgr/source/api2/setobjects.hxx @@ -157,10 +157,6 @@ namespace configmgr { public: // Construction/Destruction - OSetElementSetInfo(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree) - : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree) - { - } OSetElementSetInfo(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0) : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree) { @@ -193,10 +189,6 @@ namespace configmgr { public: // Construction/Destruction - OSetElementTreeSetUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree) - : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree) - { - } OSetElementTreeSetUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0) : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree) { @@ -231,10 +223,6 @@ namespace configmgr { public: // Construction/Destruction - OSetElementValueSetUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree) - : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree) - { - } OSetElementValueSetUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0) : m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree) { diff --git a/configmgr/source/backend/binaryreader.cxx b/configmgr/source/backend/binaryreader.cxx index b9b07d0fe78c..8f8af945026a 100644 --- a/configmgr/source/backend/binaryreader.cxx +++ b/configmgr/source/backend/binaryreader.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/io/XDataInputStream.hpp> #include <com/sun/star/io/XDataOutputStream.hpp> #include <com/sun/star/io/BufferSizeExceededException.hpp> #include <com/sun/star/io/UnexpectedEOFException.hpp> @@ -513,6 +514,11 @@ namespace configmgr // BinaryReader implementation. // -------------------------------------------------------------------------- + BinaryReader::BinaryReader(rtl::OUString const & _sFileURL): + m_sFileURL(_sFileURL) {} + + BinaryReader::~BinaryReader() {} + bool BinaryReader::open() SAL_THROW( (io::IOException, uno::RuntimeException) ) { @@ -532,10 +538,10 @@ namespace configmgr // -------------------------------------------------------------------------- - inline uno::Reference<io::XDataInputStream> BinaryReader::getDataInputStream() + inline BinaryReader_Impl * BinaryReader::getDataInputStream() { OSL_ENSURE(m_xDataInputStream.is(),"Binary Cache: Reader was not opened - no input stream"); - return m_xDataInputStream; + return m_xDataInputStream.get(); } // -------------------------------------------------------------------------- diff --git a/configmgr/source/backend/binaryreader.hxx b/configmgr/source/backend/binaryreader.hxx index 196052203c11..3fdda0f5bd56 100644 --- a/configmgr/source/backend/binaryreader.hxx +++ b/configmgr/source/backend/binaryreader.hxx @@ -30,12 +30,12 @@ #ifndef CONFIGMGR_BINARYREADER_HXX #define CONFIGMGR_BINARYREADER_HXX +#include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <osl/file.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/io/XDataInputStream.hpp> namespace configmgr { @@ -48,18 +48,16 @@ namespace configmgr namespace uno = css::uno; namespace lang = css::lang; // ----------------------------------------------------------------------------- + class BinaryReader_Impl; class BinaryReader { rtl::OUString m_sFileURL; - uno::Reference<io::XDataInputStream> m_xDataInputStream; + rtl::Reference<BinaryReader_Impl> m_xDataInputStream; public: - explicit BinaryReader (rtl::OUString const & _sFileURL) - : m_sFileURL(_sFileURL) - {} + explicit BinaryReader (rtl::OUString const & _sFileURL); - ~BinaryReader() - {} + ~BinaryReader(); public: bool open() SAL_THROW( (io::IOException, uno::RuntimeException) ); @@ -75,7 +73,7 @@ namespace configmgr void read(uno::Sequence< rtl::OUString > &_aValue) SAL_THROW( (io::IOException, uno::RuntimeException) ); private: - inline uno::Reference<io::XDataInputStream> getDataInputStream(); + inline BinaryReader_Impl * getDataInputStream(); }; // -------------------------------------------------------------------------- diff --git a/configmgr/source/inc/configgroup.hxx b/configmgr/source/inc/configgroup.hxx index bc2c2b62e1f1..97696d369ae1 100644 --- a/configmgr/source/inc/configgroup.hxx +++ b/configmgr/source/inc/configgroup.hxx @@ -96,8 +96,6 @@ namespace configmgr bool hasDoneSet() const { return m_bHasDoneSet; } - bool isDataAvailable(); - NodeChange validateSetToDefaultValue(ValueRef const& aValueNode); NodeChange validateSetToDefaultState(NodeRef const& aNode); diff --git a/configmgr/source/inc/nodechange.hxx b/configmgr/source/inc/nodechange.hxx index 5a27a028f767..dfb630d88dda 100644 --- a/configmgr/source/inc/nodechange.hxx +++ b/configmgr/source/inc/nodechange.hxx @@ -92,16 +92,9 @@ namespace configmgr NodeChange const& apply() const; // retrieve the tree where the change is actually taking place - rtl::Reference< Tree > getBaseTree() const; - // retrieve the node where the change is actually taking place - NodeRef getBaseNode() const; - - // retrieve the tree where the change is actually taking place rtl::Reference< Tree > getAffectedTree() const; // retrieve the node where the change is actually taking place NodeRef getAffectedNode() const; - // identify the node where the change is actually taking place - NodeID getAffectedNodeID() const; // Comparison friend bool operator==(NodeChange const& lhs, NodeChange const& rhs) @@ -141,10 +134,6 @@ namespace configmgr NodeChanges& test() { implTest(); return *this; } NodeChanges const& test() const { implTest(); return *this; } - /// apply all changes - NodeChanges& apply() { implApply(); return *this; } - NodeChanges const& apply() const{ implApply(); return *this; } - /// remove all changes known to be doing nothing from this collection. NodeChanges& compact(); @@ -152,10 +141,6 @@ namespace configmgr */ void add(NodeChange const& aChange); - /** insert changes into this collection - */ - void add(NodeChanges const& aChanges); - /// returns an STL-style iterator to the first element of the collection std::vector<NodeChange>::const_iterator begin() const { return m_aChanges.begin(); } std::vector<NodeChange>::iterator begin() { return m_aChanges.begin(); } @@ -166,7 +151,6 @@ namespace configmgr private: void implTest() const; - void implApply() const; std::vector<NodeChange> m_aChanges; }; diff --git a/configmgr/source/inc/tree.hxx b/configmgr/source/inc/tree.hxx index c0ef43e75b9d..f37a0cc2f443 100644 --- a/configmgr/source/inc/tree.hxx +++ b/configmgr/source/inc/tree.hxx @@ -243,7 +243,9 @@ namespace configmgr bool isValidValueNode(ValueRef const & value); +#if OSL_DEBUG_LEVEL > 0 bool isValidAnyNode(AnyNodeRef const & node); +#endif /// checks whether the node has any element nodes (of its own) bool hasElements(NodeRef const & node); diff --git a/configmgr/source/inc/treemanager.hxx b/configmgr/source/inc/treemanager.hxx index 9f334d075ec8..e37a710ad07a 100644 --- a/configmgr/source/inc/treemanager.hxx +++ b/configmgr/source/inc/treemanager.hxx @@ -132,7 +132,6 @@ namespace configmgr void addListener(configuration::AbsolutePath const& aName, const RequestOptions& _aOptions, rtl::Reference<INodeListener> const& pListener); void removeListener(const RequestOptions& _aOptions, rtl::Reference<INodeListener> const& pListener); - void disposing(backend::CacheController & _rProvider) SAL_THROW(()); void componentCreated(backend::ComponentRequest const & _aComponent) SAL_THROW(()); void componentChanged(backend::UpdateRequest const & _anUpdate) SAL_THROW(()); diff --git a/configmgr/source/inc/valueref.hxx b/configmgr/source/inc/valueref.hxx index f9721058e221..2f2110a0ff3a 100644 --- a/configmgr/source/inc/valueref.hxx +++ b/configmgr/source/inc/valueref.hxx @@ -102,7 +102,7 @@ namespace configmgr // checking bool isValidNode() const; // hashing - size_t hashCode() const; + size_t hashCode() const { return m_aParentID.hashCode() + 5*m_sNodeName.hashCode(); } // containing node this NodeID getParentID() const { return m_aParentID; } // containing node this diff --git a/configmgr/source/tree/cmtree.cxx b/configmgr/source/tree/cmtree.cxx index f27954cd0769..674ddd4e4460 100644 --- a/configmgr/source/tree/cmtree.cxx +++ b/configmgr/source/tree/cmtree.cxx @@ -65,12 +65,11 @@ namespace configmgr // ------------------------ ChildListSet implementations ------------------------ ChildListSet::ChildListSet(ChildListSet const& aSet, treeop::DeepChildCopy) - : m_aChildList(0) + : m_aChildList(aSet.m_aChildList.size()) { for (size_t i = 0; i < aSet.m_aChildList.size(); i++) { - m_aChildList.insert(m_aChildList.end(), - aSet.m_aChildList[i]->clone().release()); + m_aChildList[i] = aSet.m_aChildList[i]->clone().release(); } } ChildListSet::~ChildListSet() @@ -81,6 +80,8 @@ namespace configmgr struct ltNode { + ltNode() {} + bool operator()(const configmgr::INode* n1, const configmgr::INode* n2) const { return n1->getName().compareTo(n2->getName()) < 0; diff --git a/configmgr/source/treecache/cacheaccess.cxx b/configmgr/source/treecache/cacheaccess.cxx index 0f8662069f04..ba59185d8213 100644 --- a/configmgr/source/treecache/cacheaccess.cxx +++ b/configmgr/source/treecache/cacheaccess.cxx @@ -249,24 +249,6 @@ bool CacheLoadingAccess::findPendingChangedModules( std::vector< rtl::OUString > return !_rPendingList.empty(); } -// ----------------------------------------------------------------------------- -void CacheLoadingAccess::clearData(std::vector< rtl::Reference<CacheLine> >& _rList) SAL_THROW(()) -{ - CFG_TRACE_INFO("Tree Info: Removing all module trees for cleanup" ); - - ExtendedCacheData::ModuleList& rModules = this->m_aData.accessModuleList(); - - for(ExtendedCacheData::ModuleList::iterator it = rModules.begin(); - it != rModules.end(); - ++it) - { - if (it->second.is()) - _rList.push_back(it->second); - } - - rModules.clear(); - m_aDeadModules.clear(); -} // ------------------------------------------------------------------------- TimeStamp CacheLoadingAccess::collectDisposeList(std::vector< rtl::Reference<CacheLine> > & _rList, TimeStamp const & _aLimitTime, TimeInterval const & _aDelay) diff --git a/configmgr/source/treecache/cacheaccess.hxx b/configmgr/source/treecache/cacheaccess.hxx index ec5366c80a92..25c8ffff8e06 100644 --- a/configmgr/source/treecache/cacheaccess.hxx +++ b/configmgr/source/treecache/cacheaccess.hxx @@ -134,9 +134,6 @@ namespace configmgr TimeStamp const & _aLimitTime, TimeInterval const & _aDelay); - /// clear the contained tree, return all remaining modules - void clearData( std::vector< rtl::Reference<CacheLine> >& _rDisposeList) SAL_THROW(()); - // stuff that is particular for CacheLoadingAccess /** add the given subtree at the given location, return the tree that is then pertinent and clientAcquire() it once diff --git a/configmgr/source/treecache/cachecontroller.cxx b/configmgr/source/treecache/cachecontroller.cxx index 0eafd43ce9f3..765f7df8d2e2 100644 --- a/configmgr/source/treecache/cachecontroller.cxx +++ b/configmgr/source/treecache/cachecontroller.cxx @@ -151,138 +151,6 @@ void CacheController::dispose() SAL_THROW((com::sun::star::uno::RuntimeException } // ------------------------------------------------------------------------- -void CacheController::disposeOne(RequestOptions const & _aOptions, bool _bFlushUpdates) -{ - CFG_TRACE_INFO("CacheController: Disposing data and TreeInfo for user '%s' with locale '%s'", - OUSTRING2ASCII(_aOptions.getEntity()), OUSTRING2ASCII(_aOptions.getLocale()) ); - - m_pDisposer->clearTasks(_aOptions); - if (!m_pCacheWriter->clearTasks(_aOptions)) // had no pending updates - { - _bFlushUpdates = false; - } - else if (!_bFlushUpdates) - { - CFG_TRACE_WARNING_NI("Found orphaned Changes in the cache - Discarding."); - } - - rtl::Reference<CacheLoadingAccess> aRemoved = m_aCacheMap.remove(_aOptions); - - if (aRemoved.is()) - { - // got it out of reachability - now dispose/notify without lock - implDisposeOne(aRemoved, _aOptions, _bFlushUpdates); - } - else - CFG_TRACE_INFO_NI("- No affected TreeInfo found" ); -} - -// ------------------------------------------------------------------------- -void CacheController::disposeUser(RequestOptions const & _aUserOptions, bool _bFlushUpdates) -{ - CFG_TRACE_INFO("CacheController: Disposing data and TreeInfo(s) for user '%s'", - OUSTRING2ASCII(_aUserOptions.getEntity()) ); - - std::vector< std::pair< RequestOptions, rtl::Reference<CacheLoadingAccess> > > aDisposeList; - // collect the ones to dispose - { - rtl::OUString sUser = _aUserOptions.getEntity(); - OSL_ASSERT(sUser.getLength()); - - // This depends on the fact that Options are sorted (by struct ltOptions) - // so that all options belonging to one user are together - // (and that options with only a user set, sort first) - - CacheMap::Map aCacheData; - m_aCacheMap.swap(aCacheData); - - // find the lower_bound of all options for the user - CacheMap::Map::iterator const aFirst = aCacheData.lower_bound(_aUserOptions); - - // find the upper_bound of all options for the user (using the lower one) - CacheMap::Map::iterator aLast = aFirst; - while (aLast != aCacheData.end() && aLast->first.getEntity() == sUser) - ++aLast; - - if (aFirst != aLast) - { - aDisposeList.reserve( std::distance(aFirst, aLast) ); - - bool bHasPendingChanges = false; - - for (CacheMap::Map::iterator it = aFirst; it != aLast; ++it) - { - CFG_TRACE_INFO_NI("- Found TreeInfo for locale '%s'", OUSTRING2ASCII(it->first.getLocale()) ); - m_pDisposer->clearTasks(it->first); - - if (m_pCacheWriter->clearTasks(it->first)) - bHasPendingChanges = true; - - OSL_ASSERT(it->second.is()); - if (it->second.is()) - { - //aDisposeList.push_back( *it ); - aDisposeList.push_back( std::make_pair(it->first,it->second) ); - } - } - - if (!bHasPendingChanges) - _bFlushUpdates = false; - - else if (!_bFlushUpdates) - CFG_TRACE_WARNING_NI("Found orphaned Changes in the cache - Discarding."); - - aCacheData.erase(aFirst, aLast); - } - else - CFG_TRACE_INFO_NI("- No affected TreeInfo found" ); - - // replace the data into the map - m_aCacheMap.swap(aCacheData); - } - - // got all out of external reach - now dispose/notify without lock - for (std::vector< std::pair< RequestOptions, rtl::Reference<CacheLoadingAccess> > >::iterator i = aDisposeList.begin(); i != aDisposeList.end(); ++i) - { - if (i->second.is()) - implDisposeOne(i->second, i->first, _bFlushUpdates); - } -} - -// ------------------------------------------------------------------------- -void CacheController::implDisposeOne(rtl::Reference<CacheLoadingAccess> const & _aDisposedCache, RequestOptions const & _aOptions, bool _bFlushUpdates) -{ - OSL_ASSERT(_aDisposedCache.is()); - CFG_TRACE_INFO("Now removing Cache section (user '%s' with locale '%s')", - OUSTRING2ASCII(_aOptions.getEntity()), OUSTRING2ASCII(_aOptions.getLocale()) ); - - if (_bFlushUpdates) try - { - CFG_TRACE_INFO_NI("- Flushing pending changes" ); - - if ( !this->saveAllPendingChanges(_aDisposedCache,_aOptions) ) - { - CFG_TRACE_ERROR_NI("- Error while flushing - changes will be lost" ); - OSL_ENSURE(false,"Error while flushing changes from discarded Cache section - changes will be lost" ); - } - } - catch (uno::Exception& e) - { - (void)e; - CFG_TRACE_ERROR_NI("- Failed with exception %s (ignoring here)", OUSTRING2ASCII(e.Message) ); - } - - std::vector< rtl::Reference<CacheLine> > aDisposedList; - _aDisposedCache->clearData(aDisposedList); - - if (aDisposedList.size() > 0) - { - CFG_TRACE_INFO_NI("- Closing %d modules at the session",int(aDisposedList.size())); - this->closeModules(aDisposedList,_aOptions); - } -} - -// ------------------------------------------------------------------------- CacheController::CacheController(rtl::Reference< backend::IMergedDataProvider > const & _xBackend, const uno::Reference<uno::XComponentContext>& xContext) : m_aNotifier() diff --git a/configmgr/source/treecache/cachecontroller.hxx b/configmgr/source/treecache/cachecontroller.hxx index 240e27ce5473..b03a4e041130 100644 --- a/configmgr/source/treecache/cachecontroller.hxx +++ b/configmgr/source/treecache/cachecontroller.hxx @@ -311,9 +311,6 @@ namespace configmgr // disposing void disposeAll(bool _bFlushRemainingUpdates); - void disposeOne(RequestOptions const & _aOptions, bool _bFlushUpdates = true); - void disposeUser(RequestOptions const & _aUserOptions, bool _bFlushUpdates = true); - void implDisposeOne(rtl::Reference<CacheLoadingAccess> const & _aCache, RequestOptions const & _aOptions, bool _bFlushUpdates); void closeModules(std::vector< rtl::Reference<CacheLine> > & _aList, RequestOptions const & _aOptions); private: diff --git a/configmgr/source/treecache/cachemulticaster.cxx b/configmgr/source/treecache/cachemulticaster.cxx index fe1bc75ba462..4aa2d7c93180 100644 --- a/configmgr/source/treecache/cachemulticaster.cxx +++ b/configmgr/source/treecache/cachemulticaster.cxx @@ -52,20 +52,7 @@ namespace configmgr namespace { // manually implemented helpers, as rtl::References don't work well with std binders -// --------------------------------------------------------------------------- - - // replacing std::bind2nd( std::mem_fun(&aFunc), aArg ) - struct NotifyDisposing : std::unary_function<rtl::Reference<TreeManager>,void> - { - CacheController & m_arg; - NotifyDisposing(CacheController * _pProvider) SAL_THROW(()) - : m_arg(*_pProvider) - {} - - void operator()(rtl::Reference<TreeManager> const & _xListener) const SAL_THROW(()) - { _xListener->disposing(m_arg); } - }; // --------------------------------------------------------------------------- // replacing std::bind2nd( std::mem_fun(&TreeManager::componentCreated), _aComponentName ) diff --git a/configmgr/source/treecache/disposetimer.cxx b/configmgr/source/treecache/disposetimer.cxx index b6259724345e..5f6e9a8603e4 100644 --- a/configmgr/source/treecache/disposetimer.cxx +++ b/configmgr/source/treecache/disposetimer.cxx @@ -77,25 +77,6 @@ bool equivalentOptions(RequestOptions const& lhs, RequestOptions const& rhs) } // ------------------------------------------------------------------------- -void OTreeDisposeScheduler::clearTasks(RequestOptions const& _aOptions) -{ - CFG_TRACE_INFO("Cancelling all data cleanup tasks for user '%s' with locale '%s'", - OUSTRING2ASCII(_aOptions.getEntity()), - OUSTRING2ASCII(_aOptions.getLocale())); - - Agenda::iterator it = m_aAgenda.begin(); - while(it != m_aAgenda.end()) - { - Agenda::iterator cur = it++; - if (equivalentOptions(_aOptions,cur->second)) - { - m_aAgenda.erase(cur); - CFG_TRACE_INFO_NI("- One pending task canceled"); - } - } -} -// ------------------------------------------------------------------------- - void OTreeDisposeScheduler::stopAndClearTasks() { CFG_TRACE_INFO("Cancelling all data cleanup tasks, Stopping Cleanup timer"); diff --git a/configmgr/source/treecache/disposetimer.hxx b/configmgr/source/treecache/disposetimer.hxx index 16ecdfc5ed2a..41c8e8681c57 100644 --- a/configmgr/source/treecache/disposetimer.hxx +++ b/configmgr/source/treecache/disposetimer.hxx @@ -143,9 +143,6 @@ namespace configmgr /// ensure this will execute cleanup duties for _xOptions (no later than after getCleanupDelay() has elapsed) void scheduleCleanup(RequestOptions const & _aOptions); - /// stop and discard pending activities for _xOptions - void clearTasks(RequestOptions const & _aOptions); - /// stop and discard pending activities void stopAndClearTasks(); diff --git a/configmgr/source/treecache/treemanager.cxx b/configmgr/source/treecache/treemanager.cxx index 569f41c9c6a4..99bcd21892b2 100644 --- a/configmgr/source/treecache/treemanager.cxx +++ b/configmgr/source/treecache/treemanager.cxx @@ -494,13 +494,6 @@ void TreeManager::nodeUpdated(TreeChangeList& _rChanges) // ---------------------------------------------------------------------------- -void TreeManager::disposing(backend::CacheController & /*_rProvider*/) SAL_THROW(()) -{ - CFG_TRACE_INFO("TreeManager: provider is being disposed"); - this->dispose(); -} -// ---------------------------------------------------------------------------- - void TreeManager::componentCreated(backend::ComponentRequest const & ) SAL_THROW(()) { CFG_TRACE_INFO("TreeManager: component was created"); diff --git a/configmgr/source/treemgr/configgroup.cxx b/configmgr/source/treemgr/configgroup.cxx index 4176b6b7df12..79eb3b09ab94 100644 --- a/configmgr/source/treemgr/configgroup.cxx +++ b/configmgr/source/treemgr/configgroup.cxx @@ -353,12 +353,6 @@ bool GroupDefaulter::ensureDataAvailable(rtl::Reference< Tree > const& _aParentT } //----------------------------------------------------------------------------- -bool GroupDefaulter::isDataAvailable() -{ - return m_aHelper.tree()->areValueDefaultsAvailable(m_aHelper.node()); -} -//----------------------------------------------------------------------------- - NodeChange GroupDefaulter::validateSetToDefaultValue(ValueRef const& aValueNode) { m_aHelper.validateNode(aValueNode); diff --git a/configmgr/source/treemgr/nodechange.cxx b/configmgr/source/treemgr/nodechange.cxx index bf80db4bb4ce..9c581f19368d 100644 --- a/configmgr/source/treemgr/nodechange.cxx +++ b/configmgr/source/treemgr/nodechange.cxx @@ -142,27 +142,7 @@ bool NodeChange::getChangeLocation(NodeChangeLocation& rLoc) const { return m_pImpl && m_pImpl->fillChangeLocation(rLoc); } -//----------------------------------------------------------------------------- - -rtl::Reference< Tree > NodeChange::getBaseTree() const -{ - return m_pImpl->getTargetTree().get(); -} -//----------------------------------------------------------------------------- - -// retrieve the tree where the change is actually taking place -NodeRef NodeChange::getBaseNode() const -{ - rtl::Reference<Tree> aTree = m_pImpl->getTargetTree(); - unsigned int nOffset = m_pImpl->getTargetNode(); - - OSL_ASSERT(aTree.is() && aTree->isValidNode(nOffset)); - if (aTree.is() && nOffset) - return aTree->getNode(nOffset); - - return NodeRef(); -} //----------------------------------------------------------------------------- // retrieve the tree where the change is actually taking place @@ -192,17 +172,6 @@ NodeRef NodeChange::getAffectedNode() const } //----------------------------------------------------------------------------- -NodeID NodeChange::getAffectedNodeID() const -{ - rtl::Reference<Tree> aTree = m_pImpl->getTargetTree(); - unsigned int nOffset = m_pImpl->getTargetNode(); - - OSL_ASSERT(aTree.is() ? aTree->isValidNode(nOffset) : 0==nOffset); - - return NodeID(aTree.get(),nOffset); -} -//----------------------------------------------------------------------------- - NodeChange& NodeChange::test() { if (m_pImpl) m_pImpl->test(); @@ -270,28 +239,13 @@ void NodeChanges::implTest() const } } //----------------------------------------------------------------------------- -void NodeChanges::implApply() const -{ - for(std::vector<NodeChange>::const_iterator it = begin(), stop = end(); it != stop; ++it) - { - it ->apply(); - } -} -//----------------------------------------------------------------------------- /** insert a change into this collection */ void NodeChanges::add(NodeChange const& aChange) { m_aChanges.push_back(aChange); } -//----------------------------------------------------------------------------- -/** insert multiple changes into this collection -*/ -void NodeChanges::add(NodeChanges const& aChanges) -{ - m_aChanges.insert(m_aChanges.end(),aChanges.begin(),aChanges.end()); -} //----------------------------------------------------------------------------- /** removes a change to <var>aNode</var> from this collection (if there is one) diff --git a/configmgr/source/treemgr/noderef.cxx b/configmgr/source/treemgr/noderef.cxx index eed877c9b677..330eab07aea5 100644 --- a/configmgr/source/treemgr/noderef.cxx +++ b/configmgr/source/treemgr/noderef.cxx @@ -422,13 +422,6 @@ bool SubNodeID::isValidNode() const } //----------------------------------------------------------------------------- -// hashing -size_t SubNodeID::hashCode() const -{ - return m_aParentID.hashCode() + 5*m_sNodeName.hashCode(); -} -//----------------------------------------------------------------------------- - bool operator < (SubNodeID const& lhs, SubNodeID const& rhs) { if (lhs.m_aParentID == rhs.m_aParentID) diff --git a/configmgr/source/treemgr/setnodeimpl.hxx b/configmgr/source/treemgr/setnodeimpl.hxx index c07221d265b2..3a10f4fa4232 100644 --- a/configmgr/source/treemgr/setnodeimpl.hxx +++ b/configmgr/source/treemgr/setnodeimpl.hxx @@ -108,8 +108,19 @@ namespace configmgr class ElementSet { + struct FastLess + { + bool operator ()( + rtl::OUString const & a, rtl::OUString const & b) const + { + // first sort by length; order is immaterial, and it is fast + return a.getLength() == b.getLength() + ? a < b : a.getLength() < b.getLength(); + } + }; + public: - typedef std::map<rtl::OUString, ElementTreeData> Data; + typedef std::map<rtl::OUString, ElementTreeData, FastLess> Data; // the following must be implemented by derived classes bool isEmpty() const { return m_aData.empty(); } diff --git a/configmgr/source/treemgr/treeimpl.cxx b/configmgr/source/treemgr/treeimpl.cxx index 20f5b1b925c4..66b26092e5e4 100644 --- a/configmgr/source/treemgr/treeimpl.cxx +++ b/configmgr/source/treemgr/treeimpl.cxx @@ -470,6 +470,7 @@ bool Tree::isValidValueNode(ValueRef const & value) { return true; } +#if OSL_DEBUG_LEVEL > 0 bool Tree::isValidAnyNode(AnyNodeRef const & node) { OSL_ASSERT(nodeCount() != 0); return node.isValid() && isValidNode(node.m_nUsedPos) && @@ -477,6 +478,7 @@ bool Tree::isValidAnyNode(AnyNodeRef const & node) { (view::ViewTreeAccess(this).isGroupNodeAt(node.m_nUsedPos) && getMemberNode(node.toValue()).isValid())); } +#endif bool Tree::hasElements(NodeRef const & node) { OSL_ASSERT( |