summaryrefslogtreecommitdiff
path: root/configmgr/source/backend
diff options
context:
space:
mode:
Diffstat (limited to 'configmgr/source/backend')
-rw-r--r--configmgr/source/backend/backendaccess.cxx827
-rw-r--r--configmgr/source/backend/backendaccess.hxx157
-rw-r--r--configmgr/source/backend/backendfactory.cxx329
-rw-r--r--configmgr/source/backend/backendnotifier.cxx195
-rw-r--r--configmgr/source/backend/backendnotifier.hxx120
-rw-r--r--configmgr/source/backend/backendstratalistener.cxx56
-rw-r--r--configmgr/source/backend/backendstratalistener.hxx74
-rw-r--r--configmgr/source/backend/basicimporthandler.cxx114
-rw-r--r--configmgr/source/backend/basicimporthandler.hxx96
-rw-r--r--configmgr/source/backend/basicupdatemerger.cxx338
-rw-r--r--configmgr/source/backend/basicupdatemerger.hxx157
-rw-r--r--configmgr/source/backend/binarycache.cxx248
-rw-r--r--configmgr/source/backend/binarycache.hxx100
-rw-r--r--configmgr/source/backend/binaryreader.cxx690
-rw-r--r--configmgr/source/backend/binaryreader.hxx85
-rw-r--r--configmgr/source/backend/binaryreadhandler.cxx687
-rw-r--r--configmgr/source/backend/binaryreadhandler.hxx133
-rw-r--r--configmgr/source/backend/binarytype.hxx61
-rw-r--r--configmgr/source/backend/binarywritehandler.cxx489
-rw-r--r--configmgr/source/backend/binarywritehandler.hxx117
-rw-r--r--configmgr/source/backend/binarywriter.cxx215
-rw-r--r--configmgr/source/backend/binarywriter.hxx76
-rw-r--r--configmgr/source/backend/componentdatahelper.cxx614
-rw-r--r--configmgr/source/backend/componentdatahelper.hxx219
-rw-r--r--configmgr/source/backend/emptylayer.cxx225
-rw-r--r--configmgr/source/backend/emptylayerimpl.hxx136
-rw-r--r--configmgr/source/backend/importmergehandler.cxx296
-rw-r--r--configmgr/source/backend/importmergehandler.hxx134
-rw-r--r--configmgr/source/backend/importsvc.cxx335
-rw-r--r--configmgr/source/backend/importsvc.hxx154
-rw-r--r--configmgr/source/backend/layerdefaultremover.cxx275
-rw-r--r--configmgr/source/backend/layerdefaultremover.hxx132
-rw-r--r--configmgr/source/backend/layermerge.cxx1036
-rw-r--r--configmgr/source/backend/layermerge.hxx188
-rw-r--r--configmgr/source/backend/layerupdate.cxx110
-rw-r--r--configmgr/source/backend/layerupdate.hxx87
-rw-r--r--configmgr/source/backend/layerupdatebuilder.cxx299
-rw-r--r--configmgr/source/backend/layerupdatebuilder.hxx105
-rw-r--r--configmgr/source/backend/layerupdatehandler.cxx313
-rw-r--r--configmgr/source/backend/layerupdatehandler.hxx154
-rw-r--r--configmgr/source/backend/layerupdatemerger.cxx512
-rw-r--r--configmgr/source/backend/layerupdatemerger.hxx130
-rw-r--r--configmgr/source/backend/makefile.mk77
-rw-r--r--configmgr/source/backend/mergedcomponentdata.cxx173
-rw-r--r--configmgr/source/backend/mergedcomponentdata.hxx99
-rw-r--r--configmgr/source/backend/multistratumbackend.cxx931
-rw-r--r--configmgr/source/backend/multistratumbackend.hxx219
-rw-r--r--configmgr/source/backend/schemabuilder.cxx536
-rw-r--r--configmgr/source/backend/schemabuilder.hxx151
-rw-r--r--configmgr/source/backend/singlebackendadapter.cxx336
-rw-r--r--configmgr/source/backend/singlebackendadapter.hxx142
-rw-r--r--configmgr/source/backend/updatedata.cxx455
-rw-r--r--configmgr/source/backend/updatedata.hxx266
-rw-r--r--configmgr/source/backend/updatedispatch.cxx496
-rw-r--r--configmgr/source/backend/updatedispatch.hxx103
-rw-r--r--configmgr/source/backend/updatesvc.cxx278
-rw-r--r--configmgr/source/backend/updatesvc.hxx122
57 files changed, 0 insertions, 15202 deletions
diff --git a/configmgr/source/backend/backendaccess.cxx b/configmgr/source/backend/backendaccess.cxx
deleted file mode 100644
index 6cc5eed84ff4..000000000000
--- a/configmgr/source/backend/backendaccess.cxx
+++ /dev/null
@@ -1,827 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-#include "backendaccess.hxx"
-#include "logger.hxx"
-#include "matchlocale.hxx"
-#include "layermerge.hxx"
-#include "schemabuilder.hxx"
-
-#ifndef CONFIGMGR_BACKEND_UPDATEDISPATCHER_HXX
-#include "updatedispatch.hxx"
-#endif // CONFIGMGR_BACKEND_UPDATEDISPATCHER_HXX
-#include "backendnotifier.hxx"
-#include "emptylayer.hxx"
-#include "filehelper.hxx"
-#include "simpleinteractionrequest.hxx"
-#include "configinteractionhandler.hxx"
-#include <com/sun/star/configuration/backend/XVersionedSchemaSupplier.hpp>
-#include <com/sun/star/configuration/backend/XCompositeLayer.hpp>
-#include <com/sun/star/configuration/backend/XUpdatableLayer.hpp>
-#include <com/sun/star/configuration/backend/XBackendEntities.hpp>
-#include <com/sun/star/configuration/backend/MergeRecoveryRequest.hpp>
-#include <com/sun/star/configuration/backend/MalformedDataException.hpp>
-#include <com/sun/star/container/NoSuchElementException.hpp>
-#include <com/sun/star/lang/NullPointerException.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include "com/sun/star/task/XInteractionHandler.hpp"
-#include <rtl/ustrbuf.hxx>
-#include <rtl/ref.hxx>
-#include <rtl/logfile.hxx>
-
-#include <cppuhelper/exc_hlp.hxx>
-
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif //INCLUDED_VECTOR
-
-#ifndef INCLUDED_ALGORITHM
-#include <algorithm>
-#define INCLUDED_ALGORITHM
-#endif //INCLUDED_ALGORITHM
-
-#define OU2A(rtlOUString) (::rtl::OUStringToOString((rtlOUString), RTL_TEXTENCODING_ASCII_US).getStr())
-#define RTL_LOGFILE_OU2A(rtlOUString) OU2A(rtlOUString)
-
-#define OUSTR(txt) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(txt) )
-
-namespace configmgr { namespace backend {
-//------------------------------------------------------------------------------
- namespace task = com::sun::star::task;
-
-inline
-uno::Reference<lang::XMultiServiceFactory> BackendAccess::getServiceFactory() const
-{
- return uno::Reference<lang::XMultiServiceFactory>(mContext->getServiceManager(),uno::UNO_QUERY_THROW);
-}
-//------------------------------------------------------------------------------
-
-BackendAccess::BackendAccess(
- const uno::Reference<backenduno::XBackend>& xBackend,
- const uno::Reference<uno::XComponentContext>& xContext)
- : mContext(xContext)
- , mBackend(xBackend)
- , mBinaryCache(xContext)
- {
- OSL_ENSURE(mContext.is(), "BackendAccess: Context is missing");
- if (!mContext.is())
- throw lang::NullPointerException(rtl::OUString::createFromAscii("BackendAccess: NULL Context passed"), NULL);
- if (!xBackend.is())
- throw lang::NullPointerException(OUSTR("Configuration: Trying to create backend access without backend"),NULL);
- if (!uno::Reference<backenduno::XSchemaSupplier>::query(xBackend).is())
- throw lang::NullPointerException(OUSTR("Configuration: No backend for schemas available"),NULL);
-
-
- mNotifier = new BackendChangeNotifier(xBackend);
- //Stored as uno::reference to facilitate sharing with MultiStratumBackend
- mXNotifier = mNotifier;
-
- //Create Binary Cache
- uno::Reference<backenduno::XBackendEntities> xBackendEntities = uno::Reference<backenduno::XBackendEntities>( mBackend, uno::UNO_QUERY) ;
- OSL_ENSURE(xBackendEntities.is(),"Backend does not provide entity information");
-
- if ( xBackendEntities.is() ) mBinaryCache.setOwnerEntity(xBackendEntities->getOwnerEntity());
-}
-//------------------------------------------------------------------------------
-
-BackendAccess::~BackendAccess() {}
-//------------------------------------------------------------------------------
-namespace
-{
-//------------------------------------------------------------------------------
-
- static inline
- bool findLocale(std::vector< com::sun::star::lang::Locale > const & seq, com::sun::star::lang::Locale const & loc)
- {
- std::vector< com::sun::star::lang::Locale >::const_iterator first = seq.begin();
- std::vector< com::sun::star::lang::Locale >::const_iterator last = seq.end();
- for ( ; first != last; ++first)
- if (localehelper::equalLocale(*first, loc))
- return true;
- return false;
- }
-//------------------------------------------------------------------------------
-
- static inline
- void addLocale( com::sun::star::lang::Locale const & aLocale, std::vector< com::sun::star::lang::Locale > & inoutLocales)
- {
- if (!findLocale(inoutLocales,aLocale))
- inoutLocales.push_back(aLocale);
- }
-//------------------------------------------------------------------------------
-
- static rtl::OUString toString(uno::Sequence< rtl::OUString > const & seq, sal_Unicode separator = ',')
- {
- rtl::OUStringBuffer buf;
-
- if (sal_Int32 const nCount = seq.getLength())
- {
- buf.append(seq[0]);
- for (sal_Int32 ix=1; ix < nCount; ++ix)
- buf.append(separator).append(seq[ix]);
- }
- else
- buf.appendAscii("<none>");
-
- return buf.makeStringAndClear();
- }
-//------------------------------------------------------------------------------
-
- static
- uno::Sequence< rtl::OUString > intersect(uno::Sequence< rtl::OUString > const & seq1, uno::Sequence< rtl::OUString > const & seq2)
- {
- sal_Int32 const len1 = seq1.getLength();
- uno::Sequence< rtl::OUString > aResult(len1);
-
- rtl::OUString const * const beg2 = seq2.getConstArray();
- rtl::OUString const * const end2 = beg2 + seq2.getLength();
-
- sal_Int32 ix = 0;
- for (sal_Int32 i1 = 0; i1 < len1; ++i1)
- {
- if (std::find(beg2,end2,seq1[i1]) != end2)
- aResult[ix++] = seq1[i1];
- }
- aResult.realloc(ix);
- return aResult;
- }
-//------------------------------------------------------------------------------
-} // anonymous namespace
-//------------------------------------------------------------------------------
-
-// helper used by the binary cache
-uno::Sequence< rtl::OUString >
- getAvailableLocales(const uno::Reference<backenduno::XLayer> * pLayers, sal_Int32 nNumLayers)
-{
- uno::Sequence< rtl::OUString > aResult;
-
- for (sal_Int32 i = 0 ; i < nNumLayers ; ++ i)
- {
- uno::Reference<backenduno::XCompositeLayer> compositeLayer(
- pLayers [i], uno::UNO_QUERY) ;
-
- if (compositeLayer.is())
- {
- uno::Sequence<rtl::OUString> aLocales = compositeLayer->listSubLayerIds();
-
- if (aResult.getLength() == 0)
- {
- aResult = aLocales;
- }
- else
- {
- OSL_TRACE("Warning: multiple composite layers found. Detection of available locales is inaccurate.");
- // be defensive: only locales present in all composite layers are 'available'
- aResult= intersect(aResult,aLocales);
- }
- }
- }
- return aResult;
-}
-//------------------------------------------------------------------------------
-static rtl::OUString getLayerURL(const uno::Reference<backenduno::XLayer> & aLayer);
-
-void BackendAccess::merge(
- MergedComponentData& aData,
- const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 aNumLayers,
- com::sun::star::lang::Locale const & aRequestedLocale,
- std::vector< com::sun::star::lang::Locale > & inoutMergedLocales,
- ITemplateDataProvider *aTemplateProvider,
- sal_Int32 * pLayersMerged)
- SAL_THROW((com::sun::star::uno::Exception))
-{
- LayerMergeHandler * pMerger = new LayerMergeHandler(mContext, aData, aTemplateProvider );
- uno::Reference<backenduno::XLayerHandler> xLayerMerger(pMerger);
-
- Logger logger(mContext);
-
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::merge()");
- RTL_LOGFILE_CONTEXT_TRACE1(aLog, "merging %d layers", int(aNumLayers) );
-
- rtl::OUString const & aLanguage = aRequestedLocale.Language;
- bool const needAllLanguages = localehelper::isAnyLanguage(aLanguage);
-
- if (aLanguage.getLength() && !needAllLanguages)
- {
- if (!localehelper::isDefaultLanguage(aLanguage))
- addLocale(aRequestedLocale,inoutMergedLocales);
- }
- bool const needLocalizedData = needAllLanguages || !inoutMergedLocales.empty();
-
- if (logger.isLogging(LogLevel::FINEST))
- {
- if (!needLocalizedData)
- logger.finest("Starting merge with NO locales", "merge()","configmgr::Backend");
-
- else if (needAllLanguages)
- logger.finest("Starting merge for ALL locales", "merge()","configmgr::Backend");
-
- else
- logger.finest(OUSTR("Starting merge for locale(s): ") +
- toString(localehelper::makeIsoSequence(inoutMergedLocales)),
- "merge()","configmgr::Backend");
- }
-
- if (pLayersMerged) *pLayersMerged = 0;
-
- for (sal_Int32 i = 0 ; i < aNumLayers ; ++ i)
- {
- if (logger.isLogging(LogLevel::FINEST))
- logger.finest(OUSTR("+ Merging layer: ") + getLayerURL(pLayers[i]),
- "merge()","configmgr::Backend");
-
- pMerger->prepareLayer() ;
- pLayers [i]->readData(xLayerMerger) ;
-
- if (needLocalizedData)
- {
- uno::Reference<backenduno::XCompositeLayer> compositeLayer(
- pLayers [i], uno::UNO_QUERY) ;
-
- if (compositeLayer.is())
- {
- uno::Sequence<rtl::OUString> aSubLayerIds = compositeLayer->listSubLayerIds();
- logger.finest(OUSTR("++ Found locales: ") + toString(aSubLayerIds),
- "merge()","configmgr::Backend");
-
- for (sal_Int32 j = 0; j < aSubLayerIds.getLength(); ++j)
- {
- rtl::OUString const & aLocaleIso = aSubLayerIds[j];
- com::sun::star::lang::Locale aLocale = localehelper::makeLocale(aLocaleIso);
-
- // requesting de-CH, we accept de-CH and de, but not de-DE
- const localehelper::MatchQuality kMatchAccept = localehelper::MATCH_LANGUAGE_PLAIN;
-
- if (needAllLanguages || localehelper::isMatch(aLocale,inoutMergedLocales,kMatchAccept))
- {
- if(pMerger->prepareSublayer(aLocaleIso))
- {
- logger.finest(OUSTR("++ Merging sublayer for locale: ") + aLocaleIso,
- "merge()","configmgr::Backend");
- compositeLayer->readSubLayerData(xLayerMerger,aLocaleIso) ;
- addLocale(aLocale,inoutMergedLocales);
- }
- // else dropLocale(aLocale,inoutMergedLocales); ?
- }
- }
- }
- }
- if (pLayersMerged) ++*pLayersMerged;
- }
-}
-//------------------------------------------------------------------------------
-
-bool BackendAccess::readDefaultData( MergedComponentData & aComponentData,
- rtl::OUString const & aComponent,
- RequestOptions const & aOptions,
- bool bIncludeTemplates,
- const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- ITemplateDataProvider *aTemplateProvider,
- sal_Int32 * pLayersMerged)
- SAL_THROW((com::sun::star::uno::Exception))
-{
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog1, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::readDefaultData()");
-
- Logger logger(mContext);
- const sal_Int32 detail = LogLevel::FINER;
- bool const bLogDetail = logger.isLogging(detail);
-
- rtl::OUString const aSchemaVersion = this->getSchemaVersion(aComponent);
-
- if (logger.isLogging(LogLevel::FINE))
- {
- rtl::OUStringBuffer aMsg;
- aMsg.appendAscii("Reading data for component \"").append(aComponent).appendAscii("\"");
- aMsg.appendAscii(" [version=").append(aSchemaVersion).appendAscii("]");
-
- logger.fine( aMsg.makeStringAndClear(), "readDefaultData()","configmgr::Backend");
- }
-
- com::sun::star::lang::Locale const aRequestedLocale = localehelper::makeLocale(aOptions.getLocale());
- std::vector< com::sun::star::lang::Locale > aKnownLocales;
-
- if (bLogDetail) logger.log(detail, "... attempt to read from binary cache", "readDefaultData()","configmgr::Backend");
- bool bCacheHit = mBinaryCache.readComponentData(aComponentData, getServiceFactory(),
- aComponent, aSchemaVersion,
- aOptions.getEntity(),
- aRequestedLocale, aKnownLocales,
- pLayers, nNumLayers, bIncludeTemplates);
-
- if (!bCacheHit)
- {
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog2, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::readDefaultData() - not in cache");
-
- if (bLogDetail) logger.log(detail, "... cache miss - need full merge", "readDefaultData()","configmgr::Backend");
- if (bLogDetail) logger.log(detail, "... reading schema", "readDefaultData()","configmgr::Backend");
- {
- SchemaBuilder *schemaBuilder = new SchemaBuilder( mContext, aComponent, aComponentData, aTemplateProvider );
- uno::Reference<backenduno::XSchemaHandler> schemaHandler = schemaBuilder ;
-
- uno::Reference<backenduno::XSchema> schema = this->getSchema(aComponent);
- schema->readSchema(schemaHandler) ;
- }
-
- if (bLogDetail) logger.log(detail, "... merging layers", "readDefaultData()","configmgr::Backend");
- this->merge(aComponentData, pLayers, nNumLayers, aRequestedLocale, aKnownLocales, aTemplateProvider, pLayersMerged );
- promoteToDefault(aComponentData);
-
- if (mBinaryCache.isCacheEnabled(aOptions.getEntity()))
- {
- if (bLogDetail) logger.log(detail, "... creating binary cache", "readDefaultData()","configmgr::Backend");
- bool bWriteSuccess = mBinaryCache.writeComponentData( aComponentData, getServiceFactory(),
- aComponent, aSchemaVersion,
- aOptions.getEntity(), aKnownLocales,
- pLayers, nNumLayers );
-
- if (!bWriteSuccess)
- {
- logger.info("Binary cache write failed - disabling binary cache","readDefaultData()","configmgr::Backend");
- mBinaryCache.disableCache();
- }
- }
- else if (bLogDetail)
- logger.log(detail, "... cache hit", "readDefaultData()","configmgr::Backend");
- }
- else if (pLayersMerged)
- *pLayersMerged = nNumLayers;
-
- return aComponentData.hasSchema();
-}
-//------------------------------------------------------------------------------
-
-static rtl::OUString getLayerURL(const uno::Reference<backenduno::XLayer> & aLayer)
-{
- try
- {
- namespace beans = com::sun::star::beans;
- uno::Reference< beans::XPropertySet > xLayerProps( aLayer, uno::UNO_QUERY );
- if (xLayerProps.is())
- {
- uno::Any aPropVal = xLayerProps->getPropertyValue( OUSTR("URL") );
- rtl::OUString aResult;
- if (aPropVal >>= aResult)
- return aResult;
- }
- OSL_TRACE("Warning - Cannot get location of layer data\n");
- }
- catch (uno::Exception & e)
- {
- OSL_TRACE("Warning - Configuration: Retrieving layer URL failed: [%s]\n", OU2A(e.Message));
- }
- // TODO: use better fallback, e.g. ServiceName
- const char * const aFallback = aLayer.is() ? "<Unknown Layer Type>" : "<NULL Layer>";
- return rtl::OUString::createFromAscii(aFallback);
-}
-//------------------------------------------------------------------------------
-static inline
-rtl::OUString getLayerIdentifier(const uno::Reference<backenduno::XLayer> & aLayer)
-{
- return getLayerURL(aLayer);
-}
-
-//------------------------------------------------------------------------------
-static void removeLayerData(uno::Reference< backenduno::XLayer > const & xLayer)
-{
- OSL_ASSERT(xLayer.is());
-
- uno::Reference< backenduno::XUpdatableLayer > xLayerRemover(xLayer,uno::UNO_QUERY);
- if (xLayerRemover.is())
- try
- {
- xLayerRemover->replaceWith(createEmptyLayer());
- }
- catch (uno::Exception & e)
- {
- OSL_TRACE("Warning - Configuration: Could not clear Layer data. Error: [%s]\n", OU2A(e.Message));
- }
- else
- {
- if (! FileHelper::tryToRemoveFile(getLayerURL(xLayer),true))
- OSL_TRACE("Warning - Configuration: Could not remove broken user Layer data: [-Not Updatable-]\n");
- }
-}
-//------------------------------------------------------------------------------
-
-static void discardLayer(uno::Sequence<uno::Reference<backenduno::XLayer> >& layers, sal_Int32 nLayer)
-{
- OSL_ASSERT(0 <= nLayer && nLayer < layers.getLength());
- sal_Int32 nNewSize = layers.getLength() - 1;
-
- for (sal_Int32 i = nLayer; i<nNewSize; ++i)
- layers[i] = layers[i+1];
-
- layers.realloc(nNewSize);
-}
-//------------------------------------------------------------------------------
-
-namespace {
-
-class RecursiveHandler:
- public cppu::WeakImplHelper1< task::XInteractionHandler >
-{
-public:
- explicit RecursiveHandler(
- uno::Reference< task::XInteractionHandler > const & outer):
- m_outer(outer) {}
-
- virtual void SAL_CALL handle(
- uno::Reference< task::XInteractionRequest > const & request)
- throw (uno::RuntimeException)
- {
- backenduno::MergeRecoveryRequest req;
- if (request->getRequest() >>= req) {
- uno::Sequence< uno::Reference< task::XInteractionContinuation > >
- cs(request->getContinuations());
- for (sal_Int32 i = 0; i < cs.getLength(); ++i) {
- uno::Reference< task::XInteractionDisapprove > dis(
- cs[i], uno::UNO_QUERY);
- if (dis.is()) {
- dis->select();
- break;
- }
- }
- } else if (m_outer.is()) {
- m_outer->handle(request);
- }
- }
-
-private:
- RecursiveHandler(RecursiveHandler &); // not defined
- void operator =(RecursiveHandler &); // not defined
-
- virtual ~RecursiveHandler() {}
-
- uno::Reference< task::XInteractionHandler > m_outer;
-};
-
-}
-
-bool BackendAccess::approveRecovery(const uno::Any & aMergeException,
- const uno::Reference<backenduno::XLayer> & aBrokenLayer,
- bool bUserLayerData)
- SAL_THROW((com::sun::star::uno::Exception))
-{
- sal_uInt32 const k_supported_choices = apihelper::CONTINUATION_APPROVE | apihelper::CONTINUATION_DISAPPROVE;
-
- sal_uInt32 chosen = apihelper::CONTINUATION_UNKNOWN;
-
- apihelper::ConfigurationInteractionHandler handler;
- try {
- uno::Reference< task::XInteractionHandler > h(handler.get());
- if (h.is()) {
- handler.setRecursive(new RecursiveHandler(h));
- rtl::Reference< apihelper::SimpleInteractionRequest > req(
- new apihelper::SimpleInteractionRequest(
- uno::makeAny(
- backenduno::MergeRecoveryRequest(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "Recover from configuration merge"
- " failure")),
- aBrokenLayer, aMergeException,
- getLayerIdentifier(aBrokenLayer),
- (bUserLayerData
- && (uno::Reference< backenduno::XUpdatableLayer >::query(aBrokenLayer).is()
- || FileHelper::fileExists(
- getLayerURL(aBrokenLayer)))))),
- k_supported_choices));
- h->handle(req.get());
- chosen = req->getResponse();
- }
- } catch (uno::Exception & e) {
- OSL_TRACE("Warning - Configuration: Interaction handler failed: [%s]\n", OU2A(e.Message));
- }
-
- switch (chosen)
- {
- case apihelper::CONTINUATION_APPROVE: return true;
- case apihelper::CONTINUATION_DISAPPROVE: return false;
- case apihelper::CONTINUATION_UNKNOWN: break;
-
- default: OSL_ENSURE(false,"Unsolicited continuation chosen"); break;
- }
- // no choice available - default: approve, if user data
- return bUserLayerData;
-}
-//------------------------------------------------------------------------------
-
-ResultHolder< ComponentInstance > BackendAccess::getNodeData(const ComponentRequest& aRequest,
- ITemplateDataProvider *_aTemplateProvider,
- INodeDataListener *aListener)
- SAL_THROW((com::sun::star::uno::Exception))
-{
- rtl::OUString const component = aRequest.getComponentName();
- ITemplateDataProvider * const aTemplateProvider = _aTemplateProvider ? _aTemplateProvider : this;
-
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::getNodeData()");
- RTL_LOGFILE_CONTEXT_TRACE1(aLog, "request path: %s", RTL_LOGFILE_OU2A(component) );
-
- uno::Sequence<uno::Reference<backenduno::XLayer> > layers =
- this->getLayers(component, aRequest.getOptions()) ;
-
- sal_Int32 const k_NumUserLayers = 1;
-
- sal_Int32 nNumDefaultLayers = layers.getLength() - k_NumUserLayers;
- sal_Int32 nCurrentLayer( -1 );
- bool bDefaultRecoveryApproved = false;
-
- Logger logger(mContext);
- do try // loop to allow recovery from merge failures
- {
- MergedComponentData aComponentData;
- nCurrentLayer = -1;
-
- if (!this->readDefaultData(aComponentData, component, aRequest.getOptions(), true,
- layers.getConstArray(),nNumDefaultLayers,
- aTemplateProvider, &nCurrentLayer))
- {
- rtl::OUStringBuffer sMessage;
- sMessage.appendAscii("Configuration: No data for request. Component \"");
- sMessage.append(component);
- sMessage.appendAscii("\" contains no data. ");
-
- throw com::sun::star::container::NoSuchElementException(sMessage.makeStringAndClear(),mBackend);
- }
- OSL_ASSERT(nCurrentLayer == nNumDefaultLayers);
-
- sal_Int32 const nNumUserLayers = layers.getLength() - nNumDefaultLayers;
- if (nNumUserLayers > 0)
- {
- //Merge User layer (with all locales)
- logger.finer("... merging user layer", "getNodeData()","configmgr::Backend");
-
- std::vector< com::sun::star::lang::Locale > aLocales;
- merge(aComponentData,
- layers.getConstArray()+nNumDefaultLayers, nNumUserLayers,
- localehelper::getAnyLocale(), aLocales, aTemplateProvider );
-
- // mark this one as done
- ++nCurrentLayer;
- }
-
- logger.finer("Reading component data finished successfully", "getNodeData()","configmgr::Backend");
-
- ComponentInstance retCode(aComponentData.extractSchemaTree(),
- aComponentData.extractTemplatesTree(),
- aRequest.getComponentName()) ;
-
- //Register listener with notifier
- if(aListener)
- {
- mNotifier->addListener(aListener, aRequest);
- }
- return ResultHolder< ComponentInstance >(retCode) ;
- }
- catch (com::sun::star::container::NoSuchElementException &) { throw; }
- catch (com::sun::star::uno::RuntimeException &) { throw; }
- catch (uno::Exception & )
- {
- // can only recover if layer merging broke
- if (nCurrentLayer < 0 || layers.getLength() <= nCurrentLayer)
- throw;
-
- uno::Reference< backenduno::XLayer > xBrokenLayer = layers[nCurrentLayer];
-
- bool bUserLayerBroken = (nCurrentLayer == nNumDefaultLayers);
-
- if (!bDefaultRecoveryApproved || bUserLayerBroken)
- {
- logger.info("Parsing data layer failed. Requesting approval for automated recovery", "getNodeData()","configmgr::Backend");
- uno::Any theError = cppu::getCaughtException();
- if (!approveRecovery(theError,xBrokenLayer,bUserLayerBroken))
- cppu::throwException( theError );
- }
-
- // now do the recovery
- discardLayer(layers,nCurrentLayer);
- if (bUserLayerBroken)
- {
- logger.info("Recovering from broken user data layer - discarding the data", "getNodeData()","configmgr::Backend");
- removeLayerData(xBrokenLayer);
- }
- else
- {
- logger.info("Recovering from broken default layer - skipping", "getNodeData()","configmgr::Backend");
- bDefaultRecoveryApproved = true;
- --nNumDefaultLayers;
- }
- }
- while (true);
-}
-//------------------------------------------------------------------------------
-
-void BackendAccess::updateNodeData(const UpdateRequest& aUpdate)
- SAL_THROW((com::sun::star::uno::Exception))
-{
- rtl::OUString entity = aUpdate.getOptions().getEntity() ;
- rtl::OUString component =
- aUpdate.getUpdateRoot().getModuleName();
- uno::Reference<backenduno::XUpdateHandler> handler ;
-
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::updateNodeData()");
- RTL_LOGFILE_CONTEXT_TRACE1(aLog, "updating component: %s", RTL_LOGFILE_OU2A(component) );
-
- if (entity.getLength() == 0) {
- handler = mBackend->getOwnUpdateHandler(component) ;
- }
- else { handler = mBackend->getUpdateHandler(component, entity) ; }
- UpdateDispatcher dispatcher(handler, aUpdate.getOptions().getLocale()) ;
-
- dispatcher.dispatchUpdate(aUpdate.getUpdateRoot(),
- *aUpdate.getUpdateData()) ;
-}
-//------------------------------------------------------------------------------
-
-ResultHolder< NodeInstance > BackendAccess::getDefaultData(const NodeRequest& aRequest)
- SAL_THROW((com::sun::star::uno::Exception))
-{
- rtl::OUString const component = aRequest.getPath().getModuleName();
-
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::getDefaultData()");
- RTL_LOGFILE_CONTEXT_TRACE1(aLog, "request path: %s", RTL_LOGFILE_OU2A(aRequest.getPath().toString()) );
-
- uno::Sequence<uno::Reference<backenduno::XLayer> > const layers =
- this->getLayers(component, aRequest.getOptions()) ;
-
- sal_Int32 const nNumUserLayers = 1;
- sal_Int32 const nNumDefaultLayers = layers.getLength() - nNumUserLayers;
-
- MergedComponentData aComponentData;
-
- if (!this->readDefaultData(aComponentData, component, aRequest.getOptions(), false,
- layers.getConstArray(),nNumDefaultLayers,
- this))
- {
- rtl::OUStringBuffer sMessage;
- sMessage.appendAscii("Configuration: No data for request. Component \"");
- sMessage.append(component);
- sMessage.appendAscii("\" contains no default data. ");
-
- rtl::OUString const sMsg = sMessage.makeStringAndClear();
- Logger(mContext).finer(sMsg,"getDefaultData()","configmgr::BackendAccess");
- throw com::sun::star::container::NoSuchElementException(sMsg,mBackend);
- }
-
- std::auto_ptr<ISubtree> aResultTree = aComponentData.extractSchemaTree();
-
- configuration::AbsolutePath aPath = aRequest.getPath();
- if( aPath.begin() != aPath.end())
- {
- for(std::vector<configuration::Path::Component>::const_reverse_iterator it=aPath.begin()+1,endIt=aPath.end();it!=endIt; ++it)
- {
- std::auto_ptr<INode> aChild=aResultTree->removeChild(it->getName());
- if(aChild.get()== NULL)
- {
- rtl::OUStringBuffer sMessage;
- sMessage.appendAscii("Configuration: No data for request. Element \"");
- sMessage.append(aPath.toString());
- sMessage.appendAscii("\" does not exist in the default data. ");
-
- rtl::OUString const sMsg = sMessage.makeStringAndClear();
- Logger(mContext).finest(sMsg,"getDefaultData()","configmgr::BackendAccess");
- throw com::sun::star::container::NoSuchElementException(sMsg,mBackend);
- }
-
- ISubtree *pChildAsSubtree = aChild->asISubtree();
- if(pChildAsSubtree == NULL)
- {
- rtl::OUString sMsg = rtl::OUString::createFromAscii("BackendAccess::getDefaultData - Node Expected, Found Property: ").concat(it->getName());
- Logger(mContext).finer(sMsg,"getDefaultData()","configmgr::BackendAccess");
- throw backenduno::MalformedDataException(sMsg, mBackend, uno::Any());
- }
- aResultTree.reset(pChildAsSubtree);
- aChild.release();
- }
- }
-
- NodeInstance retCode(aResultTree, aRequest.getPath()) ;
- return ResultHolder< NodeInstance >(retCode) ;
-}
-//------------------------------------------------------------------------------
-
-ResultHolder< TemplateInstance > BackendAccess::getTemplateData(const TemplateRequest& aRequest)
- SAL_THROW((com::sun::star::uno::Exception))
-{
- rtl::OUString component = aRequest.getComponentName();
-
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::getTemplateData()");
- RTL_LOGFILE_CONTEXT_TRACE2(aLog, "requested template: %s/%s",
- RTL_LOGFILE_OU2A(aRequest.getComponentName().toString()) ,
- aRequest.isComponentRequest() ? "*" : RTL_LOGFILE_OU2A(aRequest.getComponentName().toString()) );
-
- MergedComponentData aComponentData;
-
- {
- SchemaBuilder *schemaBuilder = new SchemaBuilder( mContext, component, aComponentData ) ;
- uno::Reference<backenduno::XSchemaHandler> handler = schemaBuilder ;
-
- uno::Reference<backenduno::XSchema> schema = this->getSchema(component);
-
- schema->readTemplates(handler) ;
- }
-
- TemplateInstance::Data aResultData;
- if (aRequest.isComponentRequest())
- {
- aResultData.reset( aComponentData.extractTemplatesTree().release() );
- }
- else
- {
- backenduno::TemplateIdentifier templateId ;
- templateId.Name = aRequest.getTemplateName();
- templateId.Component = aRequest.getComponentName();
-
- aResultData = aComponentData.extractTemplateNode(templateId.Name);
- }
-
- TemplateInstance retCode(aResultData,aRequest.getTemplateName(), aRequest.getComponentName()) ;
- return ResultHolder< TemplateInstance >(retCode) ;
-}
-//------------------------------------------------------------------------------
-
-uno::Reference< backenduno::XSchema > BackendAccess::getSchema(const rtl::OUString& aComponent)
-{
- uno::Reference< backenduno::XSchemaSupplier > xSchemaBackend(mBackend, uno::UNO_QUERY_THROW);
- OSL_ASSERT(xSchemaBackend.is());
-
- uno::Reference< backenduno::XSchema > xSchema = xSchemaBackend->getComponentSchema(aComponent) ;
- if (!xSchema.is())
- {
- rtl::OUStringBuffer sMessage;
- sMessage.appendAscii("Configuration: No data for request. Component \"");
- sMessage.append(aComponent);
- sMessage.appendAscii("\" is unknown. [No schema available]");
-
- rtl::OUString const sMsg = sMessage.makeStringAndClear();
- Logger(mContext).warning(sMsg,"getSchema()","configmgr::BackendAccess");
- throw com::sun::star::container::NoSuchElementException(sMsg,xSchemaBackend);
- }
-
- return xSchema;
-}
-//------------------------------------------------------------------------------
-
-rtl::OUString BackendAccess::getSchemaVersion(const rtl::OUString& aComponent)
-{
- uno::Reference< backenduno::XVersionedSchemaSupplier > xSchemaBackend(mBackend, uno::UNO_QUERY);
- if (xSchemaBackend.is())
- return xSchemaBackend->getSchemaVersion(aComponent);
- else
- return rtl::OUString();
-}
-//------------------------------------------------------------------------------
-
-uno::Sequence< uno::Reference<backenduno::XLayer> > BackendAccess::getLayers(const rtl::OUString& aComponent,const RequestOptions& aOptions)
-{
- rtl::OUString aEntity = aOptions.getEntity() ;
-
- if (aEntity.getLength() == 0)
- {
- // Use own entity instead
- return mBackend->listOwnLayers(aComponent) ;
- }
- else
- {
- return mBackend->listLayers(aComponent, aEntity) ;
- }
-}
-//------------------------------------------------------------------------------
-void BackendAccess::removeRequestListener(INodeDataListener *aListener,
- const ComponentRequest& aRequest)
- SAL_THROW(())
-{
-
- OSL_PRECOND(aListener, "ERROR: trying to remove a NULL listener");
- mNotifier->removeListener(aListener, aRequest);
-}
-//------------------------------------------------------------------------------
-} } // configmgr.backend
diff --git a/configmgr/source/backend/backendaccess.hxx b/configmgr/source/backend/backendaccess.hxx
deleted file mode 100644
index 9e8bfef86c05..000000000000
--- a/configmgr/source/backend/backendaccess.hxx
+++ /dev/null
@@ -1,157 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_BACKENDACCESS_HXX_
-#define CONFIGMGR_BACKEND_BACKENDACCESS_HXX_
-
-#include "backendnotifier.hxx"
-#include "mergeddataprovider.hxx"
-#include "mergedcomponentdata.hxx"
-#include "matchlocale.hxx"
-#include <com/sun/star/configuration/backend/XLayer.hpp>
-#include <com/sun/star/configuration/backend/XSchema.hpp>
-#include <com/sun/star/configuration/backend/XBackend.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include "binarycache.hxx"
-#include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
-
-
-namespace configmgr { namespace backend {
-
-namespace css = com::sun::star ;
-namespace uno = css::uno ;
-namespace lang = css::lang ;
-namespace backenduno = css::configuration::backend ;
-
-/**
- Implementation of IMergedDataProvider handling the access
- to the configuration data.
- */
-class BackendAccess : public IMergedDataProvider
-{
- public :
- /**
- Constructor using an XBackend implementation and a
- service factory.
-
- @param xBackend backend used for access to data
- @param xContext uno context for instantiation of services
- */
- BackendAccess( const uno::Reference<backenduno::XBackend>& xBackend,
- const uno::Reference<uno::XComponentContext>& xContext) ;
- /** Destructor */
- ~BackendAccess(void) ;
-
- // IMergedDataProvider
- virtual ResultHolder< ComponentInstance > getNodeData(const ComponentRequest& aRequest,
- ITemplateDataProvider* aTemplateProvider,
- INodeDataListener *aListener = NULL)
- SAL_THROW((com::sun::star::uno::Exception)) ;
- virtual void removeRequestListener(INodeDataListener *aListener,
- const ComponentRequest& aRequest)
- SAL_THROW(());
- virtual void updateNodeData(const UpdateRequest& aUpdate)
- SAL_THROW((com::sun::star::uno::Exception)) ;
- virtual ResultHolder< NodeInstance > getDefaultData(const NodeRequest& aRequest)
- SAL_THROW((com::sun::star::uno::Exception)) ;
- virtual ResultHolder< TemplateInstance > getTemplateData(const TemplateRequest& aRequest)
- SAL_THROW((com::sun::star::uno::Exception)) ;
-
- private :
-
- /**
- Retrieves the schema of a component.
- */
- uno::Reference< backenduno::XSchema > getSchema(const rtl::OUString& aComponent) ;
-
- /**
- Retrieves the schema version of a component.
- */
- rtl::OUString getSchemaVersion(const rtl::OUString& aComponent) ;
-
- /**
- Retrieves the layers for a request.
- */
- uno::Sequence< uno::Reference<backenduno::XLayer> > getLayers(const rtl::OUString& aComponent,const RequestOptions& aOptions) ;
-
- /**
- Reads merged default data with a given number of layers.
- */
- bool readDefaultData( MergedComponentData & aComponentData,
- rtl::OUString const & aComponent,
- RequestOptions const & aOptions,
- bool bIncludeTemplates,
- const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- ITemplateDataProvider *aTemplateProvider,
- sal_Int32 * pLayersMerged = 0)
- SAL_THROW((com::sun::star::uno::Exception));
- /**
- Merges layers onto component data.
- */
- void merge(
- MergedComponentData& aData,
- const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 aNumLayers,
- com::sun::star::lang::Locale const & aRequestedLocale,
- std::vector< com::sun::star::lang::Locale > & inoutMergedLocales,
- ITemplateDataProvider *aTemplateProvider,
- sal_Int32 * pLayersMerged = 0)
- SAL_THROW((com::sun::star::uno::Exception));
- private :
- /**
- Decides if merging should be retried after an exception.
-
- @throws com::sun::star::uno::Exception
- if not approved
- */
- bool approveRecovery(
- const uno::Any & aMergeException,
- const uno::Reference<backenduno::XLayer> & aBrokenLayer,
- bool bUserLayerData)
- SAL_THROW((com::sun::star::uno::Exception));
-
- private :
- /** Get the factory used for service invocation */
- uno::Reference<lang::XMultiServiceFactory> getServiceFactory() const;
- /** UNO context to which this backend belongs */
- uno::Reference<uno::XComponentContext> mContext ;
- /** Backend being accessed */
- uno::Reference<backenduno::XBackend> mBackend ;
- /** Binary cache of default data */
- BinaryCache mBinaryCache;
- /** Manages Nofification from the Backends */
- uno::Reference<backenduno::XBackendChangesListener> mXNotifier;
-
- BackendChangeNotifier * mNotifier;
-
-} ;
-
-} } // configmgr.backend
-
-#endif // CONFIGMGR_BACKEND_BACKENDACCESS_HXX_
diff --git a/configmgr/source/backend/backendfactory.cxx b/configmgr/source/backend/backendfactory.cxx
deleted file mode 100644
index 46f3ce65186b..000000000000
--- a/configmgr/source/backend/backendfactory.cxx
+++ /dev/null
@@ -1,329 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "backendfactory.hxx"
-
-#ifndef CONFIGMGR_API_FACTORY_HXX_
-#include "confapifactory.hxx"
-#endif
-#include "bootstrapcontext.hxx"
-#include "bootstrap.hxx"
-#include "backendaccess.hxx"
-#include "serviceinfohelper.hxx"
-#include "wrapexception.hxx"
-
-
-#include <com/sun/star/configuration/CannotLoadConfigurationException.hpp>
-#include <com/sun/star/configuration/backend/XBackend.hpp>
-#include <com/sun/star/configuration/backend/XMultiLayerStratum.hpp>
-
-namespace configmgr
-{
-// -------------------------------------------------------------------------
- namespace backend
- {
-// -------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -------------------------------------------------------------------------
-const sal_Char k_DefaultBackendWrapper[] = "com.sun.star.comp.configuration.backend.SingleBackendAdapter";
-const sal_Char k_DefaultBackendService[] = "com.sun.star.comp.configuration.backend.LocalSingleBackend";
-
-// -------------------------------------------------------------------------
-const sal_Char k_DefaultBackendServiceAndImplName[] = K_DefaultBackendServiceAndImplName ;
-
-// -------------------------------------------------------------------------
-const sal_Char k_GenericBackendServiceAndImplName[] = "com.sun.star.configuration.backend.Backend" ;
-
-// -------------------------------------------------------------------------
-static sal_Char const * const k_BackendServiceNames [] =
-{
- k_DefaultBackendServiceAndImplName,
- k_GenericBackendServiceAndImplName,
- 0
-};
-// -------------------------------------------------------------------------
-static const ServiceRegistrationInfo k_DefaultBackendServiceInfo =
-{
- k_DefaultBackendServiceAndImplName,
- k_BackendServiceNames
-};
-// -------------------------------------------------------------------------
-static const ServiceRegistrationInfo k_GenericBackendServiceInfo =
-{
- k_GenericBackendServiceAndImplName,
- k_BackendServiceNames + 1
-};
-// -------------------------------------------------------------------------
-static const SingletonRegistrationInfo k_DefaultBackendSingletonInfo =
-{
- K_DefaultBackendSingletonName,
- k_DefaultBackendServiceAndImplName,
- k_DefaultBackendServiceAndImplName,
- & k_GenericBackendServiceInfo
-};
-// -------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-const SingletonRegistrationInfo * getDefaultBackendSingletonInfo()
-{
- return & k_DefaultBackendSingletonInfo;
-}
-// -------------------------------------------------------------------------
-
-const ServiceRegistrationInfo * getDefaultBackendServiceInfo()
-{
- return & k_DefaultBackendServiceInfo;
-}
-// -------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-
-uno::Reference<uno::XInterface> SAL_CALL
- getDefaultBackendSingleton( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const& xContext )
-{
- OSL_ENSURE( xContext.is(), "ERROR: NULL context has no singletons" );
-
- UnoContextTunnel aTunnel;
- aTunnel.passthru( xContext );
-
- uno::Reference<uno::XInterface> xResult;
-
- if (xContext.is())
- try
- {
- xContext->getValueByName(SINGLETON(K_DefaultBackendSingletonName))
- >>= xResult;
- }
- catch (uno::Exception & )
- {
- // to do: really use the tunneled failure when that is set properly
- if ( aTunnel.recoverFailure(true).hasValue() )
- {
- // have a failure, but can't recover it
- // -> try to regenerate
- instantiateDefaultBackend(xContext);
-
- OSL_ENSURE(false, "Cannot recreate configuration backend instantiation failure - using generic error");
- }
- // cannot recover any failure
- throw;
- }
-
- return xResult;
-}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-
-static
-uno::Sequence< uno::Any > createInitArgs(ContextReader const & _aContext)
-{
- OSL_ASSERT(_aContext.hasBootstrapContext());
- uno::Sequence< uno::Any > aResult( 1 );
- aResult[0] <<= _aContext.getBootstrapContext();
- return aResult;
-}
-// -------------------------------------------------------------------------
-
-static
-inline
-uno::Reference< uno::XInterface > createService(ContextReader const & _aCtx, uno::Sequence< uno::Any > const & _aInitArgs, rtl::OUString const & _aSvc)
-{
- uno::Reference< lang::XMultiComponentFactory > xFactory = _aCtx.getServiceManager();
- OSL_ENSURE(xFactory.is(),"ERROR: ComponentContext has no service manager\n");
- if (!xFactory.is()) throw uno::RuntimeException( rtl::OUString::createFromAscii("ERROR: ComponentContext has no service manager\n"), NULL );
- return xFactory->createInstanceWithArgumentsAndContext( _aSvc, _aInitArgs, _aCtx.getBaseContext());
-}
-// -------------------------------------------------------------------------
-
-static
-uno::Reference< backenduno::XBackend > wrapSingleBackend(ContextReader const & _aSettings, uno::Sequence< uno::Any > const & _aInitArgs, uno::Reference< backenduno::XMultiLayerStratum > const & _xWrappedBackend)
-{
- OSL_ASSERT(_aSettings.hasUnoBackendWrapper() || _aSettings.hasBootstrapContext());
-
- rtl::OUString aWrapperSvc = _aSettings.hasUnoBackendWrapper() ?
- _aSettings.getUnoBackendWrapper() :
- rtl::OUString::createFromAscii(k_DefaultBackendWrapper);
-
- OSL_ENSURE (aWrapperSvc.getLength(), "ERROR: No wrapper service for wrapped configuration");
- OSL_ENSURE (_xWrappedBackend.is(), "ERROR: No backend to wrap for wrapped configuration");
-
- sal_Int32 const nBaseArgsCount = _aInitArgs.getLength();
- uno::Sequence< uno::Any > aExtendedArgs( _aInitArgs );
- aExtendedArgs.realloc( nBaseArgsCount + 1 );
- aExtendedArgs[nBaseArgsCount] <<= _xWrappedBackend;
-
- return uno::Reference< backenduno::XBackend >::query( createService(_aSettings,aExtendedArgs,aWrapperSvc) );
-}
-// -------------------------------------------------------------------------
-
-static
-uno::Reference< backenduno::XBackend > createOfflineBackend(ContextReader const & _aSettings, uno::Sequence< uno::Any > const & _aInitArgs)
-{
- OSL_ASSERT(_aSettings.hasUnoBackendWrapper() || _aSettings.hasBootstrapContext());
-
- uno::Reference< backenduno::XBackend > xResult;
- if ( _aSettings.hasUnoBackendWrapper() )
- {
- rtl::OUString const aWrapperSvc = _aSettings.getUnoBackendWrapper();
-
- xResult = uno::Reference< backenduno::XBackend >::query( createService(_aSettings,_aInitArgs,aWrapperSvc) );
- }
-
- return xResult;
-}
-// -------------------------------------------------------------------------
-
-static
-uno::Reference< uno::XInterface > createRealBackend(ContextReader const & _aSettings, uno::Sequence< uno::Any > const & _aInitArgs)
-{
- OSL_ASSERT(_aSettings.hasUnoBackendService() || _aSettings.hasBootstrapContext());
-
- rtl::OUString const aBackendServiceName = _aSettings.hasUnoBackendService() ?
- _aSettings.getUnoBackendService() :
- rtl::OUString::createFromAscii(k_DefaultBackendService);
-
- uno::Reference< uno::XInterface > xResult =
- createService(_aSettings,_aInitArgs,aBackendServiceName);
-
- return xResult;
-}
-// -------------------------------------------------------------------------
-
-static
-uno::Reference< backenduno::XBackend > createOnlineBackend(ContextReader const & _aSettings, uno::Sequence< uno::Any > const & _aInitArgs)
-{
- OSL_ENSURE( _aSettings.isUnoBackend(), "ERROR - BackendFactory: For legacy backends use createSessionBackend()");
-
- uno::Reference< backenduno::XBackend > xResult;
-
- uno::Reference< uno::XInterface > xRealBackend = createRealBackend(_aSettings,_aInitArgs);
-
- if (_aSettings.hasUnoBackendWrapper())
- {
- // try wrapping a single backend
- uno::Reference< backenduno::XMultiLayerStratum > xSingleRealBackend( xRealBackend, uno::UNO_QUERY);
- if (xSingleRealBackend.is())
- xResult = wrapSingleBackend(_aSettings,_aInitArgs,xSingleRealBackend);
-
- // if we don't have one, try using it as unwrapped backend
- else
- xResult.set(xRealBackend, uno::UNO_QUERY);
- }
- else
- {
- // look for a direct implementation of XBackend
- xResult.set(xRealBackend, uno::UNO_QUERY);
- if (!xResult.is())
- {
- // try the default wrapper if we only have a single backend
- uno::Reference< backenduno::XMultiLayerStratum > xSingleRealBackend( xRealBackend, uno::UNO_QUERY);
- if (xSingleRealBackend.is())
- xResult = wrapSingleBackend(_aSettings,_aInitArgs,xSingleRealBackend);
-
- else
- OSL_ENSURE( !xRealBackend.is(), "Configuration Backend implements no known backend interface" );
- }
- }
-
- return xResult;
-}
-// -------------------------------------------------------------------------
-
-static uno::Reference< backenduno::XBackend > createUnoBackend(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const& _xCtx)
-{
- ContextReader aSettings(_xCtx);
- OSL_ENSURE( aSettings.isUnoBackend(), "ERROR - BackendFactory: Legacy backends are not supported any more");
-
- uno::Sequence< uno::Any > aArguments = createInitArgs(aSettings);
-
- sal_Bool bOffline = aSettings.hasOfflineSetting() ? aSettings.getOfflineSetting() : !aSettings.hasUnoBackendService();
-
- uno::Reference< backenduno::XBackend > xResult;
-
- if (!bOffline)
- xResult = createOnlineBackend (aSettings,aArguments);
-
- if (!xResult.is())
- xResult = createOfflineBackend(aSettings,aArguments);
-
- return xResult;
-}
-// -------------------------------------------------------------------------
-// to do: tunnel and raise fully typed exception information (and use it in the get..Singleton wrappers)
- #define TUNNEL_ALL_EXCEPTIONS() \
- WRAP_CONFIGBACKEND_CREATION_EXCEPTIONS1( UnoContextTunnel::tunnelFailure, true )
-
-// -------------------------------------------------------------------------
-
-uno::Reference<uno::XInterface> SAL_CALL instantiateDefaultBackend( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const& xTargetContext )
-{
- com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext = UnoContextTunnel::recoverContext(xTargetContext);
-
- try
- {
- return uno::Reference< uno::XInterface >( createUnoBackend(xContext), uno::UNO_QUERY );
- }
- TUNNEL_ALL_EXCEPTIONS()
-
- OSL_ASSERT(!"unreached");
- return NULL;
-}
-// -------------------------------------------------------------------------
-
-uno::Reference< backenduno::XBackend > BackendFactory::getUnoBackend()
-{
- return uno::Reference< backenduno::XBackend >::query( getDefaultBackendSingleton(m_xCtx) );
-}
-// -------------------------------------------------------------------------
-
-rtl::Reference<IMergedDataProvider> BackendFactory::createBackend()
-{
- rtl::Reference< IMergedDataProvider > xBackend;
-
- uno::Reference< backenduno::XBackend > xBackendService = this->getUnoBackend();
-
- if (xBackendService.is())
- xBackend = new BackendAccess(xBackendService, m_xCtx);
-
- return xBackend;
-}
-// -------------------------------------------------------------------------
-
-BackendFactory BackendFactory::instance(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & _xCtx)
-{
- return BackendFactory(_xCtx);
-}
-
-//-----------------------------------------------------------------------------
- } // namespace
-//-----------------------------------------------------------------------------
-} // namespace
diff --git a/configmgr/source/backend/backendnotifier.cxx b/configmgr/source/backend/backendnotifier.cxx
deleted file mode 100644
index 1f51eb56cb8e..000000000000
--- a/configmgr/source/backend/backendnotifier.cxx
+++ /dev/null
@@ -1,195 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "backendnotifier.hxx"
-
-#ifndef INCLUDED_ALGORITHM
-#include <algorithm>
-#define INCLUDED_ALGORITHM
-#endif
-#include "configpath.hxx"
-
-namespace configmgr
-{
-// ---------------------------------------------------------------------------
- namespace backend
- {
-
-
-//----------------------------------------------------------------------------
-BackendChangeNotifier::BackendChangeNotifier(const uno::Reference<backenduno::XBackend>& _xBackend)
-: m_aMutex()
- ,m_aListeners()
- ,m_aBackend(_xBackend, uno::UNO_QUERY)
-{
-
-}
-// ---------------------------------------------------------------------------
-
-BackendChangeNotifier::~BackendChangeNotifier()
-{
- m_aListeners.clear();
-}
-// ---------------------------------------------------------------------------
-void SAL_CALL BackendChangeNotifier::componentDataChanged(const backenduno::ComponentChangeEvent& _aEvent)
- throw (::com::sun::star::uno::RuntimeException)
-{
- rtl::OUString aComponentName = _aEvent.Component;
- std::map<rtl::OUString, ComponentNotifier>::iterator aIter = m_aListeners.find(aComponentName);
- if(aIter != m_aListeners.end())
- {
- aIter->second.notifyListeners(aComponentName);
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL BackendChangeNotifier::disposing( lang::EventObject const & /*rSource*/ )
-throw (uno::RuntimeException)
-{
- osl::MutexGuard aListGuard(m_aMutex);
- if (m_aBackend.is())
- {
- m_aBackend.clear();
- }
- m_aListeners.clear();
-}
-// -----------------------------------------------------------------------------
-void BackendChangeNotifier::addListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) SAL_THROW(())
-{
- osl::MutexGuard aListGuard(m_aMutex);
-
- OSL_PRECOND(_xListener, "ERROR: trying to register a NULL listener");
- ComponentListener aComponentListener(_xListener, _aRequest.getOptions());
-
- const rtl::OUString aComponentName = _aRequest.getComponentName();
-
- //Check if we have a Listener registered for that Component
- std::map<rtl::OUString, ComponentNotifier>::iterator aIter;
- aIter = m_aListeners.find(aComponentName);
- if (aIter == m_aListeners.end())
- {
- ComponentNotifier aComponentNotifier;
- aComponentNotifier.addListenerToList(aComponentListener);
- m_aListeners[aComponentName] = aComponentNotifier;
-
- //Now need to register Listener with MultiStratumBackend for that Component
- if (m_aBackend.is())
- {
- m_aBackend->addChangesListener(this, aComponentName);
- }
- }
- else
- {
- //Add Listener and Option to ComponentNotifier list
- aIter->second.addListenerToList(aComponentListener);
-
- }
-
-}
-// ---------------------------------------------------------------------------
-
-void BackendChangeNotifier::removeListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) SAL_THROW(())
-{
- osl::MutexGuard aListGuard(m_aMutex);
- OSL_PRECOND(!m_aListeners.empty(),
- "BackendChangeNotifier:Cannot Remove Listener, no Listeners Registered");
- OSL_PRECOND(_xListener, "ERROR: trying to remove a NULL listener");
-
- std::map<rtl::OUString, ComponentNotifier>::iterator aIter;
- rtl::OUString aComponentName = _aRequest.getComponentName();
-
- aIter = m_aListeners.find(aComponentName);
- if (aIter == m_aListeners.end())
- {
- OSL_TRACE("BackendChangeNotifier: removeListener: no listener registered for component %s",
- aComponentName.getStr());
- }
- else
- {
- ComponentListener aComponentListener(_xListener, _aRequest.getOptions());
- aIter->second.removeListenerFromList(aComponentListener);
- if (aIter->second.isListEmpty())
- {
- m_aListeners.erase(aIter);
- //Need all to de-register listeners from the lower layers
- if (m_aBackend.is())
- {
- m_aBackend->removeChangesListener(this, aComponentName);
- }
- }
- }
-
-}
-// ---------------------------------------------------------------------------
-ComponentNotifier::ComponentNotifier():m_aListenerList()
-{
-}
-// ---------------------------------------------------------------------------
-
-
-void ComponentNotifier::addListenerToList(const ComponentListener& _aListener)
-{
- m_aListenerList.push_back(_aListener);
- //REM TO REMOVE
- ComponentListener aListener = m_aListenerList.front();
-
-}
-// ---------------------------------------------------------------------------
-void ComponentNotifier::removeListenerFromList(const ComponentListener& _aListener)
-{
- OSL_PRECOND(!m_aListenerList.empty(),
- "ComponentNotifier:Cannot Remove Listener, no Listeners Registered");
-
- std::list<ComponentListener>::iterator aIter;
-
- //Remove first instance that matches in the list
- aIter = std::find(m_aListenerList.begin(), m_aListenerList.end(),_aListener);
- if(aIter != m_aListenerList.end())
- {
- m_aListenerList.erase(aIter);
- }
-}
-// ---------------------------------------------------------------------------
-void ComponentNotifier::notifyListeners(const rtl::OUString& _aComponent)
-{
-
- for( std::list<ComponentListener>::iterator aIter = m_aListenerList.begin();
- aIter != m_aListenerList.end(); aIter++)
- {
- ComponentRequest aRequest(_aComponent, (*aIter).m_aOptions);
-
- (*aIter).m_aListener->dataChanged(aRequest);
- }
-
-}
-// ---------------------------------------------------------------------------
- } // namespace backend
-
-// ---------------------------------------------------------------------------
-} // namespace configmgr
diff --git a/configmgr/source/backend/backendnotifier.hxx b/configmgr/source/backend/backendnotifier.hxx
deleted file mode 100644
index 78cd340624fc..000000000000
--- a/configmgr/source/backend/backendnotifier.hxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONFIGMGR_BACKEND_BACKENDNOTIFIER_HXX
-#define CONFIGMGR_BACKEND_BACKENDNOTIFIER_HXX
-
-#include "mergeddataprovider.hxx"
-#include <com/sun/star/configuration/backend/XBackend.hpp>
-#include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
-#include <osl/mutex.hxx>
-#include <cppuhelper/implbase1.hxx>
-
-#ifndef INCLUDED_MAP
-#include <map>
-#define INCLUDED_MAP
-#endif
-
-#ifndef INCLUDED_LIST
-#include <list>
-#define INCLUDED_LIST
-#endif
-
-
-namespace configmgr
-{
-// ---------------------------------------------------------------------------
- namespace backend
- {
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// ---------------------------------------------------------------------------
- struct ComponentListener
- {
- explicit
- ComponentListener(INodeDataListener * _xListener, RequestOptions _aOptions):
- m_aListener( _xListener),
- m_aOptions(_aOptions)
- {}
-
- bool operator==(const ComponentListener& _aListener)const
- {
- return ( (&m_aListener == &_aListener.m_aListener)&&
- (compareRequestOptions(m_aOptions, _aListener.m_aOptions)== 0) );
-
- }
- INodeDataListener * m_aListener;
- RequestOptions m_aOptions;
- };
-
- /** Class used to store ComponentListener(listener and options)
- */
- class ComponentNotifier
- {
- public:
- ComponentNotifier();
- void addListenerToList(const ComponentListener& _aListener);
- void removeListenerFromList(const ComponentListener& _aListener);
- bool isListEmpty(){ return m_aListenerList.empty();}
- void notifyListeners(const rtl::OUString& _aComponent);
- private:
- std::list<ComponentListener> m_aListenerList;
- };
- // ---------------------------------------------------------------------------
- /** Interface providing a multicasting service for changes in the backend
- */
- class BackendChangeNotifier :public cppu::WeakImplHelper1<backenduno::XBackendChangesListener>
- {
- public:
- BackendChangeNotifier(const uno::Reference<backenduno::XBackend>& _xBackend);
- ~BackendChangeNotifier();
-
- virtual void SAL_CALL componentDataChanged(const backenduno::ComponentChangeEvent& aEvent)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL disposing( lang::EventObject const & rSource )
- throw (uno::RuntimeException);
- // notification support.
- /// register a listener for observing changes to the cached data
- void addListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) SAL_THROW(());
- /// unregister a listener previously registered
- void removeListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) SAL_THROW(());
- private:
- osl::Mutex m_aMutex;
- std::map<rtl::OUString, ComponentNotifier> m_aListeners;
-
- /** Backend being accessed */
- uno::Reference<backenduno::XBackendChangesNotifier> m_aBackend ;
- };
-// ---------------------------------------------------------------------------
- } // namespace backend
-
-// ---------------------------------------------------------------------------
-} // namespace configmgr
-
-#endif
-
diff --git a/configmgr/source/backend/backendstratalistener.cxx b/configmgr/source/backend/backendstratalistener.cxx
deleted file mode 100644
index c1f763b8d650..000000000000
--- a/configmgr/source/backend/backendstratalistener.cxx
+++ /dev/null
@@ -1,56 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-#include "backendstratalistener.hxx"
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
- // -----------------------------------------------------------------------------
- BackendStrataListener::BackendStrataListener(const MultiStratumBackend& aBackend)
- :mBackend(aBackend)
- {}
- BackendStrataListener:: ~BackendStrataListener(){}
-
- void SAL_CALL BackendStrataListener::componentDataChanged(const backenduno::ComponentChangeEvent& aEvent)
- throw (::com::sun::star::uno::RuntimeException)
- {
-
- mBackend.notifyListeners(aEvent);
-
- }
- // -----------------------------------------------------------------------------
- void SAL_CALL BackendStrataListener::disposing( lang::EventObject const & /*rSource*/ )
- throw (uno::RuntimeException)
- {
-
- }
- }
-}
diff --git a/configmgr/source/backend/backendstratalistener.hxx b/configmgr/source/backend/backendstratalistener.hxx
deleted file mode 100644
index c9ac5309d13d..000000000000
--- a/configmgr/source/backend/backendstratalistener.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONFIGMGR_BACKEND_BACKENDSTRATALISTENER_HXX
-#define CONFIGMGR_BACKEND_BACKENDSTRATALISTENER_HXX
-
-#include <com/sun/star/configuration/backend/XBackendChangesListener.hpp>
-#include <com/sun/star/configuration/backend/ComponentChangeEvent.hpp>
-#include "backendnotifier.hxx"
-#include <com/sun/star/configuration/backend/XBackend.hpp>
-#include "multistratumbackend.hxx"
-
-
-#include <cppuhelper/implbase1.hxx>
-
-#ifndef INCLUDED_MAP
-#include <map>
-#define INCLUDED_MAP
-#endif
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
-
- namespace backenduno = ::com::sun::star::configuration::backend;
- // --------------------------------------------------------------------------
- class BackendStrataListener: public cppu::WeakImplHelper1<backenduno::XBackendChangesListener>
- {
- public:
- BackendStrataListener(const MultiStratumBackend& aBackend);
- ~BackendStrataListener();
- virtual void SAL_CALL componentDataChanged(const backenduno::ComponentChangeEvent& aEvent)
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL disposing( lang::EventObject const & rSource )
- throw (uno::RuntimeException);
- private:
- const MultiStratumBackend& mBackend ;
-
- };
-
-
-
- }
- // -----------------------------------------------------------------------------
-}
-// -----------------------------------------------------------------------------
-#endif
diff --git a/configmgr/source/backend/basicimporthandler.cxx b/configmgr/source/backend/basicimporthandler.cxx
deleted file mode 100644
index 7d763c51d661..000000000000
--- a/configmgr/source/backend/basicimporthandler.cxx
+++ /dev/null
@@ -1,114 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "basicimporthandler.hxx"
-#include <com/sun/star/configuration/backend/ComponentChangeEvent.hpp>
-#include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
-BasicImportHandler::BasicImportHandler(
- uno::Reference< backenduno::XBackend > const & xBackend,rtl::OUString const & aEntity, const sal_Bool& bNotify)
-: m_bSendNotification(bNotify)
-, m_xBackend(xBackend)
-, m_aComponentName()
-, m_aEntity(aEntity)
-{
- OSL_ENSURE( m_xBackend.is(), "Creating an import handler without a target backend" );
-}
-// -----------------------------------------------------------------------------
-
-BasicImportHandler::~BasicImportHandler()
-{
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- BasicImportHandler::startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- m_aComponentName = rtl::OUString();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- BasicImportHandler::endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if ( m_bSendNotification)
- {
- backenduno::ComponentChangeEvent aEvent;
- aEvent.Source=*this;
- aEvent.Component = m_aComponentName;
-
- uno::Reference<backenduno::XBackendChangesListener> xListener(m_xBackend, uno::UNO_QUERY);
- if( xListener.is())
- {
- xListener->componentDataChanged(aEvent);
- }
- else
- {
- OSL_ENSURE(false, "ImportMergeHandler: target backend does not support notifications");
- }
- }
- m_aComponentName = rtl::OUString();
-}
-// -----------------------------------------------------------------------------
-
-bool BasicImportHandler::startComponent( const rtl::OUString& aName )
-{
- if (hasComponent()) return false;
-
- m_aComponentName = aName;
- return true;
-}
-// -----------------------------------------------------------------------------
-
-void BasicImportHandler::raiseMalformedDataException(sal_Char const * pMsg)
-{
- rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
-
- throw backenduno::MalformedDataException(sMsg, *this, uno::Any());
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace
-
-// -----------------------------------------------------------------------------
-} // namespace
-
diff --git a/configmgr/source/backend/basicimporthandler.hxx b/configmgr/source/backend/basicimporthandler.hxx
deleted file mode 100644
index f2c217b28baa..000000000000
--- a/configmgr/source/backend/basicimporthandler.hxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_BASICIMPORTHANDLER_HXX
-#define CONFIGMGR_BACKEND_BASICIMPORTHANDLER_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
-#include <com/sun/star/configuration/backend/XBackend.hpp>
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-
- class BasicImportHandler : public cppu::WeakImplHelper1< backenduno::XLayerHandler >
- {
- public:
- explicit
- BasicImportHandler(){}
-
- BasicImportHandler(uno::Reference< backenduno::XBackend > const & xBackend,rtl::OUString const & aEntity = rtl::OUString(), const sal_Bool& bNofity= sal_False);
- ~BasicImportHandler();
-
- // XLayerHandler subset - call these implementations from your derived class implementations
- protected:
- virtual void SAL_CALL
- startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- protected:
- bool hasComponent() const { return m_aComponentName.getLength() != 0; }
- bool hasEntity() const { return m_aEntity.getLength() != 0; }
-
- rtl::OUString getComponent() const { return m_aComponentName; }
- rtl::OUString getEntity() const { return m_aEntity; }
- uno::Reference< backenduno::XBackend > getBackend() const { return m_xBackend; }
-
- bool startComponent( const rtl::OUString& aName );
-
- void raiseMalformedDataException(sal_Char const * pMsg);
- /** If True, notification should be send to backend
- */
- sal_Bool m_bSendNotification;
- private:
- uno::Reference< backenduno::XBackend > const m_xBackend;
- rtl::OUString m_aComponentName;
- rtl::OUString const m_aEntity;
-
- };
-// -----------------------------------------------------------------------------
- } // namespace xml
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/basicupdatemerger.cxx b/configmgr/source/backend/basicupdatemerger.cxx
deleted file mode 100644
index 67c47a24e9b4..000000000000
--- a/configmgr/source/backend/basicupdatemerger.cxx
+++ /dev/null
@@ -1,338 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "basicupdatemerger.hxx"
-#include "layerdefaultremover.hxx"
-
-#ifndef INCLUDED_ALGORITHM
-#include <algorithm>
-#define INCLUDED_ALGORITHM
-#endif
-#ifndef INCLUDED_ITERATOR
-#include <iterator>
-#define INCLUDED_ITERATOR
-#endif
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
-BasicUpdateMerger::BasicUpdateMerger( uno::Reference< backenduno::XLayer > const & _xSourceLayer )
-: m_xSourceLayer(_xSourceLayer)
-, m_xResultHandler()
-, m_nNesting(0)
-, m_bSkipping(false)
-{
-}
-// -----------------------------------------------------------------------------
-
-BasicUpdateMerger::~BasicUpdateMerger()
-{
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::readData( uno::Reference< backenduno::XLayerHandler > const & _xResultHandler )
- throw ( backenduno::MalformedDataException, lang::NullPointerException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!_xResultHandler.is())
- {
- rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("UpdateMerger: Error - NULL output handler unexpected") );
- throw lang::NullPointerException(sMsg,*this);
- }
- if (!m_xSourceLayer.is())
- {
- rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("UpdateMerger: Error - No source layer set") );
- throw lang::NullPointerException(sMsg,*this);
- }
-
- try
- {
- m_xResultHandler = new LayerDefaultRemover(_xResultHandler);
- m_xSourceLayer->readData( this );
- }
- catch (uno::Exception & )
- {
- m_xResultHandler.clear();
- throw;
- }
-
- m_xResultHandler.clear();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (m_nNesting)
- raiseMalformedDataException("UpdateMerger: Cannot start layer - layer already in progress");
-
- m_bSkipping = false;
-
- m_xResultHandler->startLayer();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (m_nNesting > 0)
- raiseMalformedDataException("UpdateMerger: Cannot end layer - data handling still in progress");
-
- this->flushContext();
-
- m_xResultHandler->endLayer();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->overrideNode(aName, aAttributes, bClear);
-
- pushLevel(aName);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->addOrReplaceNode(aName, aAttributes);
-
- pushLevel(aName);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->addOrReplaceNodeFromTemplate(aName, aTemplate, aAttributes);
-
- pushLevel(aName);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->endNode();
-
- popLevel();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->dropNode(aName);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->overrideProperty(aName, aAttributes, aType, bClear);
-
- pushLevel( rtl::OUString() ); // do not match context path to property names
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->endProperty();
-
- popLevel();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->setPropertyValue(aValue);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->setPropertyValueForLocale(aValue,aLocale);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->addProperty(aName, aAttributes, aType);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL BasicUpdateMerger::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isSkipping())
- m_xResultHandler->addPropertyWithValue(aName, aAttributes, aValue);
-}
-// -----------------------------------------------------------------------------
-
-void BasicUpdateMerger::raiseMalformedDataException(sal_Char const * pMsg)
-{
- rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
-
- throw backenduno::MalformedDataException(sMsg, *this, uno::Any());
-}
-// -----------------------------------------------------------------------------
-
-void BasicUpdateMerger::startSkipping()
-{
- OSL_PRECOND( m_nNesting == 0, "BasicUpdateMerger: starting to skip, while already forwarding data");
- m_nNesting = 1;
- m_bSkipping = true;
- OSL_POSTCOND( isHandling(), "BasicUpdateMerger: isHandling() is broken");
- OSL_POSTCOND( isSkipping(), "BasicUpdateMerger: isSkipping() is broken");
-}
-// -----------------------------------------------------------------------------
-
-
-void BasicUpdateMerger::pushLevel(rtl::OUString const & _aContext)
-{
- if (m_nNesting > 0)
- {
- ++m_nNesting;
- OSL_POSTCOND( isHandling(), "BasicUpdateMerger: level counting is broken" );
- }
- else if (m_nNesting < 0)
- {
- OSL_POSTCOND( isHandling(), "BasicUpdateMerger: level counting is broken" );
- }
- else if (m_aSearchPath.empty())
- {
- ++m_nNesting;
- OSL_POSTCOND( isHandling(), "BasicUpdateMerger: level counting is broken" );
- }
- else if ( m_aSearchPath.back().equals(_aContext) ) // search path is reverse - see findContext()
- {
- OSL_ENSURE( m_nNesting == 0, "BasicUpdateMerger: level count while searching must be zero");
-
- m_aSearchPath.pop_back();
- }
- else // start forwarding
- {
- m_nNesting = 1;
- OSL_POSTCOND( isHandling(), "BasicUpdateMerger: level counting is broken" );
- OSL_POSTCOND(!isSkipping(), "BasicUpdateMerger: skip flag set while searching " );
- }
-}
-// -----------------------------------------------------------------------------
-
-void BasicUpdateMerger::popLevel()
-{
- OSL_PRECOND( isHandling(), "BasicUpdateMerger: ending a node that wasn't handled here");
- if (m_nNesting > 0)
- {
- if (--m_nNesting == 0)
- m_bSkipping = false;
- }
- else if (m_nNesting == 0) // ending a context level, but the context is not yet gone
- {
- OSL_ENSURE( !m_aSearchPath.empty(), "BasicUpdateMerger: flushing a context that was already found");
- flushContext();
- leaveContext();
- }
- else
- {
- OSL_ENSURE( m_aSearchPath.empty(), "BasicUpdateMerger: Left an unfinished context" );
- }
-}
-// -----------------------------------------------------------------------------
-
-void BasicUpdateMerger::findContext(std::vector<rtl::OUString> const & _aContext)
-{
- // make the context a *reverse* copy of the context path
- OSL_PRECOND( ! isHandling(), "BasicUpdateMerger: starting context search while still handling data");
- m_aSearchPath.clear();
- m_aSearchPath.reserve(_aContext.size());
- std::copy( _aContext.rbegin(), _aContext.rend(), std::back_inserter(m_aSearchPath) );
-}
-// -----------------------------------------------------------------------------
-
-void BasicUpdateMerger::leaveContext()
-{
- OSL_PRECOND( !isHandling(), "BasicUpdateMerger: ending the context while still handling data or seaching the context");
-
- // force
- m_nNesting = -1;
-
- OSL_POSTCOND( ! isSkipping(), "BasicUpdateMerger: ending the context node while still skipping data");
- OSL_POSTCOND( isHandling(), "BasicUpdateMerger: cannot mark context as being handled to the end.");
-}
-// -----------------------------------------------------------------------------
-
-void BasicUpdateMerger::flushContext()
-{
- std::vector<rtl::OUString>::size_type nNesting = m_aSearchPath.size();
-
- while (!m_aSearchPath.empty())
- {
- m_xResultHandler->overrideNode(m_aSearchPath.back(), 0, false);
- m_aSearchPath.pop_back();
- }
- this->flushUpdate();
-
- while (nNesting > 0)
- {
- m_xResultHandler->endNode();
- --nNesting;
- }
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace
-
-// -----------------------------------------------------------------------------
-} // namespace
-
diff --git a/configmgr/source/backend/basicupdatemerger.hxx b/configmgr/source/backend/basicupdatemerger.hxx
deleted file mode 100644
index 13e1940a86c6..000000000000
--- a/configmgr/source/backend/basicupdatemerger.hxx
+++ /dev/null
@@ -1,157 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_BASICUPDATEMERGER_HXX
-#define CONFIGMGR_BACKEND_BASICUPDATEMERGER_HXX
-
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
-#include <com/sun/star/configuration/backend/XLayer.hpp>
-
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-
- class BasicUpdateMerger : public cppu::WeakImplHelper2< backenduno::XLayerHandler, backenduno::XLayer >
- {
- public:
- explicit
- BasicUpdateMerger(uno::Reference< backenduno::XLayer > const & _xSourceLayer);
- ~BasicUpdateMerger();
-
- // XLayerHandler
- protected:
- virtual void SAL_CALL
- startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- // XLayer
- protected:
- virtual void SAL_CALL
- readData( const uno::Reference< backenduno::XLayerHandler >& aHandler )
- throw (backenduno::MalformedDataException, lang::NullPointerException, lang::WrappedTargetException, uno::RuntimeException);
-
- // new overrideable
- private:
- /// write the whole update to the output
- virtual void flushUpdate() = 0;
-
- protected:
- bool isHandling() const { return m_nNesting != 0 || !m_aSearchPath.empty(); }
- bool isSkipping() const { return m_bSkipping; }
- void startSkipping();
-
- void findContext(std::vector<rtl::OUString> const & _aContext);
- void leaveContext();
-
- uno::Reference< backenduno::XLayerHandler > getResultWriter() const { return m_xResultHandler; };
-
- void raiseMalformedDataException(sal_Char const * pMsg);
- private:
- void pushLevel(rtl::OUString const & _aLevel);
- void popLevel();
-
- void flushContext();
- private:
- uno::Reference< backenduno::XLayer > m_xSourceLayer;
- uno::Reference< backenduno::XLayerHandler > m_xResultHandler;
- std::vector<rtl::OUString> m_aSearchPath;
-
- sal_Int16 m_nNesting;
- bool m_bSkipping;
- };
-// -----------------------------------------------------------------------------
- } // namespace xml
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/binarycache.cxx b/configmgr/source/backend/binarycache.cxx
deleted file mode 100644
index 263c129c809d..000000000000
--- a/configmgr/source/backend/binarycache.cxx
+++ /dev/null
@@ -1,248 +0,0 @@
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "binarycache.hxx"
-
-#include "binaryreadhandler.hxx"
-#include "binarywritehandler.hxx"
-
-#include "mergedcomponentdata.hxx"
-#include "filehelper.hxx"
-#include "typeconverter.hxx"
-
-#ifndef _CONFIGMGR_BOOTSTRAP_HXX
-#include "bootstrap.hxx"
-#endif
-#include <osl/file.hxx>
-#include "tools/getprocessworkingdir.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <rtl/logfile.hxx>
-
-#define RTL_LOGFILE_OU2A(rtlOUString) (::rtl::OUStringToOString((rtlOUString), RTL_TEXTENCODING_ASCII_US).getStr())
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- const rtl::OUString aSettingName(
- RTL_CONSTASCII_USTRINGPARAM( CONTEXT_ITEM_PREFIX_ "CacheUrl"));
- // ---------------------------------------------------------------------------------------
- static inline bool isValidFileURL (rtl::OUString const& _sFileURL)
- {
- rtl::OUString sSystemPath;
- return _sFileURL.getLength() && (osl::File::E_None == osl::File::getSystemPathFromFileURL(_sFileURL, sSystemPath));
- }
- // -----------------------------------------------------------------------------
- // ---------------------------------------------------------------------------------------
- static
- bool implEnsureAbsoluteURL(rtl::OUString & _rsURL) // also strips embedded dots etc.
- {
- if (!_rsURL.getLength())
- return false;
-
- if (!isValidFileURL(_rsURL))
- {
- OSL_TRACE("Binary cache: File URL %s is invalid.",
- rtl::OUStringToOString(_rsURL,RTL_TEXTENCODING_ASCII_US).getStr());
- return false;
- }
-
- rtl::OUString sBasePath;
- OSL_VERIFY(tools::getProcessWorkingDir(&sBasePath));
-
- rtl::OUString sAbsolute;
- if ( osl::File::E_None == osl::File::getAbsoluteFileURL(sBasePath, _rsURL, sAbsolute))
- {
- _rsURL = sAbsolute;
- return isValidFileURL(_rsURL);
- }
- else
- {
- OSL_ENSURE(!isValidFileURL(_rsURL), "Could not get absolute file URL for valid URL");
- return false;
- }
- }
- // ---------------------------------------------------------------------------------------
- static const sal_Unicode kComponentSeparator = '.' ;
- static const sal_Unicode kPathSeparator = '/' ;
- static const char kBinarySuffix[] = ".dat" ;
-
- rtl::OUString BinaryCache::getCacheFileURL(const rtl::OUString& aComponent) const
- {
- rtl::OUStringBuffer retCode (mBaseURL);
- retCode.append(kPathSeparator) ;
- // retCode.append(aComponent.replace(kComponentSeparator, kPathSeparator)) ;
- retCode.append(aComponent) ;
- retCode.appendAscii(RTL_CONSTASCII_STRINGPARAM(kBinarySuffix));
-
- rtl::OUString aResult = retCode.makeStringAndClear() ;
-
- if (isValidFileURL(aResult))
- {
- return aResult;
- }
- else
- {
- OSL_ENSURE(false, "Component File URL is invalid");
- return rtl::OUString();
- }
- }
- // -----------------------------------------------------------------------------
- BinaryCache::BinaryCache(const uno::Reference<uno::XComponentContext>& xContext )
- : mBaseURL()
- , mOwnerEntity()
- , mbCacheEnabled(false)
- {
-
- //initialise the base URL
- ContextReader aReader(xContext);
-
- rtl::OUString sCacheUrl;
- if (!aReader.isAdminService())
- {
- mbCacheEnabled = (aReader.getBestContext()->getValueByName(aSettingName) >>= sCacheUrl)
- && implEnsureAbsoluteURL(sCacheUrl);
- }
-
- if (mbCacheEnabled)
- {
- mBaseURL = sCacheUrl;
- if (!FileHelper::dirExists(sCacheUrl))
- {
- osl::File::RC errorCode = FileHelper::mkdirs(sCacheUrl);
- if (errorCode)
- {
-#if (OSL_DEBUG_LEVEL > 0)
- rtl::OString sURL = rtl::OUStringToOString(sCacheUrl,RTL_TEXTENCODING_ASCII_US);
- rtl::OString sErr = rtl::OUStringToOString(FileHelper::createOSLErrorString(errorCode),RTL_TEXTENCODING_ASCII_US);
- ::osl_trace("Configuration: Cannot create cache directory \"%s\". "
- "Error is %s [%d]",sURL.getStr(),sErr.getStr(),int(errorCode)) ;
-#endif
- mbCacheEnabled = false;
- }
- }
- }
- }
- // -----------------------------------------------------------------------------
-
- void BinaryCache::setOwnerEntity(const rtl::OUString & aOwnerEntity)
- {
- OSL_PRECOND(mOwnerEntity.getLength() == 0, "Owner entity of cache already set");
- mOwnerEntity = aOwnerEntity;
- }
- // -----------------------------------------------------------------------------
-
- void BinaryCache::disableCache()
- {
- mbCacheEnabled = false;
- }
- // -----------------------------------------------------------------------------
-
- bool BinaryCache::isCacheEnabled(rtl::OUString const & aEntity) const
- {
- if (!mbCacheEnabled) return false;
-
- // default entity is empty
- if (aEntity.getLength() == 0) return true;
-
- return aEntity.equals(mOwnerEntity);
- }
- // -----------------------------------------------------------------------------
- bool BinaryCache::readComponentData(MergedComponentData & aComponentData,
- uno::Reference< lang::XMultiServiceFactory > const & aFactory,
- rtl::OUString const & aComponent,
- rtl::OUString const & aSchemaVersion,
- rtl::OUString const & aEntity,
- com::sun::star::lang::Locale const & aRequestedLocale,
- std::vector< com::sun::star::lang::Locale > & outKnownLocales,
- const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- bool bIncludeTemplates)
- {
- if (isCacheEnabled(aEntity))
- try
- {
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BinaryCache", "jb99855", "configmgr: BinaryCache::readComponentData() - enabled");
- BinaryReadHandler aCacheReader(getCacheFileURL(aComponent),aComponent,aFactory);
-
- // #i49148# Invalidate cache when schema version changes - using former 'owner' parameter for version
- if(aCacheReader.validateHeader(pLayers, nNumLayers, aSchemaVersion, aRequestedLocale, outKnownLocales))
- {
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog1, "configmgr::backend::BinaryCache", "jb99855", "configmgr: BinaryCache::readComponentData() - cache hit");
- aComponentData.setSchemaRoot( aCacheReader.readComponentTree() );
- if (bIncludeTemplates)
- aComponentData.setTemplatesTree( aCacheReader.readTemplatesTree() );
- return true;
- }
- }
- catch (uno::Exception & e)
- {
- OSL_TRACE("Binary Cache read failed - exception: %s", rtl::OUStringToOString(e.Message,RTL_TEXTENCODING_ASCII_US).getStr());
- }
- return false;
- }
- // -----------------------------------------------------------------------------
-
- bool BinaryCache::writeComponentData(MergedComponentData const & aComponentData,
- uno::Reference< lang::XMultiServiceFactory > const & aFactory,
- rtl::OUString const & aComponent,
- rtl::OUString const & aSchemaVersion,
- rtl::OUString const & aEntity,
- std::vector< com::sun::star::lang::Locale > const & aKnownLocales,
- const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers)
- {
- if (isCacheEnabled(aEntity))
- try
- {
- RTL_LOGFILE_CONTEXT_AUTHOR(aLog3, "configmgr::backend::BinaryCache", "jb99855", "configmgr: BinaryCache::writeComponentData() - enabled");
- BinaryWriteHandler aCacheWriter(getCacheFileURL(aComponent),aComponent, aFactory);
-
- //write data to cache
- // #i49148# Invalidate cache when schema version changes - using former 'owner' parameter for schema
- if (aCacheWriter.generateHeader(pLayers, nNumLayers, aSchemaVersion, aKnownLocales))
- {
- aCacheWriter.writeComponentTree(aComponentData.getSchemaTree());
- aCacheWriter.writeTemplatesTree(aComponentData.getTemplatesTree());
- return true;
- }
- }
- catch (uno::Exception & e)
- {
- OSL_TRACE("Configuration: Cache write failed - exception: %s", rtl::OUStringToOString(e.Message,RTL_TEXTENCODING_ASCII_US).getStr());
- }
- return false;
- }
- // -----------------------------------------------------------------------------
-
- }
-// -----------------------------------------------------------------------------
-}
diff --git a/configmgr/source/backend/binarycache.hxx b/configmgr/source/backend/binarycache.hxx
deleted file mode 100644
index 1e1035faca9f..000000000000
--- a/configmgr/source/backend/binarycache.hxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONFIGMGR_BINARYCACHE_HXX
-#define CONFIGMGR_BINARYCACHE_HXX
-
-#include "matchlocale.hxx"
-
-#include <rtl/ustring.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/configuration/backend/XLayer.hpp>
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- namespace css = com::sun::star ;
- namespace uno = css::uno ;
- namespace lang = css::lang ;
- namespace backenduno = css::configuration::backend ;
-
- // -----------------------------------------------------------------------------
- class MergedComponentData;
-
- // -----------------------------------------------------------------------------
-
- class BinaryCache
- {
- public:
- explicit
- BinaryCache(const uno::Reference<uno::XComponentContext>& xContext);
-
- void setOwnerEntity(rtl::OUString const & aOwnerEntity);
- void disableCache();
-
- bool isCacheEnabled(rtl::OUString const & aEntity) const;
-
- rtl::OUString getCacheFileURL(rtl::OUString const & aComponent) const;
-
- bool readComponentData(MergedComponentData & aComponentData,
- uno::Reference< lang::XMultiServiceFactory > const & aFactory,
- rtl::OUString const & aComponent,
- rtl::OUString const & aSchemaVersion,
- rtl::OUString const & aEntity,
- com::sun::star::lang::Locale const & aRequestedLocale,
- std::vector< com::sun::star::lang::Locale > & outKnownLocales,
- const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- bool bIncludeTemplates = true);
-
- bool writeComponentData(MergedComponentData const & aComponentData,
- uno::Reference< lang::XMultiServiceFactory > const & aFactory,
- rtl::OUString const & aComponent,
- rtl::OUString const & aSchemaVersion,
- rtl::OUString const & aEntity,
- std::vector< com::sun::star::lang::Locale > const & aKnownLocales,
- const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers);
- private:
- rtl::OUString mBaseURL;
- rtl::OUString mOwnerEntity;
- bool mbCacheEnabled;
- };
-
- // -----------------------------------------------------------------------------------
- // helper for cache reader implementations - see backendaccess.cxx for implementation
- uno::Sequence< rtl::OUString >
- getAvailableLocales(const uno::Reference<backenduno::XLayer> * pLayers, sal_Int32 nNumLayers);
- // -----------------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------------
-}
-
-#endif //
-
diff --git a/configmgr/source/backend/binaryreader.cxx b/configmgr/source/backend/binaryreader.cxx
deleted file mode 100644
index f1fa4dd03188..000000000000
--- a/configmgr/source/backend/binaryreader.cxx
+++ /dev/null
@@ -1,690 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "binaryreader.hxx"
-#include "binarytype.hxx"
-#include "valuenode.hxx"
-#include "filehelper.hxx"
-#include "oslstream.hxx"
-
-
-#include <com/sun/star/uno/Type.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#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>
-
-#include <cppuhelper/implbase1.hxx>
-#include <osl/file.hxx>
-
-#ifndef INCLUDED_ALGORITHM
-#include <algorithm>
-#define INCLUDED_ALGORITHM
-#endif
-#include "tracer.hxx"
-
-#define ASCII(x) rtl::OUString::createFromAscii(x)
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- namespace uno = com::sun::star::uno;
- namespace io = com::sun::star::io;
-
-
- // --------------------------------------------------------------------------
-
- inline rtl::OUString ErrorToMessage_Impl (osl::FileBase::RC eError)
- {
- return FileHelper::createOSLErrorString (eError);
- }
-
- // --------------------------------------------------------------------------
-
- class BinaryReader_Impl :
- public cppu::WeakImplHelper1< com::sun::star::io::XDataInputStream >
- {
- public:
- /** Construction.
- */
- explicit BinaryReader_Impl (rtl::OUString const & rFileUrl)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- /** XInputStream.
- */
- virtual sal_Int32 SAL_CALL readBytes (
- uno::Sequence<sal_Int8> & rData, sal_Int32 nBytesToRead)
- throw (
- io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException, uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL readSomeBytes (
- uno::Sequence<sal_Int8> & rData, sal_Int32 nBytesToRead)
- throw (
- io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException, uno::RuntimeException);
-
- virtual void SAL_CALL skipBytes (sal_Int32 nBytesToSkip)
- throw (
- io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException, uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL available()
- throw (
- io::NotConnectedException,
- io::IOException, uno::RuntimeException);
-
- virtual void SAL_CALL closeInput()
- throw (
- io::NotConnectedException,
- io::IOException, uno::RuntimeException);
-
-
- /** XDataInputStream.
- */
- virtual sal_Int8 SAL_CALL readBoolean()
- throw (
- io::IOException, uno::RuntimeException);
-
- virtual sal_Int8 SAL_CALL readByte()
- throw (
- io::IOException, uno::RuntimeException);
-
- virtual sal_Unicode SAL_CALL readChar()
- throw (
- io::IOException, uno::RuntimeException);
-
- virtual sal_Int16 SAL_CALL readShort()
- throw (
- io::IOException, uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL readLong()
- throw (
- io::IOException, uno::RuntimeException);
-
- virtual sal_Int64 SAL_CALL readHyper()
- throw (
- io::IOException, uno::RuntimeException);
-
- virtual float SAL_CALL readFloat()
- throw (
- io::IOException, uno::RuntimeException);
-
- virtual double SAL_CALL readDouble()
- throw (
- io::IOException, uno::RuntimeException);
-
- virtual rtl::OUString SAL_CALL readUTF()
- throw (
- io::IOException, uno::RuntimeException);
-
- protected:
- /** Destruction.
- */
- virtual ~BinaryReader_Impl();
-
- private:
- sal_uInt32 checkAvail(); // may throw NotConnectedException
- sal_uInt32 getMaxAvail(sal_Int32 nRequest); // may throw NotConnectedException, BufferSizeExceededException
- sal_uInt8 const * readBuffer(sal_uInt32 nRequired); // may throw NotConnectedException, UnexpectedEOFException
- private:
- /** Representation.
- */
- sal_uInt8 * m_pBuffer;
- sal_uInt32 m_nLength;
- sal_uInt32 m_nOffset;
-
- /** Not implemented.
- */
- BinaryReader_Impl (const BinaryReader_Impl&);
- BinaryReader_Impl& operator= (const BinaryReader_Impl&);
- };
-
- // --------------------------------------------------------------------------
- static inline void checkIOError(osl::File::RC errcode)
- {
- if (errcode != osl::FileBase::E_None)
- {
- throw io::IOException (ErrorToMessage_Impl (errcode), NULL);
- }
- }
- static void raiseBufferError()
- {
- rtl::OUString sMsg = rtl::OUString::createFromAscii("Cannot allocate Buffer: Too large");
- throw io:: BufferSizeExceededException(sMsg, NULL);
- }
- // -------------------------------------------------------------------------
- BinaryReader_Impl::BinaryReader_Impl (rtl::OUString const & rFileUrl)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- : m_pBuffer (0)
- , m_nLength (0)
- , m_nOffset (0)
- {
- osl::File aFile (rFileUrl);
-
- checkIOError( aFile.open (OpenFlag_Read) );
- sal_uInt64 nLength = 0;
- checkIOError( aFile.getSize (nLength) );
- if (nLength > 0xffffffff)
- raiseBufferError();
- m_nLength = sal_uInt32(nLength);
-
- sal_uInt8 *pBuffer = static_cast<sal_uInt8*>(rtl_allocateMemory (m_nLength));
- if (!pBuffer)
- raiseBufferError();
-
- sal_uInt64 nRead = 0;
- osl::File::RC result = aFile.read (pBuffer, nLength, nRead);
- if (result != osl::FileBase::E_None)
- {
- rtl_freeMemory (pBuffer);
- checkIOError( result );
- }
- if (nRead != nLength)
- {
- rtl_freeMemory (pBuffer);
- rtl::OUString sMsg = rtl::OUString::createFromAscii("BinaryCache - Could not read entire size of file: ");
- throw io::UnexpectedEOFException(sMsg.concat(rFileUrl),NULL);
- }
- m_pBuffer = pBuffer;
- }
-
- // --------------------------------------------------------------------------
-
- BinaryReader_Impl::~BinaryReader_Impl()
- {
- if (m_pBuffer) rtl_freeMemory (m_pBuffer);
- }
-
- // --------------------------------------------------------------------------
- // XInputStream implementation.
- // --------------------------------------------------------------------------
- sal_uInt32 BinaryReader_Impl::checkAvail ()
- {
- if (!m_pBuffer)
- {
- rtl::OUString sMsg = rtl::OUString::createFromAscii("BinaryCache - Stream is not open. No data available for reading.");
- throw io::NotConnectedException(sMsg,*this);
- }
- OSL_ASSERT(m_nLength >= m_nOffset);
- return m_nLength - m_nOffset;
- }
- // --------------------------------------------------------------------------
-
- sal_uInt32 BinaryReader_Impl::getMaxAvail (sal_Int32 nRequest)
- {
- if (nRequest < 0)
- {
- rtl::OUString sMsg = rtl::OUString::createFromAscii("BinaryCache - Invalid read request - negative byte count requested.");
- throw io::BufferSizeExceededException(sMsg,*this);
- }
- sal_uInt32 const uRequest = sal_uInt32(nRequest);
- sal_uInt32 const uAvail = checkAvail ();
- return std::min(uRequest,uAvail);
- }
- // --------------------------------------------------------------------------
-
- sal_uInt8 const * BinaryReader_Impl::readBuffer (sal_uInt32 nRequest)
- {
- sal_uInt32 const nAvail = checkAvail ();
- if (nRequest > nAvail)
- {
- rtl::OUString sMsg = rtl::OUString::createFromAscii("BinaryCache - Invalid file format - read past end-of-file.");
- throw io::UnexpectedEOFException(sMsg,*this);
- }
- sal_uInt8 const * pData = m_pBuffer + m_nOffset;
- m_nOffset += nRequest;
- return pData;
- }
- // --------------------------------------------------------------------------
-
- sal_Int32 SAL_CALL BinaryReader_Impl::readBytes (
- uno::Sequence<sal_Int8> & rData, sal_Int32 nBytesToRead)
- throw (
- io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException, uno::RuntimeException)
- {
- sal_uInt32 nRead = getMaxAvail(nBytesToRead);
- if (nRead > 0)
- {
- rData.realloc (nRead);
- memcpy (rData.getArray(), readBuffer(nRead), nRead);
- }
- return sal_Int32(nRead);
- }
-
- // --------------------------------------------------------------------------
-
- sal_Int32 SAL_CALL BinaryReader_Impl::readSomeBytes (
- uno::Sequence<sal_Int8> & rData, sal_Int32 nBytesToRead)
- throw (
- io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException, uno::RuntimeException)
- {
- return readBytes(rData,nBytesToRead);
- }
-
- // --------------------------------------------------------------------------
-
- void SAL_CALL BinaryReader_Impl::skipBytes (sal_Int32 nBytesToSkip)
- throw (
- io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException, uno::RuntimeException)
- {
- (void) readBuffer(sal_uInt32(nBytesToSkip));
- }
-
- // --------------------------------------------------------------------------
-
- sal_Int32 SAL_CALL BinaryReader_Impl::available()
- throw (
- io::NotConnectedException,
- io::IOException, uno::RuntimeException)
- {
- const sal_uInt32 nMaxAvail = 0x7FFFFFFF;
- const sal_uInt32 nAvail = checkAvail();
- return sal_Int32(std::min(nAvail,nMaxAvail));
- }
-
- // --------------------------------------------------------------------------
-
- void SAL_CALL BinaryReader_Impl::closeInput()
- throw (
- io::NotConnectedException,
- io::IOException, uno::RuntimeException)
- {
- OSL_ENSURE(m_pBuffer,"BinaryCache - Closing stream that is already closed");
- if (m_pBuffer)
- {
- rtl_freeMemory (m_pBuffer);
- m_pBuffer = 0;
- }
- }
-
- // --------------------------------------------------------------------------
- // XDataInputStream implementation.
- // --------------------------------------------------------------------------
-
- sal_Int8 SAL_CALL BinaryReader_Impl::readBoolean()
- throw (io::IOException, uno::RuntimeException)
- {
- return this->readByte();
- }
-
- // --------------------------------------------------------------------------
-
- sal_Int8 SAL_CALL BinaryReader_Impl::readByte()
- throw (io::IOException, uno::RuntimeException)
- {
- sal_Int8 result = sal_Int8(*readBuffer(1));
-
- return result;
- }
-
- // --------------------------------------------------------------------------
-
- sal_Unicode SAL_CALL BinaryReader_Impl::readChar()
- throw (io::IOException, uno::RuntimeException)
- {
- sal_Unicode result;
-
- sal_uInt8 const * pData = readBuffer(sizeof result);
-
- result = sal_Unicode(
- (sal_uInt16(pData[0]) << 8) |
- (sal_uInt16(pData[1]) << 0) );
-
- return result;
- }
-
- // --------------------------------------------------------------------------
-
- sal_Int16 SAL_CALL BinaryReader_Impl::readShort()
- throw (io::IOException, uno::RuntimeException)
- {
- sal_Int16 result;
-
- sal_uInt8 const * pData = readBuffer(sizeof result);
-
- result = sal_Int16(
- (sal_uInt16(pData[0]) << 8) |
- (sal_uInt16(pData[1]) << 0) );
-
- return result;
- }
-
- // --------------------------------------------------------------------------
-
- sal_Int32 SAL_CALL BinaryReader_Impl::readLong()
- throw (io::IOException, uno::RuntimeException)
- {
- sal_Int32 result;
-
- sal_uInt8 const * pData = readBuffer(sizeof result);
-
- result = sal_Int32(
- (sal_uInt32(pData[0]) << 24) |
- (sal_uInt32(pData[1]) << 16) |
- (sal_uInt32(pData[2]) << 8) |
- (sal_uInt32(pData[3]) << 0) );
-
- return result;
- }
-
- // --------------------------------------------------------------------------
-
- sal_Int64 SAL_CALL BinaryReader_Impl::readHyper()
- throw (io::IOException, uno::RuntimeException)
- {
- sal_Int64 result;
-
- sal_uInt8 const * pData = readBuffer(sizeof result);
-
- result = sal_Int64(
- (sal_uInt64(pData[0]) << 56) |
- (sal_uInt64(pData[1]) << 48) |
- (sal_uInt64(pData[2]) << 40) |
- (sal_uInt64(pData[3]) << 32) |
- (sal_uInt64(pData[4]) << 24) |
- (sal_uInt64(pData[5]) << 16) |
- (sal_uInt64(pData[6]) << 8) |
- (sal_uInt64(pData[7]) << 0) );
-
- return result;
- }
-
- // --------------------------------------------------------------------------
-
- float SAL_CALL BinaryReader_Impl::readFloat()
- throw (io::IOException, uno::RuntimeException)
- {
- union { float f; sal_uInt32 n; } result;
-
- sal_uInt8 const * pData = readBuffer(sizeof result.n);
-
- result.n = sal_uInt32(
- (sal_uInt32(pData[0]) << 24) |
- (sal_uInt32(pData[1]) << 16) |
- (sal_uInt32(pData[2]) << 8) |
- (sal_uInt32(pData[3]) << 0) );
-
- return result.f;
- }
-
- // --------------------------------------------------------------------------
-
- double SAL_CALL BinaryReader_Impl::readDouble()
- throw (io::IOException, uno::RuntimeException)
- {
- union { double d; sal_uInt64 n; } result;
-
- sal_uInt8 const * pData = readBuffer(sizeof result.n);
-
- result.n = sal_uInt64(
- (sal_uInt64(pData[0]) << 56) |
- (sal_uInt64(pData[1]) << 48) |
- (sal_uInt64(pData[2]) << 40) |
- (sal_uInt64(pData[3]) << 32) |
- (sal_uInt64(pData[4]) << 24) |
- (sal_uInt64(pData[5]) << 16) |
- (sal_uInt64(pData[6]) << 8) |
- (sal_uInt64(pData[7]) << 0) );
-
- return result.d;
- }
-
- // --------------------------------------------------------------------------
-
- rtl::OUString SAL_CALL BinaryReader_Impl::readUTF()
- throw (io::IOException, uno::RuntimeException)
- {
- sal_uInt32 nLength;
-
- sal_uInt8 const * const pData = readBuffer(sizeof nLength);
-
- nLength = sal_uInt32(
- (sal_uInt32(pData[0]) << 24) |
- (sal_uInt32(pData[1]) << 16) |
- (sal_uInt32(pData[2]) << 8) |
- (sal_uInt32(pData[3]) << 0) );
-
- bool bIsAscii = (nLength & binary::STR_ASCII_MASK) == binary::STR_ASCII_MASK;
- nLength &=~binary::STR_ASCII_MASK;
-
- rtl::OUString result;
- if (nLength != 0)
- {
- sal_Char const * const pUTF = reinterpret_cast<sal_Char const * >(readBuffer(nLength));
-
- sal_Int32 const nStrLength = sal_Int32(nLength);
- OSL_ASSERT(nStrLength >= 0);
-
- rtl_TextEncoding const enc = bIsAscii ? RTL_TEXTENCODING_ASCII_US : RTL_TEXTENCODING_UTF8;
-
- rtl_uString_internConvert(&result.pData, pUTF, nStrLength, enc,
- OSTRING_TO_OUSTRING_CVTFLAGS, NULL);
- }
-
- return result;
- }
-
- // --------------------------------------------------------------------------
- // BinaryReader implementation.
- // --------------------------------------------------------------------------
-
- BinaryReader::BinaryReader(rtl::OUString const & _sFileURL):
- m_sFileURL(_sFileURL) {}
-
- BinaryReader::~BinaryReader() {}
-
- bool BinaryReader::open()
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- OSL_PRECOND(!m_xDataInputStream.is(),"Binary Reader: already open");
- if (m_xDataInputStream.is())
- return false;
-
- if (m_sFileURL.getLength() == 0)
- return false;
-
- if (!FileHelper::fileExists(m_sFileURL))
- return false;
-
- m_xDataInputStream.set(new BinaryReader_Impl (m_sFileURL));
- return true;
- }
-
- // --------------------------------------------------------------------------
-
- inline BinaryReader_Impl * BinaryReader::getDataInputStream()
- {
- OSL_ENSURE(m_xDataInputStream.is(),"Binary Cache: Reader was not opened - no input stream");
- return m_xDataInputStream.get();
- }
-
- // --------------------------------------------------------------------------
-
- void BinaryReader::read(sal_Bool &_bValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- _bValue = getDataInputStream()->readBoolean();
- }
-
- // --------------------------------------------------------------------------
-
- void BinaryReader::read(sal_Int8 &_nValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- _nValue = getDataInputStream()->readByte();
- }
-
- // --------------------------------------------------------------------------
-
- void BinaryReader::read(sal_Int16 &_nValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- _nValue = getDataInputStream()->readShort();
- }
-
- // --------------------------------------------------------------------------
-
- void BinaryReader::read(sal_Int32 &_nValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- _nValue = getDataInputStream()->readLong();
- }
-
- // --------------------------------------------------------------------------
-
- void BinaryReader::read(sal_Int64 &_nValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- _nValue = getDataInputStream()->readHyper();
- }
-
- // --------------------------------------------------------------------------
-
- void BinaryReader::read(double &_nValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- _nValue = getDataInputStream()->readDouble();
- }
-
- // --------------------------------------------------------------------------
-
- void BinaryReader::read(rtl::OUString& _aStr)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- _aStr = getDataInputStream()->readUTF();
- }
-
- // -----------------------------------------------------------------------------
- template <class Element>
- void readSequence(BinaryReader& _rReader, uno::Sequence< Element > & aSequence)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- // PRE: the Sequence must exist
- sal_Int32 nLength;
- _rReader.read(nLength);
-
- aSequence.realloc(nLength);
-
- Element* const pElement = aSequence.getArray(); // fill the hole array
- for(sal_Int32 i=0; i<nLength; ++i)
- {
- _rReader.read(pElement[i]); // read one element
- }
- }
-
- // --------------------------------------------------------------------------
-
- void BinaryReader::read (uno::Sequence< sal_Int8 > &_aValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- readSequence(*this, _aValue);
- }
-
- // --------------------------------------------------------------------------
-
- void BinaryReader::read (uno::Sequence< rtl::OUString > &_aValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- readSequence(*this, _aValue);
- }
-
- // --------------------------------------------------------------------------
-
- uno::Sequence< sal_Int8 > const * const for_binary = 0;
-
- #define CASE_READ_SEQUENCE(TYPE_CLASS, DATA_TYPE) \
- case TYPE_CLASS: \
- { \
- OSL_ENSURE( ::getCppuType(static_cast<DATA_TYPE const*>(0)).getTypeClass() == (TYPE_CLASS), "Typeclass does not match element type" ); \
- uno::Sequence< DATA_TYPE > aData; \
- readSequence(_rReader, aData); \
- _aValue <<= aData; \
- } break
-
- bool readSequenceValue (
- BinaryReader & _rReader,
- uno::Any & _aValue,
- uno::Type const & _aElementType)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- switch(_aElementType.getTypeClass())
- {
- CASE_READ_SEQUENCE( uno::TypeClass_BOOLEAN, sal_Bool );
-
- CASE_READ_SEQUENCE( uno::TypeClass_SHORT, sal_Int16 );
-
- CASE_READ_SEQUENCE( uno::TypeClass_LONG, sal_Int32 );
-
- CASE_READ_SEQUENCE( uno::TypeClass_HYPER, sal_Int64 );
-
- CASE_READ_SEQUENCE( uno::TypeClass_DOUBLE, double );
-
- CASE_READ_SEQUENCE( uno::TypeClass_STRING, rtl::OUString );
-
- case uno::TypeClass_SEQUENCE:
- if (_aElementType == ::getCppuType(for_binary))
- {
- uno::Sequence< sal_Int8 > aData;
- readSequence(_rReader, aData);
- _aValue <<= aData;
- break;
- }
- // else fall through
-
- default:
- OSL_ENSURE(false, "Unexpected type for sequence elements");
- return false;
- }
- return true;
- }
-
- #undef CASE_READ_SEQUENCE
-
- // --------------------------------------------------------------------------
-
-
- }
-}
diff --git a/configmgr/source/backend/binaryreader.hxx b/configmgr/source/backend/binaryreader.hxx
deleted file mode 100644
index 04dc3a1b74c3..000000000000
--- a/configmgr/source/backend/binaryreader.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#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>
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- namespace css = com::sun::star;
-
- namespace io = css::io;
- namespace uno = css::uno;
- namespace lang = css::lang;
- // -----------------------------------------------------------------------------
- class BinaryReader_Impl;
- class BinaryReader
- {
- rtl::OUString m_sFileURL;
-
- rtl::Reference<BinaryReader_Impl> m_xDataInputStream;
- public:
- explicit BinaryReader (rtl::OUString const & _sFileURL);
-
- ~BinaryReader();
-
- public:
- bool open() SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void read(sal_Bool &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(sal_Int8 &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(sal_Int16 &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(sal_Int32 &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(sal_Int64 &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(double &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(rtl::OUString& _aStr) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(uno::Sequence< sal_Int8 > &_aValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(uno::Sequence< rtl::OUString > &_aValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- private:
- inline BinaryReader_Impl * getDataInputStream();
- };
- // --------------------------------------------------------------------------
-
- bool readSequenceValue (
- BinaryReader & _rReader,
- uno::Any & _aValue,
- uno::Type const & _aElementType) SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- // --------------------------------------------------------------------------
- }
-}
-#endif
diff --git a/configmgr/source/backend/binaryreadhandler.cxx b/configmgr/source/backend/binaryreadhandler.cxx
deleted file mode 100644
index 60a0427a2b53..000000000000
--- a/configmgr/source/backend/binaryreadhandler.cxx
+++ /dev/null
@@ -1,687 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-#include "binaryreadhandler.hxx"
-#include "binarycache.hxx"
-#include "binarytype.hxx"
-#include "simpletypehelper.hxx"
-#include "typeconverter.hxx"
-#include "treenodefactory.hxx"
-
-#include "tracer.hxx"
-#include <com/sun/star/io/WrongFormatException.hpp>
-#include <com/sun/star/util/XTimeStamped.hpp>
-
-
-#define ASCII(x) rtl::OUString::createFromAscii(x)
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
-
- namespace css = com::sun::star;
- namespace io = css::io;
- namespace util = css::util;
-
- // -----------------------------------------------------------------------------
- BinaryReadHandler::BinaryReadHandler(rtl::OUString const & _aFileURL,
- rtl::OUString const & _aComponentName,
- uno::Reference<lang::XMultiServiceFactory> const & )
- : m_BinaryReader(_aFileURL)
- , m_aNodeFactory()
- , m_aComponentName(_aComponentName)
- {
- }
- // -----------------------------------------------------------------------------
- BinaryReadHandler::~BinaryReadHandler()
- {
- }
- // -----------------------------------------------------------------------------
-
- static inline
- bool isRequestingNoLocale(com::sun::star::lang::Locale const & aRequestedLocale)
- {
- rtl::OUString const & aLanguage = aRequestedLocale.Language;
- return aLanguage.getLength() == 0 || localehelper::isDefaultLanguage(aLanguage);
- }
- // -----------------------------------------------------------------------------
-
- static
- bool supportsLocale(uno::Sequence< rtl::OUString > const & aStoredLocales, rtl::OUString const & aRequestedLocale)
- {
- for (sal_Int32 ix=0; ix<aStoredLocales.getLength(); ++ix)
- if (aStoredLocales[ix].equalsIgnoreAsciiCase(aRequestedLocale))
- return true;
-
- return false;
- }
- // -----------------------------------------------------------------------------
-
- static
- bool supportsAll(uno::Sequence< rtl::OUString > const & aStoredLocales, uno::Sequence< rtl::OUString > const & aRequestedLocales)
- {
- for (sal_Int32 jx=0; jx<aRequestedLocales.getLength(); ++jx)
- if (!supportsLocale(aStoredLocales,aRequestedLocales[jx]))
- return false;
-
- return true;
- }
- // -----------------------------------------------------------------------------
-
- bool BinaryReadHandler::verifyFileHeader( const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- const rtl::OUString& _aSchemaVersion,
- com::sun::star::lang::Locale const & aRequestedLocale,
- std::vector< com::sun::star::lang::Locale > & outKnownLocales)
- {
- try
- {
- //Open the reader
- sal_Int16 nMagic, nVersion;
- m_BinaryReader.read(nMagic);
- m_BinaryReader.read(nVersion);
- if (nMagic !=binary::CFG_BINARY_MAGIC || nVersion != binary::CFG_BINARY_VERSION )
- return false;
-
- rtl::OUString aSchemaVersion;
- m_BinaryReader.read(aSchemaVersion);
- if (!aSchemaVersion.equals(_aSchemaVersion))
- return false;
-
- uno::Sequence< rtl::OUString > aAvailableLocales;
- uno::Sequence< rtl::OUString > aKnownLocales;
- m_BinaryReader.read(aKnownLocales);
- m_BinaryReader.read(aAvailableLocales);
- outKnownLocales = localehelper::makeLocaleSequence(aKnownLocales);
-
- if (isRequestingNoLocale(aRequestedLocale))
- {
- // any existing combination of locales (including none) is valid
- }
- else if (!localehelper::designatesAllLocales(aRequestedLocale))
- {
- // one particular locale requested
- rtl::OUString const aIsoLocale = localehelper::makeIsoLocale(aRequestedLocale);
- if (!supportsLocale(aKnownLocales,aIsoLocale))
- {
- // a locale we didn't load previously
- return false;
- }
- else if (! supportsLocale(aAvailableLocales,aIsoLocale))
- {
- // a locale we handled by fallback previously
- uno::Sequence< rtl::OUString > aNewlyAvailableLocales =
- getAvailableLocales(pLayers,nNumLayers);
-
- // ... and that has become available now
- if (supportsLocale(aNewlyAvailableLocales,aIsoLocale))
- return false;
-
- // ... or other new locales have been added
- if (!supportsAll(aAvailableLocales,aNewlyAvailableLocales))
- return false;
- }
- }
- else
- {
- uno::Sequence< rtl::OUString > aNewlyAvailableLocales =
- getAvailableLocales(pLayers,nNumLayers);
-
- // not all locales were requested yet
- if (!supportsAll(aKnownLocales,aNewlyAvailableLocales))
- return false;
-
- // new locales have been added
- if (!supportsAll(aAvailableLocales,aNewlyAvailableLocales))
- return false;
- }
-
- rtl::OUString aComponentName;
- m_BinaryReader.read(aComponentName);
- if (!aComponentName.equals(m_aComponentName))
- return false;
-
- return true;
- }
- catch (uno::Exception &)
- {
- CFG_TRACE_INFO("Binary Cache can't be used");
- return false;
- }
- }
- // -----------------------------------------------------------------------------
- bool BinaryReadHandler::isUptodate(const std::vector<rtl::OUString> & _timeStamps)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- sal_Int32 nNumBinaryLayers;
- m_BinaryReader.read(nNumBinaryLayers);
- if (nNumBinaryLayers < 0 || sal_uInt32(nNumBinaryLayers) != _timeStamps.size())
- return false;
-
- for ( std::vector<rtl::OUString>::const_iterator it = _timeStamps.begin();
- it != _timeStamps.end();
- ++it)
- {
- rtl::OUString binaryTimeStamp;
- m_BinaryReader.read(binaryTimeStamp);
- if ( ! it->equals(binaryTimeStamp) )
- {
- return false;
- }
- }
-
- return true;
- }
- // -----------------------------------------------------------------------------
- binary::NodeType::Type BinaryReadHandler::readNodeType()
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- binary::NodeType::Type eType = binary::NodeType::invalid;
-
- sal_Int8 nValue;
- m_BinaryReader.read(nValue);
-
- sal_uInt8 const nRightValue( nValue );
- if ( (nRightValue & binary::NodeType::nodetype_mask) == nRightValue )
- eType = binary::NodeType::Type(nRightValue);
-
- if (eType == binary::NodeType::invalid)
- {
- OSL_ENSURE(false, "unknown or unhandled node type");
- throw io::WrongFormatException();
- }
-
- return eType;
- }
-
- // -----------------------------------------------------------------------------
- binary::ValueFlags::Type BinaryReadHandler::readValueFlags(bool& bSeq, bool& bHasValue, bool& bHasDefault )
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- sal_Int8 nValue;
- m_BinaryReader.read(nValue);
-
- sal_uInt8 const nRightValue( nValue );
- binary::ValueFlags::Type eType = binary::ValueFlags::Type(nRightValue & binary::ValueFlags::basictype_mask);
- if ( eType >= binary::ValueFlags::val_invalid)
- {
- OSL_ENSURE(false, "unknown or unhandled value type");
- throw io::WrongFormatException();
- }
-
-
- if (nRightValue & binary::ValueFlags::seq)
- bSeq = true;
- else
- bSeq = false;
-
- if (nRightValue & binary::ValueFlags::first_value_NULL)
- bHasValue = false;
- else
- bHasValue = true;
-
- if (nRightValue & binary::ValueFlags::second_value_NULL)
- bHasDefault = false;
- else
- bHasDefault = true;
-
- return eType;
- }
-
- // -----------------------------------------------------------------------------
-
- void BinaryReadHandler::readName(rtl::OUString &_aString)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- m_BinaryReader.read (_aString);
- }
-
- // -----------------------------------------------------------------------------
- void BinaryReadHandler::readAttributes(node::Attributes &_aAttributes)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- sal_Int8 nValue;
- m_BinaryReader.read(nValue);
-
- _aAttributes.setState( node::State(nValue & 0x03) );
-
- _aAttributes.setAccess( nValue & 0x04 ? true : false, nValue & 0x08 ? true : false);
-
- _aAttributes.setNullable(nValue & 0x10 ? true : false);
- _aAttributes.setLocalized(nValue & 0x20 ? true : false);
- if(nValue & 0x40 )
- {
- _aAttributes.markMandatory();
- }
- if(nValue & 0x80)
- {
- _aAttributes.markRemovable();
- }
- }
- // -----------------------------------------------------------------------------
-
- void BinaryReadHandler::readGroup(rtl::OUString &_aName, node::Attributes &_aAttributes)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- readAttributes(_aAttributes);
- readName(_aName);
- }
- // -----------------------------------------------------------------------------
- void BinaryReadHandler::readSet(rtl::OUString &_aName, node::Attributes &_aAttributes,
- rtl::OUString &_sInstanceName, rtl::OUString &_sInstanceModule)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- readAttributes(_aAttributes);
- readName(_aName);
- readName(_sInstanceName);
- readName(_sInstanceModule);
- }
-
- // -----------------------------------------------------------------------------
- template <class T>
- inline
- void readAsAny(BinaryReader& rBinaryReader, uno::Any & _aValue, uno::Type& _aType, T& _aVar)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- rBinaryReader.read(_aVar);
- _aValue <<= _aVar;
- _aType = _aValue.getValueType();
- }
-
- // -----------------------------------------------------------------------------
- uno::Type convertValueTypeToType(binary::ValueFlags::Type eBasicValueType, bool bSeq)
- {
- uno::Type aType;
-
- if (!bSeq)
- {
- switch(eBasicValueType)
- {
- // --------------- Simple types ---------------
-
- case binary::ValueFlags::val_boolean:
- aType = SimpleTypeHelper::getBooleanType();
- break;
- case binary::ValueFlags::val_int16:
- aType = SimpleTypeHelper::getShortType();
- break;
- case binary::ValueFlags::val_int32:
- aType = SimpleTypeHelper::getIntType();
- break;
- case binary::ValueFlags::val_int64:
- aType = SimpleTypeHelper::getLongType();
- break;
- case binary::ValueFlags::val_double:
- aType = SimpleTypeHelper::getDoubleType();
- break;
- case binary::ValueFlags::val_string:
- aType = SimpleTypeHelper::getStringType();
- break;
- case binary::ValueFlags::val_binary:
- aType = SimpleTypeHelper::getBinaryType();
- break;
- case binary::ValueFlags::val_any:
- aType = SimpleTypeHelper::getAnyType();
- break;
- default:
- OSL_ENSURE(false,"Invalid value type");
- break;
- }
- }
- else
- {
- // ------------ Sequences ------------
- switch(eBasicValueType)
- {
- case binary::ValueFlags::val_boolean:
- aType = ::getCppuType(static_cast<uno::Sequence<sal_Bool> const*>(0));
- break;
- case binary::ValueFlags::val_int16:
- aType = ::getCppuType(static_cast<uno::Sequence<sal_Int16> const*>(0));
- break;
- case binary::ValueFlags::val_int32:
- aType = ::getCppuType(static_cast<uno::Sequence<sal_Int32> const*>(0));
- break;
- case binary::ValueFlags::val_int64:
- aType = ::getCppuType(static_cast<uno::Sequence<sal_Int64> const*>(0));
- break;
- case binary::ValueFlags::val_double:
- aType = ::getCppuType(static_cast<uno::Sequence<double> const*>(0));
- break;
- case binary::ValueFlags::val_string:
- aType = ::getCppuType(static_cast<uno::Sequence<rtl::OUString> const*>(0));
- break;
- case binary::ValueFlags::val_binary:
- aType = ::getCppuType(static_cast<uno::Sequence< uno::Sequence< sal_Int8 > > const*>(0));
- break;
- default:
- OSL_ENSURE(false,"Invalid sequence value type");
- break;
- }
- }
-
- return aType;
- }
-
- // -----------------------------------------------------------------------------
- void BinaryReadHandler::readValue(rtl::OUString &_aName, node::Attributes &_aAttributes,
- uno::Any& _aValue, uno::Any& _aDefaultValue,uno::Type& _aType)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- bool bSeq = false;
- bool bHasValue = false;
- bool bHasDefault = false;
-
- binary::ValueFlags::Type eBasicType = readValueFlags(bSeq, bHasValue, bHasDefault);
- readAttributes(_aAttributes);
- readName(_aName);
-
- if (!bSeq && (bHasValue || bHasDefault))
- {
- switch(eBasicType)
- {
- case binary::ValueFlags::val_any:
- {
- OSL_ENSURE(false,"Node of type Any cannot have value");
- throw io::WrongFormatException();
- }
- case binary::ValueFlags::val_string:
- {
- rtl::OUString aStr;
- if (bHasValue)
- readAsAny(m_BinaryReader, _aValue, _aType, aStr);
- if (bHasDefault)
- readAsAny(m_BinaryReader, _aDefaultValue, _aType, aStr);
- break;
- }
- case binary::ValueFlags::val_boolean:
- {
- sal_Bool nValue;
- if (bHasValue)
- readAsAny(m_BinaryReader,_aValue, _aType, nValue);
- if (bHasDefault)
- readAsAny(m_BinaryReader,_aDefaultValue, _aType, nValue);
- break;
- }
- case binary::ValueFlags::val_int16:
- {
- sal_Int16 nValue;
- if (bHasValue)
- readAsAny(m_BinaryReader,_aValue, _aType, nValue);
- if (bHasDefault)
- readAsAny(m_BinaryReader,_aDefaultValue, _aType, nValue);
- break;
- }
- case binary::ValueFlags::val_int32:
- {
- sal_Int32 nValue;
- if (bHasValue)
- readAsAny(m_BinaryReader,_aValue, _aType, nValue);
- if (bHasDefault)
- readAsAny(m_BinaryReader,_aDefaultValue, _aType, nValue);
- break;
- }
- case binary::ValueFlags::val_int64:
- {
- sal_Int64 nValue;
- if (bHasValue)
- readAsAny(m_BinaryReader,_aValue, _aType, nValue);
- if (bHasDefault)
- readAsAny(m_BinaryReader,_aDefaultValue, _aType, nValue);
- break;
- }
- case binary::ValueFlags::val_double:
- {
- double nValue;
- if (bHasValue)
- readAsAny(m_BinaryReader,_aValue, _aType, nValue);
- if (bHasDefault)
- readAsAny(m_BinaryReader, _aDefaultValue, _aType, nValue);
- break;
- }
- case binary::ValueFlags::val_binary:
- {
- uno::Sequence< sal_Int8 > aValue;
- if (bHasValue)
- readAsAny(m_BinaryReader,_aValue, _aType, aValue);
- if (bHasDefault)
- readAsAny(m_BinaryReader,_aDefaultValue, _aType, aValue);
- break;
- }
- default:
- OSL_ENSURE(false, "Invalid value type");
- throw io::WrongFormatException();
- }
- }
- else
- {
- _aType = convertValueTypeToType(eBasicType, bSeq);
- if (_aType == uno::Type())
- throw io::WrongFormatException();
- }
-
- if(bSeq)
- {
- OSL_ASSERT(_aType.getTypeClass() == uno::TypeClass_SEQUENCE);
- uno::Type const aElementType = getSequenceElementType(_aType);
- if (bHasValue)
- readSequenceValue(m_BinaryReader, _aValue, aElementType );
-
- if(bHasDefault)
- readSequenceValue(m_BinaryReader, _aDefaultValue, aElementType );
- }
-
- }
- // -----------------------------------------------------------------------------
- std::auto_ptr<ISubtree> BinaryReadHandler::readComponentTree()
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- binary::NodeType::Type eType = this->readNodeType();
-
- if (eType != binary::NodeType::component)
- {
- // TODO: search for component tree
- OSL_ENSURE(false, "binary Cache: unexpected tree type for component data");
- throw io::WrongFormatException();
- }
-
- return readToplevelTree();
- }
- // -----------------------------------------------------------------------------
- std::auto_ptr<ISubtree> BinaryReadHandler::readTemplatesTree()
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- binary::NodeType::Type eType = this->readNodeType();
-
- if (eType != binary::NodeType::templates)
- {
- // TODO: search for templates tree
- OSL_ENSURE(false, "binary Cache: unexpected tree type for template data");
- throw io::WrongFormatException();
- }
-
- return readToplevelTree();
- }
- // -----------------------------------------------------------------------------
-
- std::auto_ptr<ISubtree> BinaryReadHandler::readToplevelTree()
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- std::auto_ptr<ISubtree> pTree;
-
- rtl::OUString aName;
- node::Attributes aAttributes;
- const bool not_extensible = false;
-
- binary::NodeType::Type eType = this->readNodeType();
- switch (eType)
- {
- case binary::NodeType::groupnode:
- {
- this->readGroup(aName, aAttributes);
- pTree = m_aNodeFactory.createGroup(aName,not_extensible,aAttributes);
- break;
- }
- case binary::NodeType::setnode:
- {
- backenduno::TemplateIdentifier aTemplate;
- this->readSet(aName, aAttributes,aTemplate.Name, aTemplate.Component);
- pTree = m_aNodeFactory.createSet(aName,aTemplate,not_extensible,aAttributes);
- break;
- }
- case binary::NodeType::nodata:
- break;
-
- default:
- OSL_ENSURE(false, "binary Cache - cannot read data: unexpected node type for tree");
- throw io::WrongFormatException();
-
- }
-
- if (pTree.get() != NULL)
- {
- readChildren(*pTree);
-
- //read terminating stop node
- eType = this->readNodeType();
- OSL_ENSURE(binary::NodeType::stop == eType, "Missing stop node to mark end of tree");
- }
- return pTree;
- }
-
-
- // -----------------------------------------------------------------------------
- bool BinaryReadHandler::validateHeader( const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- const rtl::OUString& _aSchemaVersion,
- com::sun::star::lang::Locale const & aRequestedLocale,
- std::vector< com::sun::star::lang::Locale > & outKnownLocales)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
-
- //Check here if the file exists
- if (!m_BinaryReader.open())
- return false;
-
- if(!this->verifyFileHeader(pLayers, nNumLayers, _aSchemaVersion, aRequestedLocale, outKnownLocales))
- return false;
-
- //Check if layers are uptodate
- std::vector <rtl::OUString> timeStamps(nNumLayers);
- for (sal_Int32 i = 0 ; i < nNumLayers ; ++ i)
- {
- uno::Reference<util::XTimeStamped> xTimeStamp = uno::Reference<util::XTimeStamped>(pLayers[i], uno::UNO_QUERY);
- if (xTimeStamp.is())
- {
- rtl::OUString aTimeStamp = xTimeStamp->getTimestamp();
- timeStamps[i] = aTimeStamp;
- }
- }
-
- return this->isUptodate(timeStamps);
- }
- // -----------------------------------------------------------------------------
- void BinaryReadHandler::readChildren(ISubtree & rTree )
- {
- OSL_ASSERT(!binary::NodeType::stop); // loop stops at stop node
- while (binary::NodeType::Type eType = this->readNodeType())
- {
- rtl::OUString aName;
- node::Attributes aAttributes;
- const bool not_extensible = false;
- switch (eType)
- {
- case binary::NodeType::groupnode:
- {
- this->readGroup(aName, aAttributes);
-
- std::auto_ptr<ISubtree> pNewNode = m_aNodeFactory.createGroup(aName, not_extensible, aAttributes);
- if (pNewNode.get() == NULL)
- {
- OSL_ENSURE(false, "Error: factory returned NULL group node - skipping");
- continue;
- }
-
- readChildren( *pNewNode );
- rTree.addChild(base_ptr(pNewNode));
- break;
- }
- case binary::NodeType::setnode:
- {
- backenduno::TemplateIdentifier aTemplate;
- this->readSet(aName, aAttributes,aTemplate.Name, aTemplate.Component);
-
- std::auto_ptr<ISubtree> pNewSetNode = m_aNodeFactory.createSet(aName,aTemplate,not_extensible,aAttributes);
- if (pNewSetNode.get() == NULL)
- {
- OSL_ENSURE(false, "Error: factory returned NULL set node - skipping");
- continue;
- }
-
- readChildren( *pNewSetNode );
- rTree.addChild(base_ptr(pNewSetNode));
- break;
- }
- case binary::NodeType::valuenode:
- {
- uno::Any aValue;
- uno::Any aDefaultValue;
- uno::Type aType;
-
- this->readValue(aName, aAttributes, aValue, aDefaultValue, aType);
-
- OTreeNodeFactory & rValueFactory = m_aNodeFactory.getNodeFactory();
-
- std::auto_ptr<ValueNode> pValueNode;
- if (aValue.hasValue() || aDefaultValue.hasValue())
- {
- pValueNode = rValueFactory.createValueNode(aName,aValue, aDefaultValue, aAttributes);
- }
- else
- {
- pValueNode = rValueFactory.createNullValueNode(aName,aType, aAttributes);
- }
-
- rTree.addChild(base_ptr(pValueNode));
- break;
- }
- default:
- OSL_ENSURE(false, "Binary cache: Invalid node type");
- throw io::WrongFormatException();
- }
- }
- }
- // -----------------------------------------------------------------------------
-
- // -----------------------------------------------------------------------------
- }
- // -----------------------------------------------------------------------------
-}
diff --git a/configmgr/source/backend/binaryreadhandler.hxx b/configmgr/source/backend/binaryreadhandler.hxx
deleted file mode 100644
index d237fee3ceb6..000000000000
--- a/configmgr/source/backend/binaryreadhandler.hxx
+++ /dev/null
@@ -1,133 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONFIGMGR_BINARYREADHANDLER_HXX
-#define CONFIGMGR_BINARYREADHANDLER_HXX
-
-#include "binaryreader.hxx"
-#include "componentdatahelper.hxx"
-#include "valuenode.hxx"
-#include "binarytype.hxx"
-#include "attributes.hxx"
-#include "matchlocale.hxx"
-#include <com/sun/star/configuration/backend/XLayer.hpp>
-#include <com/sun/star/io/IOException.hpp>
-
-#ifndef INCLUDED_MEMORY
-#include <memory>
-#define INCLUDED_MEMORY
-#endif // INCLUDED_MEMORY
-
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif // INCLUDED_VECTOR
-
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- namespace css = com::sun::star;
-
- namespace io = css::io;
- namespace uno = css::uno;
- namespace backenduno = css::configuration::backend ;
-
- // -----------------------------------------------------------------------------
-
- class BinaryReadHandler
- {
- BinaryReader m_BinaryReader;
- ComponentDataFactory m_aNodeFactory;
- rtl::OUString m_aComponentName;
-
- public:
- BinaryReadHandler(rtl::OUString const & _aFileURL, rtl::OUString const & _aComponentName, uno::Reference<lang::XMultiServiceFactory> const & _aFactory);
- ~BinaryReadHandler();
-
- bool validateHeader( const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- const rtl::OUString& _aSchemaVersion,
- com::sun::star::lang::Locale const & aRequestedLocale,
- std::vector< com::sun::star::lang::Locale > & outKnownLocales)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- std::auto_ptr<ISubtree> readComponentTree()
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- std::auto_ptr<ISubtree> readTemplatesTree()
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- private:
- std::auto_ptr<ISubtree> readToplevelTree()
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void readChildren(ISubtree & rTree)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- private:
- bool verifyFileHeader( const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- const rtl::OUString& _aSchemaVersion,
- com::sun::star::lang::Locale const & aRequestedLocale,
- std::vector< com::sun::star::lang::Locale > & outKnownLocales);
-
- bool isUptodate(const std::vector<rtl::OUString> & _timeStamps)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void readChildNodes(ISubtree & rSubTree)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- binary::NodeType::Type readNodeType()
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- binary::ValueFlags::Type readValueFlags(bool& bSeq, bool& hasValue, bool& hasDefault )
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void readAttributes(node::Attributes &_aAttributes)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void readGroup(rtl::OUString &_aName, node::Attributes &_aAttributes)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void readSet(rtl::OUString &_aName, node::Attributes &_aAttributes,
- rtl::OUString &_sInstanceName, rtl::OUString &_sInstanceModule)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void readValue(rtl::OUString &_aName, node::Attributes &_aAttributes,
- uno::Any& _aValue, uno::Any& _aDefaultValue,uno::Type& _aType)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void readName(rtl::OUString &_aString)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
- };
- // ---------------------------------------------------------------------------
- }
- // -----------------------------------------------------------------------------
-}// namespace configmgr
-#endif
diff --git a/configmgr/source/backend/binarytype.hxx b/configmgr/source/backend/binarytype.hxx
deleted file mode 100644
index d335aabb4508..000000000000
--- a/configmgr/source/backend/binarytype.hxx
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef CONFIGMGR_BINARYTYPE_HXX
-#define CONFIGMGR_BINARYTYPE_HXX
-
-#include <sal/types.h>
-
-namespace configmgr
-{
- namespace binary
- {
- const sal_uInt32 STR_ASCII_MASK = 0x80000000;
- const sal_Int16 CFG_BINARY_MAGIC = 10001;
- const sal_Int16 CFG_BINARY_VERSION = 3;
-
- namespace ValueFlags
- {
- enum Type
- {
- val_any, // = 0
- val_string, // = 1
- val_boolean, // = 2
- val_int16, // = 3
- val_int32, // = 4
- val_int64, // = 5
- val_double, // = 6
- val_binary, // = 7
- val_invalid, // = 8
-
- //Sequence Flag
- seq = 0x10,
-
- //Pairstate Flags
- first_value_NULL = 0x20,
- second_value_NULL = 0x40,
-
- //Masks
- basictype_mask = 0x0F,
- valuetype_mask = 0x1F,
- pairstate_mask = first_value_NULL | second_value_NULL
- };
- }
-
- namespace NodeType
- {
- enum Type
- {
- //Node Type Identifiers
- stop = 0,
- valuenode = 0x20,
- groupnode = 0x40,
- setnode = 0x80,
- component = 0x60,
- templates = 0xA0,
- nodata = 0xC0,
- invalid = 0xE0,
-
- nodetype_mask = 0xE0
- };
- }
- }
-}
-#endif
diff --git a/configmgr/source/backend/binarywritehandler.cxx b/configmgr/source/backend/binarywritehandler.cxx
deleted file mode 100644
index 7a09857258cc..000000000000
--- a/configmgr/source/backend/binarywritehandler.cxx
+++ /dev/null
@@ -1,489 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-#include "binarywritehandler.hxx"
-#include "binarycache.hxx"
-#include <com/sun/star/util/XTimeStamped.hpp>
-#include "typeconverter.hxx"
-#include "simpletypehelper.hxx"
-
-#define ASCII(x) rtl::OUString::createFromAscii(x)
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
-
- namespace css = com::sun::star;
- namespace util = css::util ;
-
- // -----------------------------------------------------------------------------
-
- BinaryWriteHandler::BinaryWriteHandler( rtl::OUString const & _aFileURL,
- rtl::OUString const & _aComponentName,
- uno::Reference<lang::XMultiServiceFactory> const & _aFactory)
- : m_BinaryWriter(_aFileURL,_aFactory)
- , m_aComponentName(_aComponentName)
- {
-
- }
- // -----------------------------------------------------------------------------
- static
- binary::ValueFlags::Type convertTypeToValueType(uno::Type const& _aType)
- {
- binary::ValueFlags::Type eType = binary::ValueFlags::val_invalid;
- uno::TypeClass const aClass = _aType.getTypeClass();
- switch(aClass)
- {
- case uno::TypeClass_ANY:
- eType = binary::ValueFlags::val_any;
- break;
- case uno::TypeClass_BOOLEAN:
- eType = binary::ValueFlags::val_boolean;
- break;
- case uno::TypeClass_SHORT:
- eType = binary::ValueFlags::val_int16;
- break;
- case uno::TypeClass_LONG:
- eType = binary::ValueFlags::val_int32;
- break;
- case uno::TypeClass_HYPER:
- eType = binary::ValueFlags::val_int64;
- break;
- case uno::TypeClass_DOUBLE:
- eType = binary::ValueFlags::val_double;
- break;
- case uno::TypeClass_STRING:
- eType = binary::ValueFlags::val_string;
- break;
- case uno::TypeClass_SEQUENCE:
- if (_aType == SimpleTypeHelper::getBinaryType())
- {
- eType = binary::ValueFlags::val_binary;
- }
- else
- {
- uno::Type aType = configmgr::getSequenceElementType(_aType);
- eType = convertTypeToValueType(aType);
-
- OSL_ENSURE(!(eType & binary::ValueFlags::seq), "Binary Writer - Invalid value type: Multiple nesting of sequences");
- eType = binary::ValueFlags::Type( eType | binary::ValueFlags::seq );
- }
- break;
- default:
- OSL_ENSURE(false, "Binary Writer - Invalid value type: not supported");
- break;
- }
- return eType;
- }
-
- // -----------------------------------------------------------------------------
- template <class T>
- inline /* make performance crew happy ;-) */
- void writeDirectly(BinaryWriter& _rWriter, T const& _aVal)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- _rWriter.write(_aVal);
- }
- // -----------------------------------------------------------------------------
- static
- inline
- void writeDirectly(BinaryWriter& _rWriter, uno::Sequence<sal_Int8> const& _aBinary);
- // -----------------------------------------------------------------------------
- template <class T>
- inline /* make performance crew happy ;-) */
- void writeFromAny(BinaryWriter& _rWriter,uno::Any const& _aValue, T& _aVar)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- OSL_VERIFY(_aValue >>= _aVar ); // "Invalid Any for value"
- writeDirectly(_rWriter,_aVar);
- }
- // -----------------------------------------------------------------------------
-
- template <class Element>
- void writeSequence(BinaryWriter& _rWriter, uno::Sequence< Element > const& aSequence)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- sal_Int32 const nLength = aSequence.getLength();
- _rWriter.write(nLength);
-
- for(sal_Int32 i=0; i<nLength; ++i)
- {
- writeDirectly(_rWriter, aSequence[i]);
- }
- }
- // -----------------------------------------------------------------------------
- static
- inline
- void writeDirectly(BinaryWriter& _rWriter, uno::Sequence<sal_Int8> const& _aBinary)
- {
- writeSequence(_rWriter,_aBinary);
- }
- // -----------------------------------------------------------------------------
- #define CASE_WRITE_SEQUENCE(TYPE_CLASS, DATA_TYPE) \
- case TYPE_CLASS: \
- { \
- uno::Sequence< DATA_TYPE > aData; \
- OSL_ASSERT( ::getCppuType(aData.getConstArray()).getTypeClass() == (TYPE_CLASS) ); \
- OSL_VERIFY( _aValue >>= aData ); \
- writeSequence(_rWriter,aData); \
- } break
-
- // -----------------------------------------------------------------------------
- static
- void writeSequenceValue(BinaryWriter& _rWriter, uno::Any const& _aValue, uno::Type const& aElementType)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- switch(aElementType.getTypeClass())
- {
- CASE_WRITE_SEQUENCE( uno::TypeClass_BOOLEAN, sal_Bool );
-
- CASE_WRITE_SEQUENCE( uno::TypeClass_SHORT, sal_Int16 );
-
- CASE_WRITE_SEQUENCE( uno::TypeClass_LONG, sal_Int32 );
-
- CASE_WRITE_SEQUENCE( uno::TypeClass_HYPER, sal_Int64 );
-
- CASE_WRITE_SEQUENCE( uno::TypeClass_DOUBLE, double );
-
- CASE_WRITE_SEQUENCE( uno::TypeClass_STRING, rtl::OUString );
-
- CASE_WRITE_SEQUENCE( uno::TypeClass_SEQUENCE, uno::Sequence<sal_Int8> );
-
- default:
- OSL_ENSURE(false, "Unexpected typeclass for sequence elements");
- break;
- }
- }
- #undef CASE_WRITE_SEQUENCE
-
- // -----------------------------------------------------------------------------
- static
- void writeSimpleValue(BinaryWriter& _rWriter, uno::Any const& _aValue, uno::Type const& _aType)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- // PRE: Header must be written
- uno::TypeClass aDestinationClass = _aType.getTypeClass();
- switch (aDestinationClass)
- {
- case uno::TypeClass_BOOLEAN:
- {
- sal_Bool bValue = sal_False;
- writeFromAny(_rWriter, _aValue, bValue);
- break;
- }
- case uno::TypeClass_BYTE:
- {
- sal_Int8 nValue = 0;
- writeFromAny(_rWriter, _aValue, nValue);
- break;
- }
- case uno::TypeClass_SHORT:
- {
- sal_Int16 nValue = 0;
- writeFromAny(_rWriter, _aValue, nValue);
- break;
- }
- case uno::TypeClass_LONG:
- {
- sal_Int32 nValue = 0;
- writeFromAny(_rWriter, _aValue, nValue);
- break;
- }
- case uno::TypeClass_HYPER:
- {
- sal_Int64 nValue = 0;
- writeFromAny(_rWriter, _aValue, nValue);
- break;
- }
- case uno::TypeClass_DOUBLE:
- {
- double nValue = 0;
- writeFromAny(_rWriter, _aValue, nValue);
- break;
- }
- case uno::TypeClass_STRING:
- {
- rtl::OUString aStr;
- writeFromAny(_rWriter, _aValue, aStr);
- break;
- }
- case uno::TypeClass_SEQUENCE:
- {
- OSL_ENSURE (_aType == SimpleTypeHelper::getBinaryType(),"Unexpected sequence as simple type");
- uno::Sequence<sal_Int8> aBinary;
- writeFromAny(_rWriter, _aValue, aBinary);
- break;
- }
- default:
- OSL_ENSURE(false, "Unexpected typeclass for simple value");
- break;
- }
- }
-
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeValue(uno::Any const& _aValue)
- {
- bool bSeq;
- uno::Type aTargetType = getBasicType(_aValue.getValueType(), bSeq);
-
- if (!bSeq)
- {
- writeSimpleValue(m_BinaryWriter,_aValue, aTargetType);
- }
- else
- {
- writeSequenceValue(m_BinaryWriter,_aValue, aTargetType);
- }
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeFileHeader( rtl::OUString const & _aSchemaVersion,
- const uno::Sequence<rtl::OUString> & aKnownLocales,
- const uno::Sequence<rtl::OUString> & aDataLocales )
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- m_BinaryWriter.write(binary::CFG_BINARY_MAGIC);
- m_BinaryWriter.write(binary::CFG_BINARY_VERSION);
- m_BinaryWriter.write(_aSchemaVersion);
- writeSequence(m_BinaryWriter,aKnownLocales);
- writeSequence(m_BinaryWriter,aDataLocales);
- m_BinaryWriter.write(m_aComponentName);
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeGroupNode(rtl::OUString const& _aName,node::Attributes const& _aAttributes )
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- writeAttributes(_aAttributes );
- m_BinaryWriter.write(_aName);
- }
-
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeSetNode(rtl::OUString const& _aName,
- rtl::OUString const& _aTemplateName,
- rtl::OUString const& _aTemplateModule,
- node::Attributes const& _aAttributes)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- writeAttributes(_aAttributes );
- m_BinaryWriter.write(_aName);
- m_BinaryWriter.write(_aTemplateName);
- m_BinaryWriter.write(_aTemplateModule);
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeLayerInfoList(uno::Reference<backenduno::XLayer> const * pLayers, sal_Int32 nNumLayers)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
-
- m_BinaryWriter.write(nNumLayers);
- for (sal_Int32 i = 0 ; i < nNumLayers ; ++ i)
- {
- uno::Reference<util::XTimeStamped> xTimeStamp = uno::Reference<util::XTimeStamped>(pLayers[i], uno::UNO_QUERY);
-
- rtl::OUString aTimeStamp = xTimeStamp.is() ? xTimeStamp->getTimestamp() : rtl::OUString();
- m_BinaryWriter.write(aTimeStamp);
- }
-
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeNodeType(binary::NodeType::Type _eType)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- sal_Int8 nValue = static_cast< sal_Int8 >( _eType );
- m_BinaryWriter.write(nValue);
-
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeAttributes(node::Attributes const& _aAttributes)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- sal_Int8 nValue = static_cast< sal_Int8 >( _aAttributes.state() );
-
- OSL_ASSERT(0 <= nValue && nValue <= 3);
-
- OSL_ENSURE(!_aAttributes.isReadonly() || !_aAttributes.isFinalized(),"Unexpected attribute mix: node is both read-only and finalized");
-
- nValue |= (_aAttributes.isReadonly() ? 1 : 0) << 2;
- nValue |= (_aAttributes.isFinalized() ? 1 : 0) << 3;
-
- nValue |= (_aAttributes.isNullable() ? 1 : 0) << 4;
- nValue |= (_aAttributes.isLocalized() ? 1 : 0) << 5;
-
- nValue |= (_aAttributes.isMandatory() ? 1 : 0) << 6;
- nValue |= (_aAttributes.isRemovable() ? 1 : 0) << 7;
-
- m_BinaryWriter.write(nValue);
-
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeValueNode(rtl::OUString const& _aName,
- node::Attributes const& _aAttributes,
- uno::Type const& _aType,
- uno::Any const& _aUserValue,
- uno::Any const& _aDefaultValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- //write value flags
- binary::ValueFlags::Type eType = convertTypeToValueType(_aType);
- sal_Int8 nValueType = sal_Int8(eType);
-
- bool hasUserValue = _aUserValue.hasValue();
- bool hasDefault = _aDefaultValue.hasValue();
-
- if (!hasUserValue) nValueType |= binary::ValueFlags::first_value_NULL;
- if (!hasDefault) nValueType |= binary::ValueFlags::second_value_NULL;
-
- m_BinaryWriter.write(nValueType);
- writeAttributes(_aAttributes );
- m_BinaryWriter.write(_aName);
-
- if(hasUserValue)
- {
- OSL_ENSURE(_aUserValue.getValueType() == _aType, "Type mismatch in value node");
- writeValue(_aUserValue);
- }
- if(hasDefault)
- {
- OSL_ENSURE(_aDefaultValue.getValueType() == _aType, "Type mismatch in value node");
- writeValue(_aDefaultValue);
- }
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeStop()
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- sal_Int8 nStopValue = 0;
- m_BinaryWriter.write(nStopValue);
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeComponentTree(const ISubtree * _pComponentTree)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- this->writeNodeType(binary::NodeType::component);
- if (_pComponentTree)
- {
- this->writeTree(*_pComponentTree);
- this->writeStop();
- }
- else
- {
- this->writeNodeType(binary::NodeType::nodata);
- }
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeTemplatesTree(const ISubtree * _pTemplatesTree)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- this->writeNodeType(binary::NodeType::templates);
- if (_pTemplatesTree)
- {
- this->writeTree(*_pTemplatesTree);
- this->writeStop();
- }
- else
- {
- this->writeNodeType(binary::NodeType::nodata);
- }
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::writeTree(const ISubtree & rTree)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- if ( rTree.isSetNode() )
- {
- this->writeNodeType(binary::NodeType::setnode);
- this->writeSetNode( rTree.getName(),
- rTree.getElementTemplateName(),
- rTree.getElementTemplateModule(),
- rTree.getAttributes());
- }
- else
- {
- this->writeNodeType(binary::NodeType::groupnode);
- this->writeGroupNode( rTree.getName(), rTree.getAttributes() );
- }
-
- // process children
- this->applyToChildren(rTree);
-
- this->writeStop();
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::handle(const ISubtree & rTree)
- {
- writeTree(rTree);
- }
- // -----------------------------------------------------------------------------
-
- void BinaryWriteHandler::handle(const ValueNode & rValue)
- {
- this->writeNodeType(binary::NodeType::valuenode);
-
- this->writeValueNode( rValue.getName(),
- rValue.getAttributes(),
- rValue.getValueType(),
- rValue.getUserValue(),
- rValue.getDefault() );
- }
- // -----------------------------------------------------------------------------
-
- bool BinaryWriteHandler::generateHeader(const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- const rtl::OUString& aEntity,
- const std::vector< com::sun::star::lang::Locale > & aKnownLocales )
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- //Open the writer
- if (!m_BinaryWriter.open())
- return false;
-
- this->writeFileHeader( aEntity,
- localehelper::makeIsoSequence(aKnownLocales),
- getAvailableLocales(pLayers,nNumLayers) );
-
- this->writeLayerInfoList(pLayers, nNumLayers);
- return true;
- }
- // -----------------------------------------------------------------------------
-
- }
- // -----------------------------------------------------------------------------
-}
diff --git a/configmgr/source/backend/binarywritehandler.hxx b/configmgr/source/backend/binarywritehandler.hxx
deleted file mode 100644
index 9934d56056c8..000000000000
--- a/configmgr/source/backend/binarywritehandler.hxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONFIGMGR_BINARYWRITEHANDLER_HXX
-#define CONFIGMGR_BINARYWRITEHANDLER_HXX
-
-#include "valuenode.hxx"
-#include "binarywriter.hxx"
-#include "binarytype.hxx"
-#include "attributes.hxx"
-#include "matchlocale.hxx"
-#include <com/sun/star/configuration/backend/XLayer.hpp>
-#include <com/sun/star/io/IOException.hpp>
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- namespace css = com::sun::star;
-
- namespace io = css::io;
- namespace uno = css::uno;
- namespace backenduno = css::configuration::backend ;
-
- // -----------------------------------------------------------------------------
- class BinaryWriteHandler : private NodeAction
- {
- BinaryWriter m_BinaryWriter;
- rtl::OUString m_aComponentName;
-
- public:
- BinaryWriteHandler(rtl::OUString const & _aFileURL, rtl::OUString const & _aComponentName, uno::Reference<lang::XMultiServiceFactory> const & _aFactory);
-
- bool generateHeader( const uno::Reference<backenduno::XLayer> * pLayers,
- sal_Int32 nNumLayers,
- const rtl::OUString& aEntity,
- const std::vector< com::sun::star::lang::Locale > & aKnownLocales )
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void writeComponentTree(const ISubtree * _pComponentTree)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
- void writeTemplatesTree(const ISubtree * _pTemplatesTree)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
- private:
- void writeTree(ISubtree const & rTree)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- // Node Action
- virtual void handle(ISubtree const & aSubtree);
- virtual void handle(ValueNode const & aValue);
- private:
- void writeFileHeader( rtl::OUString const & _aSchemaVersion,
- const uno::Sequence<rtl::OUString> & aKnownLocales,
- const uno::Sequence<rtl::OUString> & aDataLocales )
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void writeLayerInfoList(uno::Reference<backenduno::XLayer> const * pLayers, sal_Int32 nNumlayers)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void writeGroupNode(rtl::OUString const& _aName,node::Attributes const& _aAttributes)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void writeValueNode(rtl::OUString const& _aName,
- node::Attributes const& _aAttributes,
- uno::Type const& _aType,
- uno::Any const& _aUserValue,
- uno::Any const& _aDefaultValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void writeSetNode(rtl::OUString const& _aName,
- rtl::OUString const& _aTemplateName,
- rtl::OUString const& _aTemplateModule,
- node::Attributes const& _aAttributes)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void writeAttributes(node::Attributes const& _aAttributes)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void writeNodeType(binary::NodeType::Type _eType)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void writeStop()
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- void writeValue( uno::Any const& _aValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- };
- // ---------------------------------------------------------------------------
- }
- // -----------------------------------------------------------------------------
-}// namespace configmgr
-#endif
diff --git a/configmgr/source/backend/binarywriter.cxx b/configmgr/source/backend/binarywriter.cxx
deleted file mode 100644
index c06a05173824..000000000000
--- a/configmgr/source/backend/binarywriter.cxx
+++ /dev/null
@@ -1,215 +0,0 @@
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "binarywriter.hxx"
-#include "valuenode.hxx"
-#include "filehelper.hxx"
-#include <com/sun/star/uno/Type.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include "oslstream.hxx"
-#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/XDataOutputStream.hpp>
-#include "typeconverter.hxx"
-#include "binarytype.hxx"
-#include "simpletypehelper.hxx"
-
-#define ASCII(x) rtl::OUString::createFromAscii(x)
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- namespace uno = com::sun::star::uno;
- namespace io = com::sun::star::io;
-
- BinaryWriter::BinaryWriter(rtl::OUString const &_aFileURL, uno::Reference<lang::XMultiServiceFactory> const& _xServiceProvider)
- : m_aFileURL(_aFileURL)
- , m_xServiceProvider(_xServiceProvider)
- , m_xDataOutputStream()
- {}
-
- bool BinaryWriter::open() SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- if (m_aFileURL.getLength() == 0)
- return false;
-
- OSL_ENSURE(!m_xDataOutputStream.is(), "Binary Writer: already open");
- if ( m_xDataOutputStream.is())
- return false;
-
- if (FileHelper::fileExists(m_aFileURL))
- {
- if (osl::File::RC errorCode = osl::File::remove(m_aFileURL))
- {
- // creating the file will fail later
- OSL_TRACE("Binary Cache: Cannot remove existing file [%d]",int(errorCode));
- }
- }
- else
- {
- //create missing directories
- rtl::OUString parentDirectory = FileHelper::getParentDir(m_aFileURL) ;
-
- if (osl::File::RC errorCode = FileHelper::mkdirs(parentDirectory))
- {
- // creating the file will fail later
- OSL_TRACE("Binary Cache: Cannot create package cache directory [%d]",int(errorCode));
- }
- }
-
- uno::Reference<io::XOutputStream> xOutput = new BufferedFileOutputStream(m_aFileURL, true, 1024);
-
- uno::Reference< io::XActiveDataSource > xFormattingStream(
- m_xServiceProvider->createInstance(ASCII("com.sun.star.io.DataOutputStream")),
- uno::UNO_QUERY_THROW);
-
- xFormattingStream->setOutputStream(xOutput);
-
- m_xDataOutputStream.set(xFormattingStream, uno::UNO_QUERY_THROW);
-
- OSL_ASSERT(m_xDataOutputStream.is());
- return m_xDataOutputStream.is();
- }
-
- void BinaryWriter::close() SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- if (m_xDataOutputStream.is())
- m_xDataOutputStream->closeOutput();
-
- m_xDataOutputStream.clear();
- }
-
- BinaryWriter::~BinaryWriter()
- {
- try
- {
- close();
- }
- catch (uno::Exception& e)
- {
- (void)e;
- OSL_ENSURE(false, rtl::OUStringToOString(e.Message,RTL_TEXTENCODING_ASCII_US).getStr());
- }
- }
-
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
- void BinaryWriter::write(sal_Bool _aValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- // write one byte
- m_xDataOutputStream->writeBoolean(_aValue);
- }
- void BinaryWriter::write(sal_Int8 _aValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- // write one byte
- m_xDataOutputStream->writeByte(_aValue);
- }
- void BinaryWriter::write(sal_Int16 _aValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- // write two bytes
- m_xDataOutputStream->writeShort(_aValue);
- }
- void BinaryWriter::write(sal_Int32 _aValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- // write four byte
- m_xDataOutputStream->writeLong(_aValue);
- }
- void BinaryWriter::write(sal_Int64 _aValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- // write eight byte
- m_xDataOutputStream->writeHyper(_aValue);
- }
- void BinaryWriter::write(double _aValue)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- // write eight byte
- m_xDataOutputStream->writeDouble(_aValue);
- }
-
- // -----------------------------------------------------------------------------
- bool isAsciiEncoding(rtl::OUString const& _aStr)
- {
- const sal_Unicode *pStr = _aStr.getStr();
- sal_Int32 nLen = _aStr.getLength();
- while (nLen--)
- {
- if (*pStr++ > 127)
- return false;
- }
- return true;
- }
-
- // -----------------------------------------------------------------------------
- void BinaryWriter::write(rtl::OUString const& _aStr)
- SAL_THROW( (io::IOException, uno::RuntimeException) )
- {
- // @@@ OBinaryBaseReader_Impl::readUTF() @@@
-
- rtl::OString aUTF;
- // to fasten the conversion for ascii data, we mask the length
- bool bIsAscii = isAsciiEncoding(_aStr);
- if (bIsAscii)
- rtl_uString2String (
- &(aUTF.pData), _aStr.getStr(), _aStr.getLength(),
- RTL_TEXTENCODING_ASCII_US, OUSTRING_TO_OSTRING_CVTFLAGS);
- else
- rtl_uString2String (
- &(aUTF.pData), _aStr.getStr(), _aStr.getLength(),
- RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
-
- sal_Int32 nLength = aUTF.getLength();
- uno::Sequence<sal_Int8> aData (nLength);
- memcpy (aData.getArray(), aUTF.getStr(), nLength);
-
- OSL_ENSURE((nLength & binary::STR_ASCII_MASK) == 0,"String too long");
- if (bIsAscii)
- {
- nLength |= binary::STR_ASCII_MASK;
- OSL_ASSERT((nLength & binary::STR_ASCII_MASK) == binary::STR_ASCII_MASK);
- OSL_ASSERT(sal_Int32(nLength & ~binary::STR_ASCII_MASK) == aData.getLength());
- }
- m_xDataOutputStream->writeLong (nLength);
-
- m_xDataOutputStream->writeBytes (aData);
- }
-
- // -----------------------------------------------------------------------------
-
- // -----------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------
-}
diff --git a/configmgr/source/backend/binarywriter.hxx b/configmgr/source/backend/binarywriter.hxx
deleted file mode 100644
index 03f035947bf9..000000000000
--- a/configmgr/source/backend/binarywriter.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONFIGMGR_BINARYWRITER_HXX
-#define CONFIGMGR_BINARYWRITER_HXX
-
-#include <rtl/ustring.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/XDataOutputStream.hpp>
-
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- namespace css = com::sun::star;
-
- namespace io = css::io;
- namespace uno = css::uno;
- namespace lang = css::lang;
- // -----------------------------------------------------------------------------
-
- class BinaryWriter
- {
- rtl::OUString m_aFileURL;
-
- uno::Reference<lang::XMultiServiceFactory> m_xServiceProvider;
- uno::Reference< io::XDataOutputStream > m_xDataOutputStream;
-
- public:
- BinaryWriter(rtl::OUString const& m_aFilename, uno::Reference<lang::XMultiServiceFactory> const& _rxServiceProvider);
-
- ~BinaryWriter();
- bool open() SAL_THROW( (io::IOException, uno::RuntimeException) );
- void close() SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- // Type writer
- void write(sal_Bool _bValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void write(sal_Int8 _nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void write(sal_Int16 _nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void write(sal_Int32 _nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void write(sal_Int64 _nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void write(double _nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void write(rtl::OUString const& _aStr) SAL_THROW( (io::IOException, uno::RuntimeException) );
-
- };
- } //namespace backend
-} // namespace configmgr
-
-#endif
diff --git a/configmgr/source/backend/componentdatahelper.cxx b/configmgr/source/backend/componentdatahelper.cxx
deleted file mode 100644
index 766213c35b89..000000000000
--- a/configmgr/source/backend/componentdatahelper.cxx
+++ /dev/null
@@ -1,614 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "componentdatahelper.hxx"
-#include "treenodefactory.hxx"
-#include "typeconverter.hxx"
-#include "strdecl.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <com/sun/star/lang/NoSupportException.hpp>
-#include <com/sun/star/lang/IllegalAccessException.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/container/NoSuchElementException.hpp>
-#include <com/sun/star/container/ElementExistException.hpp>
-#include <com/sun/star/beans/IllegalTypeException.hpp>
-#include <com/sun/star/beans/PropertyExistException.hpp>
-#include <com/sun/star/beans/UnknownPropertyException.hpp>
-
-// -----------------------------------------------------------------------------
-#define OUSTR( str ) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(str) )
-// -----------------------------------------------------------------------------
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace beans = ::com::sun::star::beans;
- namespace container = ::com::sun::star::container;
-// -----------------------------------------------------------------------------
-
-DataBuilderContext::DataBuilderContext( uno::Reference< uno::XComponentContext > const & xContext )
-: m_aLogger(xContext)
-, m_aParentStack()
-, m_aActiveComponent()
-, m_pContext()
-, m_aExpectedComponentName(rtl::OUString())
-{
-
-}
-// -----------------------------------------------------------------------------
-
-DataBuilderContext::DataBuilderContext( uno::Reference< uno::XComponentContext > const & xContext, uno::XInterface * _pContext, ITemplateDataProvider* aTemplateProvider )
-: m_aLogger(xContext)
-, m_aParentStack()
-, m_aActiveComponent()
-, m_pContext(_pContext)
-, m_aExpectedComponentName()
-, m_aTemplateProvider( aTemplateProvider )
-{
-
-}
-// -----------------------------------------------------------------------------
-
-DataBuilderContext::DataBuilderContext( uno::Reference< uno::XComponentContext > const & xContext, uno::XInterface * _pContext, const rtl::OUString& aExpectedComponentName, ITemplateDataProvider* aTemplateProvider )
-: m_aLogger(xContext)
-, m_aParentStack()
-, m_aActiveComponent()
-, m_pContext(_pContext)
-, m_aExpectedComponentName( aExpectedComponentName )
-, m_aTemplateProvider( aTemplateProvider )
-{
-
-}
-// -----------------------------------------------------------------------------
-
-DataBuilderContext::DataBuilderContext(DataBuilderContext const & aBaseContext, uno::XInterface * _pContext)
-: m_aLogger(aBaseContext.m_aLogger)
-, m_aParentStack()
-, m_aActiveComponent()
-, m_pContext(_pContext)
-, m_aExpectedComponentName()
-, m_aTemplateProvider( aBaseContext.m_aTemplateProvider )
-{
-
-}
-// -----------------------------------------------------------------------------
-
-DataBuilderContext::~DataBuilderContext( )
-{
-
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::raiseMalformedDataException(sal_Char const * _pText) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException, com::sun::star::uno::RuntimeException))
-{
- rtl::OUString const sMessage = makeMessageWithPath(_pText);
- m_aLogger.error(sMessage,"parse","configmgr::backend::DataBuilder");
- throw backenduno::MalformedDataException(sMessage, m_pContext, uno::Any());
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::raiseIllegalTypeException(sal_Char const * _pText) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException, com::sun::star::uno::RuntimeException))
-{
- rtl::OUString const sMessage = makeMessageWithPath(_pText);
- beans::IllegalTypeException e(sMessage, m_pContext);
-
- rtl::OUString const sFullMessage = OUSTR("Illegal Type: ").concat(sMessage);
- m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::raiseIllegalArgumentException(sal_Char const * _pText, sal_Int16 _nPos) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- rtl::OUString const sMessage = makeMessageWithPath(_pText);
- lang::IllegalArgumentException e(sMessage, m_pContext, _nPos);
-
- rtl::OUString const sFullMessage = OUSTR("Illegal Argument: ").concat(sMessage);
- m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::raiseNoSuchElementException(sal_Char const * _pText, rtl::OUString const & _sElement) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- rtl::OUString const sMessage = makeMessageWithName(_pText,_sElement);
- container::NoSuchElementException e(sMessage, m_pContext);
-
- rtl::OUString const sFullMessage = OUSTR("No Such Node: ").concat(sMessage);
- m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::raiseElementExistException(sal_Char const * _pText, rtl::OUString const & _sElement) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- rtl::OUString const sMessage = makeMessageWithName(_pText,_sElement);
- container::ElementExistException e(sMessage, m_pContext);
-
- rtl::OUString const sFullMessage = OUSTR("Node Already Exists: ").concat(sMessage);
- m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::raisePropertyExistException(sal_Char const * _pText, rtl::OUString const & _sElement) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- rtl::OUString const sMessage = makeMessageWithName(_pText,_sElement);
- beans::PropertyExistException e(sMessage, m_pContext);
-
- rtl::OUString const sFullMessage = OUSTR("No Such Property: ").concat(sMessage);
- m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
-}
-// -----------------------------------------------------------------------------
-
-rtl::OUString DataBuilderContext::makeMessageWithPath(sal_Char const * _pText) const
- SAL_THROW((com::sun::star::uno::RuntimeException))
-{
- rtl::OUStringBuffer sMessage;
- sMessage.appendAscii(_pText);
-
- sMessage.appendAscii(" [@").append(getNodeParentagePath()).appendAscii("] ");
-
- return sMessage.makeStringAndClear();
-}
-// -----------------------------------------------------------------------------
-
-rtl::OUString DataBuilderContext::makeMessageWithName(sal_Char const * _pText, rtl::OUString const & _aName) const
- SAL_THROW((com::sun::star::uno::RuntimeException))
-{
- rtl::OUStringBuffer sMessage;
- sMessage.appendAscii(_pText);
-
- if (_aName.getLength() != 0)
- sMessage.appendAscii(" [").append(getNodePath(_aName)).appendAscii("] ");
- else
- sMessage.appendAscii(" [@").append(getNodeParentagePath()).appendAscii("] ");
-
- return sMessage.makeStringAndClear();
-}
-// -----------------------------------------------------------------------------
-const sal_Unicode k_pathsep = '/';
-
-rtl::OUString DataBuilderContext::getNodeParentagePath() const
-{
- rtl::OUStringBuffer path;
-
- for (Stack< ISubtree * >::bottomup_iterator it = m_aParentStack.begin_up();
- it != m_aParentStack.end_up(); ++it)
- {
- OSL_ASSERT(*it);
- path.append(k_pathsep).append((**it).getName());
- }
-
- return path.makeStringAndClear();
-}
-// -----------------------------------------------------------------------------
-
-rtl::OUString DataBuilderContext::getNodePath(rtl::OUString const & aNodeName) const
-{
- rtl::OUStringBuffer path( getNodeParentagePath() );
-
- path.append(k_pathsep).append(aNodeName);
-
- return path.makeStringAndClear();
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-bool DataBuilderContext::isDone() const
-{
- OSL_ENSURE(m_aParentStack.empty() || hasActiveComponent(),"DataBuilderContext:Inconsistent Activity state");
-
- return m_aParentStack.empty();
-}
-// -----------------------------------------------------------------------------
-
-ISubtree & DataBuilderContext::implGetCurrentParent() const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- if (m_aParentStack.empty())
- raiseMalformedDataException("Invalid Component Data: Operation requires open parent node.");
-
- OSL_ENSURE( m_aParentStack.top(), "NULL tree on node-stack" );
-
- return *m_aParentStack.top();
-}
-// -----------------------------------------------------------------------------
-
-bool DataBuilderContext::isWritable(INode const * pNode) const
- SAL_THROW(())
-{
- OSL_PRECOND(pNode,"Unexpected NULL node pointer");
- return pNode->getAttributes().isWritable();
-
-}
-// -----------------------------------------------------------------------------
-
-bool DataBuilderContext::isRemovable(ISubtree const * pItem) const
- SAL_THROW(())
-{
- OSL_PRECOND(pItem,"Unexpected NULL item pointer");
- return pItem->getAttributes().isRemovable();
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-rtl::OUString DataBuilderContext::getTemplateComponent( const backenduno::TemplateIdentifier& aItemType ) const
-{
- if (aItemType.Component.getLength() != 0)
- return aItemType.Component;
-
- else
- return getActiveComponent();
-}
-// -----------------------------------------------------------------------------
-
-backenduno::TemplateIdentifier DataBuilderContext::completeComponent( const backenduno::TemplateIdentifier& aItemType ) const
-{
- backenduno::TemplateIdentifier aComplete(aItemType);
- if (aComplete.Component.getLength() == 0)
- aComplete.Component = getActiveComponent();
-
- return aComplete;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-backenduno::TemplateIdentifier DataBuilderContext::getCurrentItemType() const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- ISubtree const * pCurrentSet = getCurrentParent().asISubtree();
- if (!pCurrentSet || !pCurrentSet->isSetNode())
- raiseMalformedDataException("Component Builder Context: Cannot add/replace node - context is not a set");
-
- backenduno::TemplateIdentifier aCompleteType;
-
- aCompleteType.Name = pCurrentSet->getElementTemplateName();
- aCompleteType.Component = pCurrentSet->getElementTemplateModule();
-
- return aCompleteType;
-}
-// -----------------------------------------------------------------------------
-
-backenduno::TemplateIdentifier DataBuilderContext::getValidItemType(backenduno::TemplateIdentifier const & aItemType) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- ISubtree const * pCurrentSet = getCurrentParent().asISubtree();
- if (!pCurrentSet || !pCurrentSet->isSetNode())
- raiseMalformedDataException("Component Builder Context: Cannot add/replace node - context is not a set");
-
- backenduno::TemplateIdentifier aCompleteType = completeComponent( aItemType );
-
- // for now only a single item-type is supported
- if (aCompleteType.Name != pCurrentSet->getElementTemplateName())
- raiseIllegalTypeException("Component Builder Context: Cannot add/replace node - template is not permitted in containing set");
-
- if (aCompleteType.Component != pCurrentSet->getElementTemplateModule())
- raiseIllegalTypeException("Component Builder Context: Cannot add/replace node - template is not permitted in containing set (component mismatch)");
-
- return aCompleteType;
-}
-// -----------------------------------------------------------------------------
-
-ISubtree * DataBuilderContext::addNodeToCurrent(std::auto_ptr<ISubtree> _aNode)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_PRECOND(_aNode.get(), "ERROR: Adding a NULL node");
-
- if (this->findChild(_aNode->getName()))
- raiseElementExistException("Component Builder Context: The node to be added does already exist", _aNode->getName());
-
- return getCurrentParent().addChild( base_ptr(_aNode) )->asISubtree();
-}
-// -----------------------------------------------------------------------------
-
-ISubtree * DataBuilderContext::addLocalizedToCurrent(std::auto_ptr<ISubtree> _aNode)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_PRECOND(_aNode.get(), "ERROR: Adding a NULL node");
-
- if (this->findChild(_aNode->getName()))
- raisePropertyExistException("Component Builder Context: The property to be added does already exist", _aNode->getName());
-
- return getCurrentParent().addChild( base_ptr(_aNode) )->asISubtree();
-}
-// -----------------------------------------------------------------------------
-
-ValueNode * DataBuilderContext::addPropertyToCurrent(std::auto_ptr<ValueNode> _aNode, bool _bMayReplace)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_PRECOND(_aNode.get(), "ERROR: Adding a NULL node");
- OSL_PRECOND(!_bMayReplace || _aNode->getAttributes().isReplacedForUser(), "Wrong status for added property");
-
- if (this->findChild(_aNode->getName()))
- {
- // We currently may get a 'replace', when overriding an added property
- if (_bMayReplace && getCurrentParent().isSetNode())
- {
- getCurrentParent().removeChild(_aNode->getName());
- _aNode->modifyState(node::isReplaced);
- }
- else
-
- raisePropertyExistException("Component Builder Context: The property to be added does already exist", _aNode->getName());
- }
- return getCurrentParent().addChild( base_ptr(_aNode) )->asValueNode();
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::markCurrentMerged()
-{
- Stack< ISubtree * >::topdown_iterator it = m_aParentStack.begin_down(), end = m_aParentStack.end_down();
- for ( ;it != end && (*it)->isDefault(); ++it)
- (*it)->modifyState( node::isMerged );
-
-#if OSL_DEBUG_LEVEL > 0
- for ( ;it != end; ++it)
- OSL_ENSURE(!(*it)->isDefault(),"Found a default node in ancestry of a merged change");
-#endif
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-bool DataBuilderContext::isProperty(INode * pProp) const
- SAL_THROW((com::sun::star::uno::RuntimeException))
-{
- OSL_PRECOND(pProp, "ERROR: Unexpected NULL node");
-
- if (pProp == NULL)
- {
- rtl::OUString sMsg = makeMessageWithName("INTERNAL ERROR (DataBuilderContext): Trying to inspect NULL node",rtl::OUString() );
- throw uno::RuntimeException( sMsg, m_pContext );
- }
-
- if ( ISubtree * pTree = pProp->asISubtree() )
- return isLocalizedValueSet( *pTree );
-
- OSL_ASSERT(dynamic_cast< ValueNode * >(pProp) != 0);
- return true;
-}
-// -----------------------------------------------------------------------------
-
-INode * DataBuilderContext::findChild(rtl::OUString const & _aName)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- return getCurrentParent().getChild(_aName);
-}
-// -----------------------------------------------------------------------------
-
-INode * DataBuilderContext::findProperty(rtl::OUString const & _aName)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- INode * pResult = findChild(_aName);
- if (pResult && !isProperty(pResult))
- {
- raiseMalformedDataException("Component Builder Context: Found an existing inner node, where a property was expected");
- }
- return pResult;
-}
-// -----------------------------------------------------------------------------
-
-ISubtree * DataBuilderContext::findNode(rtl::OUString const & _aName)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- INode * pResult = findChild(_aName);
-
- if (!pResult)
- return NULL;
-
- if (!isNode(pResult))
- raiseMalformedDataException("Component Builder Context: Found an existing property, where an inner node was expected");
-
- OSL_ASSERT(dynamic_cast< ISubtree * >(pResult) != 0);
- return pResult->asISubtree();
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::pushNode(ISubtree * pTree)
- SAL_THROW((com::sun::star::uno::RuntimeException))
-{
- OSL_PRECOND(hasActiveComponent(), "Component Builder Context: Entering a node without having an active component");
- OSL_PRECOND(pTree, "ERROR: Pushing a NULL tree");
-
- if (pTree == NULL)
- {
- rtl::OUString sMsg = makeMessageWithName("INTERNAL ERROR (DataBuilderContext): Trying to push NULL tree",rtl::OUString() );
- throw uno::RuntimeException( sMsg, m_pContext );
- }
- m_aParentStack.push(pTree);
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::popNode()
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_PRECOND(hasActiveComponent(), "Component Builder Context: Leaving a node without having an active component");
- if (m_aParentStack.empty())
- raiseMalformedDataException("Invalid Component Data: Unmatched end of node");
-
- OSL_ENSURE( m_aParentStack.top(), "NULL tree on node-stack" );
-
- m_aParentStack.pop();
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::startActiveComponent(rtl::OUString const & _aComponent)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_PRECOND(!hasActiveComponent(), "Component Builder Context: Component is already active");
- OSL_PRECOND(m_aParentStack.empty(), "Component Builder Context: Starting Component/Template while inside a node");
-
- if (!m_aParentStack.empty())
- raiseMalformedDataException("Invalid Component Data: Starting component while node is still open");
-
- if (m_aExpectedComponentName.getLength()!=0)
- {
- if (m_aExpectedComponentName.compareTo ( _aComponent)!= 0 )
- raiseMalformedDataException("Invalid Component Data: Component name does not match request");
- }
- m_aActiveComponent = _aComponent;
-
- OSL_POSTCOND(hasActiveComponent(), "Component Builder Context: Could not start Component/Template");
-}
-// -----------------------------------------------------------------------------
-
-void DataBuilderContext::endActiveComponent()
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_PRECOND( hasActiveComponent(), "Component Builder Context: No Component active");
- OSL_PRECOND(m_aParentStack.empty(), "Component Builder Context: Ending Component/Template while inside a node");
-
- if (!m_aParentStack.empty())
- raiseMalformedDataException("Invalid Component Data: Ending component while node is still open");
-
- m_aActiveComponent = rtl::OUString();
-
- OSL_POSTCOND(!hasActiveComponent(), "Component Builder Context: Could not end Component/Template");
-}
-// -----------------------------------------------------------------------------
-ResultHolder< TemplateInstance > DataBuilderContext::getTemplateData (TemplateRequest const & _aRequest )
-{
- return(m_aTemplateProvider->getTemplateData (_aRequest));
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-ComponentDataFactory::ComponentDataFactory()
-: m_rNodeFactory( getDefaultTreeNodeFactory() )
-{
-}
-// -----------------------------------------------------------------------------
-
-std::auto_ptr<ISubtree> ComponentDataFactory::createGroup( rtl::OUString const & _aName,
- bool _bExtensible,
- node::Attributes const & _aAttributes) const
-{
- if (_bExtensible)
- {
- return getNodeFactory().createSetNode( _aName,
- toTemplateName(TYPE_ANY,false),
- TEMPLATE_MODULE_NATIVE_VALUE,
- _aAttributes );
- }
- else
- {
- return getNodeFactory().createGroupNode( _aName,
- _aAttributes );
- }
-}
-// -----------------------------------------------------------------------------
-
-std::auto_ptr<ISubtree> ComponentDataFactory::createSet(rtl::OUString const & _aName,
- backenduno::TemplateIdentifier const & _aItemType,
- bool _bExtensible,
- node::Attributes const & _aAttributes) const
-{
- OSL_ENSURE(!_bExtensible, "DataBuilderContext: Unimplemented feature: Extensible Set node");
- if (_bExtensible)
- return std::auto_ptr<ISubtree>();
-
- return getNodeFactory().createSetNode( _aName,
- _aItemType.Name,
- _aItemType.Component,
- _aAttributes );
-}
-// -----------------------------------------------------------------------------
-
-std::auto_ptr<ISubtree> ComponentDataFactory::createLocalizedContainer( rtl::OUString const & _aName,
- uno::Type const & _aValueType,
- node::Attributes const & _aAttributes) const
-{
- node::Attributes aLocalizedAttributes(_aAttributes);
- aLocalizedAttributes.setLocalized (true);
-
- return getNodeFactory().createSetNode( _aName,
- toTemplateName(_aValueType),
- TEMPLATE_MODULE_LOCALIZED_VALUE,
- aLocalizedAttributes );
-
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-namespace
-{
- DECLARE_CONSTASCII_USTRING(INSTANCE_MARKER);
- IMPLEMENT_CONSTASCII_USTRING(INSTANCE_MARKER, "instantiate@");
-}
-// -----------------------------------------------------------------------------
-
-std::auto_ptr<ISubtree> ComponentDataFactory::createPlaceHolder(rtl::OUString const & _aName,
- backenduno::TemplateIdentifier const & _aInstanceType) const
-{
- return getNodeFactory().createSetNode( _aName,
- INSTANCE_MARKER + _aInstanceType.Name,
- _aInstanceType.Component,
- node::Attributes());
-}
-// -----------------------------------------------------------------------------
-
-bool ComponentDataFactory::isInstancePlaceHolder(ISubtree const & _aInstanceTree)
-{
- return !! _aInstanceTree.getElementTemplateName().match(INSTANCE_MARKER);
-}
-// -----------------------------------------------------------------------------
-
-backenduno::TemplateIdentifier ComponentDataFactory::getInstanceType(ISubtree const & _aInstanceTree)
-{
- OSL_ENSURE( isInstancePlaceHolder(_aInstanceTree), "Instance placeholder tree expected" );
-
- backenduno::TemplateIdentifier aResult;
-
- if (isInstancePlaceHolder(_aInstanceTree))
- {
- aResult.Name = _aInstanceTree.getElementTemplateName().copy( INSTANCE_MARKER.getLength() );
- aResult.Component = _aInstanceTree.getElementTemplateModule();
- }
-
- return aResult;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace backend
-
-// -------------------------------------------------------------------------
-} // namespace configmgr
diff --git a/configmgr/source/backend/componentdatahelper.hxx b/configmgr/source/backend/componentdatahelper.hxx
deleted file mode 100644
index 53f6200f822a..000000000000
--- a/configmgr/source/backend/componentdatahelper.hxx
+++ /dev/null
@@ -1,219 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */
-
-#ifndef CONFIGMGR_BACKEND_COMPONENTDATAHELPER_HXX
-#define CONFIGMGR_BACKEND_COMPONENTDATAHELPER_HXX
-
-#include "valuenode.hxx"
-#include "utility.hxx"
-#include "stack.hxx"
-#include <com/sun/star/configuration/backend/TemplateIdentifier.hpp>
-#include <com/sun/star/configuration/backend/MalformedDataException.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
-
-#ifndef INCLUDED_MEMORY
-#include <memory>
-#define INCLUDED_MEMORY
-#endif
-#include "mergeddataprovider.hxx"
-#ifndef CONFIGMGR_LOGGER_HXX_
-#include "logger.hxx"
-#endif
-#include "request.hxx"
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- class OTreeNodeFactory;
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace backenduno = ::com::sun::star::configuration::backend;
-
-// -----------------------------------------------------------------------------
-
- class DataBuilderContext
- {
- Logger m_aLogger;
- Stack< ISubtree * > m_aParentStack;
- rtl::OUString m_aActiveComponent;
- uno::XInterface * m_pContext;
- rtl::OUString m_aExpectedComponentName;
- ITemplateDataProvider * m_aTemplateProvider;
- public:
- explicit DataBuilderContext(uno::Reference< uno::XComponentContext > const & xContext);
- DataBuilderContext(uno::Reference< uno::XComponentContext > const & xContext, uno::XInterface * _pContext , ITemplateDataProvider* aTemplateProvider = NULL);
- DataBuilderContext(uno::Reference< uno::XComponentContext > const & xContext, uno::XInterface * _pContext, const rtl::OUString& aExpectedComponentName,ITemplateDataProvider* aTemplateProvider = NULL );
- DataBuilderContext(DataBuilderContext const & aBaseContext, uno::XInterface * _pContext);
- ~DataBuilderContext();
-
- bool isDone() const;
-
- bool hasActiveComponent() const { return m_aActiveComponent.getLength() != 0; }
- rtl::OUString getActiveComponent() const { return m_aActiveComponent; }
-
- ISubtree & getCurrentParent()
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
- { return implGetCurrentParent(); }
-
- ISubtree const & getCurrentParent() const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
- { return implGetCurrentParent(); }
-
- node::Attributes getCurrentAttributes() const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
- { return implGetCurrentParent().getAttributes(); }
-
- ITemplateDataProvider * getTemplateProvider() const
- { return m_aTemplateProvider; }
-
- rtl::OUString getTemplateComponent(backenduno::TemplateIdentifier const & aItemType ) const;
-
- backenduno::TemplateIdentifier completeComponent(backenduno::TemplateIdentifier const & aItemType ) const;
-
- backenduno::TemplateIdentifier getCurrentItemType() const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- backenduno::TemplateIdentifier getValidItemType(backenduno::TemplateIdentifier const & aItemType) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void startActiveComponent(rtl::OUString const & _aComponent)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void endActiveComponent()
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- bool isProperty(INode * pProp) const
- SAL_THROW((com::sun::star::uno::RuntimeException));
-
- bool isNode(INode * pNode) const SAL_THROW((com::sun::star::uno::RuntimeException))
- { return !isProperty(pNode); }
-
- void pushNode(ISubtree * pTree)
- SAL_THROW((com::sun::star::uno::RuntimeException));
- void popNode()
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- INode * findProperty(rtl::OUString const & _aName)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- ISubtree * findNode(rtl::OUString const & _aName)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- bool isWritable(INode const * pNode) const
- SAL_THROW(());
- bool isRemovable(ISubtree const * pItem) const
- SAL_THROW(());
-
- ISubtree * addNodeToCurrent(std::auto_ptr<ISubtree> _aNode)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- ISubtree * addLocalizedToCurrent(std::auto_ptr<ISubtree> _aNode)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- ValueNode * addPropertyToCurrent(std::auto_ptr<ValueNode> _aNode, bool _bMayReplace = false)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void markCurrentMerged();
-
- // Logging support
- Logger const & getLogger() const { return m_aLogger; }
-
- rtl::OUString getNodeParentagePath() const;
- rtl::OUString getNodePath(rtl::OUString const & aNodeName) const;
-
- // Exception support
- void raiseMalformedDataException (sal_Char const * _pText) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void raiseIllegalArgumentException (sal_Char const * _pText, sal_Int16 _nPos = 0) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void raiseElementExistException (sal_Char const * _pText, rtl::OUString const & _sElement) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void raiseNoSuchElementException (sal_Char const * _pText, rtl::OUString const & _sElement) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void raisePropertyExistException (sal_Char const * _pText, rtl::OUString const & _sElement) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void raiseIllegalTypeException (sal_Char const * _pText) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- ResultHolder< TemplateInstance > getTemplateData (TemplateRequest const & _aRequest );
- private:
- INode * findChild(rtl::OUString const & _aName)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- rtl::OUString makeMessageWithPath(sal_Char const * _pText) const
- SAL_THROW((com::sun::star::uno::RuntimeException));
-
- rtl::OUString makeMessageWithName(sal_Char const * _pText, rtl::OUString const & _aName) const
- SAL_THROW((com::sun::star::uno::RuntimeException));
-
- ISubtree & implGetCurrentParent() const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- };
-// -----------------------------------------------------------------------------
-
- class ComponentDataFactory
- {
- OTreeNodeFactory & m_rNodeFactory;
- public:
- ComponentDataFactory();
-
- ComponentDataFactory(OTreeNodeFactory & _rNodeFactory)
- : m_rNodeFactory(_rNodeFactory)
- {}
-
- public:
- OTreeNodeFactory& getNodeFactory() const { return m_rNodeFactory; }
-
- std::auto_ptr<ISubtree> createGroup(rtl::OUString const & _aName,
- bool _bExtensible,
- node::Attributes const & _aAttributes) const;
-
- std::auto_ptr<ISubtree> createSet( rtl::OUString const & _aName,
- backenduno::TemplateIdentifier const & aItemType,
- bool _bExtensible,
- node::Attributes const & _aAttributes) const;
-
- std::auto_ptr<ISubtree> createLocalizedContainer(rtl::OUString const & _aName,
- uno::Type const & _aValueType,
- node::Attributes const & _aAttributes) const;
-
- std::auto_ptr<ISubtree> createPlaceHolder(rtl::OUString const & _aName,
- backenduno::TemplateIdentifier const & _aInstanceType) const;
-
- static bool isInstancePlaceHolder(ISubtree const & _aInstanceTree);
- static backenduno::TemplateIdentifier getInstanceType(ISubtree const & _aInstanceTree);
- };
-// -----------------------------------------------------------------------------
- } // namespace backend
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/emptylayer.cxx b/configmgr/source/backend/emptylayer.cxx
deleted file mode 100644
index b0f9bf2799f7..000000000000
--- a/configmgr/source/backend/emptylayer.cxx
+++ /dev/null
@@ -1,225 +0,0 @@
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "emptylayerimpl.hxx"
-#include "emptylayer.hxx"
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- // -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
-
- uno::Reference< backenduno::XLayer > createEmptyLayer()
- {
- return new EmptyLayer();
- }
- // -----------------------------------------------------------------------------
-
- bool checkEmptyLayer(uno::Reference< backenduno::XLayer > const & xLayer )
- {
- OSL_ENSURE(xLayer.is(),"Unexpected NULL Layer");
- if (!xLayer.is()) return false;
-
- RequireEmptyLayer * const pChecker = new RequireEmptyLayer;
- uno::Reference< backenduno::XLayerHandler > xChecker(pChecker);
-
- try
- {
- xLayer->readData(xChecker);
- }
- catch (uno::Exception &)
- {
- OSL_ENSURE(!pChecker->wasEmpty(), "Checking for empty layer: exception occurred after empty layer was ended");
- }
-
- return pChecker->wasEmpty();
- }
-
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
-
- EmptyLayer::~EmptyLayer( )
- {
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL
- EmptyLayer::readData( const uno::Reference< backenduno::XLayerHandler >& aHandler )
- throw (backenduno::MalformedDataException, lang::NullPointerException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if (aHandler.is())
- {
- aHandler->startLayer();
- aHandler->endLayer();
- }
- else
- throw lang::NullPointerException(rtl::OUString::createFromAscii("EmptyLayer: Null Handler"),*this);
- }
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
-
- RequireEmptyLayer::RequireEmptyLayer()
- : m_bStarted(false)
- , m_bInvalid(false)
- , m_bEmpty(false)
- {
- }
- // -----------------------------------------------------------------------------
-
- RequireEmptyLayer::~RequireEmptyLayer( )
- {
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::startLayer( )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- m_bInvalid = false;
- m_bEmpty = false;
-
- if (m_bStarted) fail("Layer started twice");
- m_bStarted = true;
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::endLayer( )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- if (!m_bStarted) fail("Layer was not started");
- m_bEmpty = !m_bInvalid;
- m_bStarted = false;
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::overrideNode( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/, sal_Bool /*bClear*/ )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::addOrReplaceNode( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/ )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::addOrReplaceNodeFromTemplate( const rtl::OUString& /*aName*/, const backenduno::TemplateIdentifier& /*aTemplate*/, sal_Int16 /*aAttributes*/)
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::endNode( )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::dropNode( const rtl::OUString& /*aName*/ )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::addProperty( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/, const uno::Type& /*aType*/ )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::addPropertyWithValue( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/, const uno::Any& /*aValue*/ )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::overrideProperty( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/, const uno::Type& /*aType*/, sal_Bool /*bClear*/ )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::endProperty( )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::setPropertyValue( const uno::Any& /*aValue*/ )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL RequireEmptyLayer::setPropertyValueForLocale( const uno::Any& /*aValue*/, const rtl::OUString& /*aLocale*/ )
- throw (backenduno::MalformedDataException, uno::RuntimeException)
- {
- failNotEmpty();
- }
- // -----------------------------------------------------------------------------
-
- void RequireEmptyLayer::fail(sal_Char const * pMsg)
- {
- if (!m_bStarted & !m_bInvalid) pMsg = "Layer was not started";
- m_bInvalid = true;
- m_bStarted = false;
-
- OSL_ASSERT(pMsg);
- rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
-
- throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
- }
-
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
-
- // -----------------------------------------------------------------------------
- } // namespace
-
- // -----------------------------------------------------------------------------
-} // namespace
-
diff --git a/configmgr/source/backend/emptylayerimpl.hxx b/configmgr/source/backend/emptylayerimpl.hxx
deleted file mode 100644
index 0c22e3355376..000000000000
--- a/configmgr/source/backend/emptylayerimpl.hxx
+++ /dev/null
@@ -1,136 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_EMPTYLAYERIMPL_HXX
-#define CONFIGMGR_BACKEND_EMPTYLAYERIMPL_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
-#include <com/sun/star/configuration/backend/XLayer.hpp>
-
-// -----------------------------------------------------------------------------
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- // -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
- // -----------------------------------------------------------------------------
-
- class EmptyLayer : public cppu::WeakImplHelper1<backenduno::XLayer>
- {
- public:
- virtual ~EmptyLayer();
-
- // XLayer
- public:
- virtual void SAL_CALL
- readData( const uno::Reference< backenduno::XLayerHandler >& aHandler )
- throw (backenduno::MalformedDataException, lang::NullPointerException, lang::WrappedTargetException, uno::RuntimeException);
- };
- // -----------------------------------------------------------------------------
-
- class RequireEmptyLayer : public cppu::WeakImplHelper1<backenduno::XLayerHandler>
- {
- public:
- RequireEmptyLayer();
- virtual ~RequireEmptyLayer();
-
- bool wasEmpty() const { return m_bEmpty; }
- bool wasInvalid() const { return m_bInvalid; }
- // XLayerHandler
- public:
- virtual void SAL_CALL
- startLayer( )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endLayer( )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endNode( )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endProperty( )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
- throw (backenduno::MalformedDataException, uno::RuntimeException);
-
- private:
- void failNotEmpty() { fail("layer is not empty"); }
- void fail(sal_Char const * pMsg);
-
- private:
- bool m_bStarted;
- bool m_bInvalid;
- bool m_bEmpty;
- };
- // -----------------------------------------------------------------------------
- } // namespace xml
- // -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
diff --git a/configmgr/source/backend/importmergehandler.cxx b/configmgr/source/backend/importmergehandler.cxx
deleted file mode 100644
index cf85e973efc4..000000000000
--- a/configmgr/source/backend/importmergehandler.cxx
+++ /dev/null
@@ -1,296 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "importmergehandler.hxx"
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <rtl/ustrbuf.hxx>
-
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace beans = ::com::sun::star::beans;
-
-// -----------------------------------------------------------------------------
-
-ImportMergeHandler::ImportMergeHandler(
- uno::Reference< backenduno::XBackend > const & xTargetBackend, Mode mode, rtl::OUString const & aEntity, sal_Bool const & bNotify )
-: BasicImportHandler(xTargetBackend,aEntity, bNotify)
-, m_xOutputHandler()
-, m_mode(mode)
-{
-}
-// -----------------------------------------------------------------------------
-
-void ImportMergeHandler::failNotStarted()
-{
- OSL_ENSURE(!hasComponent(), "Import handler after failure to create output handler or after closing");
- raiseMalformedDataException("configmgr::backend::ImportHandler: Trying to generate output before identifying the target component");
-}
-// -----------------------------------------------------------------------------
-
-inline bool ImportMergeHandler::isStarted() const
-{
- return !! m_xOutputHandler.is();
-}
-// -----------------------------------------------------------------------------
-
-inline void ImportMergeHandler::checkStarted()
-{
- if (!isStarted()) failNotStarted();
-}
-// -----------------------------------------------------------------------------
-
-inline uno::Reference< backenduno::XUpdateHandler > ImportMergeHandler::getOutputHandler()
-{
- checkStarted();
- return m_xOutputHandler;
-}
-// -----------------------------------------------------------------------------
-
-static
-bool setHandlerProperty(uno::Reference< uno::XInterface > const & xHandler, char const * property, sal_Bool value)
-{
- OSL_ASSERT(property);
- uno::Reference< lang::XInitialization > xInitHandler( xHandler, uno::UNO_QUERY );
- if (xHandler.is())
- try
- {
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] <<= beans::NamedValue( rtl::OUString::createFromAscii(property), uno::makeAny(value) );
- xInitHandler->initialize(aArgs);
- return true;
- }
- catch (uno::Exception & e)
- {
- OSL_TRACE("Configuration Import Handler - Could not set output handler property '%s': %s\n",
- property,rtl::OUStringToOString(e.Message,RTL_TEXTENCODING_ASCII_US).getStr());
-
- OSL_ENSURE(false, "Output Handler does not support expected property" );
- }
- else
- {
- OSL_TRACE("Configuration Import Handler - Could not set output handler property '%s': %s\n",
- property,"Object does not support expected interface");
-
- OSL_ENSURE(false, "Output Handler does not support expected interface" );
- }
- return false;
-}
-// -----------------------------------------------------------------------------
-uno::Reference< backenduno::XUpdateHandler > ImportMergeHandler::createOutputHandler()
-{
- OSL_PRECOND( hasComponent(), "Trying to create output-handler for Import Merger without setting a component first") ;
- rtl::OUString const aComponentName = this->getComponent();
-
- uno::Reference< backenduno::XUpdateHandler > xOutputHandler;
- try
- {
- xOutputHandler = hasEntity() ? getBackend()->getUpdateHandler(aComponentName,getEntity())
- : getBackend()->getOwnUpdateHandler(aComponentName);
- }
- catch (lang::NoSupportException & e)
- {
- rtl::OUStringBuffer sMessage;
- sMessage.appendAscii("configmgr::backend::ImportHandler: ");
- sMessage.appendAscii("Could not get output handler for component ").append(aComponentName);
- sMessage.appendAscii(": Backend does not support updates - ").append( e.Message );
-
- throw lang::WrappedTargetException(sMessage.makeStringAndClear(), *this, uno::makeAny(e));
- }
- catch (lang::IllegalArgumentException & e)
- {
- rtl::OUStringBuffer sMessage;
- sMessage.appendAscii("configmgr::backend::ImportHandler: ");
- sMessage.appendAscii("Could not get output handler for component ").append(aComponentName);
- sMessage.appendAscii(" due to a backend exception: ").append( e.Message );
-
- throw lang::WrappedTargetException(sMessage.makeStringAndClear(), *this, uno::makeAny(e));
- }
-
- if (!xOutputHandler.is())
- {
- rtl::OUStringBuffer sMessage;
- sMessage.appendAscii("configmgr::backend::ImportHandler: ");
- sMessage.appendAscii("Cannot import. ERROR - The backend returns a NULL handler for component ")
- .append(aComponentName).append( sal_Unicode('.') );
-
- throw uno::RuntimeException(sMessage.makeStringAndClear(), *this);
- }
-
- switch (m_mode)
- {
- case merge: break;
- case copy: setHandlerProperty(xOutputHandler,"Truncate", sal_True); break;
- case no_overwrite: setHandlerProperty(xOutputHandler,"Overwrite",sal_False); break;
-
- default: OSL_ASSERT(false); break;
- }
-
- return xOutputHandler;
-}
-// -----------------------------------------------------------------------------
-
-// XLayerHandler
-
-void SAL_CALL ImportMergeHandler::startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- m_xOutputHandler.clear();
-
- BasicImportHandler::startLayer();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (isStarted())
- try
- {
- getOutputHandler()->endUpdate();
- }
- catch (lang::IllegalAccessException & iae)
- {
- rtl::OUString const sMsg(RTL_CONSTASCII_USTRINGPARAM("ImportHandler - no write access to layer: "));
- throw lang::WrappedTargetException(sMsg.concat(iae.Message),*this,uno::makeAny(iae));
- }
-
- BasicImportHandler::endLayer();
- m_xOutputHandler.clear();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!isStarted() && startComponent(aName))
- try
- {
- (m_xOutputHandler = createOutputHandler())->startUpdate( );
- }
- catch (lang::IllegalAccessException & iae)
- {
- rtl::OUString const sMsg(RTL_CONSTASCII_USTRINGPARAM("ImportHandler - no write access to layer: "));
- throw lang::WrappedTargetException(sMsg.concat(iae.Message),*this,uno::makeAny(iae));
- }
-
- OSL_ENSURE(!bClear,"'clear' operation not supported properly on import");
-
- bool bReset = (m_mode != merge) || bClear; // is not relevant for no_overwrite,but might be cheaper there
- getOutputHandler()->modifyNode(aName,aAttributes,aAttributes,bReset);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- getOutputHandler()->addOrReplaceNode(aName,aAttributes);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- getOutputHandler()->addOrReplaceNodeFromTemplate(aName,aAttributes,aTemplate);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- getOutputHandler()->endNode();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- getOutputHandler()->removeNode(aName);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- (void) bClear; // avoid warning about unused parameter
- OSL_ENSURE(!bClear,"'clear' operation not supported on import");
- getOutputHandler()->modifyProperty(aName,aAttributes,aAttributes,aType);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- getOutputHandler()->endProperty();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- getOutputHandler()->setPropertyValue(aValue);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- getOutputHandler()->setPropertyValueForLocale(aValue,aLocale);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- getOutputHandler()->addOrReplaceProperty(aName, aAttributes, aType);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL ImportMergeHandler::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- getOutputHandler()->addOrReplacePropertyWithValue(aName, aAttributes, aValue);
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace
-
-// -----------------------------------------------------------------------------
-} // namespace
-
diff --git a/configmgr/source/backend/importmergehandler.hxx b/configmgr/source/backend/importmergehandler.hxx
deleted file mode 100644
index 74803a445392..000000000000
--- a/configmgr/source/backend/importmergehandler.hxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_IMPORTMERGEHANDLER_HXX
-#define CONFIGMGR_BACKEND_IMPORTMERGEHANDLER_HXX
-
-#include "basicimporthandler.hxx"
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-
- class ImportMergeHandler : public BasicImportHandler
- {
- public:
- enum Mode
- {
- merge, // merge as update into existing data
- copy, // reset existing data first -> copy imported data
- no_overwrite // copy/merge only if no data is in the layer
- };
-
- explicit
- ImportMergeHandler(uno::Reference< backenduno::XBackend > const & xTargetBackend, Mode mode,
- rtl::OUString const & aEntity = rtl::OUString(), sal_Bool const & bNotify = sal_False);
-
- // XLayerHandler
- protected:
- virtual void SAL_CALL
- startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
- private:
- bool isStarted() const;
- void checkStarted();
- void failNotStarted();
-
- uno::Reference< backenduno::XUpdateHandler > getOutputHandler();
-
- uno::Reference< backenduno::XUpdateHandler > createOutputHandler();
- private:
- uno::Reference< backenduno::XUpdateHandler > m_xOutputHandler;
- Mode m_mode;
- };
-// -----------------------------------------------------------------------------
- } // namespace xml
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/importsvc.cxx b/configmgr/source/backend/importsvc.cxx
deleted file mode 100644
index 01af7e0e7811..000000000000
--- a/configmgr/source/backend/importsvc.cxx
+++ /dev/null
@@ -1,335 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "importsvc.hxx"
-#include "importmergehandler.hxx"
-#include "backendfactory.hxx"
-
-#ifndef CONFIGMGR_API_FACTORY_HXX_
-#include "confapifactory.hxx"
-#endif
-#include <com/sun/star/beans/NamedValue.hpp>
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace beans = ::com::sun::star::beans;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-sal_Char const * const aMergeImporterServices[] =
-{
- "com.sun.star.configuration.backend.MergeImporter",
- 0,
- "com.sun.star.configuration.backend.Importer",
- 0
-};
-const ServiceImplementationInfo aMergeImporterSI =
-{
- "com.sun.star.comp.configuration.backend.MergeImporter",
- aMergeImporterServices, aMergeImporterServices + 2
-};
-// -----------------------------------------------------------------------------
-
-const ServiceRegistrationInfo* getMergeImportServiceInfo()
-{ return getRegistrationInfo(& aMergeImporterSI); }
-// -----------------------------------------------------------------------------
-
-MergeImportService::MergeImportService(uno::Reference< uno::XComponentContext > const & _xContext)
-: ImportService(_xContext, &aMergeImporterSI)
-{
-}
-// -----------------------------------------------------------------------------
-
-uno::Reference< uno::XInterface > SAL_CALL instantiateMergeImporter
-( uno::Reference< uno::XComponentContext > const& xContext )
-{
- return * new MergeImportService( xContext );
-}
-// -----------------------------------------------------------------------------
-
-uno::Reference< backenduno::XLayerHandler > MergeImportService::createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity)
-{
- if (!xBackend.is())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import without a backend. No default backend could be created") );
- throw lang::NullPointerException(sMessage,*this);
- }
-
- uno::Reference< backenduno::XLayerHandler > aHandler( new ImportMergeHandler(xBackend, ImportMergeHandler::merge, aEntity, m_bSendNotification) );
-
- return aHandler;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-sal_Char const * const aCopyImporterServices[] =
-{
- "com.sun.star.configuration.backend.CopyImporter",
- 0,
- "com.sun.star.configuration.backend.Importer",
- 0
-};
-const ServiceImplementationInfo aCopyImporterSI =
-{
- "com.sun.star.comp.configuration.backend.CopyImporter",
- aCopyImporterServices, aCopyImporterServices + 2
-};
-// -----------------------------------------------------------------------------
-
-const ServiceRegistrationInfo* getCopyImportServiceInfo()
-{ return getRegistrationInfo(& aCopyImporterSI); }
-// -----------------------------------------------------------------------------
-
-CopyImportService::CopyImportService(uno::Reference< uno::XComponentContext > const & _xContext)
-: ImportService(_xContext, &aCopyImporterSI)
-{
-}
-// -----------------------------------------------------------------------------
-
-uno::Reference< uno::XInterface > SAL_CALL instantiateCopyImporter
-( uno::Reference< uno::XComponentContext > const& xContext )
-{
- return * new CopyImportService( xContext );
-}
-// -----------------------------------------------------------------------------
-
-uno::Reference< backenduno::XLayerHandler > CopyImportService::createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity)
-{
- if (!xBackend.is())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import without a backend. No default backend could be created") );
- throw lang::NullPointerException(sMessage,*this);
- }
-
- ImportMergeHandler::Mode aMode = m_bOverwrite ? ImportMergeHandler::copy : ImportMergeHandler::no_overwrite;
- uno::Reference< backenduno::XLayerHandler > aHandler( new ImportMergeHandler(xBackend,aMode,aEntity) );
-
- return aHandler;
-}
-// -----------------------------------------------------------------------------
-
-sal_Bool CopyImportService::setImplementationProperty(rtl::OUString const & aName, uno::Any const & aValue)
-{
- if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Overwrite")))
- {
- return (aValue >>= m_bOverwrite);
- }
-
- return ImportService::setImplementationProperty(aName,aValue);
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-ImportService::ImportService(uno::Reference< uno::XComponentContext > const & _xContext, ServiceInfoHelper const & aSvcInfo )
-: m_bSendNotification(false)
-, m_aMutex()
-, m_xContext(_xContext)
-, m_xDestinationBackend()
-, m_aServiceInfo(aSvcInfo)
-{
- if (!m_xContext.is())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Importer: Unexpected NULL context"));
- throw lang::NullPointerException(sMessage,NULL);
- }
-}
-// -----------------------------------------------------------------------------
-
-ImportService::~ImportService()
-{}
-// -----------------------------------------------------------------------------
-
-uno::Reference< backenduno::XBackend > ImportService::createDefaultBackend() const
-{
- return BackendFactory::instance( m_xContext ).getUnoBackend();
-}
-// -----------------------------------------------------------------------------
-
-sal_Bool ImportService::setImplementationProperty(rtl::OUString const & aName, uno::Any const & aValue)
-{
- if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Notify")))
- {
- return (aValue >>= m_bSendNotification);
- }
-
- return false;
-}
-// -----------------------------------------------------------------------------
-
-// XInitialize
-
-void SAL_CALL
- ImportService::initialize( const uno::Sequence< uno::Any >& aArguments )
- throw (uno::Exception, uno::RuntimeException)
-{
- sal_Int16 const nCount = static_cast<sal_Int16>(aArguments.getLength());
-
- if (sal_Int32(nCount) != aArguments.getLength())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Importer"));
- throw lang::IllegalArgumentException(sMessage,*this,0);
- }
-
- for (sal_Int16 i = 0; i < nCount; ++i)
- {
- beans::NamedValue aExtraArg;
- if (aArguments[i] >>= aExtraArg)
- {
- OSL_VERIFY( setImplementationProperty(aExtraArg.Name, aExtraArg.Value) );
-
- continue;
- }
-
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration Importer"
- "- NamedValue expected"));
- throw lang::IllegalArgumentException(sMessage,*this,i+1);
- }
-}
-
-// -----------------------------------------------------------------------------
-
-// XLayerImporter
-
-uno::Reference< backenduno::XBackend > SAL_CALL
- ImportService::getTargetBackend( )
- throw (uno::RuntimeException)
-{
- uno::Reference< backenduno::XBackend > xRet;
- {
- osl::MutexGuard aGuard(m_aMutex);
- xRet = m_xDestinationBackend;
- }
-
- if (!xRet.is())
- {
- xRet = createDefaultBackend();
-
- osl::MutexGuard aGuard(m_aMutex);
- if (!m_xDestinationBackend.is())
- m_xDestinationBackend = xRet;
- }
- return xRet;
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- ImportService::setTargetBackend( const uno::Reference< backenduno::XBackend >& aBackend )
- throw (lang::NullPointerException, uno::RuntimeException)
-{
- if (!aBackend.is())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to set a NULL backend") );
- throw lang::NullPointerException(sMessage,*this);
- }
-
- osl::MutexGuard aGuard(m_aMutex);
- m_xDestinationBackend = aBackend;
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- ImportService::importLayer( const uno::Reference< backenduno::XLayer >& aLayer )
- throw ( backenduno::MalformedDataException,
- lang::WrappedTargetException, lang::IllegalArgumentException,
- lang::NullPointerException, uno::RuntimeException)
-{
- if (!aLayer.is())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import a NULL layer") );
- throw lang::NullPointerException(sMessage,*this);
- }
-
- uno::Reference< backenduno::XLayerHandler > aInputHandler = createImportHandler( getTargetBackend() );
- aLayer->readData( aInputHandler );
-
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- ImportService::importLayerForEntity( const uno::Reference< backenduno::XLayer >& aLayer, const rtl::OUString& aEntity )
- throw ( backenduno::MalformedDataException,
- lang::WrappedTargetException, lang::IllegalArgumentException,
- lang::NullPointerException, uno::RuntimeException)
-{
- if (!aLayer.is())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import a NULL layer") );
- throw lang::NullPointerException(sMessage,*this);
- }
-
- uno::Reference< backenduno::XLayerHandler > aInputHandler = createImportHandler( getTargetBackend(), aEntity );
- aLayer->readData( aInputHandler );
-}
-// -----------------------------------------------------------------------------
-
-// XServiceInfo
-
-rtl::OUString SAL_CALL
- ImportService::getImplementationName( )
- throw (uno::RuntimeException)
-{
- return getServiceInfo().getImplementationName( );
-}
-// -----------------------------------------------------------------------------
-
-
-sal_Bool SAL_CALL
- ImportService::supportsService( const rtl::OUString& ServiceName )
- throw (uno::RuntimeException)
-{
- return getServiceInfo().supportsService( ServiceName );
-}
-// -----------------------------------------------------------------------------
-
-
-uno::Sequence< ::rtl::OUString > SAL_CALL
- ImportService::getSupportedServiceNames( )
- throw (uno::RuntimeException)
-{
- return getServiceInfo().getSupportedServiceNames( );
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace
-
-// -----------------------------------------------------------------------------
-} // namespace
-
diff --git a/configmgr/source/backend/importsvc.hxx b/configmgr/source/backend/importsvc.hxx
deleted file mode 100644
index 2450c329dfef..000000000000
--- a/configmgr/source/backend/importsvc.hxx
+++ /dev/null
@@ -1,154 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_IMPORTSVC_HXX
-#define CONFIGMGR_BACKEND_IMPORTSVC_HXX
-
-#include "serviceinfohelper.hxx"
-#include <cppuhelper/implbase3.hxx>
-#include <osl/mutex.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/configuration/backend/XLayerImporter.hpp>
-#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-
- class ImportService : public ::cppu::WeakImplHelper3<
- backenduno::XLayerImporter,
- lang::XInitialization,
- lang::XServiceInfo
- >
- {
- public:
- explicit
- ImportService(uno::Reference< uno::XComponentContext > const & _xContext, ServiceInfoHelper const & aSvcInfo);
- ~ImportService();
-
- // XInitialization
- virtual void SAL_CALL
- initialize( const uno::Sequence< uno::Any >& aArguments )
- throw (uno::Exception, uno::RuntimeException);
-
- // XServiceInfo
- virtual rtl::OUString SAL_CALL
- getImplementationName( )
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- supportsService( const rtl::OUString& ServiceName )
- throw (uno::RuntimeException);
-
- virtual uno::Sequence< rtl::OUString > SAL_CALL
- getSupportedServiceNames( )
- throw (uno::RuntimeException);
-
- // XLayerImporter
- virtual uno::Reference< backenduno::XBackend > SAL_CALL
- getTargetBackend( )
- throw (uno::RuntimeException);
-
- virtual void SAL_CALL
- setTargetBackend( const uno::Reference< backenduno::XBackend >& aBackend )
- throw (lang::NullPointerException, uno::RuntimeException);
-
- virtual void SAL_CALL
- importLayer( const uno::Reference< backenduno::XLayer >& aLayer )
- throw ( backenduno::MalformedDataException,
- lang::WrappedTargetException, lang::IllegalArgumentException,
- lang::NullPointerException, uno::RuntimeException);
-
- virtual void SAL_CALL
- importLayerForEntity( const uno::Reference< backenduno::XLayer >& aLayer, const rtl::OUString& aEntity )
- throw ( backenduno::MalformedDataException,
- lang::WrappedTargetException, lang::IllegalArgumentException,
- lang::NullPointerException, uno::RuntimeException);
- protected:
- uno::Reference< backenduno::XBackend > createDefaultBackend() const;
-
- //uno::Reference< lang::XMultiServiceFactory > getServiceFactory() const
-
- virtual sal_Bool setImplementationProperty( rtl::OUString const & aName, uno::Any const & aValue);
- /** Notify backend of import */
- sal_Bool m_bSendNotification;
- private:
- // is pure virtual to allow different import services
- virtual uno::Reference< backenduno::XLayerHandler > createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity = rtl::OUString()) = 0;
-
- private:
- osl::Mutex m_aMutex;
- uno::Reference< uno::XComponentContext > m_xContext;
- uno::Reference< backenduno::XBackend > m_xDestinationBackend;
-
-
- ServiceInfoHelper m_aServiceInfo;
-
- ServiceInfoHelper const & getServiceInfo() const { return m_aServiceInfo; }
- };
-// -----------------------------------------------------------------------------
-
- class MergeImportService : public ImportService
- {
- public:
- explicit MergeImportService(uno::Reference< uno::XComponentContext > const & _xContext);
- private:
- uno::Reference< backenduno::XLayerHandler > createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity);
- };
-// -----------------------------------------------------------------------------
-
- class CopyImportService : public ImportService
- {
- public:
- explicit CopyImportService(uno::Reference< uno::XComponentContext > const & _xContext);
- private:
- uno::Reference< backenduno::XLayerHandler > createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity);
- sal_Bool setImplementationProperty( rtl::OUString const & aName, uno::Any const & aValue);
- private:
- sal_Bool m_bOverwrite;
- };
-// -----------------------------------------------------------------------------
- } // namespace xml
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/layerdefaultremover.cxx b/configmgr/source/backend/layerdefaultremover.cxx
deleted file mode 100644
index a773f5770f30..000000000000
--- a/configmgr/source/backend/layerdefaultremover.cxx
+++ /dev/null
@@ -1,275 +0,0 @@
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "layerdefaultremover.hxx"
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- // -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- // -----------------------------------------------------------------------------
-
- LayerDefaultRemover::LayerDefaultRemover(uno::Reference< backenduno::XLayerHandler > const & _xResultHandler)
- :m_xResultHandler(_xResultHandler)
- {
- }
- // -----------------------------------------------------------------------------
-
- LayerDefaultRemover::~LayerDefaultRemover( )
- {
- }
- // -----------------------------------------------------------------------------
-
- bool LayerDefaultRemover::hasPendingProperty()
- {
- return m_aPropName.Name.getLength()!=0;
- }
- // -----------------------------------------------------------------------------
-
- void LayerDefaultRemover::clearPendingProperty()
- {
- m_aPropName = PropertyStruct();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- clearPendingProperty();
- m_xResultHandler->startLayer();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if (hasPendingProperty())
- {
- sal_Char const * pMsg =
- "LayerDefaultRemover: Illegal property started operation";
- raiseMalformedDataException(pMsg);
- }
- if (!m_aNodeStack.empty())
- {
- sal_Char const * pMsg =
- "LayerDefaultRemover: Illegal node started operation";
- raiseMalformedDataException(pMsg);
- }
- m_xResultHandler->endLayer();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if (hasPendingProperty())
- {
- sal_Char const * pMsg =
- "LayerDefaultRemover: Illegal property started operation";
- raiseMalformedDataException(pMsg);
- }
- if (aAttributes == 0 && !bClear)
- {
- m_aNodeStack.push_back(aName);
- }
- else
- {
- playBackNodeStack();
- m_xResultHandler->overrideNode(aName,aAttributes,bClear);
- }
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- playBackNodeStack();
- m_xResultHandler->addOrReplaceNode(aName, aAttributes);
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- playBackNodeStack();
- m_xResultHandler->addOrReplaceNodeFromTemplate(aName,aTemplate,aAttributes);
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if (hasPendingProperty())
- {
- sal_Char const * pMsg =
- "LayerDefaultRemover: Illegal property started operation";
- raiseMalformedDataException(pMsg);
- }
- if (m_aNodeStack.empty())
- {
- m_xResultHandler->endNode();
- }
- else
- {
- m_aNodeStack.pop_back();
- }
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- playBackNodeStack();
- m_xResultHandler->dropNode(aName);
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- playBackNodeStack();
- m_xResultHandler->addProperty (aName,aAttributes,aType);
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- playBackNodeStack();
- m_xResultHandler->addPropertyWithValue(aName,aAttributes,aValue);
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if (hasPendingProperty())
- {
- sal_Char const * pMsg =
- "LayerDefaultRemover: Illegal property started operation";
- raiseMalformedDataException(pMsg);
- }
- if (aAttributes != 0 || bClear)
- {
- m_aPropName.Name=rtl::OUString();
- playBackNodeStack();
- m_xResultHandler->overrideProperty(aName,aAttributes,aType,bClear);
- }
- else
- {
- m_aPropName.Name = aName;
- m_aPropName.Type = aType;
- }
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- if (hasPendingProperty())
- {
- clearPendingProperty();
- }
- else
- m_xResultHandler->endProperty();
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- playBackNodeStack(true);
- m_xResultHandler->setPropertyValue(aValue);
- }
- // -----------------------------------------------------------------------------
-
- void SAL_CALL LayerDefaultRemover::setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
- {
- playBackNodeStack(true);
- m_xResultHandler->setPropertyValueForLocale(aValue,aLocale);
- }
- // -----------------------------------------------------------------------------
-
- void LayerDefaultRemover::playBackNodeStack(bool bPlayProperty)
- {
- if (!bPlayProperty && hasPendingProperty())
- {
- sal_Char const * pMsg =
- "LayerDefaultRemover: Illegal property started operation";
- raiseMalformedDataException(pMsg);
- }
- if ( !hasPendingProperty() && bPlayProperty && !m_aNodeStack.empty() )
- {
- sal_Char const * pMsg =
- "LayerDefaultRemover: Illegal Operation: Operation requires a started property";
- raiseMalformedDataException(pMsg);
- }
- if (!m_aNodeStack.empty())
- {
- for (std::vector<rtl::OUString>::iterator aIter = m_aNodeStack.begin();
- aIter != m_aNodeStack.end(); aIter++)
- {
- m_xResultHandler->overrideNode(*aIter, 0,false);
- }
- m_aNodeStack.clear();
- }
- if (bPlayProperty)
- {
- if (hasPendingProperty())
- {
- m_xResultHandler->overrideProperty(m_aPropName.Name,0,m_aPropName.Type,false);
- clearPendingProperty();
- }
- }
- }
- // -----------------------------------------------------------------------------
-
- void LayerDefaultRemover::raiseMalformedDataException(sal_Char const * pMsg)
- {
- OSL_ASSERT(pMsg);
- rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
-
- throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
- }
-
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
- // -----------------------------------------------------------------------------
- } // namespace
-
- // -----------------------------------------------------------------------------
-} // namespace
-
diff --git a/configmgr/source/backend/layerdefaultremover.hxx b/configmgr/source/backend/layerdefaultremover.hxx
deleted file mode 100644
index 20dba567f7dc..000000000000
--- a/configmgr/source/backend/layerdefaultremover.hxx
+++ /dev/null
@@ -1,132 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_XML_LAYERDECORATOR_HXX
-#define CONFIGMGR_XML_LAYERDECORATOR_HXX
-
-#include <cppuhelper/implbase1.hxx>
-
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif
-
-#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
-
-// -----------------------------------------------------------------------------
-namespace configmgr
-{
- // -----------------------------------------------------------------------------
- namespace backend
- {
- // -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
- // -----------------------------------------------------------------------------
-
- class LayerDefaultRemover : public cppu::WeakImplHelper1<backenduno::XLayerHandler>
- {
- public:
- explicit
- LayerDefaultRemover(uno::Reference< backenduno::XLayerHandler > const & _xResultHandler);
- virtual ~LayerDefaultRemover();
-
- // XLayerHandler
- public:
- virtual void SAL_CALL
- startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- private:
- void playBackNodeStack( bool bPlayProperty=false);
- void raiseMalformedDataException(sal_Char const * pMsg);
- inline bool hasPendingProperty();
- inline void clearPendingProperty();
- private:
- uno::Reference< backenduno::XLayerHandler > m_xResultHandler;
- std::vector<rtl::OUString> m_aNodeStack;
- struct PropertyStruct
- {
- rtl::OUString Name;
- uno::Type Type;
- }m_aPropName;
- };
- // -----------------------------------------------------------------------------
- } // namespace xml
- // -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
diff --git a/configmgr/source/backend/layermerge.cxx b/configmgr/source/backend/layermerge.cxx
deleted file mode 100644
index e15ad932494c..000000000000
--- a/configmgr/source/backend/layermerge.cxx
+++ /dev/null
@@ -1,1036 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "layermerge.hxx"
-#include "treenodefactory.hxx"
-#include "matchlocale.hxx"
-#include "valuetypeconverter.hxx"
-#include "typeconverter.hxx"
-#include <com/sun/star/configuration/backend/SchemaAttribute.hpp>
-#include <com/sun/star/configuration/backend/NodeAttribute.hpp>
-
-#include <rtl/ustrbuf.hxx>
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
- namespace SchemaAttribute = backenduno::SchemaAttribute;
- namespace NodeAttribute = backenduno::NodeAttribute;
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-//#if OSL_DEBUG_LEVEL > 0
-// currently not used in debug builds
-#if 0
- static void check_if_complete(uno::Reference< uno::XComponentContext > const & _xContext)
- {
- MergedComponentData aData;
-
- uno::Reference< backenduno::XLayerHandler >
- test(new LayerMergeHandler(_xContext, aData));
- }
-#endif
-
-// -----------------------------------------------------------------------------
-
-struct LayerMergeHandler::Converter
-{
- explicit
- Converter(uno::Reference< uno::XComponentContext > const & xContext);
-
- uno::Any convertValue(uno::Type const & _aTargetType, uno::Any const & _aValue);
-
- static uno::Reference< com::sun::star::script::XTypeConverter > createTCV(uno::Reference< uno::XComponentContext > const & xContext);
-
- ValueConverter m_aConverter;
- bool m_bConvertData;
-};
-// -----------------------------------------------------------------------------
-LayerMergeHandler::LayerMergeHandler(uno::Reference< uno::XComponentContext > const & xContext, MergedComponentData & _rData, ITemplateDataProvider* aTemplateProvider )
-: m_rData(_rData)
-//, m_aContext(xContext,static_cast<backenduno::XLayerHandler*>(this),aTemplateProvider )
-, m_aContext(xContext)
-, m_aFactory()
-, m_aLocale()
-, m_pProperty(NULL)
-, m_pConverter( new Converter(xContext) )
-, m_nSkipping(0)
-, m_bSublayer(false)
-{
- m_aContext = DataBuilderContext(xContext,static_cast<backenduno::XLayerHandler*>(this),aTemplateProvider );
- OSL_ENSURE( m_rData.hasSchema(), "Creating layer merger without default data" );
-}
-// -----------------------------------------------------------------------------
-
-LayerMergeHandler::~LayerMergeHandler( )
-{
- delete m_pConverter;
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::prepareLayer()
-{
- OSL_ENSURE(isDone(), "LayerMergeHandler: Warning: Previous layer or schema not terminated properly");
- if (!isDone())
- m_aContext.getLogger().error("Previous layer or schema not terminated properly", "prepareLayer()", "configmgr::LayerMergeHandler");
-
- m_aLocale = localehelper:: getDefaultLanguage();
- m_bSublayer = false;
-
- promoteToDefault(m_rData);
-}
-// -----------------------------------------------------------------------------
-
-bool LayerMergeHandler::prepareSublayer(rtl::OUString const & aLocale)
-{
- OSL_ENSURE(isDone(), "LayerMergeHandler: Warning: Previous layer not terminated properly");
- if (!isDone())
- m_aContext.getLogger().error("Previous layer not terminated properly", "prepareSublayer()", "configmgr::LayerMergeHandler");
-
- m_aLocale = aLocale;
- m_bSublayer = (aLocale.getLength() != 0);
-
- return m_bSublayer;
-}
-// -----------------------------------------------------------------------------
-
-namespace
-{
- struct CheckRestrictedAccessVisitor : NodeAction
- {
- node::Access m_access;
-
- CheckRestrictedAccessVisitor(node::Access _access) : m_access(_access) {}
-
- void handle(ValueNode const & _aNode) { check(_aNode); }
-
- void handle(ISubtree const & _aNode)
- {
- node::Access aNext = check(_aNode);
- CheckRestrictedAccessVisitor(aNext).applyToChildren(_aNode);
- }
-
- node::Access check(INode const & _aNode)
- {
- node::Attributes const aFoundAttr = _aNode.getAttributes();
- node::Access const aFoundAccess = aFoundAttr.getAccess();
- OSL_ENSURE(m_access <= aFoundAccess, "Subnode has more access than its parent");
-
- return aFoundAccess;
- }
- };
-// --------------------
- struct RestrictAccessVisitor : NodeModification
- {
- node::Access m_access;
-
- RestrictAccessVisitor(bool _bFinalize)
- : m_access(_bFinalize ? node::accessFinal : node::accessReadonly)
- {}
-
- void handle(ValueNode & _aNode) { restrict(_aNode); }
-
- void handle(ISubtree & _aNode)
- {
- if (restrict(_aNode))
- this->applyToChildren(_aNode);
- else
- OSL_DEBUG_ONLY(CheckRestrictedAccessVisitor(m_access).applyToNode(_aNode));
- }
-
- bool restrict(INode & _aNode)
- {
- node::Attributes const aFoundAttr = _aNode.getAttributes();
-
- if (aFoundAttr.getAccess() >= m_access) return false; // already restricted enough
-
- _aNode.modifyAccess(m_access);
- return true;
- }
- };
-}
-// -----------------------------------------------------------------------------
-void LayerMergeHandler::propagateAttributes(ISubtree & _rParent)
-{
- node::Attributes aAttributes = _rParent.getAttributes();
-
- if (aAttributes.isReadonly() || aAttributes.isFinalized())
- RestrictAccessVisitor(aAttributes.isWritable()).applyToChildren(_rParent);
-}
-// -----------------------------------------------------------------------------
-
-node::Attributes LayerMergeHandler::makePropertyAttributes(sal_Int16 aSchemaAttributes)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- const sal_uInt16 k_allPropertySchemaAttributes =
- SchemaAttribute::REQUIRED;
-
- if ((aSchemaAttributes & k_allPropertySchemaAttributes) !=
- (aSchemaAttributes & SchemaAttribute::MASK))
- {
- sal_Char const * pMsg = (aSchemaAttributes & SchemaAttribute::LOCALIZED) ?
- "Layer merging: Cannot add localized property to extensible node" :
- "Layer merging: Unreckognized Schema Attribute for new Property" ;
-
- m_aContext.raiseIllegalArgumentException(pMsg,2);
- }
- OSL_ASSERT( !(aSchemaAttributes & SchemaAttribute::LOCALIZED) ); // check the check
-
- node::Attributes aAttributes = m_aContext.getCurrentAttributes();
-
- if (aSchemaAttributes & SchemaAttribute::REQUIRED)
- aAttributes.setNullable (false);
-
- //Set state, removable and mandatory attribute flags
- aAttributes.setState(node::isAdded);
- aAttributes.setRemovability(true,true);
-
-
- return aAttributes;
-
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::checkPropertyType(uno::Type const & _aType)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_ASSERT(m_pProperty);
-
- if (ValueNode * pValue = m_pProperty->asValueNode())
- {
- if (pValue->getValueType() != _aType)
- {
- if (pValue->getValueType().getTypeClass() == uno::TypeClass_ANY)
- {
- OSL_ENSURE( pValue->isNull(), "Layer merging: Non-null 'any' value" );
-
- if (_aType != uno::Type())
- OSL_VERIFY( pValue->setValueType(_aType) );
-
- else
- {
- OSL_TRACE("Layer merging: Illegal property type: VOID overriding ANY");
- m_aContext.getLogger().warning("Illegal property type: VOID overriding ANY - ignoring",
- "checkPropertyType()", "configmgr::LayerMergeHandler");
- // m_aContext.raiseIllegalTypeException("Layer merging: Illegal property type: VOID overriding ANY");
- }
- }
- else if (_aType == uno::Type() && m_pConverter)
- m_pConverter->m_bConvertData = true;
-
- else
- m_aContext.raiseIllegalTypeException("Layer merging: Cannot merge property value: types does not match");
- }
- }
- else if (ISubtree *localisedSet = m_pProperty->asISubtree()) {
- // We're dealing with localised data.
- uno::Type valueType = parseTemplateName(
- localisedSet->getElementTemplateName()) ;
-
- if (valueType != _aType) {
- if (valueType.getTypeClass() == uno::TypeClass_ANY) {
- if (_aType == uno::Type()) {
- // VOID value
- m_aContext.raiseIllegalTypeException(
- "Layer merging: VOID value for localised ANY type") ;
- }
- // TODO Could we have to set the localised data type?
- }
- else if (_aType == uno::Type() && m_pConverter) {
- m_pConverter->m_bConvertData = sal_True ;
- }
- else {
- m_aContext.raiseIllegalTypeException("Layer merging: property value does not match localised type") ;
- }
- }
- }
-
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::setValueAndCheck(ValueNode& _rValueNode, uno::Any const & _aValue)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- if (_aValue.hasValue() && m_pConverter && m_pConverter->m_bConvertData)
- {
- uno::Any aConvertedValue = m_pConverter->convertValue(_rValueNode.getValueType(),_aValue);
- if (!aConvertedValue.hasValue())
- m_aContext.raiseIllegalTypeException("Layer merging: Cannot merge property value: cannot convert data to type of property");
-
- if (! _rValueNode.setValue(aConvertedValue) )
- m_aContext.raiseIllegalTypeException("Layer merging: Cannot merge property value: converted type does not match");
- }
- else if (! _rValueNode.setValue(_aValue) )
- {
- m_aContext.raiseIllegalTypeException("Layer merging: Cannot merge property value: type does not match");
- }
-
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::setLocalizedValue(ISubtree * pProperty, uno::Any const & _aValue, rtl::OUString const & _aLocale)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- if (ISubtree * pLocalizedCont = pProperty->asISubtree())
- {
- OSL_ENSURE(isLocalizedValueSet(*pLocalizedCont),"Layer merging: property node is not a value");
-
- if (INode * pLocale = pLocalizedCont->getChild(_aLocale))
- {
- if (ValueNode * pLocValue = pLocale->asValueNode())
- {
- setValueAndCheck(*pLocValue,_aValue);
- }
- else
- {
- OSL_ENSURE(false,"Layer merging: Localized subnode is not a value");
- m_aContext.getLogger().error("Localized subnode is not a value - ignoring data",
- "setLocalizedValue()", "configmgr::LayerMergeHandler");
- }
- }
- else {
- node::Attributes attributes = pLocalizedCont->getAttributes() ;
- uno::Type valueType = parseTemplateName(
- pLocalizedCont->getElementTemplateName()) ;
-
- attributes.setLocalized(false) ;
- OSL_ENSURE(valueType != uno::Type(),
- "Cannot determine type for localised value") ;
- std::auto_ptr<ValueNode> localisedValue =
- m_aFactory.getNodeFactory().createNullValueNode(_aLocale,
- valueType,
- attributes) ;
-
- if (_aValue.hasValue()) {
- setValueAndCheck(*localisedValue, _aValue) ;
- }
- pLocalizedCont->addChild(base_ptr(localisedValue)) ;
- }
- }
-
- else if (ValueNode * pValue = pProperty->asValueNode())
- {
- OSL_ENSURE(false, "Layer merging: Got locale-dependent value for non-localized node");
- m_aContext.getLogger().error("Got locale-dependent value for non-localized node",
- "setLocalizedValue()", "configmgr::LayerMergeHandler");
- setValueAndCheck(*pValue,_aValue);
- }
-
- else
- {
- OSL_ENSURE(false, "Layer merging: Unknown node type for localized node");
- m_aContext.getLogger().error("Unknown node type for localized node",
- "setLocalizedValue()", "configmgr::LayerMergeHandler");
- }
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::applyPropertyValue(uno::Any const & _aValue)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_ASSERT(m_pProperty);
-
- if (ValueNode * pValue = m_pProperty->asValueNode())
- {
- setValueAndCheck(*pValue,_aValue);
- }
-
- else if (ISubtree * pLocalizedCont = m_pProperty->asISubtree())
- {
- setLocalizedValue(pLocalizedCont,_aValue,m_aLocale);
- }
-
- else
- {
- OSL_ENSURE(false, "Layer merging: Unknown node type for property");
- m_aContext.getLogger().error("Unknown node type for property",
- "applyPropertyValue()", "configmgr::LayerMergeHandler");
- }
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::applyPropertyValue(uno::Any const & _aValue, rtl::OUString const & _aLocale)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_ASSERT(m_pProperty);
-
- if (_aLocale.getLength() == 0)
- m_aContext.raiseIllegalArgumentException("Locale string is empty");
-
- if (ISubtree * pLocalizedCont = m_pProperty->asISubtree())
- {
- setLocalizedValue(pLocalizedCont,_aValue, _aLocale);
- }
-
- else if (ValueNode * pValue = m_pProperty->asValueNode())
- {
- //OSL_ENSURE(false, "Layer merging: Got locale-dependent value for non localized node");
- setValueAndCheck(*pValue,_aValue);
- }
-
- else
- {
- OSL_ENSURE(false, "Layer merging: Unknown node type for localized property");
- m_aContext.getLogger().error("Unknown node type for localized property",
- "applyPropertyValue()", "configmgr::LayerMergeHandler");
- }
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::applyAttributes(INode * pNode, sal_Int16 aNodeAttributes)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- sal_Int16 const k_allNodeAttributes =
- NodeAttribute::MANDATORY |
- NodeAttribute::FINALIZED |
- NodeAttribute::READONLY;
-
- if ((aNodeAttributes & k_allNodeAttributes) !=
- (aNodeAttributes & NodeAttribute::MASK))
- {
- sal_Char const * pMsg =
- "Layer merging: Unreckognized Node Attribute" ;
-
- m_aContext.raiseIllegalArgumentException(pMsg,2);
- }
-
- if (aNodeAttributes & NodeAttribute::READONLY)
- {
- OSL_ENSURE(!(aNodeAttributes & NodeAttribute::FINALIZED),
- "Layer merging: Warning: Node is both read-only and finalized");
- if (aNodeAttributes & NodeAttribute::FINALIZED)
- m_aContext.getLogger().warning("Node is both read-only and finalized - treating as readonly",
- "applyAttributes()", "configmgr::LayerMergeHandler");
-
- pNode->modifyAccess(node::accessReadonly);
- }
- else if (aNodeAttributes & NodeAttribute::FINALIZED)
- {
- pNode->modifyAccess(node::accessFinal);
- }
-
- if ( m_aContext.isNode(pNode) )
- {
- if (aNodeAttributes & NodeAttribute::MANDATORY)
- {
- pNode->markMandatory();
- }
- }
- else if (aNodeAttributes) // do this only if there actually was something to do
- {
- if (ISubtree * pLocCont = pNode->asISubtree())
- {
- OSL_ENSURE(isLocalizedValueSet(*pLocCont),"Layer merging: Property subtree must be a localized value set");
- propagateAttributes(*pLocCont);
- }
- }
-
-
-}
-// -----------------------------------------------------------------------------
-
-static
-void doLogRejection(sal_Int16 loglevel, DataBuilderContext const & aContext,
- INode * pNode, bool bMandatory)
-{
- rtl::OUStringBuffer aMessage;
- aMessage.appendAscii("Rejecting override: Node/Property ")
- .append(aContext.getNodePath(pNode->getName()))
- .appendAscii(" is ").appendAscii(bMandatory ? "mandatory" : "finalized")
- .appendAscii(" in a prior layer.");
-
- aContext.getLogger().log(loglevel,aMessage.makeStringAndClear(),
- bMandatory ? "addOrReplace/dropNode()" : "startOverride()",
- "configmgr::LayerMergeHandler");
-}
-
-static inline
-void logRejection(DataBuilderContext const & aContext, INode * pNode, bool bMandatory=false)
-{
- const sal_Int16 loglevel = LogLevel::INFO;
- if (aContext.getLogger().isLogging(loglevel))
- {
- doLogRejection(loglevel, aContext, pNode, bMandatory);
- }
-}
-// -----------------------------------------------------------------------------
-
-bool LayerMergeHandler::startOverride(INode * pNode, sal_Bool bClear) /* ensure writable, mark merged */
- SAL_THROW(())
-{
- OSL_PRECOND(pNode,"startOverride: non-NULL base node required");
- if (!m_aContext.isWritable(pNode))
- {
- // #i41700# write-protection is enforced, unless merging localizations
- if (!m_bSublayer)
- {
- logRejection(m_aContext,pNode);
- return false;
- }
- else
- OSL_ASSERT(m_aLocale.getLength() != 0);
- }
-
- OSL_ENSURE(!bClear,"'clear' operation is not yet supported");
- if (bClear)
- m_aContext.getLogger().warning("'clear' operation is not yet supported",
- "startOverride()", "configmgr::LayerMergeHandler");
-
- return true;
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::ensureUnchanged(INode const * pNode) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- // to do: change state handling to detect this within sets
- OSL_PRECOND(pNode,"INTERNAL ERROR: Unexpected NULL node pointer");
-
- if (!this->isInSublayer())
- if (pNode->getAttributes().state() == node::isMerged)
- m_aContext.raiseMalformedDataException("Layer merging: Duplicate node or property in this layer");
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-// XLayerHandler
-
-void SAL_CALL LayerMergeHandler::startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- ISubtree * pSchema = m_rData.getSchemaTree();
- OSL_ENSURE(pSchema,"No base data to merge layer into");
-
- if (!pSchema)
- {
- m_aContext.getLogger().error("No schema data for merging layer", "startLayer", "configmgr::LayerMergeHandler");
- throw uno::RuntimeException(rtl::OUString::createFromAscii("Layer merging: No data to merge with"),*this);
- }
-
- m_aContext.startActiveComponent(pSchema->getName());
-
- m_pProperty = NULL;
- m_nSkipping = 0;
-
- OSL_POSTCOND( m_aContext.hasActiveComponent(), "Layer merging: could not set active component");
- OSL_POSTCOND( m_aContext.isDone(), "Layer merging: newly started component is not empty");
- OSL_POSTCOND( !this->isSkipping(), "Layer merging: newly started component is in skipping state");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- m_aContext.raiseMalformedDataException("Layer merging: Unmatched data being skipped was not terminated properly.");
-
- m_aContext.endActiveComponent();
-
- m_bSublayer = false;
-
- OSL_POSTCOND( !m_aContext.hasActiveComponent(), "Layer merging: could not clear active component");
- OSL_POSTCOND( m_aContext.isDone(), "Layer merging: could not finish processing");
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::overrideLayerRoot( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- OSL_PRECOND( m_aContext.hasActiveComponent(), "Layer merging: active component is not set");
- OSL_PRECOND( m_aContext.isDone(), "Layer merging: node is not root");
-
- if (m_aContext.getActiveComponent() != aName)
- m_aContext.raiseIllegalArgumentException("Layer merging: Name of layer being merged does not match component name",1);
-
- // check the argument
- if (ISubtree * pSchema = m_rData.getSchemaTree())
- {
- OSL_ENSURE(pSchema->getName() == aName,"Schema name does not match active component");
-
- ensureUnchanged(pSchema);
-
- if (startOverride(pSchema,bClear))
- {
- applyAttributes(pSchema,aAttributes);
-
- m_aContext.pushNode(pSchema);
-
- OSL_POSTCOND( m_aContext.hasActiveComponent(), "Layer merging: could not set active component");
- OSL_POSTCOND( !m_aContext.isDone(), "Layer merging: could not start component");
- }
- else
- this->skipNode();
- }
- else
- {
- OSL_ENSURE(false,"No base data to merge layer into");
- m_aContext.getLogger().warning("No component data in schema for merging layer",
- "overrideNode() [for layer root]", "configmgr::LayerMergeHandler");
- this->skipNode();
- }
-}
-// -----------------------------------------------------------------------------
-
-static inline
-sal_Int16 getOverrideViolationLogLevel(bool bIsSublayer)
-{ return bIsSublayer ? LogLevel::FINER : LogLevel::INFO; }
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::implOverrideNode(
- ISubtree * node, sal_Int16 attributes, bool clear)
-{
- ensureUnchanged(node);
- if (startOverride(node, clear)) {
- applyAttributes(node, attributes);
- m_aContext.pushNode(node);
- } else {
- skipNode();
- }
-}
-
-void SAL_CALL LayerMergeHandler::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- {
- this->skipNode();
- }
- else if (m_aContext.isDone())
- {
- this->overrideLayerRoot(aName,aAttributes,bClear);
- }
- else if (ISubtree * pNode = m_aContext.findNode(aName))
- {
- implOverrideNode(pNode, aAttributes, bClear);
- }
- else // ignore non-matched data
- {
- const sal_Int16 loglevel = getOverrideViolationLogLevel(m_bSublayer);
- if (m_aContext.getLogger().isLogging(loglevel))
- {
- rtl::OUStringBuffer aMessage;
- aMessage.appendAscii("Node ").append(m_aContext.getNodePath(aName))
- .appendAscii(" to be overridden does not exist - skipping");
-
- m_aContext.getLogger().log(loglevel,aMessage.makeStringAndClear(), "overrideNode()", "configmgr::LayerMergeHandler");
- }
- // m_aContext.raiseNoSuchElementException("Layer merging: The node to be overridden does not exist.",aName);
- this->skipNode();
- }
-}
-// -----------------------------------------------------------------------------
-
-void LayerMergeHandler::implAddOrReplaceNode( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
-{
- ISubtree * pReplacedNode = m_aContext.findNode(aName);
- if (pReplacedNode)
- {
- if ((aAttributes & NodeAttribute::FUSE) == 0) {
- this->ensureUnchanged(pReplacedNode);
-
- if (!m_aContext.isRemovable(pReplacedNode))
- {
- logRejection(m_aContext,pReplacedNode,true);
- this->skipNode();
- return;
- }
- } else {
- implOverrideNode(
- pReplacedNode, aAttributes & ~NodeAttribute::FUSE, false);
- return;
- }
- }
-
- std::auto_ptr<INode> apNewInstance;
- if (aTemplate.Component == m_aContext.getActiveComponent())
- {
- apNewInstance = m_rData.instantiateTemplate(aName, aTemplate.Name);
- }
- else
- {
- TemplateRequest aTemplateRequest(aTemplate.Name, aTemplate.Component);
- apNewInstance = m_aContext.getTemplateData( aTemplateRequest ).extractDataAndClear();
- if (apNewInstance.get())
- apNewInstance->setName( aName );
- }
-
- if (NULL == apNewInstance.get())
- m_aContext.raiseNoSuchElementException("Layer merging: Cannot instantiate template.", aTemplate.Name);
-
- applyAttributes(apNewInstance.get(), aAttributes & ~NodeAttribute::FUSE);
- //Set removable flag
- apNewInstance->markRemovable();
-
- m_aContext.markCurrentMerged();
-
- if (pReplacedNode) m_aContext.getCurrentParent().removeChild( aName );
-
- INode * pAddedInstance = m_aContext.getCurrentParent().addChild( apNewInstance );
-
- m_aContext.pushNode(pAddedInstance->asISubtree());
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- {
- this->skipNode();
- return;
- }
-
- implAddOrReplaceNode( aName, m_aContext.getCurrentItemType(), aAttributes);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- {
- this->skipNode();
- return;
- }
-
- // TODO: correct argument position (from 2 to 3) for an illegal argument exception wrt attributes
- implAddOrReplaceNode( aName, m_aContext.getValidItemType(aTemplate), aAttributes);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->leaveSkippedNode())
- return;
-
- this->propagateAttributes(m_aContext.getCurrentParent());
-
- m_aContext.popNode();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- return;
-
- if (!m_aContext.getCurrentParent().isSetNode())
- m_aContext.raiseMalformedDataException("Layer merging: Removing child nodes is only possible in set nodes.");
-
- if (ISubtree * pDropped = m_aContext.findNode(aName))
- {
- this->ensureUnchanged(pDropped);
- if (!m_aContext.isRemovable(pDropped))
- {
- logRejection(m_aContext,pDropped,true);
- return;
- }
- }
- else
- {
- const sal_Int16 loglevel = getOverrideViolationLogLevel(m_bSublayer);
- if (m_aContext.getLogger().isLogging(loglevel))
- {
- rtl::OUStringBuffer aMessage;
- aMessage.appendAscii("Node ").append(m_aContext.getNodePath(aName))
- .appendAscii(" to be removed does not exist - ignoring");
-
- m_aContext.getLogger().log(loglevel,aMessage.makeStringAndClear(), "dropNode()", "configmgr::LayerMergeHandler");
- }
- // m_aContext.raiseNoSuchElementException("Layer merging: The node to be removed does not exist.",aName);
- }
- m_aContext.markCurrentMerged();
- m_aContext.getCurrentParent().removeChild(aName);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- {
- this->skipNode();
- }
- else if (INode * pProp = m_aContext.findProperty(aName))
- {
- ensureUnchanged(pProp);
-
- if (startOverride(pProp,bClear))
- {
- applyAttributes(pProp,aAttributes);
-
- m_pProperty = pProp;
-
- checkPropertyType(aType);
- }
- else
- this->skipNode();
- }
- else // ignore non-matched data
- {
- const sal_Int16 loglevel = getOverrideViolationLogLevel(m_bSublayer);
- if (m_aContext.getLogger().isLogging(loglevel))
- {
- rtl::OUStringBuffer aMessage;
- aMessage.appendAscii("Property ").append(m_aContext.getNodePath(aName))
- .appendAscii(" to be overridden does not exist - skipping");
-
- m_aContext.getLogger().log(loglevel,aMessage.makeStringAndClear(), "overrideNode()", "configmgr::LayerMergeHandler");
- }
- // m_aContext.raiseUnknownPropertyException("Layer merging: The property to be overridden does not exist.",aName);
- this->skipNode();
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->leaveSkippedNode())
- return;
-
- if (!m_pProperty)
- m_aContext.raiseMalformedDataException("Layer merging: Invalid data: Ending a property that wasn't started.");
-
- if (ISubtree * pLocalizedSet = m_pProperty->asISubtree())
- this->propagateAttributes(*pLocalizedSet);
-
- m_pProperty = NULL;
- if (m_pConverter) m_pConverter->m_bConvertData = false;
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- return;
-
- // TODO: add type validation
- node::Attributes aValueAttributes = makePropertyAttributes(aAttributes & SchemaAttribute::MASK);
-
- std::auto_ptr<ValueNode> aPropertyValue =
- m_aFactory.getNodeFactory().createNullValueNode(aName,aType,aValueAttributes);
-
- applyAttributes(aPropertyValue.get(),aAttributes & NodeAttribute::MASK);
-
- // can be a replace for dynamic properties (current update limitation)
- m_aContext.markCurrentMerged();
- m_aContext.addPropertyToCurrent(aPropertyValue, true);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- return;
-
- node::Attributes aValueAttributes = makePropertyAttributes(aAttributes & SchemaAttribute::MASK);
-
- std::auto_ptr<ValueNode> aPropertyValue =
- m_aFactory.getNodeFactory().createValueNode(aName,aValue,aValueAttributes);
-
- applyAttributes(aPropertyValue.get(),aAttributes & NodeAttribute::MASK);
-
- // can be a replace for dynamic properties (current update limitation)
- m_aContext.markCurrentMerged();
- m_aContext.addPropertyToCurrent(aPropertyValue, true);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- return;
-
- if (!m_pProperty)
- m_aContext.raiseMalformedDataException("Layer merging: Invalid data: Overriding a value without a property.");
-
- OSL_ASSERT( !m_pProperty->getAttributes().isReplacedForUser() );
- m_pProperty->modifyState( node::isMerged );
- m_aContext.markCurrentMerged();
-
- applyPropertyValue(aValue);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerMergeHandler::setPropertyValueForLocale( const uno::Any& aValue, rtl::OUString const & aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (this->isSkipping())
- return;
-
- if (!m_pProperty)
- m_aContext.raiseMalformedDataException("Layer merging: Invalid data: Overriding a (localized) value without a property.");
-
- OSL_ASSERT( !m_pProperty->getAttributes().isReplacedForUser() );
- m_pProperty->modifyState( node::isMerged );
- m_aContext.markCurrentMerged();
-
- applyPropertyValue(aValue,aLocale);
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-uno::Reference< com::sun::star::script::XTypeConverter >
- LayerMergeHandler::Converter::createTCV(uno::Reference< uno::XComponentContext > const & xContext)
-{
- OSL_ENSURE(xContext.is(),"Cannot create TypeConverter for LayerMergeHandler without a Context");
-
- uno::Reference< lang::XMultiComponentFactory > xFactory = xContext->getServiceManager();
- OSL_ENSURE(xFactory.is(),"Cannot create TypeConverter for LayerMergeHandler without a ServiceManager");
-
- uno::Reference< com::sun::star::script::XTypeConverter > xTCV;
- if (xFactory.is())
- {
- static const rtl::OUString k_sTCVService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"));
-
- xTCV = uno::Reference< com::sun::star::script::XTypeConverter >::query(xFactory->createInstanceWithContext(k_sTCVService,xContext));
- }
- return xTCV;
-}
-// -----------------------------------------------------------------------------
-
-LayerMergeHandler::Converter::Converter(uno::Reference< uno::XComponentContext > const & xContext)
-: m_aConverter( createTCV(xContext) )
-, m_bConvertData(false)
-{
-}
-// -----------------------------------------------------------------------------
-static
-inline
-uno::Type getBinaryDataType()
-{
- uno::Sequence< sal_Int8 > const * const forBinary = 0;
- return ::getCppuType(forBinary);
-}
-// -----------------------------------------------------------------------------
-
-uno::Any LayerMergeHandler::Converter::convertValue(uno::Type const & _aTargetType, uno::Any const & _aValue)
-{
- OSL_ENSURE( m_bConvertData, "Unexpected: Calling convert data, when data conversion is not active");
- OSL_ENSURE( _aValue.hasValue(), "Unexpected: Calling convert data, when data to convert is VOID");
-
- if (_aTargetType == _aValue.getValueType()) return _aValue;
-
- m_aConverter.reset(_aTargetType);
-
- if (m_aConverter.isList())
- {
- uno::Sequence< rtl::OUString > aStringList;
- if (_aValue >>= aStringList)
- return m_aConverter.convertListToAny(aStringList);
- }
-
- rtl::OUString aContent;
- if (_aValue >>= aContent)
- return m_aConverter.convertToAny(aContent);
-
-
- OSL_ENSURE(false, "Cannot convert typed value (not a string)");
-
- return uno::Any();
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-namespace
-{
-// -----------------------------------------------------------------------------
- static inline bool isFinal(node::Attributes const& _aAttributes)
- {
- return _aAttributes.isFinalized() || _aAttributes.isReadonly();
- }
- // --------------------------------- AttributeSetter ---------------------------------
-
- class DefaultPromoter : NodeModification
- {
- public:
- explicit
- DefaultPromoter()
- {}
-
- void adjustAccess(INode& _rNode);
-
- using NodeModification::applyToNode;
- private:
- void handle(ValueNode& _rValueNode);
- void handle(ISubtree& _rSubtree);
- };
-// -----------------------------------------------------------------------------
-
- void DefaultPromoter::adjustAccess(INode& _rNode)
- {
- _rNode.promoteAccessToDefault();
- }
-// -----------------------------------------------------------------------------
-
- void DefaultPromoter::handle(ValueNode& _rValueNode)
- {
- _rValueNode.promoteToDefault();
- adjustAccess(_rValueNode);
- }
-// -----------------------------------------------------------------------------
-
- void DefaultPromoter::handle(ISubtree& _rSubtree)
- {
- _rSubtree.markAsDefault();
- this->applyToChildren(_rSubtree);
- adjustAccess(_rSubtree);
- }
-//--------------------------------------------------------------------------
-
-}
-// -----------------------------------------------------------------------------
-void promoteToDefault(MergedComponentData & _rTree)
-{
- if (ISubtree * pTreeData = _rTree.getSchemaTree())
- DefaultPromoter().applyToNode(*pTreeData);
-
- else
- OSL_ENSURE(false,"No Data to promote to default");
-
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace backend
-
-// -------------------------------------------------------------------------
-} // namespace configmgr
diff --git a/configmgr/source/backend/layermerge.hxx b/configmgr/source/backend/layermerge.hxx
deleted file mode 100644
index 55e511f63c50..000000000000
--- a/configmgr/source/backend/layermerge.hxx
+++ /dev/null
@@ -1,188 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_LAYERMERGE_HXX
-#define CONFIGMGR_BACKEND_LAYERMERGE_HXX
-
-#include "mergedcomponentdata.hxx"
-#include "componentdatahelper.hxx"
-#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- class OTreeNodeFactory;
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
-
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-
- class LayerMergeHandler
- : public cppu::WeakImplHelper1<backenduno::XLayerHandler>
- {
- public:
- explicit
- LayerMergeHandler(uno::Reference< uno::XComponentContext > const & _xContext, MergedComponentData & _rData, ITemplateDataProvider* aTemplateProvider = NULL);
- virtual ~LayerMergeHandler();
-
- // prepare merging
- void prepareLayer();
- bool prepareSublayer(rtl::OUString const & aLocale);
-
- // checking the result
- bool isDone() const { return m_aContext.isDone(); }
- bool isInSublayer() const { return m_bSublayer; }
-
- // XLayerHandler
- public:
- virtual void SAL_CALL
- startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- private:
- void propagateAttributes(ISubtree & _rParent);
-
- node::Attributes makePropertyAttributes(sal_Int16 aSchemaAttributes)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void checkPropertyType(uno::Type const & _aType)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void applyPropertyValue(uno::Any const & _aValue)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void applyPropertyValue(uno::Any const & _aValue, rtl::OUString const & _aLocale)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void applyAttributes(INode * pNode, sal_Int16 aNodeAttributes)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void overrideLayerRoot( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- bool startOverride(INode * pNode, sal_Bool bClear) /* check if writable, mark merged */
- SAL_THROW(());
-
- void implOverrideNode(
- ISubtree * node, sal_Int16 attributes, bool clear);
-
- void implAddOrReplaceNode(const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void ensureUnchanged(INode const * pNode) const
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void setLocalizedValue(ISubtree * pProperty, uno::Any const & _aValue, rtl::OUString const & _aLocale)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
-
- void setValueAndCheck(ValueNode & _rValueNode, uno::Any const & _aValue)
- SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- private:
- void skipNode() { ++m_nSkipping; }
- bool isSkipping() const { return m_nSkipping != 0; }
- bool leaveSkippedNode() { return m_nSkipping && m_nSkipping--; }
- private:
- struct Converter;
- MergedComponentData & m_rData;
- DataBuilderContext m_aContext;
- ComponentDataFactory m_aFactory;
- rtl::OUString m_aLocale;
- INode * m_pProperty;
- Converter * m_pConverter;
-
- sal_uInt32 m_nSkipping;
- bool m_bSublayer;
- };
-// -----------------------------------------------------------------------------
-
- /// change attributes and states of the tree to make it a proper default layer
- void promoteToDefault(MergedComponentData & _rTree);
-// -----------------------------------------------------------------------------
- } // namespace backend
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/layerupdate.cxx b/configmgr/source/backend/layerupdate.cxx
deleted file mode 100644
index 894bb7c549ce..000000000000
--- a/configmgr/source/backend/layerupdate.cxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "layerupdate.hxx"
-#include "updatedata.hxx"
-#include "configpath.hxx"
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
-LayerUpdate::LayerUpdate()
-: m_xContextNode()
-{
-}
-// -----------------------------------------------------------------------------
-
-LayerUpdate::LayerUpdate(LayerUpdate const & _aOther)
-: m_xContextNode(_aOther.m_xContextNode)
-, m_aContextPath(_aOther.m_aContextPath)
-{
-}
-// -----------------------------------------------------------------------------
-
-LayerUpdate::~LayerUpdate()
-{
-}
-// -----------------------------------------------------------------------------
-
-LayerUpdate & LayerUpdate::operator =(LayerUpdate const & _aOther)
-{
- m_xContextNode = _aOther.m_xContextNode;
- return *this;
-}
-// -----------------------------------------------------------------------------
-
-void LayerUpdate::setContextNode(rtl::Reference<NodeUpdate> const & _xContextNode)
-{
- m_xContextNode = _xContextNode;
- if (_xContextNode.is())
- makeContextPath(_xContextNode->getName());
-
- else
- m_aContextPath.clear();
-}
-// -----------------------------------------------------------------------------
-
-void LayerUpdate::makeContextPath(rtl::OUString const & _aPath)
-{
- configuration::AbsolutePath const aParsedPath = configuration::AbsolutePath::parse(_aPath);
-
- m_aContextPath.clear();
- m_aContextPath.reserve( aParsedPath.getDepth() );
- for (std::vector<configuration::Path::Component>::const_reverse_iterator it = aParsedPath.begin(); it != aParsedPath.end(); ++it)
- {
- m_aContextPath.push_back( it->getName() );
- }
-}
-// -----------------------------------------------------------------------------
-
-rtl::Reference<NodeUpdate> LayerUpdate::getContextNode() const
-{
- return m_xContextNode;
-}
-// -----------------------------------------------------------------------------
-
-std::vector<rtl::OUString> const & LayerUpdate::getContextPath() const
-{
- OSL_PRECOND( m_xContextNode.is(), "Cannot get context path without context node" );
-
- return m_aContextPath;
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace backend
-
-// -------------------------------------------------------------------------
-} // namespace configmgr
diff --git a/configmgr/source/backend/layerupdate.hxx b/configmgr/source/backend/layerupdate.hxx
deleted file mode 100644
index ee1384c62958..000000000000
--- a/configmgr/source/backend/layerupdate.hxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_LAYERUPDATE_HXX
-#define CONFIGMGR_BACKEND_LAYERUPDATE_HXX
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <rtl/ref.hxx>
-#include <rtl/ustring.hxx>
-
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif
-
-namespace com { namespace sun { namespace star { namespace configuration { namespace backend {
- class XLayerHandler;
-} } } } }
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
- class NodeUpdate;
-
- class LayerUpdate
- {
- public:
- LayerUpdate();
- LayerUpdate(LayerUpdate const & _aOther);
- ~LayerUpdate();
- LayerUpdate & operator =(LayerUpdate const & _aOther);
- public:
- bool isEmpty() const { return ! m_xContextNode.is(); }
-
- rtl::Reference<NodeUpdate> getContextNode() const;
- std::vector<rtl::OUString> const & getContextPath() const;
-
- void setContextNode(rtl::Reference<NodeUpdate> const & _xContextNode);
-
- private:
- void makeContextPath(rtl::OUString const & _aContextPath);
-
- private:
- rtl::Reference<NodeUpdate> m_xContextNode;
- std::vector<rtl::OUString> m_aContextPath;
- };
-// -----------------------------------------------------------------------------
-
- } // namespace backend
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/layerupdatebuilder.cxx b/configmgr/source/backend/layerupdatebuilder.cxx
deleted file mode 100644
index 6f1d4807f2fb..000000000000
--- a/configmgr/source/backend/layerupdatebuilder.cxx
+++ /dev/null
@@ -1,299 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "layerupdatebuilder.hxx"
-#include "updatedata.hxx"
-#include "layerupdate.hxx"
-#include <com/sun/star/configuration/backend/TemplateIdentifier.hpp>
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
-LayerUpdateBuilder::LayerUpdateBuilder()
-: m_aUpdate()
-, m_pCurrentNode(NULL)
-, m_pCurrentProp(NULL)
-{
-}
-// -----------------------------------------------------------------------------
-
-void LayerUpdateBuilder::clear()
-{
- m_pCurrentProp = NULL;
- m_pCurrentNode = NULL;
- m_aUpdate = LayerUpdate();
-
- OSL_POSTCOND( this->isEmpty(), "LayerUpdateBuilder: Could not reset the stored update.");
-}
-// -----------------------------------------------------------------------------
-
-LayerUpdate const & LayerUpdateBuilder::result() const
-{
- OSL_ENSURE(this->isComplete(),
- "LayerUpdateBuilder: There is no result to retrieve"
- " - building the data is still in progress.");
-
- return m_aUpdate;
-}
-// -----------------------------------------------------------------------------
-
-inline
-LayerUpdate & LayerUpdateBuilder::data()
-{
- return m_aUpdate;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::init()
-{
- if (m_pCurrentNode) return false;
-
- LayerUpdate & update = data();
- m_pCurrentNode = new NodeModification(NULL, rtl::OUString(), 0, 0, false);
- update.setContextNode(m_pCurrentNode);
-
- OSL_ENSURE(m_pCurrentProp == NULL, "LayerUpdateBuilder: Internal error: got a current property for a new context");
-
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::modifyNode(rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset)
-{
- OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
-
- NodeUpdate * pNewNode = new NodeModification(m_pCurrentNode,_aName,_nFlags,_nFlagsMask,_bReset);
- rtl::Reference<ElementUpdate> xNewNode(pNewNode);
-
- if (!m_pCurrentNode->addNodeUpdate(xNewNode))
- return false;
-
- m_pCurrentNode = pNewNode;
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::replaceNode(rtl::OUString const & _aName, sal_Int16 _nFlags, backenduno::TemplateIdentifier const * _pTemplate)
-{
- OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
-
- NodeUpdate * pNewNode = _pTemplate ?
- new NodeReplace(m_pCurrentNode,_aName,_nFlags,_pTemplate->Name,_pTemplate->Component) :
- new NodeReplace(m_pCurrentNode,_aName,_nFlags);
-
- rtl::Reference<ElementUpdate> xNewNode(pNewNode);
-
- if (!m_pCurrentNode->addNodeUpdate(xNewNode))
- return false;
-
- m_pCurrentNode = pNewNode;
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::finishNode()
-{
- OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
-
- if (m_pCurrentProp || !m_pCurrentNode) return false;
-
- m_pCurrentNode = m_pCurrentNode->getParent();
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::removeNode(rtl::OUString const & _aName)
-{
- OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
-
- NodeDrop * pNewNode = new NodeDrop(m_pCurrentNode,_aName);
-
- rtl::Reference<ElementUpdate> xNewNode(pNewNode);
-
- if (!m_pCurrentNode->addNodeUpdate(xNewNode))
- return false;
-
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::modifyProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType)
-{
- OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
-
- PropertyUpdate * pNewProp = new PropertyUpdate(m_pCurrentNode,_aName,_nFlags,_nFlagsMask,_aType);
- rtl::Reference<ElementUpdate> xNewProp(pNewProp);
-
- if (!m_pCurrentNode->addPropertyUpdate(xNewProp))
- return false;
-
- m_pCurrentProp = pNewProp;
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::setPropertyValue(uno::Any const & _aValue)
-{
- OSL_PRECOND(m_pCurrentProp, "LayerUpdateBuilder: Illegal state for property operation");
-
- return m_pCurrentProp->setValue(_aValue);
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::setPropertyValueForLocale(uno::Any const & _aValue, rtl::OUString const & _aLocale)
-{
- OSL_PRECOND(m_pCurrentProp, "LayerUpdateBuilder: Illegal state for property operation");
-
- return m_pCurrentProp->setValueFor(_aLocale, _aValue);
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::resetPropertyValue()
-{
- OSL_PRECOND(m_pCurrentProp, "LayerUpdateBuilder: Illegal state for property operation");
-
- return m_pCurrentProp->resetValue();
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::resetPropertyValueForLocale(rtl::OUString const & _aLocale)
-{
- OSL_PRECOND(m_pCurrentProp, "LayerUpdateBuilder: Illegal state for property operation");
-
- return m_pCurrentProp->resetValueFor(_aLocale);
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::finishProperty()
-{
- OSL_PRECOND(m_pCurrentProp, "LayerUpdateBuilder: Illegal state for property operation");
- if (!m_pCurrentProp) return false;
- m_pCurrentProp->finishValue();
-
- OSL_ASSERT(m_pCurrentNode == m_pCurrentProp->getParent());
-
- m_pCurrentProp = NULL;
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::addNullProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType)
-{
- OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
-
- PropertyAdd * pNewProp = new PropertyAdd(m_pCurrentNode,_aName,_nFlags,_aType);
-
- rtl::Reference<ElementUpdate> xNewProp(pNewProp);
-
- if (!m_pCurrentNode->addPropertyUpdate(xNewProp))
- return false;
-
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::addProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue)
-{
- OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
-
- PropertyAdd * pNewProp = new PropertyAdd(m_pCurrentNode,_aName,_nFlags,_aValue);
-
- rtl::Reference<ElementUpdate> xNewProp(pNewProp);
-
- if (!m_pCurrentNode->addPropertyUpdate(xNewProp))
- return false;
-
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::resetProperty(rtl::OUString const & _aName)
-{
- OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
-
- PropertyReset * pNewProp = new PropertyReset(m_pCurrentNode,_aName);
-
- rtl::Reference<ElementUpdate> xNewProp(pNewProp);
-
- if (!m_pCurrentNode->addPropertyUpdate(xNewProp))
- return false;
-
- return true;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::finish()
-{
- if (!this->finishNode()) return false;
-
- return m_pCurrentNode == NULL;
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::isEmpty() const
-{
- OSL_ENSURE( !m_pCurrentNode || !m_aUpdate.isEmpty(), "LayerUpdateBuilder: Invariant violation: got a current node without a layer");
- return m_aUpdate.isEmpty();
-}
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::isActive() const
-{
- OSL_ENSURE( !m_pCurrentNode || !m_aUpdate.isEmpty(), "LayerUpdateBuilder: Invariant violation: got a current node without a layer");
- return m_pCurrentNode != 0;
-}
-// -----------------------------------------------------------------------------
-#if OSL_DEBUG_LEVEL > 0
-bool LayerUpdateBuilder::isComplete() const
-{
- OSL_ENSURE( !m_pCurrentNode || !m_aUpdate.isEmpty(), "LayerUpdateBuilder: Invariant violation: got a current node without a layer");
- return !m_aUpdate.isEmpty() && m_pCurrentNode == NULL;
-}
-#endif
-// -----------------------------------------------------------------------------
-
-bool LayerUpdateBuilder::isPropertyActive() const
-{
- OSL_ENSURE( !m_pCurrentNode || !m_aUpdate.isEmpty(), "LayerUpdateBuilder: Invariant violation: got a current node without a layer");
- OSL_ENSURE(m_pCurrentNode || !m_pCurrentProp, "LayerUpdateBuilder: Invariant violation: got a current property without a node");
- return m_pCurrentProp != 0;
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace backend
-
-// -------------------------------------------------------------------------
-} // namespace configmgr
diff --git a/configmgr/source/backend/layerupdatebuilder.hxx b/configmgr/source/backend/layerupdatebuilder.hxx
deleted file mode 100644
index c86d18628935..000000000000
--- a/configmgr/source/backend/layerupdatebuilder.hxx
+++ /dev/null
@@ -1,105 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_LAYERUPDATEBUILDER_HXX
-#define CONFIGMGR_BACKEND_LAYERUPDATEBUILDER_HXX
-
-#include "layerupdate.hxx"
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Type.hxx>
-#include <rtl/ustring.hxx>
-
-namespace com { namespace sun { namespace star { namespace configuration { namespace backend {
- struct TemplateIdentifier;
-} } } } }
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
- class NodeUpdate;
- class PropertyUpdate;
-
- class LayerUpdateBuilder
- {
- LayerUpdate m_aUpdate;
- NodeUpdate * m_pCurrentNode;
- PropertyUpdate * m_pCurrentProp;
- public:
- LayerUpdateBuilder();
-
- public:
- /// initialize the update
- bool init();
-
- bool modifyNode(rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset);
- bool replaceNode(rtl::OUString const & _aName, sal_Int16 _nFlags, backenduno::TemplateIdentifier const * _pTemplate = NULL);
- bool finishNode();
-
- bool removeNode(rtl::OUString const & _aName);
-
- bool modifyProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType);
- bool setPropertyValue(uno::Any const & _aValue);
- bool setPropertyValueForLocale(uno::Any const & _aValue, rtl::OUString const & _aLocale);
- bool resetPropertyValue();
- bool resetPropertyValueForLocale(rtl::OUString const & _aLocale);
- bool finishProperty();
-
- bool addNullProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType);
- bool addProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue);
- bool resetProperty(rtl::OUString const & _aName);
-
- bool finish();
- void clear();
-
- bool isEmpty() const;
- bool isActive() const;
-#if OSL_DEBUG_LEVEL > 0
- bool isComplete() const;
-#endif
- bool isPropertyActive() const;
-
- LayerUpdate const & result() const;
- private:
- LayerUpdate & data();
- };
-// -----------------------------------------------------------------------------
-
- } // namespace backend
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/layerupdatehandler.cxx b/configmgr/source/backend/layerupdatehandler.cxx
deleted file mode 100644
index 22786e912a7e..000000000000
--- a/configmgr/source/backend/layerupdatehandler.cxx
+++ /dev/null
@@ -1,313 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "layerupdatehandler.hxx"
-#include "layerupdatemerger.hxx"
-
-#ifndef CONFIGMGR_API_FACTORY_HXX_
-#include "confapifactory.hxx"
-#endif
-#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
-#include <com/sun/star/configuration/backend/XLayer.hpp>
-#include <com/sun/star/beans/PropertyExistException.hpp>
-
-// -----------------------------------------------------------------------------
-#define OUSTR( str ) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( str ) )
-// -----------------------------------------------------------------------------
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-
-uno::Reference< uno::XInterface > SAL_CALL instantiateUpdateMerger
-( uno::Reference< uno::XComponentContext > const& xContext )
-{
- return * new LayerUpdateHandler( xContext );
-}
-
-// -----------------------------------------------------------------------------
-
-LayerUpdateHandler::LayerUpdateHandler(uno::Reference< uno::XComponentContext > const & _xContext)
-: UpdateService(_xContext)
-, m_aBuilder()
-{
-}
-// -----------------------------------------------------------------------------
-
-LayerUpdateHandler::~LayerUpdateHandler()
-{
-}
-// -----------------------------------------------------------------------------
-inline
-void LayerUpdateHandler::checkBuilder(bool _bForProperty)
-{
- if ( m_aBuilder.isEmpty() )
- raiseMalformedDataException("LayerUpdateHandler: Illegal operation - no update is in progress");
-
- if ( !m_aBuilder.isActive() )
- raiseMalformedDataException("LayerUpdateHandler: Illegal operation - no context for update available");
-
- if ( m_aBuilder.isPropertyActive() != _bForProperty )
- raiseMalformedDataException("LayerUpdateHandler: Illegal operation - a property is in progress");
-}
-// -----------------------------------------------------------------------------
-
-void LayerUpdateHandler::raiseMalformedDataException(sal_Char const * pMsg)
-{
- rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
- throw backenduno::MalformedDataException(sMsg,*this,uno::Any());
-}
-// -----------------------------------------------------------------------------
-
-void LayerUpdateHandler::raiseNodeChangedBeforeException(sal_Char const * pMsg)
-{
- rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
- throw backenduno::MalformedDataException(sMsg,*this,uno::Any());
-}
-// -----------------------------------------------------------------------------
-
-void LayerUpdateHandler::raisePropChangedBeforeException(sal_Char const * pMsg)
-{
- rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
- throw backenduno::MalformedDataException(sMsg,*this,uno::Any());
-}
-// -----------------------------------------------------------------------------
-
-void LayerUpdateHandler::raisePropExistsException(sal_Char const * pMsg)
-{
- rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
- com::sun::star::beans::PropertyExistException e(sMsg,*this);
-
- throw backenduno::MalformedDataException(sMsg,*this, uno::makeAny(e));
-}
-// -----------------------------------------------------------------------------
-
-// XUpdateHandler
-void SAL_CALL
- LayerUpdateHandler::startUpdate( )
- throw ( backenduno::MalformedDataException, lang::IllegalAccessException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- this->checkSourceLayer();
- if (!m_aBuilder.init())
- raiseMalformedDataException("LayerUpdateHandler: Cannot start update - update is already in progress");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::endUpdate( )
- throw ( backenduno::MalformedDataException, lang::IllegalAccessException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder();
-
- if (!m_aBuilder.finish())
- raiseMalformedDataException("LayerUpdateHandler: Cannot finish update - a node is still open.");
-
- uno::Reference< backenduno::XLayer > xMergedLayer( LayerUpdateMerger::getMergedLayer(this->getSourceLayer(), m_aBuilder.result()) );
-
- m_aBuilder.clear();
-
- this->writeUpdatedLayer(xMergedLayer);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::modifyNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, sal_Bool bReset )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder();
-
- if (!m_aBuilder.modifyNode(aName,aAttributes,aAttributeMask,bReset))
- raiseNodeChangedBeforeException("LayerUpdateHandler: Cannot start node modification - node has already been changed.");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder();
-
- if (!m_aBuilder.replaceNode(aName,aAttributes,NULL))
- raiseNodeChangedBeforeException("LayerUpdateHandler: Cannot start added/replaced node - node has already been changed.");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aTemplate )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder();
-
- if (!m_aBuilder.replaceNode(aName,aAttributes,&aTemplate))
- raiseNodeChangedBeforeException("LayerUpdateHandler: Cannot start added/replaced node - node has already been changed.");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder();
-
- if (!m_aBuilder.finishNode())
- {
- OSL_ENSURE(m_aBuilder.isPropertyActive() || !m_aBuilder.isActive(), "LayerUpdateHandler: Unexpected failure mode for finishNode");
- if (m_aBuilder.isPropertyActive())
- raiseMalformedDataException("LayerUpdateHandler: Cannot finish node update - open property has not been ended.");
- else
- raiseMalformedDataException("LayerUpdateHandler: Cannot finish node update - no node has been started.");
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::removeNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder();
-
- if (!m_aBuilder.removeNode(aName))
- raiseNodeChangedBeforeException("LayerUpdateHandler: Cannot remove node - node has already been changed.");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler:: modifyProperty( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, const uno::Type & aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder(false);
-
- if (!m_aBuilder.modifyProperty(aName,aAttributes,aAttributeMask, aType))
- raisePropChangedBeforeException("LayerUpdateHandler: Cannot start property modification - property has already been changed.");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler:: setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder(true); // already checks for open property
-
- OSL_VERIFY( m_aBuilder.setPropertyValue(aValue) );
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler:: setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder(true); // already checks for open property
-
- OSL_VERIFY( m_aBuilder.setPropertyValueForLocale(aValue,aLocale) );
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::resetPropertyValue( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder(true); // already checks for open property
-
- OSL_VERIFY( m_aBuilder.resetPropertyValue() );
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::resetPropertyValueForLocale( const rtl::OUString& aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder(true); // already checks for open property
-
- OSL_VERIFY( m_aBuilder.resetPropertyValueForLocale(aLocale) );
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- checkBuilder(true); // already checks for open property
-
- OSL_VERIFY ( m_aBuilder.finishProperty() );
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::resetProperty( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!m_aBuilder.resetProperty(aName))
- raisePropChangedBeforeException("LayerUpdateHandler: Cannot reset property - property has already been changed.");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::addOrReplaceProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!m_aBuilder.addNullProperty(aName,aAttributes,aType))
- raisePropExistsException("LayerUpdateHandler: Cannot add property - property exists (and has already been changed).");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::addOrReplacePropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!m_aBuilder.addProperty(aName,aAttributes,aValue))
- raisePropExistsException("LayerUpdateHandler: Cannot add property - property exists (and has already been changed).");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL
- LayerUpdateHandler::removeProperty( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- // treat 'remove' as 'reset'. (Note: does not verify that this actually amounts to dropping the property)
- if (!m_aBuilder.resetProperty(aName))
- raisePropChangedBeforeException("LayerUpdateHandler: Cannot remove property - property has already been changed.");
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace
-
-// -----------------------------------------------------------------------------
-} // namespace
-
diff --git a/configmgr/source/backend/layerupdatehandler.hxx b/configmgr/source/backend/layerupdatehandler.hxx
deleted file mode 100644
index 8a02870f4dfd..000000000000
--- a/configmgr/source/backend/layerupdatehandler.hxx
+++ /dev/null
@@ -1,154 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_LAYERUPDATEHANDLER_HXX
-#define CONFIGMGR_BACKEND_LAYERUPDATEHANDLER_HXX
-
-#include "sal/config.h"
-
-#include "boost/utility.hpp"
-
-#include "updatesvc.hxx"
-#include "layerupdatebuilder.hxx"
-#include "utility.hxx"
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
- class LayerUpdateBuilder;
-
- class LayerUpdateHandler: private boost::noncopyable, public UpdateService
- {
- public:
- explicit
- LayerUpdateHandler(uno::Reference< uno::XComponentContext > const & _xContext);
-
- ~LayerUpdateHandler();
-
- // XUpdateHandler
- virtual void SAL_CALL
- startUpdate( )
- throw ( backenduno::MalformedDataException, lang::IllegalAccessException,
- lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endUpdate( )
- throw ( backenduno::MalformedDataException, lang::IllegalAccessException,
- lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- modifyNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, sal_Bool bReset )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const rtl::OUString& aName, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aTemplate )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- removeNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- modifyProperty( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- resetPropertyValue( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- resetPropertyValueForLocale( const rtl::OUString& aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- resetProperty( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplacePropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- removeProperty( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- private:
- LayerUpdateBuilder & getUpdateBuilder();
-
- void checkBuilder(bool _bForProperty = false);
-
- void raiseMalformedDataException(sal_Char const * pMsg);
- void raiseNodeChangedBeforeException(sal_Char const * pMsg);
- void raisePropChangedBeforeException(sal_Char const * pMsg);
- void raisePropExistsException(sal_Char const * pMsg);
-
- private:
- LayerUpdateBuilder m_aBuilder;
- };
-// -----------------------------------------------------------------------------
- } // namespace xml
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/layerupdatemerger.cxx b/configmgr/source/backend/layerupdatemerger.cxx
deleted file mode 100644
index 94c6ae37ec4a..000000000000
--- a/configmgr/source/backend/layerupdatemerger.cxx
+++ /dev/null
@@ -1,512 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "layerupdatemerger.hxx"
-#include "layerupdatebuilder.hxx"
-#include "updatedata.hxx"
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
-LayerUpdateMerger::LayerUpdateMerger(uno::Reference< backenduno::XLayer > const & _xSourceLayer, LayerUpdate const & _aLayerUpdate)
-: BasicUpdateMerger(_xSourceLayer)
-, m_aLayerUpdate(_aLayerUpdate)
-, m_xCurrentNode()
-{
-}
-// -----------------------------------------------------------------------------
-
-LayerUpdateMerger::~LayerUpdateMerger()
-{
-}
-// -----------------------------------------------------------------------------
-
-void LayerUpdateMerger::flushUpdate()
-{
- OSL_ENSURE(!BasicUpdateMerger::isHandling(), "LayerUpdateMerger: Unexpected: flushing data, while base implementation is active");
- OSL_ENSURE(m_xCurrentNode.is(),"LayerUpdateMerger: No data for flushing.");
-
- if (m_xCurrentNode.is())
- {
- m_xCurrentNode->writeChildrenToLayer(getResultWriter().get());
- m_xCurrentNode.clear();
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- BasicUpdateMerger::startLayer();
-
- m_xCurrentNode = m_aLayerUpdate.getContextNode();
-
- BasicUpdateMerger::findContext(m_aLayerUpdate.getContextPath());
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- BasicUpdateMerger::endLayer();
-
- OSL_ENSURE(!m_xCurrentNode.is(), "Path being updated not found in data - update not written");
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::overrideNode(aName, aAttributes, bClear);
- return;
- }
-
- OSL_ASSERT(m_xCurrentNode.is());
-
- rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getNodeByName(aName);
- if (!xUpdate.is())
- {
- BasicUpdateMerger::overrideNode(aName, aAttributes, bClear);
- OSL_ASSERT(BasicUpdateMerger::isHandling());
- return;
- }
- m_xCurrentNode->removeNodeByName(aName);
-
- if (NodeUpdate * pNodeUpdate = xUpdate->asNodeUpdate(true))
- {
- getResultWriter()->overrideNode(aName, pNodeUpdate->updateFlags(aAttributes), bClear);
- m_xCurrentNode.set(pNodeUpdate);
- }
- else
- {
- xUpdate->writeToLayer(getResultWriter().get());
- BasicUpdateMerger::startSkipping();
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::addOrReplaceNode(aName, aAttributes);
- return;
- }
-
- OSL_ASSERT(m_xCurrentNode.is());
-
- rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getNodeByName(aName);
- if (!xUpdate.is())
- {
- BasicUpdateMerger::addOrReplaceNode(aName, aAttributes);
- OSL_ASSERT(BasicUpdateMerger::isHandling());
- return;
- }
- m_xCurrentNode->removeNodeByName(aName);
-
- if (NodeUpdate * pNodeUpdate = xUpdate->asNodeUpdate(true))
- {
- getResultWriter()->addOrReplaceNode(aName, pNodeUpdate->updateFlags(aAttributes));
- m_xCurrentNode.set(pNodeUpdate);
- }
- else
- {
- xUpdate->writeToLayer(getResultWriter().get());
- BasicUpdateMerger::startSkipping();
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::addOrReplaceNodeFromTemplate(aName, aTemplate, aAttributes);
- return;
- }
-
- OSL_ASSERT(m_xCurrentNode.is());
-
- rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getNodeByName(aName);
- if (!xUpdate.is())
- {
- BasicUpdateMerger::addOrReplaceNodeFromTemplate(aName, aTemplate, aAttributes);
- OSL_ASSERT(BasicUpdateMerger::isHandling());
- return;
- }
- m_xCurrentNode->removeNodeByName(aName);
-
- if (NodeUpdate * pNodeUpdate = xUpdate->asNodeUpdate(true))
- {
- getResultWriter()->addOrReplaceNodeFromTemplate(aName, aTemplate, pNodeUpdate->updateFlags(aAttributes));
- m_xCurrentNode.set(pNodeUpdate);
- }
- else
- {
- xUpdate->writeToLayer(getResultWriter().get());
- BasicUpdateMerger::startSkipping();
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::endNode();
- return;
- }
-
- OSL_ASSERT(m_xCurrentNode.is());
-
- // write unhandled so far changes
- m_xCurrentNode->writeChildrenToLayer( getResultWriter().get() );
-
- rtl::Reference<NodeUpdate> xParent( m_xCurrentNode->getParent() );
-
- if (xParent.is())
- getResultWriter()->endNode();
-
- else
- BasicUpdateMerger::leaveContext();
-
- m_xCurrentNode = xParent;
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::dropNode(aName);
- return;
- }
-
- OSL_ASSERT(m_xCurrentNode.is());
-
- rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getNodeByName(aName);
- if (xUpdate.is())
- {
- m_xCurrentNode->removeNodeByName(aName);
-
- if (NodeUpdate * pNodeUpdate = xUpdate->asNodeUpdate())
- {
- if (pNodeUpdate-> getOperation() == NodeUpdate::replace)
- {
- xUpdate->writeToLayer( getResultWriter().get() );
- return;
- }
- else
- {
- malformedUpdate("LayerUpdateMerger: Applying modification to dropped node");
- }
- }
- }
-
- getResultWriter()->dropNode(aName);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::overrideProperty(aName, aAttributes, aType, bClear);
- return;
- }
-
- OSL_ASSERT( m_xCurrentNode.is());
-
- rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getPropertyByName(aName);
- if (!xUpdate.is())
- {
- BasicUpdateMerger::overrideProperty(aName, aAttributes, aType, bClear);
- OSL_ASSERT(BasicUpdateMerger::isHandling());
- return;
- }
-
- m_xCurrentNode->removePropertyByName(aName);
-
- if (PropertyUpdate * pPropUpdate = xUpdate->asPropertyUpdate())
- {
- OSL_ENSURE( aType == pPropUpdate->getValueType() ||
- aType == uno::Type() ||
- pPropUpdate->getValueType() == uno::Type(),
- "Error in update merger: type mismatch overriding property ...");
-
- getResultWriter()->overrideProperty(aName, pPropUpdate->updateFlags(aAttributes), aType, bClear);
- m_xCurrentProp.set(pPropUpdate);
- }
- else
- {
- xUpdate->writeToLayer(getResultWriter().get());
- BasicUpdateMerger::startSkipping();
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::endProperty();
- return;
- }
-
- OSL_ASSERT(m_xCurrentNode.is());
-
- if (!m_xCurrentProp.is())
- {
- rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("LayerUpdateMerger: Invalid data: Ending property that wasn't started.") );
- throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
- }
-
- // write unhandled so far values
- m_xCurrentProp->writeValuesToLayer( getResultWriter().get() );
-
- getResultWriter()->endProperty();
-
- m_xCurrentProp.clear();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::setPropertyValue(aValue);
- return;
- }
-
- OSL_ASSERT(m_xCurrentNode.is());
-
- if (!m_xCurrentProp.is())
- {
- rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("LayerUpdateMerger: Invalid data: setting value, but no property is started.") );
- throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
- }
-
- if (!m_xCurrentProp->hasChange())
- {
- BasicUpdateMerger::setPropertyValue(aValue);
- return;
- }
-
-#ifndef CFG_UPDATEMERGER_BATCHWRITE_PROPERTIES
- if (m_xCurrentProp->hasValue())
- {
- getResultWriter()->setPropertyValue(m_xCurrentProp->getValue());
- }
- else
- {
- OSL_ENSURE(m_xCurrentProp->hasReset(),"LayerUpdateMerger: ERROR: Unknown change type in PropertyUpdate");
- // write nothing to result
- }
-
- // mark handled
- m_xCurrentProp->removeValue();
-#endif
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::setPropertyValueForLocale(aValue, aLocale);
- return;
- }
-
- OSL_ASSERT(m_xCurrentNode.is());
-
- if (!m_xCurrentProp.is())
- {
- rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("LayerUpdateMerger: Invalid data: setting value, but no property is started.") );
- throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
- }
-
- if (!m_xCurrentProp->hasChangeFor(aLocale))
- {
- BasicUpdateMerger::setPropertyValueForLocale(aValue, aLocale);
- return;
- }
-
-#ifndef CFG_UPDATEMERGER_BATCHWRITE_PROPERTIES
- if (m_xCurrentProp->hasValueFor(aLocale))
- {
- getResultWriter()->setPropertyValueForLocale(m_xCurrentProp->getValueFor(aLocale),aLocale);
- }
- else
- {
- OSL_ENSURE(m_xCurrentProp->hasResetFor(aLocale),"LayerUpdateMerger: ERROR: Unknown change type in PropertyUpdate");
- // write nothing to result
- }
-
- // mark handled
- m_xCurrentProp->removeValueFor(aLocale);
-#endif
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::addProperty(aName, aAttributes, aType);
- return;
- }
- OSL_ASSERT( m_xCurrentNode.is());
-
- rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getPropertyByName(aName);
- if (!xUpdate.is())
- {
- BasicUpdateMerger::addProperty(aName, aAttributes, aType);
- return;
- }
-
- m_xCurrentNode->removePropertyByName(aName);
-
- if (PropertyUpdate * pPropUpdate = xUpdate->asPropertyUpdate())
- {
- if (pPropUpdate->hasValue() && pPropUpdate->getValue().hasValue())
- {
- // TODO: validate value-type
- uno::Any aNewValue = pPropUpdate->getValue();
- OSL_ASSERT( aNewValue.hasValue() );
-
- if (aNewValue.getValueType() != aType)
- malformedUpdate("LayerUpdateMerger: cannot do type conversion while writing updates");
-
- getResultWriter()->addPropertyWithValue(aName, pPropUpdate->updateFlags(aAttributes), aNewValue);
- }
- else
- {
- // TODO: validate type
- if (pPropUpdate->getValueType() != aType && pPropUpdate->getValueType() != uno::Type())
- malformedUpdate("LayerUpdateMerger: types for property update do not match");
-
- OSL_ENSURE(!pPropUpdate->hasReset(),"Warning: resetting the value of an added property is undefined - reverting to NULL");
- getResultWriter()->addProperty(aName, pPropUpdate->updateFlags(aAttributes), aType);
- }
- }
- else
- {
- xUpdate->writeToLayer(getResultWriter().get());
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL LayerUpdateMerger::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (BasicUpdateMerger::isHandling())
- {
- BasicUpdateMerger::addPropertyWithValue(aName, aAttributes, aValue);
- return;
- }
- OSL_ASSERT( m_xCurrentNode.is());
-
- rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getPropertyByName(aName);
- if (!xUpdate.is())
- {
- BasicUpdateMerger::addPropertyWithValue(aName, aAttributes, aValue);
- return;
- }
-
- m_xCurrentNode->removePropertyByName(aName);
-
- if (PropertyUpdate * pPropUpdate = xUpdate->asPropertyUpdate())
- {
- if (!pPropUpdate->hasChange()) // attribute change only
- {
- getResultWriter()->addPropertyWithValue(aName, pPropUpdate->updateFlags(aAttributes), aValue);
- }
- else if (pPropUpdate->hasReset())
- {
- // write nothing
- }
- else if (pPropUpdate->getValue().hasValue()) // setting to non-NULL value
- {
- OSL_ASSERT(pPropUpdate->hasValue());
-
- // TODO: validate value-type
- uno::Any aNewValue = pPropUpdate->getValue();
-
- if (aNewValue.getValueType() != aValue.getValueType())
- malformedUpdate("LayerUpdateMerger: cannot do type conversion while writing updates");
-
- getResultWriter()->addPropertyWithValue(aName, pPropUpdate->updateFlags(aAttributes), aNewValue);
- }
- else // setting to null value
- {
- OSL_ASSERT(pPropUpdate->hasValue());
-
- // TODO: validate type
- if (pPropUpdate->getValueType() != aValue.getValueType() && pPropUpdate->getValueType() != uno::Type())
- malformedUpdate("LayerUpdateMerger: types for property update do not match");
-
- getResultWriter()->addProperty(aName, pPropUpdate->updateFlags(aAttributes), aValue.getValueType());
- }
- }
- else
- {
- xUpdate->writeToLayer(getResultWriter().get());
- }
-}
-// -----------------------------------------------------------------------------
-
-void LayerUpdateMerger::malformedUpdate(sal_Char const * pMsg)
-{
- { (void)pMsg; }
- OSL_ENSURE(false,pMsg);
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace
-
-// -----------------------------------------------------------------------------
-} // namespace
-
diff --git a/configmgr/source/backend/layerupdatemerger.hxx b/configmgr/source/backend/layerupdatemerger.hxx
deleted file mode 100644
index 2636b3974266..000000000000
--- a/configmgr/source/backend/layerupdatemerger.hxx
+++ /dev/null
@@ -1,130 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_LAYERUPDATEMERGER_HXX
-#define CONFIGMGR_BACKEND_LAYERUPDATEMERGER_HXX
-
-#include "basicupdatemerger.hxx"
-#include "layerupdate.hxx"
-#include <rtl/ref.hxx>
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- class NodeUpdate;
- class PropertyUpdate;
-
- class LayerUpdateMerger : protected BasicUpdateMerger
- {
- public:
- static uno::Reference< backenduno::XLayer > getMergedLayer(uno::Reference< backenduno::XLayer > const & _xSourceLayer, LayerUpdate const & _aLayerUpdate)
- { return new LayerUpdateMerger(_xSourceLayer, _aLayerUpdate); }
-
- public:
- explicit
- LayerUpdateMerger( uno::Reference< backenduno::XLayer > const & _xSourceLayer, LayerUpdate const & _aLayerUpdate);
-
- ~LayerUpdateMerger();
-
-
- // XLayerHandler overrides
- protected:
- virtual void SAL_CALL
- startLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endLayer( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- dropNode( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endProperty( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValue( const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- // BasicUpdateMerger
- virtual void flushUpdate();
- private:
- void malformedUpdate(sal_Char const * pMsg);
- private:
- LayerUpdate m_aLayerUpdate;
- rtl::Reference<NodeUpdate> m_xCurrentNode;
- rtl::Reference<PropertyUpdate> m_xCurrentProp;
- };
-// -----------------------------------------------------------------------------
- } // namespace xml
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/makefile.mk b/configmgr/source/backend/makefile.mk
deleted file mode 100644
index 2b0f223701da..000000000000
--- a/configmgr/source/backend/makefile.mk
+++ /dev/null
@@ -1,77 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org 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 version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJINC=$(PRJ)$/source
-PRJNAME=configmgr
-TARGET=backend
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings ---
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/makefile.pmk
-
-# --- Files ---
-
-
-SLOFILES=\
- $(SLO)$/mergedcomponentdata.obj \
- $(SLO)$/componentdatahelper.obj \
- $(SLO)$/schemabuilder.obj \
- $(SLO)$/layermerge.obj \
- $(SLO)$/updatesvc.obj \
- $(SLO)$/layerupdatehandler.obj \
- $(SLO)$/basicupdatemerger.obj \
- $(SLO)$/layerupdatemerger.obj \
- $(SLO)$/layerupdatebuilder.obj \
- $(SLO)$/layerupdate.obj \
- $(SLO)$/updatedata.obj \
- $(SLO)$/updatedispatch.obj \
- $(SLO)$/singlebackendadapter.obj \
- $(SLO)$/backendaccess.obj \
- $(SLO)$/backendfactory.obj \
- $(SLO)$/importsvc.obj \
- $(SLO)$/basicimporthandler.obj \
- $(SLO)$/importmergehandler.obj \
- $(SLO)$/layerdefaultremover.obj \
- $(SLO)$/emptylayer.obj \
- $(SLO)$/binarywriter.obj \
- $(SLO)$/binaryreader.obj \
- $(SLO)$/binarywritehandler.obj \
- $(SLO)$/binaryreadhandler.obj \
- $(SLO)$/binarycache.obj \
- $(SLO)$/backendnotifier.obj \
- $(SLO)$/backendstratalistener.obj \
- $(SLO)$/multistratumbackend.obj \
-
-
-# --- Targets ---
-
-.INCLUDE : target.mk
-
diff --git a/configmgr/source/backend/mergedcomponentdata.cxx b/configmgr/source/backend/mergedcomponentdata.cxx
deleted file mode 100644
index b79223da37d0..000000000000
--- a/configmgr/source/backend/mergedcomponentdata.cxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "mergedcomponentdata.hxx"
-#include "treenodefactory.hxx"
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
-MergedComponentData::MergedComponentData( )
-: m_pSchemaTree()
-, m_pTemplatesTree()
-{
-
-}
-// -----------------------------------------------------------------------------
-
-MergedComponentData::~MergedComponentData( )
-{
-
-}
-// -----------------------------------------------------------------------------
-
-void MergedComponentData::clear( )
-{
- m_pTemplatesTree.reset();
- m_pSchemaTree.reset();
-}
-// -----------------------------------------------------------------------------
-
-bool MergedComponentData::hasSchema()const
-{
- return m_pSchemaTree.get() != NULL;
-}
-// -----------------------------------------------------------------------------
-
-
-bool MergedComponentData::hasTemplates() const
-{
- return m_pTemplatesTree.get() != NULL;
-}
-// -----------------------------------------------------------------------------
-
-rtl::OUString MergedComponentData::getTemplateAccessor (backenduno::TemplateIdentifier const & _aTemplateName) const
-{
- return _aTemplateName.Name;
-}
-// -----------------------------------------------------------------------------
-
-bool MergedComponentData::hasTemplate(rtl::OUString const & _aTemplateName) const
-{
- return m_pTemplatesTree.get() != NULL &&
- m_pTemplatesTree->getChild( _aTemplateName ) != NULL;
-}
-// -----------------------------------------------------------------------------
-
-std::auto_ptr<ISubtree> MergedComponentData::extractSchemaTree()
-{
- return m_pSchemaTree;
-}
-// -----------------------------------------------------------------------------
-
-std::auto_ptr<ISubtree> MergedComponentData::extractTemplatesTree()
-{
- return m_pTemplatesTree;
-}
-// -----------------------------------------------------------------------------
-
-std::auto_ptr<INode> MergedComponentData::extractTemplateNode(rtl::OUString const & _aTemplateName)
-{
- if (m_pTemplatesTree.get() == NULL)
- return std::auto_ptr<INode>();
-
- return m_pTemplatesTree->removeChild(_aTemplateName);
-}
-// -----------------------------------------------------------------------------
-
-ISubtree const * MergedComponentData::findTemplate(rtl::OUString const & _aTemplateName) const
-{
- INode const * pTemplateNode = m_pTemplatesTree->getChild(_aTemplateName);
-
- ISubtree const * pTemplateTree = pTemplateNode ? pTemplateNode->asISubtree() : NULL;
-
- OSL_ENSURE(pTemplateTree || !pTemplateNode, "ERROR: Template is not a subtree");
-
- return pTemplateTree;
-}
-// -----------------------------------------------------------------------------
-
-std::auto_ptr<INode> MergedComponentData::instantiateTemplate(rtl::OUString const & _aName, rtl::OUString const & _aTemplateName) const
-{
- if (INode const * pTemplateNode = m_pTemplatesTree->getChild(_aTemplateName))
- {
- std::auto_ptr<INode> aResult = pTemplateNode->clone();
- aResult->setName(_aName);
- return aResult;
- }
- else
- {
- return std::auto_ptr<INode>();
- }
-}
-// -----------------------------------------------------------------------------
-
-ISubtree * MergedComponentData::setSchemaRoot(std::auto_ptr<ISubtree> _aSchemaRoot)
-{
- OSL_PRECOND(_aSchemaRoot.get(),"ERROR: Setting a NULL schema root.");
- OSL_PRECOND(!hasSchema(),"ERROR: Schema root already set");
-
- m_pSchemaTree = _aSchemaRoot;
-
- return m_pSchemaTree.get();
-}
-// -----------------------------------------------------------------------------
-void MergedComponentData::setTemplatesTree(std::auto_ptr<ISubtree> _aTemplateTree)
-{
- OSL_PRECOND(!hasTemplates(),"ERROR: Template Tree already set");
- m_pTemplatesTree = _aTemplateTree;
-}
-// -----------------------------------------------------------------------------
-ISubtree * MergedComponentData::addTemplate(std::auto_ptr<ISubtree> _aNode, backenduno::TemplateIdentifier const & aTemplate)
-{
- OSL_PRECOND(_aNode.get(), "ERROR: Adding a NULL template");
-
- if (!m_pTemplatesTree.get())
- {
- m_pTemplatesTree = getDefaultTreeNodeFactory().createGroupNode( aTemplate.Component, node::Attributes() );
- }
- else
- {
- OSL_ENSURE(m_pTemplatesTree->getName().equals(aTemplate.Component),
- "Template Component names do not match");
- }
-
- return m_pTemplatesTree->addChild( base_ptr(_aNode) )->asISubtree();
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace backend
-
-// -------------------------------------------------------------------------
-} // namespace configmgr
diff --git a/configmgr/source/backend/mergedcomponentdata.hxx b/configmgr/source/backend/mergedcomponentdata.hxx
deleted file mode 100644
index af6d1eddd52c..000000000000
--- a/configmgr/source/backend/mergedcomponentdata.hxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */
-
-#ifndef CONFIGMGR_BACKEND_MERGEDCOMPONENTDATA_HXX
-#define CONFIGMGR_BACKEND_MERGEDCOMPONENTDATA_HXX
-
-#include "valuenode.hxx"
-
-#include <com/sun/star/configuration/backend/TemplateIdentifier.hpp>
-
-#ifndef INCLUDED_MEMORY
-#include <memory>
-#define INCLUDED_MEMORY
-#endif
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- class OTreeNodeFactory;
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace backenduno = ::com::sun::star::configuration::backend;
-
-// -----------------------------------------------------------------------------
-
- class MergedComponentData
- {
- public:
- MergedComponentData();
- ~MergedComponentData();
-
- bool hasSchema() const;
- bool hasTemplates() const;
- bool hasTemplate(rtl::OUString const & _aTemplateName) const;
-
- rtl::OUString getTemplateAccessor (backenduno::TemplateIdentifier const & _aTemplateName) const;
-
- ISubtree const * getSchemaTree() const { return m_pSchemaTree.get(); }
- ISubtree const * getTemplatesTree() const { return m_pTemplatesTree.get(); }
- ISubtree const * findTemplate(rtl::OUString const & _aTemplateName) const;
-
- ISubtree * getSchemaTree() { return m_pSchemaTree.get(); }
- ISubtree * getTemplatesTree() { return m_pTemplatesTree.get(); }
-
- std::auto_ptr<INode> instantiateTemplate(rtl::OUString const & _aName, rtl::OUString const & _aTemplateName) const;
-
- void clear();
-
- ISubtree * setSchemaRoot(std::auto_ptr<ISubtree> _aSchemaRoot);
- ISubtree * addTemplate(std::auto_ptr<ISubtree> _aNode, backenduno::TemplateIdentifier const & aTemplate);
- void setTemplatesTree(std::auto_ptr<ISubtree> _aTemplateTree);
-
- std::auto_ptr<ISubtree> extractSchemaTree();
- std::auto_ptr<ISubtree> extractTemplatesTree();
- std::auto_ptr<INode> extractTemplateNode(rtl::OUString const & _aTemplateName);
- private:
- std::auto_ptr<ISubtree> m_pSchemaTree;
- std::auto_ptr<ISubtree> m_pTemplatesTree;
-
- };
-// -----------------------------------------------------------------------------
-
- } // namespace backend
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/multistratumbackend.cxx b/configmgr/source/backend/multistratumbackend.cxx
deleted file mode 100644
index 79f1b50b72cc..000000000000
--- a/configmgr/source/backend/multistratumbackend.cxx
+++ /dev/null
@@ -1,931 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "multistratumbackend.hxx"
-
-#ifndef CONFIGMGR_API_FACTORY_HXX_
-#include "confapifactory.hxx"
-#endif // CONFIGMGR_API_FACTORY_HXX_
-#include "serviceinfohelper.hxx"
-#include "backendstratalistener.hxx"
-
-#ifndef _CONFIGMGR_BOOTSTRAP_HXX
-#include "bootstrap.hxx"
-#endif
-#include "simpleinteractionrequest.hxx"
-#include "configinteractionhandler.hxx"
-#include <com/sun/star/configuration/backend/XMultiLayerStratum.hpp>
-#include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp>
-#include <com/sun/star/configuration/backend/StratumCreationException.hpp>
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
-#include <rtl/ustrbuf.hxx>
-
-#include <cppuhelper/exc_hlp.hxx>
-
-#include <stdio.h>
-
-//==============================================================================
-#define OU2A(rtlOUString) (::rtl::OUStringToOString((rtlOUString), RTL_TEXTENCODING_ASCII_US).getStr())
-//==============================================================================
-
-namespace {
-
-namespace css = com::sun::star;
-
-}
-
-namespace configmgr { namespace backend {
-
-//==============================================================================
-static const rtl::OUString kSchemaServiceParam(
- RTL_CONSTASCII_USTRINGPARAM( CONTEXT_ITEM_PREFIX_ "SchemaSupplier"));
-
-static const rtl::OUString kStrataServiceParam(
- RTL_CONSTASCII_USTRINGPARAM( CONTEXT_ITEM_PREFIX_ "Strata"));
-
-static const rtl::OUString kEntity(
- RTL_CONSTASCII_USTRINGPARAM(CONTEXT_ITEM_PREFIX_"EntityLayer")) ;
-
-static const rtl::OUString kAdminModeFlag(
- RTL_CONSTASCII_USTRINGPARAM(CONTEXT_ITEM_ADMINFLAG)) ;
-
-static const rtl::OUString kThisOwnerEntity(
- RTL_CONSTASCII_USTRINGPARAM("<ThisOwnerEntity>")) ;
-
-//------------------------------------------------------------------------------
-bool checkOptionalArg(rtl::OUString& aArg)
- {
- if (aArg.getLength() && aArg[0] == sal_Unicode('?'))
- {
- aArg = aArg.copy(1);
- return true;
- }
- else
- {
- return false;
- }
- }
-//------------------------------------------------------------------------------
-void parseStrataInfo(const rtl::OUString aServiceList,
- std::vector< std::pair<rtl::OUString, rtl::OUString> >& aServiceInfoList,
- const uno::Reference<uno::XInterface>& pContext)
-{
- sal_Int32 nNextToken =0;
- sal_Int32 nLength = aServiceList.getLength();
-
- do
- {
- rtl::OUString aServiceName =aServiceList.getToken(0, ':',nNextToken);
- if((nNextToken ==-1)||(aServiceName.getLength()==0))
- {
- throw backenduno::BackendSetupException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "Malformed Strata Service specified")),
- pContext, uno::Any()) ;
- }
- rtl::OUString aServiceData = aServiceList.getToken(0, ';',nNextToken);
-
- std::pair<rtl::OUString, rtl::OUString> aServiceInfo(aServiceName,aServiceData);
- aServiceInfoList.push_back(aServiceInfo);
- }
- while (nNextToken >= 0 && nNextToken < nLength ) ;
-}
-//------------------------------------------------------------------------------
-MultiStratumBackend::MultiStratumBackend(
- const uno::Reference<uno::XComponentContext>& xContext)
- : cppu::WeakComponentImplHelper7< backenduno::XBackend, backenduno::XBackendEntities, backenduno::XVersionedSchemaSupplier, backenduno::XBackendChangesNotifier, backenduno::XBackendChangesListener, lang::XInitialization, lang::XServiceInfo >(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY_THROW)
- ,mListenerList()
-{
-
-}
-//------------------------------------------------------------------------------
-
-MultiStratumBackend::~MultiStratumBackend()
-{
-}
-//------------------------------------------------------------------------------
-bool MultiStratumBackend::checkOkState()
-{
- if (!mSchemaSupplier.is())
- {
- if(rBHelper.bDisposed)
- {
- throw lang::DisposedException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "MultiStratumBackend: Backends already disposed")),*this);
- }
- else
- {
- throw uno::RuntimeException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "MultiStratumBackend: Object was never Initialised")),*this);
- }
- }
- return true;
-}
-//------------------------------------------------------------------------------
-
-void SAL_CALL MultiStratumBackend::initialize(
- const uno::Sequence<uno::Any>& aParameters)
- throw (uno::RuntimeException, uno::Exception,
- css::configuration::InvalidBootstrapFileException,
- backenduno::BackendSetupException) {
-
- if (aParameters.getLength() == 0) {
- throw lang::IllegalArgumentException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "No parameters provided to MultiStratumBackend")),
- *this, 0) ;
- }
-
- uno::Reference<uno::XComponentContext> context ;
-
- for (sal_Int32 i = 0 ; i < aParameters.getLength() ; ++ i) {
- if (aParameters [i] >>= context) { break ; }
- }
-
-
- try
- {
- //Initialize Backends
- initializeSchemaSupplier (context);
- initializeBackendStrata(context);
-
- sal_Bool bAdminMode = false;
- context->getValueByName(kAdminModeFlag) >>= bAdminMode;
-
- if (bAdminMode)
- {
- // find given entity
- rtl::OUString sDefaultEntity;
- if ( (context->getValueByName(kEntity) >>= sDefaultEntity) && sDefaultEntity.getLength() )
- {
- for (sal_uInt32 i = 0; i < mBackendStrata.size(); i++)
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( mBackendStrata[i], uno::UNO_QUERY );
- if (xEntities.is()&& xEntities->supportsEntity(sDefaultEntity))
- {
- mBackendStrata.resize(i+1);
- mOwnerEntity = sDefaultEntity;
- break;
- }
- }
- }
- else
- {
- mBackendStrata.resize(1);
- }
- }
-
- if(mOwnerEntity.getLength()==0)
- {
- uno::Reference< backenduno::XBackendEntities > xEntities(
- mBackendStrata[mBackendStrata.size()-1], uno::UNO_QUERY );
- if (xEntities.is())
- {
- mOwnerEntity = xEntities->getOwnerEntity();
- }
- else
- {
- mOwnerEntity = kThisOwnerEntity;
- }
- }
- mStrataListener = new BackendStrataListener(*this);
-
- }
- catch(uno::Exception& )
- {
- mSchemaSupplier.clear();
- mBackendStrata.clear() ;
-
- throw;
- }
-
-}
-//------------------------------------------------------------------------------
-void MultiStratumBackend::initializeSchemaSupplier(const uno::Reference<uno::XComponentContext>& aContext)
-{
-
- rtl::OUString aServiceName;
-
- aContext->getValueByName(kSchemaServiceParam) >>= aServiceName;
- uno::Sequence< uno::Any > aInitArgs( 1 );
- aInitArgs[0] <<= aContext;
- mSchemaSupplier = uno::Reference<backenduno::XSchemaSupplier>::query(mFactory->createInstanceWithArguments(aServiceName,aInitArgs)) ;
- if (!mSchemaSupplier.is())
- {
- throw backenduno::BackendSetupException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "MultiStratumBackend: Could not create Schema Supplier service")),
- *this, uno::Any()) ;
-
- }
-}
-//------------------------------------------------------------------------------
-static
-bool approveRecovery(const backenduno::StratumCreationException & aError)
-{
- sal_uInt32 const k_supported_choices = apihelper::CONTINUATION_APPROVE ; //| apihelper::CONTINUATION_DISAPPROVE;
-
- sal_uInt32 chosen = apihelper::CONTINUATION_UNKNOWN;
-
- apihelper::ConfigurationInteractionHandler handler;
- try {
- uno::Reference< css::task::XInteractionHandler > h(handler.get());
- if (h.is()) {
- rtl::Reference< apihelper::SimpleInteractionRequest > req(
- new apihelper::SimpleInteractionRequest(
- uno::makeAny(aError), k_supported_choices));
- h->handle(req.get());
- chosen = req->getResponse();
- }
- } catch (uno::Exception & e) {
- OSL_TRACE("Warning - Configuration: Interaction handler failed: [%s]\n", OU2A(e.Message));
- }
-
- switch (chosen)
- {
- case apihelper::CONTINUATION_APPROVE: return true;
- case apihelper::CONTINUATION_DISAPPROVE: return false;
- case apihelper::CONTINUATION_UNKNOWN: break;
-
- default: OSL_ENSURE(false,"Unsolicited continuation chosen"); break;
- }
- // no choice available - default: disapprove
- return false;
-}
-//------------------------------------------------------------------------------
-void MultiStratumBackend::initializeBackendStrata(const uno::Reference<uno::XComponentContext>& aContext)
-{
-
- rtl::OUString sStrata;
- //Get Strata
- aContext->getValueByName(kStrataServiceParam) >>= sStrata;
- if(sStrata.getLength()==0)
- {
- throw backenduno::BackendSetupException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "MultiStratumBackend: No Strata Services Specified")),
- *this, uno::Any()) ;
-
- }
-
- //need to parse the Strata to extract service names and data location
- std::vector< std::pair<rtl::OUString, rtl::OUString> > aServiceInfoList;
- parseStrataInfo(sStrata,aServiceInfoList,*this);
-
- for (std::vector< std::pair<rtl::OUString, rtl::OUString> >::const_iterator it = aServiceInfoList.begin(); it != aServiceInfoList.end(); ++it)
- {
- uno::Sequence< uno::Any > aInitArgs( 1 );
- rtl::OUString sServiceName = it->first;
- const rtl::OUString& sServiceData = it->second;
- aInitArgs[0] <<= sServiceData;
- uno::Reference <uno::XInterface> xBackend;
- bool bOptional = checkOptionalArg(sServiceName);
-
- try
- {
- xBackend= mFactory->createInstanceWithArguments(sServiceName,aInitArgs);
- }
- catch (uno::Exception& exception)
- {
- if(!bOptional)
- {
- static const sal_Char sErrContext[] = "MultiStratumBackend: Could not create Backend Stratum Service: ";
- rtl::OUString const sContext(RTL_CONSTASCII_USTRINGPARAM(sErrContext));
- rtl::OUString const sMessage = sContext.concat(exception.Message);
-
- backenduno::StratumCreationException error(sMessage,*this,
- ::cppu::getCaughtException(),
- sServiceName,sServiceData);
- if (!approveRecovery(error))
- throw error;
- }
-
- }
- if (xBackend.is())
- {
- mBackendStrata.push_back(xBackend) ;
- }
- }
-}
-//---------------------------------------------------------------------------------------------
-// XBackendEntities
-rtl::OUString SAL_CALL
- MultiStratumBackend::getOwnerEntity( )
- throw (uno::RuntimeException)
-{
-
- if (checkOkState())
- {
- return mOwnerEntity;
- }
- return rtl::OUString();
-}
-//------------------------------------------------------------------------------
-
-rtl::OUString SAL_CALL
- MultiStratumBackend::getAdminEntity()
- throw (uno::RuntimeException)
-{
- osl::MutexGuard aGuard(mMutex);
- if (checkOkState())
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( mBackendStrata[0], uno::UNO_QUERY );
- if(xEntities.is())
- {
- return xEntities->getAdminEntity();
- }
- else
- {
- return rtl::OUString();
- }
- }
- return rtl::OUString();
-}
-//------------------------------------------------------------------------------
-
-sal_Bool SAL_CALL
- MultiStratumBackend::supportsEntity( const rtl::OUString& aEntity )
- throw (backenduno::BackendAccessException, uno::RuntimeException)
-{
-
- osl::MutexGuard aGuard(mMutex);
- if (checkOkState())
- {
- for (std::vector< uno::Reference <uno::XInterface> >::const_iterator it = mBackendStrata.begin(); it != mBackendStrata.end(); ++it)
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( *it, uno::UNO_QUERY );
- if (xEntities.is())
- {
- if( xEntities->supportsEntity(aEntity))
- return true;
- }
- }
- return false;
- }
- return false;
-}
-//------------------------------------------------------------------------------
-
-sal_Bool SAL_CALL
- MultiStratumBackend::isEqualEntity( const rtl::OUString& aEntity, const rtl::OUString& aOtherEntity )
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- osl::MutexGuard aGuard(mMutex);
- if (aEntity.getLength() == 0)
- {
- rtl::OUString const sMsg(RTL_CONSTASCII_USTRINGPARAM(
- "LocalSingleBackend - Invalid empty entity."));
-
- throw lang::IllegalArgumentException(sMsg, *this, 1);
- }
- if (aOtherEntity.getLength() == 0)
- {
- rtl::OUString const sMsg(RTL_CONSTASCII_USTRINGPARAM(
- "LocalSingleBackend - Invalid empty entity."));
-
- throw lang::IllegalArgumentException(sMsg, *this, 2);
- }
-
-
- if (aEntity.equals(aOtherEntity))
- {
- return true;
- }
-
- if (checkOkState())
- {
- for (std::vector< uno::Reference <uno::XInterface> >::const_iterator it = mBackendStrata.begin(); it != mBackendStrata.end(); ++it)
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( *it, uno::UNO_QUERY );
- if (xEntities.is())
- {
- if( xEntities->supportsEntity(aEntity))
- return xEntities->isEqualEntity(aEntity,aOtherEntity);
- }
- }
- return false;
- }
- return false;
-}
-//------------------------------------------------------------------------------
-
-rtl::OUString SAL_CALL
- MultiStratumBackend::getSchemaVersion(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- osl::MutexGuard aGuard(mMutex);
-
- if (checkOkState())
- {
- uno::Reference<backenduno::XVersionedSchemaSupplier> xVersionSupplier(mSchemaSupplier,uno::UNO_QUERY);
- if (xVersionSupplier.is())
- return xVersionSupplier->getSchemaVersion(aComponent) ;
- }
- return rtl::OUString();
-}
-//------------------------------------------------------------------------------
-
-uno::Reference<backenduno::XSchema> SAL_CALL
- MultiStratumBackend::getComponentSchema(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- osl::MutexGuard aGuard(mMutex);
-
- if (checkOkState())
- {
- return mSchemaSupplier->getComponentSchema(aComponent) ;
- }
- return NULL;
-}
-//------------------------------------------------------------------------------
-
-uno::Sequence<uno::Reference<backenduno::XLayer> > SAL_CALL
- MultiStratumBackend::listOwnLayers(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- if (checkOkState())
- {
- return listLayers(aComponent, mOwnerEntity ) ;
- }
- return uno::Sequence<uno::Reference<backenduno::XLayer> >() ;
-}
-//------------------------------------------------------------------------------
-
-uno::Reference<backenduno::XUpdateHandler> SAL_CALL
- MultiStratumBackend::getOwnUpdateHandler(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::NoSupportException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- if (checkOkState())
- {
- return getUpdateHandler(aComponent, mOwnerEntity) ;
- }
- return NULL;
-}
-//------------------------------------------------------------------------------
-
-uno::Sequence<uno::Reference<backenduno::XLayer> > SAL_CALL
- MultiStratumBackend::listLayers(const rtl::OUString& aComponent,
- const rtl::OUString& aEntity)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
-
- osl::MutexGuard aGuard(mMutex);
- if (checkOkState())
- {
- sal_Int32 nNumSupportedLayers = mBackendStrata.size();
- if(aEntity != mOwnerEntity)
- {
- nNumSupportedLayers = findSupportingStratum(aEntity);
- }
- return searchSupportingStrata(nNumSupportedLayers,aEntity,aComponent);
- }
- return uno::Sequence<uno::Reference<backenduno::XLayer> >();
-}
-//------------------------------------------------------------------------------
-sal_Int32 MultiStratumBackend::findSupportingStratum(const rtl::OUString& aEntity)
-{
- sal_Int32 nNumLayers = mBackendStrata.size();
- for (std::vector< uno::Reference <uno::XInterface> >::reverse_iterator it = mBackendStrata.rbegin(); it != mBackendStrata.rend(); ++it)
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( *it, uno::UNO_QUERY );
- if (xEntities.is())
- {
- if( xEntities->supportsEntity(aEntity))
- {
- return nNumLayers;
- }
- }
- nNumLayers--;
- }
- rtl::OUStringBuffer sMsg;
- sMsg.appendAscii("\n MultiStratumBackend: No Backend supports Entity: \"");
- sMsg.append(aEntity);
- throw lang::IllegalArgumentException(sMsg.makeStringAndClear(),
- *this, 0) ;
-}
-//------------------------------------------------------------------------------
-uno::Sequence<uno::Reference<backenduno::XLayer> >
- MultiStratumBackend::searchSupportingStrata(sal_Int32 nNumLayers,
- rtl::OUString aEntity,
- const rtl::OUString& aComponent)
-{
- uno::Sequence<uno::Reference<backenduno::XLayer> > aLayers;
- std::vector<uno::Reference<backenduno::XLayer> > aBackendLayers;
- for (sal_Int32 i = 0 ; i < nNumLayers ; ++ i)
- {
- uno::Sequence<uno::Reference<backenduno::XLayer> > aMultiLayers;
- uno::Reference< backenduno::XBackendEntities > xEntities(mBackendStrata[i], uno::UNO_QUERY );
-
- uno::Reference<backenduno::XBackend> xBackend(mBackendStrata[i], uno::UNO_QUERY) ;
- if (xBackend.is())
- {
- if (xEntities.is())
- {
- if( !xEntities->supportsEntity(aEntity))
- {
- aEntity = xEntities->getOwnerEntity();
- }
- aMultiLayers = xBackend->listLayers(aComponent, aEntity) ;
- }
- else
- {
- aMultiLayers = xBackend->listOwnLayers(aComponent);
- }
- }
- else
- {
- uno::Reference<backenduno::XMultiLayerStratum> xMultiLayerStratum(
- mBackendStrata[i], uno::UNO_QUERY) ;
-
- if (xMultiLayerStratum.is())
- {
- if (xEntities.is())
- {
- if( !xEntities->supportsEntity(aEntity))
- {
- aEntity = xEntities->getOwnerEntity();
- }
- aMultiLayers = xMultiLayerStratum->getLayers(
- xMultiLayerStratum->listLayerIds(aComponent, aEntity),
- rtl::OUString()) ;
-
- }
- else
- {
- throw backenduno::BackendSetupException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "MultiStratumBackend: XMultiLayerStratum must support XBackendEntities")),
- *this, uno::Any()) ;
- }
-
- }
- else
- {
- uno::Reference<backenduno::XSingleLayerStratum> xSingleLayerStratum(
- mBackendStrata[i], uno::UNO_REF_QUERY_THROW) ;
- if (xSingleLayerStratum.is())
- {
- uno::Reference<backenduno::XLayer> xLayer = xSingleLayerStratum->getLayer( aComponent, rtl::OUString());
- //Could be an empty layer
- if (xLayer.is())
- {
- aBackendLayers.push_back(xLayer);
- }
- }
- }
- }
- // There might be non-existent layers in the list if there's no
- // actual data associated to a given layer id. Hence we have to
- // compress the list.
- for (sal_Int32 j = 0 ; j < aMultiLayers.getLength() ; ++j)
- {
- if (aMultiLayers [j].is())
- {
- aBackendLayers.push_back( aMultiLayers[j]);
- }
- }
- }
- aLayers.realloc(aBackendLayers.size());
- for (sal_uInt32 k =0; k < aBackendLayers.size();k++)
- {
- aLayers[k] = aBackendLayers[k];
- }
- return aLayers;
-}
-//------------------------------------------------------------------------------
-uno::Reference<backenduno::XUpdateHandler> SAL_CALL
- MultiStratumBackend::getUpdateHandler(const rtl::OUString& aComponent,
- const rtl::OUString& aEntity)
- throw (backenduno::BackendAccessException,
- lang::NoSupportException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- osl::MutexGuard aGuard(mMutex);
-
- if (checkOkState())
- {
-
- sal_Int32 nNumSupportedLayers = mBackendStrata.size();
- rtl::OUString aUsedEntity;
-
- if(aEntity != mOwnerEntity)
- {
- nNumSupportedLayers = findSupportingStratum(aEntity);
- aUsedEntity = aEntity;
- }
- else
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( mBackendStrata[mBackendStrata.size()-1], uno::UNO_QUERY );
- if (xEntities.is())
- {
- aUsedEntity = xEntities->getOwnerEntity();
- }
- }
- sal_Int32 nStrataIndex = nNumSupportedLayers -1;
-
- uno::Reference<backenduno::XBackend> xBackend(
- mBackendStrata[nStrataIndex], uno::UNO_QUERY) ;
- uno::Reference< uno::XInterface > xHandler;
- if(xBackend.is())
- {
- if (aUsedEntity.getLength()==0)
- {
- xHandler = xBackend->getOwnUpdateHandler(aComponent) ;
- return uno::Reference<backenduno::XUpdateHandler>(xHandler,uno::UNO_REF_QUERY_THROW);
- }
- else
- {
- xHandler = xBackend->getUpdateHandler(aComponent, aUsedEntity) ;
- return uno::Reference<backenduno::XUpdateHandler>(xHandler,uno::UNO_REF_QUERY_THROW);
- }
- }
- else
- {
-
- uno::Sequence<uno::Any> arguments(1) ;
-
- uno::Reference< backenduno::XMultiLayerStratum > xMultiLayerStratum
- (mBackendStrata[nStrataIndex], uno::UNO_QUERY );
- if(xMultiLayerStratum.is())
- {
- arguments [0] <<= xMultiLayerStratum->getUpdatableLayer(
- xMultiLayerStratum->getUpdateLayerId(aComponent,aUsedEntity));
- }
- else
- {
- uno::Reference< backenduno::XSingleLayerStratum > xSingleLayerStratum(
- mBackendStrata[nStrataIndex], uno::UNO_REF_QUERY_THROW );
-
- arguments [0] <<= xSingleLayerStratum->getUpdatableLayer(aComponent);
-
- }
-
- if(!xHandler.is())
- {
- try
- {
- const rtl::OUString kUpdateMerger(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.backend.LayerUpdateMerger")) ;
-
-
- if(!mFactory.is())
- {
- throw lang::DisposedException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "MultiStratumBackend: Service Factory already dispoed")),*this);
- }
-
- xHandler = mFactory->createInstanceWithArguments(kUpdateMerger, arguments);
- }
- catch (uno::RuntimeException & )
- {throw;}
- catch (uno::Exception & e)
- {
- const rtl::OUString sMessage(RTL_CONSTASCII_USTRINGPARAM(
- "Configuration MultiStratumBackend: Cannot create UpdateMerger - error message: ")) ;
- throw uno::RuntimeException(sMessage.concat(e.Message),*this);
- }
- }
- return uno::Reference<backenduno::XUpdateHandler>(xHandler, uno::UNO_REF_QUERY_THROW) ;
- }
- }
- return NULL;
-}
-// ---------------------------------------------------------------------------
-// ComponentHelper
-void SAL_CALL MultiStratumBackend::disposing()
-{
- osl::MutexGuard aGuard(mMutex);
- if (mFactory.is())
- {
- mFactory.clear();
- }
- if (mSchemaSupplier.is())
- {
- uno::Reference< lang::XComponent> xComp( mSchemaSupplier, uno::UNO_QUERY);
- if (xComp.is())
- {
- xComp->dispose();
- }
- if (mSchemaSupplier.is())
- {
- mSchemaSupplier.clear();
- }
- }
- if (!mBackendStrata.empty())
- {
- for (std::vector< uno::Reference <uno::XInterface> >::const_iterator it = mBackendStrata.begin(); it != mBackendStrata.end(); ++it)
- {
- uno::Reference< lang::XComponent> xComp( *it, uno::UNO_QUERY );
- if (xComp.is())
- {
- try
- {
- xComp->dispose();
- }
- catch(uno::Exception &){}
- }
- }
- mBackendStrata.clear();
-
- }
-
- }
-//------------------------------------------------------------------------------
-
-static const sal_Char * const kBackendService = "com.sun.star.configuration.backend.Backend" ;
-
-static const sal_Char * const kImplementation =
- "com.sun.star.comp.configuration.backend.MultiStratumBackend" ;
-
-static sal_Char const * const kServiceNames [] =
-{
- kBackendService,
- 0
-} ;
-static const ServiceImplementationInfo kServiceInfo =
-{
- kImplementation,
- kServiceNames,
- 0
-} ;
-
-const ServiceRegistrationInfo *getMultiStratumBackendServiceInfo()
-{
- return getRegistrationInfo(&kServiceInfo) ;
-}
-
-uno::Reference<uno::XInterface> SAL_CALL
- instantiateMultiStratumBackend(const uno::Reference< uno::XComponentContext >& xContext)
-{
- return *new MultiStratumBackend(xContext) ;
-}
-//------------------------------------------------------------------------------
-
-static const rtl::OUString kImplementationName(
- RTL_CONSTASCII_USTRINGPARAM(kImplementation)) ;
-//------------------------------------------------------------------------------
-
-rtl::OUString SAL_CALL
- MultiStratumBackend::getImplementationName(void)
- throw (uno::RuntimeException)
-{
- return ServiceInfoHelper(&kServiceInfo).getImplementationName() ;
-}
-//------------------------------------------------------------------------------
-
-sal_Bool SAL_CALL
- MultiStratumBackend::supportsService(const rtl::OUString& aServiceName)
- throw (uno::RuntimeException)
-{
- return ServiceInfoHelper(&kServiceInfo).supportsService(aServiceName) ;
-}
-//------------------------------------------------------------------------------
-uno::Sequence<rtl::OUString> SAL_CALL
- MultiStratumBackend::getSupportedServiceNames(void)
- throw (uno::RuntimeException)
-{
- return ServiceInfoHelper(&kServiceInfo).getSupportedServiceNames() ;
-}
-//------------------------------------------------------------------------------
-void SAL_CALL MultiStratumBackend::addChangesListener( const uno::Reference<backenduno::XBackendChangesListener>& xListener,
- const rtl::OUString& aComponent)
- throw (::com::sun::star::uno::RuntimeException)
-{
- osl::MutexGuard aGuard(mMutex);
- if(checkOkState())
- {
-
- mListenerList.insert( ListenerList::value_type(aComponent, xListener));
- //Now register with lower layers
- for (sal_uInt32 i = 0 ; i < mBackendStrata.size() ; ++ i)
- {
- uno::Reference<backenduno::XBackendChangesNotifier> xBackend(mBackendStrata[i], uno::UNO_QUERY) ;
- if (xBackend.is())
- {
- xBackend->addChangesListener(mStrataListener, aComponent);
- }
- }
- }
-}
-//------------------------------------------------------------------------------
-void SAL_CALL MultiStratumBackend::removeChangesListener( const uno::Reference<backenduno::XBackendChangesListener>& /*xListner*/,
- const rtl::OUString& aComponent)
- throw (::com::sun::star::uno::RuntimeException)
-{
- osl::MutexGuard aGuard(mMutex);
- if(checkOkState())
- {
- sal_Int32 nCount = mListenerList.count(aComponent);
- if (nCount == 0)
- {
- OSL_TRACE("MultiStratumBackend: removeListener: no listener registered for component %s"
- , aComponent.getStr());
- }
- else
- {
- ListenerList::iterator aIter;
- aIter = mListenerList.find(aComponent);
- mListenerList.erase(aIter);
- if (nCount == 1)
- {
- //Deregister Listener from strata backend if they support notification
- for (sal_uInt32 i = 0 ; i < mBackendStrata.size(); ++ i)
- {
- uno::Reference<backenduno::XBackendChangesNotifier> xBackend(mBackendStrata[i], uno::UNO_QUERY) ;
- if (xBackend.is())
- {
- xBackend->removeChangesListener(mStrataListener, aComponent);
- }
- }
- }
- }
- }
-}
-//------------------------------------------------------------------------------
-void MultiStratumBackend::componentDataChanged(const backenduno::ComponentChangeEvent& aEvent)
- throw (::com::sun::star::uno::RuntimeException)
-{
- try
- {
- notifyListeners( aEvent);
-
- }
- catch (uno::RuntimeException& ) { throw; }
- catch (uno::Exception& e)
- {
- throw lang::WrappedTargetRuntimeException(e.Message, *this, uno::makeAny(e));
- }
-}
-//------------------------------------------------------------------------------
-void MultiStratumBackend::disposing( lang::EventObject const & /*rSource*/ )
- throw (::com::sun::star::uno::RuntimeException)
-{}
-//------------------------------------------------------------------------------
-void MultiStratumBackend::notifyListeners(const backenduno::ComponentChangeEvent& aEvent)const
-{
- //fire off notification to all registered listeners for specific Component
- ListenerList::const_iterator aIter;
- rtl::OUString aComponentName = aEvent.Component;
- if (mListenerList.empty())
- {
- OSL_TRACE("MultiStratumBackend: notifyListeners: no listeners registered for component %s",
- aComponentName.getStr());
- }
- else
- {
- aIter = mListenerList.begin();
- do{
- if (aIter->first == aComponentName)
- {
- aIter->second->componentDataChanged(aEvent);
- }
- aIter++;
- }while (aIter != mListenerList.end());
- }
- }
-//------------------------------------------------------------------------------
-} } // configmgr.backend
-
diff --git a/configmgr/source/backend/multistratumbackend.hxx b/configmgr/source/backend/multistratumbackend.hxx
deleted file mode 100644
index b7bb53e3a8e8..000000000000
--- a/configmgr/source/backend/multistratumbackend.hxx
+++ /dev/null
@@ -1,219 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_MULTISTRATUMBACKEND_HXX_
-#define CONFIGMGR_BACKEND_MULTISTRATUMBACKEND_HXX_
-
-#include <com/sun/star/configuration/backend/XBackend.hpp>
-#include <com/sun/star/configuration/backend/XBackendEntities.hpp>
-#include <com/sun/star/configuration/backend/XVersionedSchemaSupplier.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/configuration/InvalidBootstrapFileException.hpp>
-#include <com/sun/star/configuration/backend/BackendSetupException.hpp>
-#include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
-#include <com/sun/star/configuration/backend/XBackendChangesListener.hpp>
-#include <cppuhelper/compbase7.hxx>
-
-#ifndef INCLUDED_MAP
-#include <map>
-#define INCLUDED_MAP
-#endif
-
-namespace configmgr { namespace backend {
-
-namespace css = com::sun::star ;
-namespace uno = css::uno ;
-namespace lang = css::lang ;
-namespace backenduno = css::configuration::backend ;
-
-/**
- Class implementing the Backend service for multibackend access.
- It creates the required backends and coordinates access to them.
- */
-class MultiStratumBackend : public cppu::WeakComponentImplHelper7< backenduno::XBackend, backenduno::XBackendEntities, backenduno::XVersionedSchemaSupplier, backenduno::XBackendChangesNotifier, backenduno::XBackendChangesListener, lang::XInitialization, lang::XServiceInfo > {
- public :
- /**
- Service constructor from a service factory.
-
- @param xContext component context
- */
- explicit
- MultiStratumBackend(
- const uno::Reference<uno::XComponentContext>& xContext) ;
- /** Destructor */
- ~MultiStratumBackend() ;
-
- // XInitialize
- virtual void SAL_CALL initialize(
- const uno::Sequence<uno::Any>& aParameters)
- throw (uno::RuntimeException, uno::Exception,
- css::configuration::InvalidBootstrapFileException,
- backenduno::BackendSetupException) ;
-
- // XVersionedSchemaSupplier
- virtual rtl::OUString
- SAL_CALL getSchemaVersion(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException) ;
-
- // XSchemaSupplier
- virtual uno::Reference<backenduno::XSchema>
- SAL_CALL getComponentSchema(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException) ;
-
- // XBackend
- virtual uno::Sequence<uno::Reference<backenduno::XLayer> >
- SAL_CALL listOwnLayers(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException) ;
-
- virtual uno::Reference<backenduno::XUpdateHandler>
- SAL_CALL getOwnUpdateHandler(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- lang::NoSupportException,
- uno::RuntimeException) ;
- virtual uno::Sequence<uno::Reference<backenduno::XLayer> > SAL_CALL
- listLayers(const rtl::OUString& aComponent,
- const rtl::OUString& aEntity)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException) ;
- virtual uno::Reference<backenduno::XUpdateHandler> SAL_CALL
- getUpdateHandler(const rtl::OUString& aComponent,
- const rtl::OUString& aEntity)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- lang::NoSupportException,
- uno::RuntimeException) ;
-
- // XBackendEntities
- virtual rtl::OUString SAL_CALL
- getOwnerEntity( )
- throw (uno::RuntimeException);
-
- virtual rtl::OUString SAL_CALL
- getAdminEntity( )
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- supportsEntity( const rtl::OUString& aEntity )
- throw (backenduno::BackendAccessException, uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- isEqualEntity( const rtl::OUString& aEntity, const rtl::OUString& aOtherEntity )
- throw ( backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException);
-
- // XServiceInfo
- virtual rtl::OUString SAL_CALL getImplementationName()
- throw (uno::RuntimeException) ;
- virtual sal_Bool SAL_CALL supportsService(
- const rtl::OUString& aServiceName)
- throw (uno::RuntimeException) ;
- virtual uno::Sequence<rtl::OUString> SAL_CALL
- getSupportedServiceNames(void) throw (uno::RuntimeException) ;
-
- // XBackendChangesNotifier
- virtual void SAL_CALL addChangesListener( const uno::Reference<backenduno::XBackendChangesListener>& xListner,
- const rtl::OUString& aComponent)
- throw (::com::sun::star::uno::RuntimeException);
-
-
- virtual void SAL_CALL removeChangesListener( const uno::Reference<backenduno::XBackendChangesListener>& xListner,
- const rtl::OUString& aComponent)
- throw (::com::sun::star::uno::RuntimeException);
-
- // XBackendChangesListener
- virtual void SAL_CALL componentDataChanged(const backenduno::ComponentChangeEvent& aEvent)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL disposing( lang::EventObject const & rSource )
- throw (uno::RuntimeException);
-
- void notifyListeners(const backenduno::ComponentChangeEvent& aEvent) const;
- protected:
- // ComponentHelper
- virtual void SAL_CALL disposing();
- private :
- /** Initialize the schema supplier backend
-
- */
- void initializeSchemaSupplier(const uno::Reference<uno::XComponentContext>& aContext);
-
- /** Initialize strata(SingleLayer or MultiLayer) backend
- */
- void initializeBackendStrata(const uno::Reference<uno::XComponentContext>& aContext);
-
- /** Get Layers from Backend Strata
- */
- uno::Sequence<uno::Reference<backenduno::XLayer> >
- searchSupportingStrata(sal_Int32 nNumLayer,
- rtl::OUString aEntity,
- const rtl::OUString& aComponent) ;
-
-
- /** Find the Stratum that supports the specified Entity
- * @return Number of Supported Strata
- */
- sal_Int32 findSupportingStratum(const rtl::OUString& aEntity) ;
-
-
- /**
- Check state of MultiStratumBackend -
- @return true if not disposed/uninitialized
- */
- bool checkOkState();
- /** Service factory */
- uno::Reference<lang::XMultiServiceFactory> mFactory ;
- /** Mutex for resource protection */
- osl::Mutex mMutex ;
-
- uno::Reference<backenduno::XSchemaSupplier> mSchemaSupplier ;
- /** list of all backends */
- std::vector< uno::Reference <uno::XInterface> > mBackendStrata;
-
- rtl::OUString mOwnerEntity;
-
- /** Helper object that listens to the Strata Backends */
- uno::Reference<backenduno::XBackendChangesListener> mStrataListener;
- /** List of higher level listeners */
- typedef std::multimap< rtl::OUString, uno::Reference<backenduno::XBackendChangesListener> > ListenerList;
- ListenerList mListenerList;
-} ;
-
-} } // configmgr.backend
-
-#endif // CONFIGMGR_BACKEND_MULTISTRATUMBACKEND_HXX_
diff --git a/configmgr/source/backend/schemabuilder.cxx b/configmgr/source/backend/schemabuilder.cxx
deleted file mode 100644
index 8059aca9eecb..000000000000
--- a/configmgr/source/backend/schemabuilder.cxx
+++ /dev/null
@@ -1,536 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "schemabuilder.hxx"
-#include "treenodefactory.hxx"
-#include "matchlocale.hxx"
-#include <com/sun/star/configuration/backend/SchemaAttribute.hpp>
-#include <rtl/ustrbuf.hxx>
-
-#ifndef INCLUDED_ALGORITHM
-#include <algorithm>
-#define INCLUDED_ALGORITHM
-#endif
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
- namespace SchemaAttribute = backenduno::SchemaAttribute;
-// -----------------------------------------------------------------------------
-//#if OSL_DEBUG_LEVEL > 0
-// currently not used in debug builds
-#if 0
- static void check_if_complete(MergedComponentData & md, uno::Reference< uno::XComponentContext > const & xContext)
- {
- uno::Reference< backenduno::XSchemaHandler >
- test(new SchemaBuilder(xContext, rtl::OUString(),md,NULL));
- }
-#endif
-// -----------------------------------------------------------------------------
-
-SchemaBuilder::SchemaBuilder(uno::Reference< uno::XComponentContext > const & xContext, const rtl::OUString& aExpectedComponentName, MergedComponentData & rData, ITemplateDataProvider* aTemplateProvider )
-: m_aData(rData)
-, m_aContext(xContext)
-//, m_aContext(xContext,static_cast<backenduno::XSchemaHandler*>(this), aExpectedComponentName, aTemplateProvider )
-, m_aFactory()
-{
- m_aContext = DataBuilderContext(xContext,static_cast<backenduno::XSchemaHandler*>(this), aExpectedComponentName, aTemplateProvider );
-}
-// -----------------------------------------------------------------------------
-
-SchemaBuilder::~SchemaBuilder( )
-{
-
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// XSchemaHandler
-
-void SAL_CALL SchemaBuilder::startSchema( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!this->isDone())
- m_aContext.raiseMalformedDataException("Schema builder: Unexpected Restart of Schema");
-
- m_aData.clear();
-
- OSL_ASSERT(!m_aContext.hasActiveComponent());
- OSL_ASSERT( m_aContext.isDone());
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::endSchema( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (!this->isDone())
- m_aContext.raiseMalformedDataException("Schema builder: Unexpected End of Schema");
-
- substituteInstances();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::importComponent( const rtl::OUString& /*aName*/ )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- //OSL_TRACE("WARNING: Configuration schema parser: Cross-component references are not yet supported\n");
-}
-// -----------------------------------------------------------------------------
-
-
-void SAL_CALL SchemaBuilder::startComponent( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (m_aData.hasSchema())
- m_aContext.raiseElementExistException("Schema builder: The component schema is already loaded", rtl::OUString());
-
- m_aContext.startActiveComponent(aName);
-
- std::auto_ptr<ISubtree> apSchema =
- m_aFactory.createGroup(aName,0,getComponentRootAttributes());
-
- ISubtree * pSchema = m_aData.setSchemaRoot(apSchema);
-
- m_aContext.pushNode(pSchema);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::endComponent( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- m_aContext.popNode();
-
- m_aContext.endActiveComponent();
-}
-// -----------------------------------------------------------------------------
-
-bool SchemaBuilder::isExtensible(sal_Int16 aSchemaAttributes)
-{
- sal_Int16 const aValidAttributes = aSchemaAttributes & SchemaAttribute::EXTENSIBLE;
-
- if (aValidAttributes != aSchemaAttributes)
- m_aContext.raiseIllegalArgumentException("Schema builder: Illegal attribute specified for node.",2);
-
- return (aValidAttributes != 0);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::startGroupTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (aTemplate.Component.getLength() == 0)
- m_aContext.raiseIllegalArgumentException("Schema builder: Starting template without owning component",1);
-
- m_aContext.startActiveComponent(aTemplate.Component);
-
- if (m_aData.hasTemplate(aTemplate.Name))
- m_aContext.raiseElementExistException("Schema builder: Template already exists",aTemplate.Name);
-
- rtl::OUString aName = m_aData.getTemplateAccessor(aTemplate);
- bool bExtensible = isExtensible(aAttributes);
-
- std::auto_ptr<ISubtree> aTemplateTree =
- m_aFactory.createGroup(aName,bExtensible,getTemplateBaseAttributes());
-
- ISubtree * pTree = m_aData.addTemplate(aTemplateTree,aTemplate);
-
- m_aContext.pushNode(pTree);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::startSetTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if (aTemplate.Component.getLength() == 0)
- m_aContext.raiseIllegalArgumentException("Schema builder: Starting template without owning component",1);
-
- m_aContext.startActiveComponent(aTemplate.Component);
-
- if (m_aData.hasTemplate(aTemplate.Name))
- m_aContext.raiseElementExistException("Schema builder: Template already exists",aTemplate.Name);
-
- rtl::OUString aName = m_aData.getTemplateAccessor(aTemplate);
- backenduno::TemplateIdentifier aFullType = m_aContext.completeComponent(aItemType);
- bool bExtensible = isExtensible(aAttributes);
-
- std::auto_ptr<ISubtree> aTemplateTree =
- m_aFactory.createSet( aName,aFullType,bExtensible,getTemplateBaseAttributes());
-
- ISubtree * pTree = m_aData.addTemplate(aTemplateTree,aTemplate);
-
- m_aContext.pushNode(pTree);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::endTemplate( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- m_aContext.popNode();
-
- m_aContext.endActiveComponent();
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::startGroup( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- bool bExtensible = isExtensible(aAttributes);
-
- std::auto_ptr<ISubtree> aTree = m_aFactory.createGroup(aName,bExtensible,getNodeAttributes());
-
- ISubtree * pTree = m_aContext.addNodeToCurrent(aTree);
-
- m_aContext.pushNode(pTree);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::startSet( const rtl::OUString& aName, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- backenduno::TemplateIdentifier aFullType = m_aContext.completeComponent(aItemType);
- bool bExtensible = isExtensible(aAttributes);
-
- std::auto_ptr<ISubtree> aTree = m_aFactory.createSet(aName,aFullType,bExtensible,getNodeAttributes());
-
- ISubtree * pTree = m_aContext.addNodeToCurrent(aTree);
-
- m_aContext.pushNode(pTree);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- m_aContext.popNode();
-
- if (m_aContext.isDone())
- m_aContext.raiseMalformedDataException("Schema builder: Incorrect Termination");
-}
-// -----------------------------------------------------------------------------
-
-node::Attributes SchemaBuilder::makePropertyAttributes(sal_Int16 aSchemaAttributes) const
-{
- const sal_uInt16 c_AllPropertyAttributes =
- SchemaAttribute::REQUIRED | SchemaAttribute::LOCALIZED;
-
- if ((aSchemaAttributes & c_AllPropertyAttributes) != aSchemaAttributes)
- m_aContext.raiseIllegalArgumentException("SchemaBuilder: Unreckognized Attribute for Property",2);
-
- node::Attributes aAttributes = getNodeAttributes();
-
- if (aSchemaAttributes & SchemaAttribute::REQUIRED)
- aAttributes.setNullable (false);
-
- return aAttributes;
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- // TODO: add type validation
- node::Attributes aValueAttributes = makePropertyAttributes(aAttributes);
-
- if (aAttributes & SchemaAttribute::LOCALIZED)
- {
- std::auto_ptr<ISubtree> aLocalizedProp =
- m_aFactory.createLocalizedContainer(aName,aType,aValueAttributes);
-
- m_aContext.addLocalizedToCurrent(aLocalizedProp);
- }
- else
- {
- std::auto_ptr<ValueNode> aPropertyValue =
- m_aFactory.getNodeFactory().createNullValueNode(aName,aType,aValueAttributes);
-
- m_aContext.addPropertyToCurrent(aPropertyValue);
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::addPropertyWithDefault( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aDefaultValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- // TODO: add parameter validation
- node::Attributes aValueAttributes = makePropertyAttributes(aAttributes);
-
- if (aAttributes & SchemaAttribute::LOCALIZED)
- {
- std::auto_ptr<ISubtree> aLocalizedProp =
- m_aFactory.createLocalizedContainer(aName,aDefaultValue.getValueType(),aValueAttributes);
-
- std::auto_ptr<ValueNode> aPropertyValue =
- m_aFactory.getNodeFactory().createValueNode(localehelper::getDefaultLanguage(),aDefaultValue,aValueAttributes);
-
- aLocalizedProp->addChild( base_ptr(aPropertyValue) );
-
- m_aContext.addLocalizedToCurrent(aLocalizedProp);
- }
- else
- {
- std::auto_ptr<ValueNode> aPropertyValue =
- m_aFactory.getNodeFactory().createValueNode(aName,aDefaultValue,aValueAttributes);
-
-
- m_aContext.addPropertyToCurrent( aPropertyValue);
- }
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::addInstance( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- backenduno::TemplateIdentifier aFullType = m_aContext.completeComponent(aTemplate);
-
- std::auto_ptr<ISubtree> aPlaceHolder =
- m_aFactory.createPlaceHolder(aName,aFullType);
-
- m_aContext.addNodeToCurrent(aPlaceHolder);
-}
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SchemaBuilder::addItemType( const backenduno::TemplateIdentifier& aItemType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
-{
- if ( m_aContext.getCurrentParent().getElementTemplateName() != aItemType.Name ||
- m_aContext.getCurrentParent().getElementTemplateModule() != m_aContext.getTemplateComponent(aItemType) )
- {
- OSL_ENSURE(false, "SchemaBuilder: Multiple ItemTypes for Sets are currently not supported");
- m_aContext.raiseMalformedDataException("SchemaBuilder: Unsupported Feature: Multiple ItemTypes for Sets");
- }
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-node::Attributes SchemaBuilder::getNodeAttributes() const
-{
- node::Attributes aResult = m_aContext.getCurrentAttributes();
- aResult.setState( node::isDefault );
- return aResult;
-}
-// -----------------------------------------------------------------------------
-
-node::Attributes SchemaBuilder::getComponentRootAttributes()
-{
- node::Attributes aResult;
- aResult.setState( node::isDefault );
- return aResult;
-}
-// -----------------------------------------------------------------------------
-
-node::Attributes SchemaBuilder::getTemplateBaseAttributes()
-{
- node::Attributes aResult;
- aResult.setState( node::isReplaced );
- return aResult;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-namespace
-{
- class SubstitutionHelper : NodeModification
- {
- MergedComponentData & m_rData;
- DataBuilderContext m_aContext;
- ComponentDataFactory m_aFactory;
-
- std::vector< rtl::OUString > m_aReplacementList;
- std::vector< ISubtree const * > m_aTemplateStack;
- public:
- SubstitutionHelper(DataBuilderContext const & aBaseContext, MergedComponentData & _rData, uno::XInterface * _pContext)
- : m_rData(_rData)
- , m_aContext(aBaseContext,_pContext)
- , m_aReplacementList()
- , m_aTemplateStack()
- {}
-
- void substituteInData();
- private:
- void substituteInComponent(ISubtree * _pComponent);
- void substituteInNode(ISubtree & _rNode);
- void substituteInList();
-
- void substitute(rtl::OUString const & _aName);
-
- virtual void handle(ValueNode&);
- virtual void handle(ISubtree&);
- };
-}
-// -----------------------------------------------------------------------------
-
-void SchemaBuilder::substituteInstances()
-{
- SubstitutionHelper helper(m_aContext, m_aData, static_cast<backenduno::XSchemaHandler*>(this));
-
- helper.substituteInData();
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-namespace
-{
-// -----------------------------------------------------------------------------
- void SubstitutionHelper::substituteInData()
- {
- if (m_rData.hasTemplates())
- substituteInComponent(m_rData.getTemplatesTree());
-
- if (m_rData.hasSchema())
- substituteInComponent(m_rData.getSchemaTree());
- }
- // -----------------------------------------------------------------------------
-
- void SubstitutionHelper::substituteInComponent(ISubtree * _pComponent)
- {
- OSL_ENSURE(_pComponent,"ERROR: Trying to substitute in NULL component");
-
- if (_pComponent)
- {
- m_aContext.startActiveComponent(_pComponent->getName());
- this->substituteInNode(*_pComponent);
- m_aContext.endActiveComponent();
- }
- }
- // -----------------------------------------------------------------------------
-
- void SubstitutionHelper::substituteInNode(ISubtree & _rNode)
- {
- std::vector< rtl::OUString > aSaveInstances;
- aSaveInstances.swap(m_aReplacementList);
-
- // todo: own stack to check against infinite recursion
- m_aContext.pushNode(&_rNode);
-
- this->applyToChildren(_rNode); // fill the list
-
- this->substituteInList();
-
- m_aContext.popNode();
-
- aSaveInstances.swap(m_aReplacementList);
- }
- // -----------------------------------------------------------------------------
-
- void SubstitutionHelper::substituteInList()
- {
- for(std::vector< rtl::OUString >::iterator it = m_aReplacementList.begin();
- it != m_aReplacementList.end(); ++it)
- {
- this->substitute(*it);
- }
- }
- // -----------------------------------------------------------------------------
-
- void SubstitutionHelper::substitute(rtl::OUString const & _aName)
- {
-
- ISubtree & rParent = m_aContext.getCurrentParent();
-
- std::auto_ptr<INode> pReplacedNode = rParent.removeChild(_aName);
- OSL_ASSERT( pReplacedNode.get() != NULL );
-
- ISubtree * pReplacedInstance = pReplacedNode->asISubtree();
- OSL_ASSERT( pReplacedInstance != NULL );
-
- backenduno::TemplateIdentifier aTemplateName = m_aFactory.getInstanceType(*pReplacedInstance);
- if (aTemplateName.Component == m_aContext.getActiveComponent())
- {
- if (ISubtree const * pTemplate = m_rData.findTemplate(aTemplateName.Name))
- {
- std::vector< ISubtree const * >::iterator beg = m_aTemplateStack.begin(), end = m_aTemplateStack.end();
- if (std::find(beg,end,pTemplate) != end)
- m_aContext.raiseMalformedDataException("SchemaBuilder: Could not expand instances: Template is recursive");
-
- m_aTemplateStack.push_back(pTemplate);
-
- std::auto_ptr< INode > pTemplateInstance = pTemplate->clone();
-
- pTemplateInstance->setName(_aName);
- // TODO: adjust state/attributes here (?)
-
- ISubtree * pAddedTree = rParent.addChild(pTemplateInstance)->asISubtree();
-
- OSL_ENSURE(pAddedTree, "Could not obtain added template instance");
-
- this->substituteInNode(*pAddedTree);
-
- m_aTemplateStack.pop_back();
- }
- else
- {
- m_aContext.raiseMalformedDataException("SchemaBuilder: Could not expand instances: Template not found");
- }
- }
- //Import Template from different component
- else
- {
- TemplateRequest aTemplateRequest(aTemplateName.Name,
- aTemplateName.Component );
- ResultHolder< TemplateInstance > aResult = m_aContext.getTemplateData( aTemplateRequest );
-
- std::auto_ptr<INode> pTemplateInstance = aResult.extractDataAndClear();
- pTemplateInstance->setName(_aName);
-
- // Add template instance - must be a tree as any template
- OSL_VERIFY(
- rParent.addChild(pTemplateInstance)->asISubtree() );
- }
- }
- // -----------------------------------------------------------------------------
-
- void SubstitutionHelper::handle(ValueNode&)
- {
- }
- // -----------------------------------------------------------------------------
-
- void SubstitutionHelper::handle(ISubtree& _rTree)
- {
- if (m_aFactory.isInstancePlaceHolder(_rTree))
- m_aReplacementList.push_back(_rTree.getName());
-
- else
- substituteInNode(_rTree);
- }
-// -----------------------------------------------------------------------------
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace backend
-
-// -------------------------------------------------------------------------
-} // namespace configmgr
diff --git a/configmgr/source/backend/schemabuilder.hxx b/configmgr/source/backend/schemabuilder.hxx
deleted file mode 100644
index 69becb1d6895..000000000000
--- a/configmgr/source/backend/schemabuilder.hxx
+++ /dev/null
@@ -1,151 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_SCHEMABUILDER_HXX
-#define CONFIGMGR_BACKEND_SCHEMABUILDER_HXX
-
-#include "mergedcomponentdata.hxx"
-#include "componentdatahelper.hxx"
-#include "mergeddataprovider.hxx"
-#include <com/sun/star/configuration/backend/XSchemaHandler.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- class OTreeNodeFactory;
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
-
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-
- class SchemaBuilder
- : public cppu::WeakImplHelper1<backenduno::XSchemaHandler>
- {
- public:
- SchemaBuilder(uno::Reference< uno::XComponentContext > const & xContext, const rtl::OUString& aExpectedComponentName, MergedComponentData & rData, ITemplateDataProvider* aTemplateProvider = NULL );
- virtual ~SchemaBuilder();
-
- // checking the result
- bool isDone() const { return m_aContext.isDone(); }
-
- MergedComponentData & result();
- MergedComponentData const & result() const;
-
- // XSchemaHandler
- public:
- virtual void SAL_CALL
- startSchema( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endSchema( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- importComponent( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- startComponent( const rtl::OUString& aName )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endComponent( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- startGroupTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- startSetTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endTemplate( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- startGroup( const rtl::OUString& aName, sal_Int16 aAttributes )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- startSet( const rtl::OUString& aName, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- endNode( )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addPropertyWithDefault( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aDefaultValue )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addInstance( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- virtual void SAL_CALL
- addItemType( const backenduno::TemplateIdentifier& aItemType )
- throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
-
- private:
- static node::Attributes getComponentRootAttributes();
- static node::Attributes getTemplateBaseAttributes();
- node::Attributes getNodeAttributes() const;
- node::Attributes makePropertyAttributes(sal_Int16 aSchemaAttributes) const;
-
- bool isExtensible(sal_Int16 aSchemaAttributes);
-
- void substituteInstances();
- private:
- MergedComponentData & m_aData;
- DataBuilderContext m_aContext;
- ComponentDataFactory m_aFactory;
- };
-// -----------------------------------------------------------------------------
-
- } // namespace backend
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/singlebackendadapter.cxx b/configmgr/source/backend/singlebackendadapter.cxx
deleted file mode 100644
index 6a119c81cdab..000000000000
--- a/configmgr/source/backend/singlebackendadapter.cxx
+++ /dev/null
@@ -1,336 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-#include "singlebackendadapter.hxx"
-
-#ifndef CONFIGMGR_API_FACTORY_HXX_
-#include "confapifactory.hxx"
-#endif // CONFIGMGR_API_FACTORY_HXX_
-#include "serviceinfohelper.hxx"
-#include <com/sun/star/configuration/backend/XMultiLayerStratum.hpp>
-#include <com/sun/star/configuration/CannotLoadConfigurationException.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-namespace configmgr { namespace backend {
-
-//==============================================================================
-
-SingleBackendAdapter::SingleBackendAdapter(
- const uno::Reference<uno::XComponentContext>& xContext)
- : cppu::WeakComponentImplHelper5< backenduno::XBackend, backenduno::XBackendEntities, backenduno::XSchemaSupplier, lang::XInitialization, lang::XServiceInfo >(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY) {
-}
-//------------------------------------------------------------------------------
-
-SingleBackendAdapter::~SingleBackendAdapter(void) {}
-//------------------------------------------------------------------------------
-
-void SAL_CALL SingleBackendAdapter::initialize(
- const uno::Sequence<uno::Any>& aParameters)
- throw (uno::RuntimeException, uno::Exception) {
-
- uno::Any const * const pParams = aParameters.getConstArray();
- sal_Int32 nCount = aParameters.getLength();
-
- for (sal_Int32 ix = 0; ix < nCount; ++ix)
- {
- if (pParams[ix] >>= mBackend) break;
- }
-
- if (!mBackend.is())
- {
- throw com::sun::star::configuration::CannotLoadConfigurationException(
- rtl::OUString::createFromAscii("Online SingleBackend Adapter: Cannot operate without real (Single)Backend"),
- *this);
- }
-}
-//------------------------------------------------------------------------------
-static inline rtl::OUString getSingleLayerDummyEntity()
-{ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")); }
-//------------------------------------------------------------------------------
-bool SingleBackendAdapter::checkOkState()
-{
- if (!mBackend.is())
- {
- if(rBHelper.bDisposed)
- {
- throw lang::DisposedException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "SingleBackendAdapter: Backend already disposed")),*this);
- }
- else
- {
- throw backenduno::BackendAccessException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "SingleBackendAdapter: Object was never Initialised")),*this,uno::Any() );
- }
- }
- return true;
-}
-
-//------------------------------------------------------------------------------
-
-// XBackendEntities
-rtl::OUString SAL_CALL
- SingleBackendAdapter::getOwnerEntity( )
- throw (uno::RuntimeException)
-{
- if (mBackend.is())
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( mBackend, uno::UNO_REF_QUERY_THROW );
-
- return xEntities->getOwnerEntity();
- }
- else
- {
- throw uno::RuntimeException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "SingleBackendAdapter: Object was never Initialised")),*this);
- }
-}
-//------------------------------------------------------------------------------
-
-rtl::OUString SAL_CALL
- SingleBackendAdapter::getAdminEntity( )
- throw (uno::RuntimeException)
-{
- if (mBackend.is())
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( mBackend, uno::UNO_REF_QUERY_THROW );
- return xEntities->getAdminEntity();
- }
- else
- {
- throw uno::RuntimeException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "SingleBackendAdapter: Object was never Initialised")),*this);
- }
-}
-//------------------------------------------------------------------------------
-
-sal_Bool SAL_CALL
- SingleBackendAdapter::supportsEntity( const rtl::OUString& aEntity )
- throw (backenduno::BackendAccessException, uno::RuntimeException)
-{
- if (checkOkState())
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( mBackend, uno::UNO_REF_QUERY_THROW );
- return xEntities->supportsEntity(aEntity);
- }
- return false;
-}
-//------------------------------------------------------------------------------
-
-sal_Bool SAL_CALL
- SingleBackendAdapter::isEqualEntity( const rtl::OUString& aEntity, const rtl::OUString& aOtherEntity )
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- if (checkOkState())
- {
- uno::Reference< backenduno::XBackendEntities > xEntities( mBackend, uno::UNO_REF_QUERY_THROW );
- return xEntities->isEqualEntity(aEntity,aOtherEntity);
- }
- return false;
-}
-//------------------------------------------------------------------------------
-
-uno::Reference<backenduno::XSchema> SAL_CALL
- SingleBackendAdapter::getComponentSchema(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- if (checkOkState())
- {
- return mBackend->getComponentSchema(aComponent) ;
- }
- return false;
-}
-//------------------------------------------------------------------------------
-
-uno::Sequence<uno::Reference<backenduno::XLayer> > SAL_CALL
- SingleBackendAdapter::listOwnLayers(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- if (checkOkState())
- {
- return listLayers(aComponent, this->getOwnerEntity()) ;
- }
- return false;
-}
-//------------------------------------------------------------------------------
-
-uno::Reference<backenduno::XUpdateHandler> SAL_CALL
- SingleBackendAdapter::getOwnUpdateHandler(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::NoSupportException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- if (checkOkState())
- {
- return getUpdateHandler(aComponent, this->getOwnerEntity()) ;
- }
- return false;
-}
-//------------------------------------------------------------------------------
-
-uno::Sequence<uno::Reference<backenduno::XLayer> > SAL_CALL
- SingleBackendAdapter::listLayers(const rtl::OUString& aComponent,
- const rtl::OUString& aEntity)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- if (checkOkState())
- {
- uno::Reference< backenduno::XMultiLayerStratum > xBackend( mBackend, uno::UNO_REF_QUERY_THROW );
-
- uno::Sequence<uno::Reference<backenduno::XLayer> > retCode =
- xBackend->getLayers(xBackend->listLayerIds(aComponent, aEntity),
- rtl::OUString()) ;
-
- // There might be non-existent layers in the list if there's no
- // actual data associated to a given layer id. Hence we have to
- // compress the list.
- sal_Int32 maxLayer = 0 ;
-
- for (sal_Int32 i = 0 ; i < retCode.getLength() ; ++ i)
- {
- if (retCode [i].is())
- {
- if (i != maxLayer) { retCode [maxLayer] = retCode [i] ; }
- ++ maxLayer ;
- }
- }
- retCode.realloc(maxLayer) ;
- return retCode ;
- }
- return false;
-}
-//------------------------------------------------------------------------------
-
-uno::Reference<backenduno::XUpdateHandler> SAL_CALL
- SingleBackendAdapter::getUpdateHandler(const rtl::OUString& aComponent,
- const rtl::OUString& aEntity)
- throw (backenduno::BackendAccessException,
- lang::NoSupportException,
- lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- if (checkOkState())
- {
- uno::Reference< backenduno::XMultiLayerStratum > xBackend( mBackend, uno::UNO_REF_QUERY_THROW );
-
- uno::Sequence<uno::Any> arguments(1) ;
-
- arguments [0] <<= xBackend->getUpdatableLayer(
- xBackend->getUpdateLayerId(aComponent,
- aEntity)) ;
- uno::Reference< uno::XInterface > xHandler;
- try
- {
- const rtl::OUString kUpdateMerger(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.backend.LayerUpdateMerger")) ;
-
- xHandler = mFactory->createInstanceWithArguments(kUpdateMerger, arguments);
- }
- catch (uno::RuntimeException & )
- {throw;}
- catch (uno::Exception & e)
- {
- const rtl::OUString sMessage(RTL_CONSTASCII_USTRINGPARAM(
- "Configuration SingleBackendAdapter: Cannot create UpdateMerger - error message: ")) ;
- throw uno::RuntimeException(sMessage.concat(e.Message),*this);
- }
-
- return uno::Reference<backenduno::XUpdateHandler>(xHandler, uno::UNO_REF_QUERY_THROW) ;
- }
- return false;
-}
-//------------------------------------------------------------------------------
-
-static const sal_Char * const kBackendService = "com.sun.star.configuration.backend.Backend" ;
-static const sal_Char * const kAdapterService = "com.sun.star.configuration.backend.BackendAdapter" ;
-static const sal_Char * const kOnlineService = "com.sun.star.configuration.backend.OnlineBackend" ;
-
-static const sal_Char * const kImplementation =
- "com.sun.star.comp.configuration.backend.SingleBackendAdapter" ;
-
-static sal_Char const * const kServiceNames [] =
-{
- kOnlineService,
- kAdapterService,
- 0,
- kBackendService,
- 0
-} ;
-static const ServiceImplementationInfo kServiceInfo =
-{
- kImplementation,
- kServiceNames,
- kServiceNames + 3
-} ;
-
-const ServiceRegistrationInfo *getSingleBackendAdapterServiceInfo()
-{
- return getRegistrationInfo(&kServiceInfo) ;
-}
-
-uno::Reference<uno::XInterface> SAL_CALL
- instantiateSingleBackendAdapter(const uno::Reference< uno::XComponentContext >& xContext)
-{
- return *new SingleBackendAdapter(xContext) ;
-}
-//------------------------------------------------------------------------------
-
-rtl::OUString SAL_CALL
- SingleBackendAdapter::getImplementationName(void)
- throw (uno::RuntimeException)
-{
- return ServiceInfoHelper(&kServiceInfo).getImplementationName() ;
-}
-//------------------------------------------------------------------------------
-
-sal_Bool SAL_CALL
- SingleBackendAdapter::supportsService(const rtl::OUString& aServiceName)
- throw (uno::RuntimeException)
-{
- return ServiceInfoHelper(&kServiceInfo).supportsService(aServiceName) ;
-}
-//------------------------------------------------------------------------------
-
-uno::Sequence<rtl::OUString> SAL_CALL
- SingleBackendAdapter::getSupportedServiceNames(void)
- throw (uno::RuntimeException)
-{
- return ServiceInfoHelper(&kServiceInfo).getSupportedServiceNames() ;
-}
-//------------------------------------------------------------------------------
-
-} } // configmgr.backend
-
diff --git a/configmgr/source/backend/singlebackendadapter.hxx b/configmgr/source/backend/singlebackendadapter.hxx
deleted file mode 100644
index 391434ecf597..000000000000
--- a/configmgr/source/backend/singlebackendadapter.hxx
+++ /dev/null
@@ -1,142 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_SINGLEBACKENDADAPTER_HXX_
-#define CONFIGMGR_BACKEND_SINGLEBACKENDADAPTER_HXX_
-
-#include <com/sun/star/configuration/backend/XBackend.hpp>
-#include <com/sun/star/configuration/backend/XBackendEntities.hpp>
-#include <com/sun/star/configuration/backend/XSchemaSupplier.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/compbase5.hxx>
-
-namespace configmgr { namespace backend {
-
-namespace css = com::sun::star ;
-namespace uno = css::uno ;
-namespace lang = css::lang ;
-namespace backenduno = css::configuration::backend ;
-
-/**
- Class implementing the Backend service for remote access.
- It just transfers calls to a SingleBackend implementation.
- */
-class SingleBackendAdapter : public cppu::WeakComponentImplHelper5< backenduno::XBackend, backenduno::XBackendEntities, backenduno::XSchemaSupplier, lang::XInitialization, lang::XServiceInfo > {
- public :
- /**
- Service constructor from a service factory.
-
- @param aFactory service factory
- */
- SingleBackendAdapter(
- const uno::Reference<uno::XComponentContext>& xContext) ;
- /** Destructor */
- ~SingleBackendAdapter(void) ;
-
- // XInitialize
- virtual void SAL_CALL initialize(
- const uno::Sequence<uno::Any>& aParameters)
- throw (uno::RuntimeException, uno::Exception) ;
-
- // XSchemaSupplier
- virtual uno::Reference<backenduno::XSchema>
- SAL_CALL getComponentSchema(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException) ;
-
- // XBackend
- virtual uno::Sequence<uno::Reference<backenduno::XLayer> >
- SAL_CALL listOwnLayers(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException) ;
-
- virtual uno::Reference<backenduno::XUpdateHandler>
- SAL_CALL getOwnUpdateHandler(const rtl::OUString& aComponent)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- lang::NoSupportException,
- uno::RuntimeException) ;
- virtual uno::Sequence<uno::Reference<backenduno::XLayer> > SAL_CALL
- listLayers(const rtl::OUString& aComponent,
- const rtl::OUString& aEntity)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException) ;
- virtual uno::Reference<backenduno::XUpdateHandler> SAL_CALL
- getUpdateHandler(const rtl::OUString& aComponent,
- const rtl::OUString& aEntity)
- throw (backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- lang::NoSupportException,
- uno::RuntimeException) ;
-
- // XBackendEntities
- virtual rtl::OUString SAL_CALL
- getOwnerEntity( )
- throw (uno::RuntimeException);
-
- virtual rtl::OUString SAL_CALL
- getAdminEntity( )
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- supportsEntity( const rtl::OUString& aEntity )
- throw (backenduno::BackendAccessException, uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- isEqualEntity( const rtl::OUString& aEntity, const rtl::OUString& aOtherEntity )
- throw ( backenduno::BackendAccessException,
- lang::IllegalArgumentException,
- uno::RuntimeException);
-
- // XServiceInfo
- virtual rtl::OUString SAL_CALL getImplementationName(void)
- throw (uno::RuntimeException) ;
- virtual sal_Bool SAL_CALL supportsService(
- const rtl::OUString& aServiceName)
- throw (uno::RuntimeException) ;
- virtual uno::Sequence<rtl::OUString> SAL_CALL
- getSupportedServiceNames(void) throw (uno::RuntimeException) ;
- protected :
- private :
- /** Service factory */
- uno::Reference<lang::XMultiServiceFactory> mFactory ;
- /** Mutex for resource protection */
- osl::Mutex mMutex ;
- /** Remote backend that the offline cache is handling */
- uno::Reference<backenduno::XSchemaSupplier> mBackend ;
- /* checks if object is in initialized and undisposed state */
- bool checkOkState();
-} ;
-
-} } // configmgr.backend
-
-#endif // CONFIGMGR_BACKEND_SINGLEBACKENDADAPTER_HXX_
diff --git a/configmgr/source/backend/updatedata.cxx b/configmgr/source/backend/updatedata.cxx
deleted file mode 100644
index 9e6484e09aab..000000000000
--- a/configmgr/source/backend/updatedata.cxx
+++ /dev/null
@@ -1,455 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "updatedata.hxx"
-
-#include <com/sun/star/configuration/backend/NodeAttribute.hpp>
-#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
-
-#include <iterator>
-#include <algorithm>
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
-ElementUpdate::ElementUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask)
-: NamedUpdate(_aName)
-, m_pParent(_pParent)
-, m_nFlags(_nFlags)
-, m_nFlagsMask(_nFlagsMask)
-{
-}
-// -----------------------------------------------------------------------------
-
-sal_Int16 ElementUpdate::updateFlags(sal_Int16 _nFlags) const
-{
- return (_nFlags & ~m_nFlagsMask) | (m_nFlags & m_nFlagsMask);
-}
-// -----------------------------------------------------------------------------
-
-NodeUpdate * ElementUpdate::asNodeUpdate(bool )
-{
- return NULL;
-}
-// -----------------------------------------------------------------------------
-
-PropertyUpdate * ElementUpdate::asPropertyUpdate()
-{
- return NULL;
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-NodeUpdate::NodeUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, Op _op)
-: ElementUpdate(_pParent,_aName,_nFlags, _nFlagsMask)
-, m_aNodes()
-, m_aProperties()
-, m_aRemovedElements()
-, m_op(_op)
-{
-}
-// -----------------------------------------------------------------------------
-
-NodeUpdate * NodeUpdate::asNodeUpdate(bool _bMerged)
-{
- return (!_bMerged || m_op == modify
- || (updateFlags() & backenduno::NodeAttribute::FUSE) != 0)
- ? this : NULL;
-}
-// -----------------------------------------------------------------------------
-
-bool NodeUpdate::addNodeUpdate(rtl::Reference<ElementUpdate> const & _aNode)
-{
- OSL_PRECOND( _aNode.is(), "ERROR: NodeUpdate: Trying to add NULL node.");
- OSL_PRECOND( _aNode->getParent() == this, "ERROR: NodeUpdate: Node being added has wrong parent.");
- OSL_ENSURE(m_aNodes.find(_aNode->getName()) == m_aNodes.end(),
- "NodeUpdate: Child node being added already exists in this node.");
-
- return m_aNodes.insert( ElementList::value_type(_aNode->getName(),_aNode) ).second;
-}
-// -----------------------------------------------------------------------------
-
-bool NodeUpdate::addPropertyUpdate(rtl::Reference<ElementUpdate> const & _aProp)
-{
- OSL_PRECOND( _aProp.is(), "ERROR: NodeUpdate: Trying to add NULL property.");
- OSL_PRECOND( _aProp->getParent() == this, "ERROR: NodeUpdate: Property being added has wrong parent.");
- OSL_ENSURE(m_aProperties.find(_aProp->getName()) == m_aProperties.end(),
- "NodeUpdate: Property being added already exists in this node.");
-
- return m_aProperties.insert( ElementList::value_type(_aProp->getName(),_aProp) ).second;
-}
-// -----------------------------------------------------------------------------
-
-void NodeUpdate::removeNodeByName(rtl::OUString const & _aName)
-{
- ElementList::iterator it = m_aNodes.find(_aName);
- OSL_ENSURE(it != m_aNodes.end(),
- "NodeUpdate: Child node being removed is not in this node.");
-
- if (it != m_aNodes.end())
- {
- m_aRemovedElements.insert(*it);
- m_aNodes.erase(it);
- }
-}
-// -----------------------------------------------------------------------------
-
-void NodeUpdate::removePropertyByName (rtl::OUString const & _aName)
-{
- ElementList::iterator it = m_aProperties.find(_aName);
- OSL_ENSURE(it != m_aProperties.end(),
- "NodeUpdate: Property being removed is not in this node.");
-
- if (it != m_aProperties.end())
- {
- m_aRemovedElements.insert(*it);
- m_aProperties.erase(it);
- }
-}
-// -----------------------------------------------------------------------------
-
-rtl::Reference<ElementUpdate> NodeUpdate::getNodeByName(rtl::OUString const & _aName) const
-{
- ElementList::const_iterator it = m_aNodes.find(_aName);
-
- return it != m_aNodes.end() ? it->second : rtl::Reference<ElementUpdate>();
-}
-// -----------------------------------------------------------------------------
-
-rtl::Reference<ElementUpdate> NodeUpdate::getPropertyByName (rtl::OUString const & _aName) const
-{
- ElementList::const_iterator it = m_aProperties.find(_aName);
-
- return it != m_aProperties.end() ? it->second : rtl::Reference<ElementUpdate>();
-}
-// -----------------------------------------------------------------------------
-
-void NodeUpdate::writeChildrenToLayer(backenduno::XLayerHandler * _pLayer)
-{
- OSL_ASSERT(_pLayer);
- for (ElementList::const_iterator itP = beginProperties(); itP != endProperties(); ++itP)
- itP->second->writeToLayer(_pLayer);
-
- for (ElementList::const_iterator itN = beginNodes(); itN != endNodes(); ++itN)
- itN->second->writeToLayer(_pLayer);
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-NodeModification::NodeModification(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset)
-: NodeUpdate(_pParent,_aName,_nFlags, _nFlagsMask, _bReset ? reset : modify)
-{
-}
-// -----------------------------------------------------------------------------
-
-void NodeModification::writeToLayer(backenduno::XLayerHandler * _pLayer)
-{
- OSL_ASSERT(_pLayer);
-
- if ( this->getOperation() == reset && // if we have an empty
- !this->changedFlags() && // 'reset' node, that means
- !this->hasChildren() ) // we need to write
- return; // nothing
-
- _pLayer->overrideNode( this->getName(), this->updateFlags(), false );
- this->writeChildrenToLayer(_pLayer);
- _pLayer->endNode();
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-NodeReplace::NodeReplace(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags)
-: NodeUpdate(_pParent,_aName,_nFlags, _nFlags, replace)
-, m_aTemplateName()
-, m_aTemplateComponent()
-{
-}
-// -----------------------------------------------------------------------------
-
-NodeReplace::NodeReplace(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateComponent)
-: NodeUpdate(_pParent,_aName,_nFlags, _nFlags, replace)
-, m_aTemplateName(_aTemplateName)
-, m_aTemplateComponent(_aTemplateComponent)
-{
-}
-// -----------------------------------------------------------------------------
-
-bool NodeReplace::hasTemplate() const
-{
- return m_aTemplateName.getLength() != 0;
-}
-// -----------------------------------------------------------------------------
-
-void NodeReplace::writeToLayer(backenduno::XLayerHandler * _pLayer)
-{
- OSL_ASSERT(_pLayer);
-
- if (this->hasTemplate())
- {
- backenduno::TemplateIdentifier aTemplate( m_aTemplateName, m_aTemplateComponent );
- _pLayer->addOrReplaceNodeFromTemplate( this->getName(), aTemplate, this->updateFlags() );
- }
- else
- _pLayer->addOrReplaceNode( this->getName(), this->updateFlags() );
-
- this->writeChildrenToLayer(_pLayer);
- _pLayer->endNode();
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-NodeDrop::NodeDrop(NodeUpdate * _pParent, rtl::OUString const & _aName)
-: ElementUpdate(_pParent,_aName,0,0)
-{
-}
-// -----------------------------------------------------------------------------
-
-void NodeDrop::writeToLayer(backenduno::XLayerHandler * _pLayer)
-{
- OSL_ASSERT(_pLayer);
- _pLayer->dropNode(this->getName());
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-PropertyUpdate::PropertyUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType)
-: ElementUpdate(_pParent,_aName,_nFlags,_nFlagsMask)
-, m_aValues()
-, m_aType(_aType)
-{}
-// -----------------------------------------------------------------------------
-
-PropertyUpdate * PropertyUpdate::asPropertyUpdate()
-{
- return this;
-}
-// -----------------------------------------------------------------------------
-
-static uno::Any makeResetMarker()
-{
- uno::Reference< backenduno::XLayerHandler > xNull;
- return uno::makeAny(xNull);
-}
-// -----------------------------------------------------------------------------
-
-inline bool PropertyUpdate::isResetMarker(uno::Any const & _aValue)
-{
- OSL_ENSURE( _aValue.getValueTypeClass() != uno::TypeClass_INTERFACE ||
- _aValue == makeResetMarker() && _aValue.getValueType() == makeResetMarker().getValueType(),
- "Unexpected any: Interface reference will be taken as reset marker");
-
- return _aValue.getValueTypeClass() == uno::TypeClass_INTERFACE;
-}
-// -----------------------------------------------------------------------------
-
-uno::Any const & PropertyUpdate::getResetMarker()
-{
- static uno::Any const aMarker = makeResetMarker();
-
- OSL_ASSERT( isResetMarker(aMarker) );
-
- return aMarker;
-}
-// -----------------------------------------------------------------------------
-
-bool PropertyUpdate::setValueFor(rtl::OUString const & _aLocale, uno::Any const & _aValueUpdate)
-{
- OSL_PRECOND( !isResetMarker(_aValueUpdate), "PropertyUpdate: ERROR: Trying to set a reset marker as regular value" );
-
- OSL_ENSURE(m_aValues.find(_aLocale) == m_aValues.end(),
- "PropertyUpdate: Locale being added already has a value in this property.");
-
- if (_aValueUpdate.hasValue())
- {
- if (m_aType.getTypeClass() == uno::TypeClass_ANY)
- m_aType = _aValueUpdate.getValueType();
-
- else
- OSL_ENSURE( m_aType == _aValueUpdate.getValueType() ||
- m_aType == uno::Type(),
- "ValueType mismatch in PropertyUpdate");
- }
- return m_aValues.insert( ValueList::value_type(_aLocale,_aValueUpdate) ).second;
-}
-// -----------------------------------------------------------------------------
-
-bool PropertyUpdate::resetValueFor(rtl::OUString const & _aLocale)
-{
- OSL_ENSURE(m_aValues.find(_aLocale) == m_aValues.end(),
- "PropertyUpdate: Locale being reset already has a value in this property.");
-
- return m_aValues.insert( ValueList::value_type(_aLocale,getResetMarker()) ).second;
-}
-// -----------------------------------------------------------------------------
-
-void PropertyUpdate::removeValueFor(rtl::OUString const & _aLocale)
-{
- OSL_ENSURE(m_aValues.find(_aLocale) != m_aValues.end(),
- "PropertyUpdate: Locale being removed is not in this node.");
-
- m_aValues.erase(_aLocale);
-}
-// -----------------------------------------------------------------------------
-
-void PropertyUpdate::finishValue()
-{
- if (m_aType.getTypeClass() == uno::TypeClass_ANY)
- m_aType = uno::Type();
-}
-// -----------------------------------------------------------------------------
-
-bool PropertyUpdate::hasValueFor(rtl::OUString const & _aLocale) const
-{
- ValueList::const_iterator it = m_aValues.find(_aLocale);
-
- return it != m_aValues.end() && ! isResetMarker(it->second);
-}
-// -----------------------------------------------------------------------------
-
-bool PropertyUpdate::hasResetFor(rtl::OUString const & _aLocale) const
-{
- ValueList::const_iterator it = m_aValues.find(_aLocale);
-
- return it != m_aValues.end() && isResetMarker(it->second);
-}
-// -----------------------------------------------------------------------------
-
-bool PropertyUpdate::hasChangeFor(rtl::OUString const & _aLocale) const
-{
- ValueList::const_iterator it = m_aValues.find(_aLocale);
-
- return it != m_aValues.end();
-}
-// -----------------------------------------------------------------------------
-
-uno::Any PropertyUpdate::getValueFor(rtl::OUString const & _aLocale) const
-{
- ValueList::const_iterator it = m_aValues.find(_aLocale);
-
- OSL_ENSURE(it != m_aValues.end() && !isResetMarker(it->second),
- "PropertyUpdate: Should not call getValue() unless hasValue() returns true" );
-
- return it != m_aValues.end() && !isResetMarker(it->second) ? it->second : uno::Any();
-}
-// -----------------------------------------------------------------------------
-
-void PropertyUpdate::writeValueToLayer(backenduno::XLayerHandler * _pLayer, uno::Any const & _aValue)
-{
- OSL_ASSERT(_pLayer);
- if ( !isResetMarker(_aValue) )
- _pLayer->setPropertyValue(_aValue);
-
- // else - to reset - do nothing
-}
-// -----------------------------------------------------------------------------
-
-void PropertyUpdate::writeValueToLayerFor(backenduno::XLayerHandler * _pLayer, uno::Any const & _aValue, rtl::OUString const & _aLocale)
-{
- OSL_ASSERT(_pLayer);
- if (_aLocale == this->primarySlot())
- this->writeValueToLayer(_pLayer,_aValue);
-
- else if ( !isResetMarker(_aValue) )
- _pLayer->setPropertyValueForLocale(_aValue,_aLocale);
-
- // else - to reset - do nothing
-}
-// -----------------------------------------------------------------------------
-
-void PropertyUpdate::writeValuesToLayer(backenduno::XLayerHandler * _pLayer)
-{
- OSL_ASSERT(_pLayer);
- for (ValueList::const_iterator itV = beginValues(); itV != endValues(); ++itV)
- this->writeValueToLayerFor(_pLayer, itV->second, itV->first);
-}
-// -----------------------------------------------------------------------------
-
-void PropertyUpdate::writeToLayer(backenduno::XLayerHandler * _pLayer)
-{
- OSL_ASSERT(_pLayer);
-
- _pLayer->overrideProperty( this->getName(), this->updateFlags(), this->m_aType, false );
- this->writeValuesToLayer(_pLayer);
- _pLayer->endProperty();
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-
-PropertyAdd::PropertyAdd(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType)
-: ElementUpdate(_pParent,_aName,_nFlags,_nFlags)
-, m_aValueType(_aType)
-, m_aValue()
-{
-
-}
-// -----------------------------------------------------------------------------
-
-PropertyAdd::PropertyAdd(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue)
-: ElementUpdate(_pParent,_aName,_nFlags,_nFlags)
-, m_aValueType(_aValue.getValueType())
-, m_aValue(_aValue)
-{
-}
-// -----------------------------------------------------------------------------
-
-void PropertyAdd::writeToLayer(backenduno::XLayerHandler * _pLayer)
-{
- OSL_ASSERT(_pLayer);
- if (this->hasValue())
- _pLayer->addPropertyWithValue(this->getName(),this->updateFlags(),this->getValue());
- else
- _pLayer->addProperty(this->getName(),this->updateFlags(),this->getValueType());
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-PropertyReset::PropertyReset(NodeUpdate * _pParent, rtl::OUString const & _aName)
-: ElementUpdate(_pParent,_aName,0,0)
-{
-}
-// -----------------------------------------------------------------------------
-
-void PropertyReset::writeToLayer(backenduno::XLayerHandler * _pLayer)
-{
- (void) _pLayer; // avoid warning about unused parameter
- OSL_ASSERT(_pLayer);
- // skip - nothing to write
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace backend
-
-// -------------------------------------------------------------------------
-} // namespace configmgr
diff --git a/configmgr/source/backend/updatedata.hxx b/configmgr/source/backend/updatedata.hxx
deleted file mode 100644
index c38ee0f857a8..000000000000
--- a/configmgr/source/backend/updatedata.hxx
+++ /dev/null
@@ -1,266 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_UPDATEDATA_HXX
-#define CONFIGMGR_BACKEND_UPDATEDATA_HXX
-
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Type.hxx>
-#include <rtl/ref.hxx>
-#include <rtl/ustring.hxx>
-#include <salhelper/simplereferenceobject.hxx>
-#include "utility.hxx"
-
-#ifndef INCLUDED_SET
-#include <set>
-#define INCLUDED_SET
-#endif
-#ifndef INCLUDED_MAP
-#include <map>
-#define INCLUDED_MAP
-#endif
-
-namespace com { namespace sun { namespace star { namespace configuration { namespace backend {
- class XLayerHandler;
-} } } } }
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
- class ElementUpdate;
- class NodeUpdate;
- class NodeModification;
- class NodeReplace;
- class NodeDrop;
- class PropertyUpdate;
- class PropertyAdd;
- class PropertyReset;
-
-// -----------------------------------------------------------------------------
-
- class NamedUpdate : public salhelper::SimpleReferenceObject
- {
- rtl::OUString const m_aName;
-
- protected:
- explicit
- NamedUpdate(rtl::OUString const & _aName)
- : m_aName(_aName)
- {}
-
- ~NamedUpdate() {};
-
- public:
- rtl::OUString const & getName() const { return m_aName; }
- };
-// -----------------------------------------------------------------------------
- class ElementUpdate : public NamedUpdate
- {
- NodeUpdate * m_pParent;
- sal_Int16 m_nFlags;
- sal_Int16 m_nFlagsMask;
- protected:
- ElementUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask);
-
- public:
- virtual NodeUpdate * asNodeUpdate(bool _bMerged = false);
- virtual PropertyUpdate * asPropertyUpdate();
-
- virtual void writeToLayer(backenduno::XLayerHandler * _pLayer) = 0;
-
- public:
- NodeUpdate * getParent() const { return m_pParent; }
-
- sal_Int16 changedFlags() const { return m_nFlagsMask; }
- sal_Int16 updateFlags(sal_Int16 _nFlags = 0) const;
-
- };
-// -----------------------------------------------------------------------------
-
- class NodeUpdate : public ElementUpdate
- {
- typedef std::map< rtl::OUString, rtl::Reference<ElementUpdate> > ElementList;
- public:
- enum Op { modify, reset, replace };
-
- protected:
- NodeUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, Op _op);
-
- virtual NodeUpdate * asNodeUpdate(bool _bMerged);
-
- public:
- bool addNodeUpdate (rtl::Reference<ElementUpdate> const & _aNode);
- bool addPropertyUpdate (rtl::Reference<ElementUpdate> const & _aProp);
- void removeNodeByName (rtl::OUString const & _aName);
- void removePropertyByName (rtl::OUString const & _aName);
-
- Op getOperation() const { return m_op; }
-
- rtl::Reference<ElementUpdate> getNodeByName (rtl::OUString const & _aName) const;
- rtl::Reference<ElementUpdate> getPropertyByName (rtl::OUString const & _aName) const;
-
- ElementList::const_iterator beginNodes() const { return m_aNodes.begin(); }
- ElementList::const_iterator endNodes() const { return m_aNodes.end(); };
- ElementList::const_iterator beginProperties() const { return m_aProperties.begin(); };
- ElementList::const_iterator endProperties() const { return m_aProperties.end(); };
-
- bool hasChildren() const { return !m_aNodes.empty() || !m_aProperties.empty(); }
-
- void writeChildrenToLayer(backenduno::XLayerHandler * _pLayer);
- private:
- ElementList m_aNodes;
- ElementList m_aProperties;
- ElementList m_aRemovedElements;
- Op m_op;
- };
-// -----------------------------------------------------------------------------
-
- class NodeModification : public NodeUpdate
- {
- public:
- NodeModification(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset);
- virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
- };
-// -----------------------------------------------------------------------------
-
- class NodeReplace : public NodeUpdate
- {
- public:
- NodeReplace(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags);
- NodeReplace(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateComponent);
-
- bool hasTemplate() const;
- rtl::OUString getTemplateName() const { return m_aTemplateName; }
- rtl::OUString getTemplateComponent() const { return m_aTemplateComponent; }
-
- virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
- private:
- rtl::OUString m_aTemplateName;
- rtl::OUString m_aTemplateComponent;
- };
-// -----------------------------------------------------------------------------
-
- class NodeDrop : public ElementUpdate
- {
- public:
- NodeDrop(NodeUpdate * _pParent, rtl::OUString const & _aName);
-
- virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
- };
-// -----------------------------------------------------------------------------
-
- class PropertyUpdate : public ElementUpdate
- {
- typedef std::map< rtl::OUString, uno::Any > ValueList;
-
- ValueList m_aValues;
- uno::Type m_aType;
- public:
- PropertyUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType);
-
- bool setValueFor(rtl::OUString const & _aLocale, uno::Any const & _aValueUpdate);
- bool resetValueFor(rtl::OUString const & _aLocale);
- void removeValueFor(rtl::OUString const & _aLocale);
-
- bool setValue(uno::Any const & _aValueUpdate) { return setValueFor(primarySlot(), _aValueUpdate); }
- bool resetValue() { return resetValueFor(primarySlot()); }
- void removeValue() { removeValueFor(primarySlot()); }
-
- void finishValue();
-
- uno::Type const & getValueType() const { return m_aType; }
-
- bool hasValueFor(rtl::OUString const & _aLocale) const;
- bool hasValue() const { return hasValueFor(primarySlot()); }
-
- bool hasResetFor(rtl::OUString const & _aLocale) const;
- bool hasReset() const { return hasResetFor(primarySlot()); }
-
- bool hasChangeFor(rtl::OUString const & _aLocale) const;
- bool hasChange() const { return hasChangeFor(primarySlot()); }
-
- uno::Any getValueFor(rtl::OUString const & _aLocale) const;
- uno::Any getValue() const { return getValueFor(primarySlot()); }
-
- ValueList::const_iterator beginValues() const { return m_aValues.begin(); }
- ValueList::const_iterator endValues() const { return m_aValues.end(); }
-
- void writeValueToLayerFor(backenduno::XLayerHandler * _pLayer, uno::Any const & _aValue, rtl::OUString const & _aLocale);
- void writeValueToLayer(backenduno::XLayerHandler * _pLayer, uno::Any const & _aValue);
- void writeValuesToLayer(backenduno::XLayerHandler * _pLayer);
- virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
- private:
- rtl::OUString primarySlot() const { return rtl::OUString(); }
-
- static uno::Any const & getResetMarker();
- static inline bool isResetMarker(uno::Any const & _aValue);
-
- virtual PropertyUpdate * asPropertyUpdate();
- };
-// -----------------------------------------------------------------------------
-
- class PropertyAdd : public ElementUpdate
- {
- uno::Type m_aValueType;
- uno::Any m_aValue;
- public:
- PropertyAdd(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType);
- PropertyAdd(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue);
-
- bool hasValue() const { return !! m_aValue.hasValue(); }
- uno::Any const & getValue() const { return m_aValue; }
- uno::Type const & getValueType() const { return m_aValueType; }
-
- virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
- };
-// -----------------------------------------------------------------------------
-
- class PropertyReset : public ElementUpdate
- {
- public:
- PropertyReset(NodeUpdate * _pParent, rtl::OUString const & _aName);
-
- virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
- };
-// -----------------------------------------------------------------------------
-
- } // namespace backend
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/updatedispatch.cxx b/configmgr/source/backend/updatedispatch.cxx
deleted file mode 100644
index 5ff8057d9889..000000000000
--- a/configmgr/source/backend/updatedispatch.cxx
+++ /dev/null
@@ -1,496 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "treefragment.hxx"
-#include "updatedispatch.hxx"
-#include "configpath.hxx"
-#include "node.hxx"
-#include "matchlocale.hxx"
-
-#include <com/sun/star/configuration/backend/XUpdateHandler.hpp>
-#include <com/sun/star/configuration/backend/NodeAttribute.hpp>
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
-
-UpdateDispatcher::UpdateDispatcher(uno::Reference< backenduno::XUpdateHandler > const & _xUpdateHandler, rtl::OUString const & _aLocale)
-: m_pContextPath(NULL)
-, m_xUpdateHandler(_xUpdateHandler)
-, m_aLocale(_aLocale)
-, m_aElementName()
-, m_bInValueSet(false)
-, m_bInLocalizedValues(false)
-{
-}
-// -----------------------------------------------------------------------------
-
-UpdateDispatcher::~UpdateDispatcher()
-{
-}
-// -----------------------------------------------------------------------------
-
-void UpdateDispatcher::dispatchUpdate(configuration::AbsolutePath const & _aRootPath, SubtreeChange const& _anUpdate)
-{
- if (!m_xUpdateHandler.is())
- {
- rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("ERROR: Cannot dispatch update - no handler found") );
- throw uno::RuntimeException(sMsg,NULL);
- }
-
- OSL_PRECOND( !_aRootPath.isRoot(), "Cannot apply update, where root is outside a component" );
-
- OSL_PRECOND( m_pContextPath == NULL, "Update Dispatcher already has a context path" );
- if (!_aRootPath.getParentPath().isRoot())
- {
- OSL_ENSURE(false,"Obsolete functionality used: starting update with non-empty context");
- m_pContextPath = &_aRootPath;
- }
-
- this->startUpdate();
- this->applyToChange(_anUpdate);
- this->endUpdate();
-
- m_pContextPath = NULL;
-}
-// -----------------------------------------------------------------------------
-
-void UpdateDispatcher::startUpdate()
-{
- m_xUpdateHandler->startUpdate();
- m_bInValueSet = false;
- m_bInLocalizedValues = false;
- m_aElementName = rtl::OUString();
-
- if (m_pContextPath)
- {
- std::vector<configuration::Path::Component>::const_reverse_iterator it = m_pContextPath->begin();
- std::vector<configuration::Path::Component>::const_reverse_iterator stop = m_pContextPath->end();
-
- OSL_ASSERT(it != stop);
- --stop;
-
- for ( ; it != stop; ++it)
- {
- m_xUpdateHandler->modifyNode(it->getName(),0,0,false);
- }
- }
-}
-// -----------------------------------------------------------------------------
-
-void UpdateDispatcher::endUpdate()
-{
- if (m_pContextPath)
- {
- std::vector<configuration::Path::Component>::const_reverse_iterator it = m_pContextPath->begin();
- std::vector<configuration::Path::Component>::const_reverse_iterator stop = m_pContextPath->end();
-
- OSL_ASSERT(it != stop);
- --stop;
-
- for ( ; it != stop; ++it)
- {
- m_xUpdateHandler->endNode();
- }
- }
- m_xUpdateHandler->endUpdate();
-}
-// -----------------------------------------------------------------------------
-
-void UpdateDispatcher::handle(ValueChange const& aValueNode)
-{
- // special case: doing members of a localized property (as set)
- if (m_bInLocalizedValues)
- {
- rtl::OUString aLocale = aValueNode.getNodeName();
-
- if (aLocale.getLength())
- {
- if ( aValueNode.isToDefault() )
- m_xUpdateHandler->resetPropertyValueForLocale( aLocale );
- else
- m_xUpdateHandler->setPropertyValueForLocale( aValueNode.getNewValue(), aLocale );
- }
- else
- {
- if ( aValueNode.isToDefault() )
- m_xUpdateHandler->resetPropertyValue( );
- else
- m_xUpdateHandler->setPropertyValue( aValueNode.getNewValue() );
- }
- return;
- }
-
- // normal case: updating a single property
- switch (aValueNode.getMode())
- {
- case ValueChange::wasDefault:
- if (aValueNode.isReplacedValue())
- {
-
- OSL_ENSURE(m_bInValueSet, "UpdateDispatcher: Cannot add/replace a value in a nonextensible node");
- OSL_ENSURE(!aValueNode.isLocalizedValue(), "UpdateDispatcher: Cannot add a localized value in a layer");
-
- sal_Int16 nAttr = getUpdateAttributes(aValueNode.getAttributes(),true);
-
- if (aValueNode.getNewValue().hasValue())
- {
- m_xUpdateHandler->addOrReplacePropertyWithValue( aValueNode.getNodeName(),
- nAttr,
- aValueNode.getNewValue());
- }
- else
- {
- m_xUpdateHandler->addOrReplaceProperty( aValueNode.getNodeName(),
- nAttr,
- aValueNode.getValueType());
- }
-
- break;
- }
- // else fall thru to changeValue case
-
- case ValueChange::changeValue:
- {
- sal_Int16 nAttr = getUpdateAttributes(aValueNode.getAttributes(),false);
- sal_Int16 nAttrMask = getUpdateAttributeMask(aValueNode.getAttributes());
-
- m_xUpdateHandler->modifyProperty( aValueNode.getNodeName(),
- nAttr, nAttrMask,
- aValueNode.getValueType() );
-
- if (aValueNode.isLocalizedValue() && m_aLocale.getLength())
- {
- m_xUpdateHandler->setPropertyValueForLocale( aValueNode.getNewValue(), m_aLocale );
- }
- else
- {
- m_xUpdateHandler->setPropertyValue( aValueNode.getNewValue() );
- }
-
- m_xUpdateHandler->endProperty();
- }
- break;
-
- case ValueChange::setToDefault:
- m_xUpdateHandler->resetProperty( aValueNode.getNodeName() );
- break;
-
- case ValueChange::changeDefault:
- OSL_ENSURE(false, "Illegal mode in ValueChange");
- break;
-
- default:
- OSL_ENSURE(false, "Illegal mode in ValueChange");
- break;
- };
-}
-// -----------------------------------------------------------------------------
-
-void UpdateDispatcher::handle(AddNode const& aAddNode)
-{
- rtl::Reference< data::TreeSegment > aAddedTree = aAddNode.getNewTree();
-
- OSL_ENSURE(aAddedTree.is(), "AddNode has no new data -> cannot add anything");
-
- OSL_ENSURE( ((m_bInValueSet||m_bInLocalizedValues) == aAddedTree->fragment->nodes[0].isValue()),
- "Found added subtree in value set (extensible group)\n" );
-
- this->visitTree(aAddedTree->fragment);
-}
-// -----------------------------------------------------------------------------
-
-void UpdateDispatcher::handle(RemoveNode const& aRemoveNode)
-{
- OSL_ENSURE( !m_bInLocalizedValues, "UpdateDispatcher: Removing values for a specific locale is currently not supported");
-
- rtl::Reference< data::TreeSegment > aRemovedTree = aRemoveNode.getRemovedTree();
-
- OSL_ENSURE( !aRemovedTree.is() ||
- ((m_bInValueSet||m_bInLocalizedValues) == aRemovedTree->fragment->nodes[0].isValue()),
- "Found removed subtree in value set (extensible group)\n" );
-
- if (m_bInLocalizedValues)
- OSL_TRACE("configmgr: UpdateDispatcher - Removing value for locale ignored");
-
- else if (m_bInValueSet)
- m_xUpdateHandler->removeProperty( aRemoveNode.getNodeName() );
-
- else
- m_xUpdateHandler->removeNode( aRemoveNode.getNodeName() );
-}
-// -----------------------------------------------------------------------------
-
-void UpdateDispatcher::handle(SubtreeChange const& aSubtree)
-{
- OSL_ENSURE( !m_bInLocalizedValues, "UpdateDispatcher: A localized value cannot be a complete subtree");
- OSL_ENSURE( !m_bInValueSet, "UpdateDispatcher: A dynamic property cannot be a complete subtree");
-
- sal_Int16 nAttr = getUpdateAttributes(aSubtree.getAttributes(),false);
- sal_Int16 nAttrMask = getUpdateAttributeMask(aSubtree.getAttributes());
-
- if (isLocalizedValueSet(aSubtree))
- {
- m_xUpdateHandler->modifyProperty( aSubtree.getNodeName(),
- nAttr, nAttrMask,
- uno::Type() );
-
- m_bInLocalizedValues = true;
- this->applyToChildren(aSubtree);
- m_bInLocalizedValues = false;
-
- m_xUpdateHandler->endProperty();
- }
-
- else
- {
- m_xUpdateHandler->modifyNode( aSubtree.getNodeName(),
- nAttr, nAttrMask,
- aSubtree.isToDefault() );
-
- m_bInValueSet = isValueSet(aSubtree);
- this->applyToChildren(aSubtree);
- m_bInValueSet = false;
-
- m_xUpdateHandler->endNode();
- }
-}
-// -----------------------------------------------------------------------------
-
-bool UpdateDispatcher::handle(sharable::ValueNode * node)
-{
- rtl::OUString aName;
-
- // special case: doing members of a localized property (as set)
- if (m_bInLocalizedValues)
- {
- // the node name is the locale
- rtl::OUString aLocale;
- OSL_VERIFY(testReplacedAndGetName(sharable::node(node), aLocale)); // "Adding a localized subvalue but not as root of element tree"
-
- if (aLocale.getLength() && ! localehelper::isDefaultLanguage(aLocale))
- {
- m_xUpdateHandler->setPropertyValueForLocale(node->getValue(), aLocale);
- }
- else
- {
- m_xUpdateHandler->setPropertyValue(node->getValue());
- }
- }
- else if (testReplacedAndGetName(sharable::node(node), aName) && sharable::node(node)->getAttributes().isRemovable()) // we must be inside a set of values
- {
-
- OSL_ENSURE(!node->info.isLocalized(), "UpdateDispatcher: Cannot add a localized value in a layer .");
-
- sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),true);
-
- if (!node->isNull())
- {
- m_xUpdateHandler->addOrReplacePropertyWithValue( aName,
- nAttr,
- node->getValue());
- }
- else
- {
- m_xUpdateHandler->addOrReplaceProperty( aName,
- nAttr,
- node->getValueType());
- }
- }
- else // normal case: updating a single property //Inserting set
- {
- sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),false);
- sal_Int16 nAttrMask = getUpdateAttributeMask(sharable::node(node)->getAttributes());
-
- m_xUpdateHandler->modifyProperty( aName, nAttr, nAttrMask, node->getValueType() );
-
- if (node->info.isLocalized() && m_aLocale.getLength())
- {
- m_xUpdateHandler->setPropertyValueForLocale(node->getValue(), m_aLocale);
- }
- else
- {
- m_xUpdateHandler->setPropertyValue(node->getValue());
- }
-
- m_xUpdateHandler->endProperty();
- }
- return false;
-}
-// -----------------------------------------------------------------------------
-
-bool UpdateDispatcher::handle(sharable::GroupNode * node)
-{
- OSL_ENSURE( !m_bInLocalizedValues, "UpdateDispatcher: A localized value cannot be a complete group");
-
- rtl::OUString aName;
-
- if ( testReplacedAndGetName(sharable::node(node), aName) )
- {
- sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),true);
-
- m_xUpdateHandler->addOrReplaceNode( aName, nAttr );
-
- this->visitChildren(node);
-
- m_xUpdateHandler->endNode();
- }
- else
- {
- sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),false);
- sal_Int16 nAttrMask = getUpdateAttributeMask(sharable::node(node)->getAttributes());
-
- m_xUpdateHandler->modifyNode( aName, nAttr, nAttrMask, false );
-
- this->visitChildren(node);
-
- m_xUpdateHandler->endNode();
- }
- return false;
-}
-// -----------------------------------------------------------------------------
-
-bool UpdateDispatcher::handle(sharable::SetNode * node)
-{
- OSL_ENSURE( !m_bInLocalizedValues, "UpdateDispatcher: A localized value cannot be a complete set");
-
- rtl::OUString aName;
-
- if ( testReplacedAndGetName(sharable::node(node), aName) )
- {
- OSL_ENSURE( !node->info.isLocalized(), "UpdateDispatcher: Cannot add a localized value in a layer." );
-
- sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),true);
-
- m_xUpdateHandler->addOrReplaceNode( aName, nAttr );
-
- this->visitElements(node);
-
- m_xUpdateHandler->endNode();
- }
- else
- {
- sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),false);
- sal_Int16 nAttrMask = getUpdateAttributeMask(sharable::node(node)->getAttributes());
-
- if (node->info.isLocalized())
- {
- m_xUpdateHandler->modifyProperty( aName, nAttr, nAttrMask, uno::Type() );
-
- m_bInLocalizedValues = true;
- this->visitElements(node);
- m_bInLocalizedValues = false;
-
- m_xUpdateHandler->endProperty();
- }
-
- else
- {
- m_xUpdateHandler->modifyNode( aName, nAttr, nAttrMask, false );
-
- this->visitElements(node);
-
- m_xUpdateHandler->endNode();
- }
- }
- return false;
-}
-// -----------------------------------------------------------------------------
-
-bool UpdateDispatcher::testReplacedAndGetName(sharable::Node * node, rtl::OUString & _aName)
-{
- if (m_aElementName.getLength())
- {
- OSL_ENSURE( node->isFragmentRoot(), "ERROR - UpdateDispatcher: Found orphaned 'element' name for inner node");
- _aName = m_aElementName;
- m_aElementName = rtl::OUString();
- return true;
- }
- else
- {
- OSL_ENSURE(!node->isFragmentRoot(), "ERROR - UpdateDispatcher: Found no 'element' name for fragment root node");
- _aName = node->getName();
- return false;
- }
-}
-// -----------------------------------------------------------------------------
-
-bool UpdateDispatcher::handle(sharable::TreeFragment * tree)
-{
- m_aElementName = tree->getName();
- bool done = SetVisitor::handle(tree); // dispatch to root node
- m_aElementName = rtl::OUString(); // clear - just to be safe
- return done;
-}
-// -----------------------------------------------------------------------------
-
-sal_Int16 UpdateDispatcher::getUpdateAttributes(node::Attributes const & _aAttributes, bool bAdded)
-{
- namespace NodeAttribute = backenduno::NodeAttribute;
-
- // no support for post-creation attribute changes yet
- if (!bAdded)
- {
- OSL_ENSURE( getUpdateAttributeMask(_aAttributes) == 0,
- "Incomplete support for attribute changes" );
- return 0;
- }
-
- sal_Int16 nResult = 0;
-
- if (_aAttributes.isReadonly())
- nResult = NodeAttribute::READONLY;
-
- if (_aAttributes.isFinalized())
- nResult |= NodeAttribute::FINALIZED;
-
- if (!_aAttributes.isNullable())
- nResult |= NodeAttribute::MANDATORY;
-
- return nResult;
-}
-// -----------------------------------------------------------------------------
-
-sal_Int16 UpdateDispatcher::getUpdateAttributeMask(node::Attributes const & /*_aAttributes*/)
-{
- // no support for post-creation attribute changes yet
- return 0;
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace backend
-
-// -------------------------------------------------------------------------
-} // namespace configmgr
diff --git a/configmgr/source/backend/updatedispatch.hxx b/configmgr/source/backend/updatedispatch.hxx
deleted file mode 100644
index 139c3aee02fc..000000000000
--- a/configmgr/source/backend/updatedispatch.hxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_UPDATEDISPATCH_HXX
-#define CONFIGMGR_BACKEND_UPDATEDISPATCH_HXX
-
-#include "change.hxx"
-#include "nodevisitor.hxx"
-#include "utility.hxx"
-#include <boost/utility.hpp>
-#include <com/sun/star/uno/Reference.hxx>
-
-namespace com { namespace sun { namespace star { namespace configuration { namespace backend {
- class XUpdateHandler;
-} } } } }
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace configuration
- {
- class AbsolutePath;
- }
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace backenduno = ::com::sun::star::configuration::backend;
-
-// -----------------------------------------------------------------------------
-
- class UpdateDispatcher: private boost::noncopyable, private ChangeTreeAction, private data::SetVisitor
- {
- public:
- UpdateDispatcher(uno::Reference< backenduno::XUpdateHandler > const & _xUpdateHandler, rtl::OUString const & _aLocale);
- ~UpdateDispatcher();
-
- void dispatchUpdate(configuration::AbsolutePath const & _aRootPath, SubtreeChange const& _anUpdate);
-
- protected:
- using data::NodeVisitor::handle;
-
- private:
- void startUpdate();
- void endUpdate();
-
- virtual void handle(ValueChange const& aValueNode);
- virtual void handle(AddNode const& aAddNode);
- virtual void handle(RemoveNode const& aRemoveNode);
- virtual void handle(SubtreeChange const& aSubtree) ;
-
- virtual bool handle(sharable::ValueNode * node);
- virtual bool handle(sharable::GroupNode * node);
- virtual bool handle(sharable::SetNode * node);
- virtual bool handle(sharable::TreeFragment * tree);
- private:
- sal_Int16 getUpdateAttributes(node::Attributes const & _aAttributes, bool bAdded);
- sal_Int16 getUpdateAttributeMask(node::Attributes const & _aAttributes);
-
- bool testReplacedAndGetName(sharable::Node * node, rtl::OUString & _aName);
- private:
- configuration::AbsolutePath const * m_pContextPath;
- uno::Reference< backenduno::XUpdateHandler > m_xUpdateHandler;
- rtl::OUString m_aLocale;
- rtl::OUString m_aElementName;
- bool m_bInValueSet;
- bool m_bInLocalizedValues;
- };
-// -----------------------------------------------------------------------------
- } // namespace backend
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-
diff --git a/configmgr/source/backend/updatesvc.cxx b/configmgr/source/backend/updatesvc.cxx
deleted file mode 100644
index dca013e5c1b9..000000000000
--- a/configmgr/source/backend/updatesvc.cxx
+++ /dev/null
@@ -1,278 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include "updatesvc.hxx"
-
-#ifndef CONFIGMGR_API_FACTORY_HXX_
-#include "confapifactory.hxx"
-#endif
-#include "emptylayer.hxx"
-#include <com/sun/star/configuration/backend/XUpdatableLayer.hpp>
-#include <com/sun/star/configuration/backend/XLayerHandler.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace beans = ::com::sun::star::beans;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-
-sal_Char const * const aUpdateMergerServices[] =
-{
- "com.sun.star.configuration.backend.LayerUpdateMerger",
- 0
-};
-const ServiceImplementationInfo aUpdateMergerSI =
-{
- "com.sun.star.comp.configuration.backend.LayerUpdateMerger",
- aUpdateMergerServices,
- 0
-};
-// -----------------------------------------------------------------------------
-
-const ServiceRegistrationInfo* getUpdateMergerServiceInfo()
-{ return getRegistrationInfo(& aUpdateMergerSI); }
-// -----------------------------------------------------------------------------
-
-inline
-ServiceInfoHelper UpdateService::getServiceInfo()
-{
- return & aUpdateMergerSI;
-}
-// -----------------------------------------------------------------------------
-
-
-UpdateService::UpdateService(uno::Reference< uno::XComponentContext > const & _xContext)
-: m_xServiceFactory(_xContext->getServiceManager(),uno::UNO_QUERY)
-, m_aSourceMode(merge)
-{
- if (!m_xServiceFactory.is())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Update Merger: Context has no service manager (or missing interface)"));
- throw uno::RuntimeException(sMessage,NULL);
- }
-}
-// -----------------------------------------------------------------------------
-
-// XInitialization
-
-void SAL_CALL
- UpdateService::initialize( const uno::Sequence< uno::Any >& aArguments )
- throw (uno::Exception, uno::RuntimeException)
-{
- sal_Int16 const nCount = static_cast<sal_Int16>(aArguments.getLength());
-
- if (sal_Int32(nCount) != aArguments.getLength())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Update Merger"));
- throw lang::IllegalArgumentException(sMessage,*this,0);
- }
-
- for (sal_Int16 i = 0; i < nCount; ++i)
- {
- uno::Reference< backenduno::XUpdatableLayer > xUpdLayer;
- if (aArguments[i] >>= xUpdLayer)
- {
- m_xSourceLayer = xUpdLayer.get();
- m_xLayerWriter.clear();
-
- OSL_ASSERT( uno::Reference< backenduno::XUpdatableLayer >::query(m_xSourceLayer).is() || !xUpdLayer.is() );
-
- continue;
- }
-
- if (aArguments[i] >>= m_xSourceLayer)
- continue;
-
- if (aArguments[i] >>= m_xLayerWriter)
- continue;
-
- beans::NamedValue aExtraArg;
- if (aArguments[i] >>= aExtraArg)
- {
- OSL_VERIFY( setImplementationProperty(aExtraArg.Name, aExtraArg.Value) );
-
- continue;
- }
-
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration Update Merger"
- "- XLayer, XLayerHandler or XUpdatableLayer expected"));
- throw lang::IllegalArgumentException(sMessage,*this,i);
- }
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool UpdateService::setImplementationProperty(rtl::OUString const & aName, uno::Any const & aValue)
-{
- if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Overwrite")))
- {
- sal_Bool bOverwrite = sal_False;
- if (aValue >>= bOverwrite)
- {
- if (!bOverwrite)
- m_aSourceMode = protect;
-
- else if (protect == m_aSourceMode)
- m_aSourceMode = merge;
-
- return true;
- }
- }
-
- else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Truncate")))
- {
- sal_Bool bTruncate = sal_False;
- if (aValue >>= bTruncate)
- {
- if (!bTruncate)
- m_aSourceMode = merge;
-
- else if (merge == m_aSourceMode)
- m_aSourceMode = truncate;
-
- return true;
- }
- }
-
- return false;
-}
-// -----------------------------------------------------------------------------
-
-bool UpdateService::validateSourceLayerAndCheckNotEmpty() SAL_THROW( (lang::IllegalAccessException) )
-{
- switch (m_aSourceMode)
- {
- case merge: // TODO: check for readonly layer
- return true;
-
- case protect: if (!checkEmptyLayer(m_xSourceLayer))
- raiseIllegalAccessException("UpdateService: Layer already exists");
- // else fall through
-
- case truncate: return false;
-
- default: OSL_ASSERT(!"not reached");
- return true;
- }
-}
-// -----------------------------------------------------------------------------
-
-uno::Reference< backenduno::XLayer > UpdateService::getSourceLayer() SAL_THROW( (lang::IllegalAccessException) )
-{
- if ( validateSourceLayerAndCheckNotEmpty() )
- return m_xSourceLayer;
- else
- return createEmptyLayer();
-}
-// -----------------------------------------------------------------------------
-
-void UpdateService::raiseIllegalAccessException(sal_Char const * pMsg)
- SAL_THROW( (lang::IllegalAccessException) )
-{
- rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
- throw lang::IllegalAccessException(sMsg,*this);
-}
-// -----------------------------------------------------------------------------
-
-void UpdateService::writeUpdatedLayer(uno::Reference< backenduno::XLayer > const & _xLayer)
-{
- OSL_ENSURE( _xLayer.is(), "UpdateService: Trying to write NULL XLayer");
-
- if (!_xLayer.is())
- {
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Update Merger - Internal error: trying to write a NULL Layer"));
- throw uno::RuntimeException(sMessage,*this);
- }
-
- // use our layer writer, if we have one
- if ( m_xLayerWriter.is() )
- {
- _xLayer->readData( m_xLayerWriter );
- return;
- }
-
- // look for an updatable layer otherwise
- uno::Reference< backenduno::XUpdatableLayer > xUpdLayer(m_xSourceLayer, uno::UNO_QUERY);
- if (xUpdLayer.is())
- {
- xUpdLayer->replaceWith( _xLayer );
- return;
- }
-
- rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Update Merger: Cannot write merge results - no recipient available."));
- throw uno::RuntimeException(sMessage,*this);
-}
-// -----------------------------------------------------------------------------
-
-// XServiceInfo
-
-::rtl::OUString SAL_CALL
- UpdateService::getImplementationName( )
- throw (uno::RuntimeException)
-{
- return getServiceInfo().getImplementationName( );
-}
-// -----------------------------------------------------------------------------
-
-
-sal_Bool SAL_CALL
- UpdateService::supportsService( const ::rtl::OUString& ServiceName )
- throw (uno::RuntimeException)
-{
- return getServiceInfo().supportsService( ServiceName );
-}
-// -----------------------------------------------------------------------------
-
-
-uno::Sequence< ::rtl::OUString > SAL_CALL
- UpdateService::getSupportedServiceNames( )
- throw (uno::RuntimeException)
-{
- return getServiceInfo().getSupportedServiceNames( );
-}
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- } // namespace
-
-// -----------------------------------------------------------------------------
-} // namespace
-
diff --git a/configmgr/source/backend/updatesvc.hxx b/configmgr/source/backend/updatesvc.hxx
deleted file mode 100644
index a44e39df6b17..000000000000
--- a/configmgr/source/backend/updatesvc.hxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_BACKEND_UPDATESVC_HXX
-#define CONFIGMGR_BACKEND_UPDATESVC_HXX
-
-#include "serviceinfohelper.hxx"
-#include <cppuhelper/implbase3.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/configuration/backend/XUpdateHandler.hpp>
-
-// -----------------------------------------------------------------------------
-
-namespace com { namespace sun { namespace star { namespace configuration { namespace backend {
- class XLayerHandler;
- class XLayer;
-} } } } }
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace backend
- {
-// -----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
- namespace lang = ::com::sun::star::lang;
- namespace backenduno = ::com::sun::star::configuration::backend;
-// -----------------------------------------------------------------------------
-
- class UpdateService : public ::cppu::WeakImplHelper3<
- lang::XInitialization,
- lang::XServiceInfo,
- backenduno::XUpdateHandler
- >
- {
- public:
- explicit
- UpdateService(uno::Reference< uno::XComponentContext > const & _xContext);
-
- // XInitialization
- virtual void SAL_CALL
- initialize( const uno::Sequence< uno::Any >& aArguments )
- throw (uno::Exception, uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL
- getImplementationName( )
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- supportsService( const ::rtl::OUString& ServiceName )
- throw (uno::RuntimeException);
-
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames( )
- throw (uno::RuntimeException);
-
- protected:
- uno::Reference< lang::XMultiServiceFactory > getServiceFactory() const
- { return m_xServiceFactory; }
-
- void checkSourceLayer() SAL_THROW( (lang::IllegalAccessException) )
- { validateSourceLayerAndCheckNotEmpty(); }
-
- uno::Reference< backenduno::XLayer > getSourceLayer() SAL_THROW( (lang::IllegalAccessException) );
-
- void writeUpdatedLayer(uno::Reference< backenduno::XLayer > const & _xLayer);
-
- virtual sal_Bool setImplementationProperty(rtl::OUString const & aName, uno::Any const & aValue);
-
- void raiseIllegalAccessException(sal_Char const * pMsg)
- SAL_THROW( (lang::IllegalAccessException) );
-
- private:
- bool validateSourceLayerAndCheckNotEmpty() SAL_THROW( (lang::IllegalAccessException) );
-
- private:
- uno::Reference< lang::XMultiServiceFactory > m_xServiceFactory;
- uno::Reference< backenduno::XLayer > m_xSourceLayer;
- uno::Reference< backenduno::XLayerHandler > m_xLayerWriter;
- enum { merge, truncate, protect } m_aSourceMode;
-
- static ServiceInfoHelper getServiceInfo();
- };
-// -----------------------------------------------------------------------------
- } // namespace xml
-// -----------------------------------------------------------------------------
-
-} // namespace configmgr
-#endif
-
-
-
-