summaryrefslogtreecommitdiff
path: root/configmgr/source/backend
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-03-19 15:20:19 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-03-19 15:20:19 +0000
commita0b65deaa6e999132779e26f2b448dfa8662963c (patch)
treea95b27955dfdab804007b22c857171a8fe4bc84a /configmgr/source/backend
parentcf49371243377a126dca9acecf3f7d0a62a47920 (diff)
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'configmgr/source/backend')
-rw-r--r--configmgr/source/backend/backendaccess.cxx33
-rw-r--r--configmgr/source/backend/backendaccess.hxx16
-rw-r--r--configmgr/source/backend/backendfactory.cxx283
-rw-r--r--configmgr/source/backend/componentdatahelper.cxx30
-rw-r--r--configmgr/source/backend/componentdatahelper.hxx26
-rw-r--r--configmgr/source/backend/emptylayerimpl.hxx6
-rw-r--r--configmgr/source/backend/importsvc.cxx28
-rw-r--r--configmgr/source/backend/importsvc.hxx21
-rw-r--r--configmgr/source/backend/layermerge.cxx130
-rw-r--r--configmgr/source/backend/layermerge.hxx17
-rw-r--r--configmgr/source/backend/layerupdatehandler.cxx12
-rw-r--r--configmgr/source/backend/layerupdatehandler.hxx6
-rw-r--r--configmgr/source/backend/makefile.mk4
-rw-r--r--configmgr/source/backend/mergedcomponentdata.cxx20
-rw-r--r--configmgr/source/backend/mergedcomponentdata.hxx12
-rw-r--r--configmgr/source/backend/schemabuilder.cxx65
-rw-r--r--configmgr/source/backend/schemabuilder.hxx10
-rw-r--r--configmgr/source/backend/singlebackendadapter.cxx33
-rw-r--r--configmgr/source/backend/singlebackendadapter.hxx16
-rw-r--r--configmgr/source/backend/updatesvc.cxx10
-rw-r--r--configmgr/source/backend/updatesvc.hxx11
21 files changed, 558 insertions, 231 deletions
diff --git a/configmgr/source/backend/backendaccess.cxx b/configmgr/source/backend/backendaccess.cxx
index b4b144577d6e..57f542cb838e 100644
--- a/configmgr/source/backend/backendaccess.cxx
+++ b/configmgr/source/backend/backendaccess.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: backendaccess.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: ssmith $ $Date: 2002-12-13 10:14:44 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -92,9 +92,13 @@ namespace configmgr { namespace backend {
BackendAccess::BackendAccess(
const uno::Reference<backenduno::XBackend>& xBackend,
- const uno::Reference<lang::XMultiServiceFactory>& xFactory)
- : mFactory(xFactory), mBackend(xBackend)
+ const uno::Reference<uno::XComponentContext>& xContext)
+ : mFactory(xContext->getServiceManager(), uno::UNO_QUERY)
+ , mBackend(xBackend)
{
+ OSL_ENSURE(mFactory.is(), "BackendAccess: Context has no ServiceManager (or it is missing an interface)");
+ if (!mFactory.is())
+ throw uno::RuntimeException(OUString::createFromAscii("BackendAccess: Context has no ServiceManager (or it is missing an interface)"), NULL);
}
//------------------------------------------------------------------------------
@@ -128,9 +132,10 @@ static void merge(
MergedComponentData& aData,
const uno::Sequence<uno::Reference<backenduno::XLayer> >& aLayers,
sal_Int32 aNbLayers,
- const rtl::OUString& aLocale)
+ const rtl::OUString& aLocale,
+ ITemplateDataProvider *aTemplateProvider=NULL)
{
- LayerMergeHandler * pMerger = new LayerMergeHandler(aFactory, aData, OUString());
+ LayerMergeHandler * pMerger = new LayerMergeHandler(aFactory, aData, aTemplateProvider);
uno::Reference<backenduno::XLayerHandler> xLayerMerger(pMerger);
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::merge()");
@@ -138,18 +143,19 @@ static void merge(
for (sal_Int32 i = 0 ; i < aNbLayers ; ++ i)
{
- promoteToDefault(aData) ;
+ pMerger->prepareLayer() ;
aLayers [i]->readData(xLayerMerger) ;
uno::Reference<backenduno::XCompositeLayer> compositeLayer(
aLayers [i], uno::UNO_QUERY) ;
- if (compositeLayer.is()) {
+ if (compositeLayer.is())
+ {
rtl::OUString bestLocale = findBestLocale(
compositeLayer->listSubLayerIds(), aLocale) ;
- if (bestLocale.getLength() > 0) {
- promoteToDefault(aData) ;
+ if (pMerger->prepareSublayer(bestLocale) )
+ {
compositeLayer->readSubLayerData(xLayerMerger, bestLocale) ;
}
}
@@ -158,11 +164,12 @@ static void merge(
//------------------------------------------------------------------------------
ComponentResult BackendAccess::getNodeData(const ComponentRequest& aRequest,
+ ITemplateDataProvider *aTemplateProvider,
INodeDataListener *aListener)
CFG_UNO_THROW_ALL()
{
rtl::OUString component = aRequest.getComponentName().toString() ;
- SchemaBuilder *schemaBuilder = new backend::SchemaBuilder( component ) ;
+ SchemaBuilder *schemaBuilder = new backend::SchemaBuilder( component, aTemplateProvider == NULL ? this:aTemplateProvider ) ;
uno::Reference<backenduno::XSchemaHandler> schemaHandler = schemaBuilder ;
uno::Sequence<uno::Reference<backenduno::XLayer> > layers ;
uno::Reference<backenduno::XSchema> schema ;
@@ -177,7 +184,7 @@ ComponentResult BackendAccess::getNodeData(const ComponentRequest& aRequest,
schema->readSchema(schemaHandler) ;
merge(mFactory, schemaBuilder->result(), layers, layers.getLength(),
- aNodeRequest.getOptions().getLocale());
+ aNodeRequest.getOptions().getLocale(),aTemplateProvider );
ComponentInstance retCode(schemaBuilder->result().extractSchemaTree(),
schemaBuilder->result().extractTemplatesTree(),
@@ -260,7 +267,7 @@ TemplateResult BackendAccess::getTemplateData(const TemplateRequest& aRequest)
templateId.Name = aRequest.getTemplateName().toString() ;
templateId.Component = aRequest.getComponentName().toString() ;
- aResultData = schemaBuilder->result().extractTemplateNode(templateId);
+ aResultData = schemaBuilder->result().extractTemplateNode(templateId.Name);
}
TemplateInstance retCode(aResultData,aRequest.getTemplateName(), aRequest.getComponentName()) ;
diff --git a/configmgr/source/backend/backendaccess.hxx b/configmgr/source/backend/backendaccess.hxx
index 4f72f7492761..790842ee155e 100644
--- a/configmgr/source/backend/backendaccess.hxx
+++ b/configmgr/source/backend/backendaccess.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: backendaccess.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: ssmith $ $Date: 2002-12-13 10:14:44 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,9 +82,12 @@
#include <drafts/com/sun/star/configuration/backend/XBackend.hpp>
#endif // _COM_SUN_STAR_CONFIGURATION_BACKEND_XBACKEND_HPP_
+#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_
+#include <com/sun/star/uno/XComponentContext.hpp>
+#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif // _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#endif
namespace configmgr { namespace backend {
@@ -105,15 +108,16 @@ class BackendAccess : public IMergedDataProvider {
service factory.
@param xBackend backend used for access to data
- @param xFactory factory for instantiation of services
+ @param xContext uno context for instantiation of services
*/
- BackendAccess(const uno::Reference<backenduno::XBackend>& xBackend,
- const uno::Reference<lang::XMultiServiceFactory>& xFactory) ;
+ BackendAccess( const uno::Reference<backenduno::XBackend>& xBackend,
+ const uno::Reference<uno::XComponentContext>& xContext) ;
/** Destructor */
~BackendAccess(void) ;
// IMergedDataProvider
virtual ComponentResult getNodeData(const ComponentRequest& aRequest,
+ ITemplateDataProvider* aTemplateProvider,
INodeDataListener *aListener = NULL)
CFG_UNO_THROW_ALL() ;
virtual void removeRequestListener(INodeDataListener *aListener)
diff --git a/configmgr/source/backend/backendfactory.cxx b/configmgr/source/backend/backendfactory.cxx
index 18bfc7eff32e..75fe1114bd98 100644
--- a/configmgr/source/backend/backendfactory.cxx
+++ b/configmgr/source/backend/backendfactory.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: backendfactory.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: ssmith $ $Date: 2002-12-13 10:14:45 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,6 +61,9 @@
#include "backendfactory.hxx"
+#ifndef CONFIGMGR_API_FACTORY_HXX_
+#include "confapifactory.hxx"
+#endif
#ifndef CONFIGMGR_BOOTSTRAPCONTEXT_HXX_
#include "bootstrapcontext.hxx"
#endif
@@ -70,6 +73,12 @@
#ifndef CONFIGMGR_BACKEND_BACKENDACCESS_HXX_
#include "backendaccess.hxx"
#endif
+#ifndef CONFIGMGR_SERVICEINFOHELPER_HXX_
+#include "serviceinfohelper.hxx"
+#endif
+#ifndef CONFIGMGR_WRAPEXCEPTION_HXX
+#include "wrapexception.hxx"
+#endif
#ifndef _COM_SUN_STAR_CONFIGURATION_CANNOTLOADCONFIGURATIONEXCEPTION_HPP_
@@ -91,27 +100,183 @@ namespace configmgr
// -------------------------------------------------------------------------
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_DefaultSingleBackendServiceAndImplName[] = K_DefaultSingleBackendServiceAndImplName ;
+
+// -------------------------------------------------------------------------
+const sal_Char k_GenericBackendServiceAndImplName[] = "com.sun.star.configuration.backend.Backend" ;
+const sal_Char k_GenericSingleBackendServiceAndImplName[] = "com.sun.star.configuration.backend.SingleBackend" ;
+
+// -------------------------------------------------------------------------
+static AsciiServiceName const k_BackendServiceNames [] =
+{
+ k_DefaultBackendServiceAndImplName,
+ k_GenericBackendServiceAndImplName,
+ 0
+};
+static AsciiServiceName const k_SingleBackendServiceNames [] =
+{
+ k_DefaultSingleBackendServiceAndImplName,
+ k_GenericSingleBackendServiceAndImplName,
+ 0
+};
+// -------------------------------------------------------------------------
+static const ServiceRegistrationInfo k_DefaultBackendServiceInfo =
+{
+ k_DefaultBackendServiceAndImplName,
+ k_BackendServiceNames
+};
+static const ServiceRegistrationInfo k_DefaultSingleBackendServiceInfo =
+{
+ k_DefaultSingleBackendServiceAndImplName,
+ k_SingleBackendServiceNames
+};
+// -------------------------------------------------------------------------
+static const ServiceRegistrationInfo k_GenericBackendServiceInfo =
+{
+ k_GenericBackendServiceAndImplName,
+ k_BackendServiceNames + 1
+};
+static const ServiceRegistrationInfo k_GenericSingleBackendServiceInfo =
+{
+ k_GenericSingleBackendServiceAndImplName,
+ k_SingleBackendServiceNames + 1
+};
+// -------------------------------------------------------------------------
+static const SingletonRegistrationInfo k_DefaultBackendSingletonInfo =
+{
+ K_DefaultBackendSingletonName,
+ k_DefaultBackendServiceAndImplName,
+ k_DefaultBackendServiceAndImplName,
+ & k_GenericBackendServiceInfo
+};
+static const SingletonRegistrationInfo k_DefaultSingleBackendSingletonInfo =
+{
+ K_DefaultSingleBackendSingletonName,
+ k_DefaultSingleBackendServiceAndImplName,
+ k_DefaultSingleBackendServiceAndImplName,
+ & k_GenericSingleBackendServiceInfo
+};
+// -------------------------------------------------------------------------
+// -------------------------------------------------------------------------
+const SingletonRegistrationInfo * getDefaultBackendSingletonInfo()
+{
+ return & k_DefaultBackendSingletonInfo;
+}
+// -------------------------------------------------------------------------
+const SingletonRegistrationInfo * getDefaultSingleBackendSingletonInfo()
+{
+ return & k_DefaultSingleBackendSingletonInfo;
+}
+// -------------------------------------------------------------------------
+
+const ServiceRegistrationInfo * getDefaultBackendServiceInfo()
+{
+ return & k_DefaultBackendServiceInfo;
+}
+// -------------------------------------------------------------------------
+const ServiceRegistrationInfo * getDefaultSingleBackendServiceInfo()
+{
+ return & k_DefaultSingleBackendServiceInfo;
+}
+// -------------------------------------------------------------------------
+// -------------------------------------------------------------------------
+
+uno::Reference<uno::XInterface> SAL_CALL
+ getDefaultBackendSingleton( CreationContext 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;
+}
+// -------------------------------------------------------------------------
+
+uno::Reference<uno::XInterface> SAL_CALL
+ getDefaultSingleBackendSingleton( CreationContext 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_DefaultSingleBackendSingletonName))
+ >>= 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
+ instantiateDefaultSingleBackend(xContext);
+
+ OSL_ENSURE(false, "Cannot recreate configuration backend instantiation failure - using generic error");
+ }
+ // cannot recover any failure
+ throw;
+ }
+
+ return xResult;
+}
+// -------------------------------------------------------------------------
+// -------------------------------------------------------------------------
+
+typedef BackendFactory::CreationContext CreationContext;
+typedef uno::Sequence< uno::Any > UnoInitArgs;
// -------------------------------------------------------------------------
-typedef uno::Sequence< uno::Any > UnoInitArgs;
static
-UnoInitArgs createInitArgs(ConnectionSettings const & _aSettings)
+UnoInitArgs createInitArgs(ContextReader const & _aContext)
{
- uno::Reference< uno::XCurrentContext > xBootstrapArgs = new BootstrapContext(_aSettings.getUnoSettings());
+ OSL_ASSERT(_aContext.hasBootstrapContext());
uno::Sequence< uno::Any > aResult( 1 );
- aResult[0] <<= xBootstrapArgs;
+ aResult[0] <<= _aContext.getBootstrapContext();
return aResult;
}
// -------------------------------------------------------------------------
-typedef BackendFactory::CreationContext CreationContext;
-
static
inline
-uno::Reference< uno::XInterface > createService(CreationContext const & _xCtx, UnoInitArgs const & _aInitArgs, OUString const & _aSvc)
+uno::Reference< uno::XInterface > createService(ContextReader const & _aCtx, UnoInitArgs const & _aInitArgs, OUString const & _aSvc)
{
- OSL_ASSERT(_xCtx.is());
- return _xCtx->createInstanceWithArguments( _aSvc, _aInitArgs);
+ uno::Reference< lang::XMultiComponentFactory > xFactory = _aCtx.getServiceManager();
+ OSL_ENSURE(xFactory.is(),"ERROR: ComponentContext has no service manager\n");
+ if (!xFactory.is()) throw uno::RuntimeException( OUString::createFromAscii("ERROR: ComponentContext has no service manager\n"), NULL );
+ return xFactory->createInstanceWithArgumentsAndContext( _aSvc, _aInitArgs, _aCtx.getBaseContext());
}
// -------------------------------------------------------------------------
@@ -119,8 +284,10 @@ typedef uno::Reference< backenduno::XSingleBackend > UnoSingleBackend;
typedef uno::Reference< backenduno::XBackend > UnoBackend;
static
-UnoBackend wrapSingleBackend(ConnectionSettings const & _aSettings, CreationContext const & _xCtx, UnoInitArgs const & _aInitArgs, UnoSingleBackend const & _xWrappedBackend)
+UnoBackend wrapSingleBackend(ContextReader const & _aSettings, UnoInitArgs const & _aInitArgs, UnoSingleBackend const & _xWrappedBackend)
{
+ OSL_ASSERT(_aSettings.hasUnoBackendWrapper() || _aSettings.hasBootstrapContext());
+
OUString aWrapperSvc = _aSettings.hasUnoBackendWrapper() ?
_aSettings.getUnoBackendWrapper() :
OUString::createFromAscii(k_DefaultBackendWrapper);
@@ -133,19 +300,21 @@ UnoBackend wrapSingleBackend(ConnectionSettings const & _aSettings, CreationCont
aExtendedArgs.realloc( nBaseArgsCount + 1 );
aExtendedArgs[nBaseArgsCount] <<= _xWrappedBackend;
- return UnoBackend::query( createService(_xCtx,aExtendedArgs,aWrapperSvc) );
+ return UnoBackend::query( createService(_aSettings,aExtendedArgs,aWrapperSvc) );
}
// -------------------------------------------------------------------------
static
-UnoBackend createOfflineBackend(ConnectionSettings const & _aSettings, CreationContext const & _xCtx, UnoInitArgs const & _aInitArgs)
+UnoBackend createOfflineBackend(ContextReader const & _aSettings, UnoInitArgs const & _aInitArgs)
{
+ OSL_ASSERT(_aSettings.hasUnoBackendWrapper() || _aSettings.hasBootstrapContext());
+
UnoBackend xResult;
if ( _aSettings.hasUnoBackendWrapper() )
{
OUString const aWrapperSvc = _aSettings.getUnoBackendWrapper();
- xResult = UnoBackend::query( createService(_xCtx,_aInitArgs,aWrapperSvc) );
+ xResult = UnoBackend::query( createService(_aSettings,_aInitArgs,aWrapperSvc) );
}
return xResult;
@@ -153,34 +322,36 @@ UnoBackend createOfflineBackend(ConnectionSettings const & _aSettings, CreationC
// -------------------------------------------------------------------------
static
-uno::Reference< uno::XInterface > createRealBackend(ConnectionSettings const & _aSettings, CreationContext const & _xCtx, UnoInitArgs const & _aInitArgs)
+uno::Reference< uno::XInterface > createRealBackend(ContextReader const & _aSettings, UnoInitArgs const & _aInitArgs)
{
+ OSL_ASSERT(_aSettings.hasUnoBackendService() || _aSettings.hasBootstrapContext());
+
OUString const aBackendServiceName = _aSettings.hasUnoBackendService() ?
_aSettings.getUnoBackendService() :
OUString::createFromAscii(k_DefaultBackendService);
uno::Reference< uno::XInterface > xResult =
- createService(_xCtx,_aInitArgs,aBackendServiceName);
+ createService(_aSettings,_aInitArgs,aBackendServiceName);
return xResult;
}
// -------------------------------------------------------------------------
static
-UnoBackend createOnlineBackend(ConnectionSettings const & _aSettings, CreationContext const & _xCtx, UnoInitArgs const & _aInitArgs)
+UnoBackend createOnlineBackend(ContextReader const & _aSettings, UnoInitArgs const & _aInitArgs)
{
OSL_ENSURE( _aSettings.isUnoBackend(), "ERROR - BackendFactory: For legacy backends use createSessionBackend()");
UnoBackend xResult;
- uno::Reference< uno::XInterface > xRealBackend = createRealBackend(_aSettings,_xCtx,_aInitArgs);
+ uno::Reference< uno::XInterface > xRealBackend = createRealBackend(_aSettings,_aInitArgs);
if (_aSettings.hasUnoBackendWrapper())
{
// try wrapping a single backend
UnoSingleBackend xSingleRealBackend( xRealBackend, uno::UNO_QUERY);
if (xSingleRealBackend.is())
- xResult = wrapSingleBackend(_aSettings,_xCtx,_aInitArgs,xSingleRealBackend);
+ xResult = wrapSingleBackend(_aSettings,_aInitArgs,xSingleRealBackend);
// if we don't have one, try using it as unwrapped backend
else
@@ -195,7 +366,7 @@ UnoBackend createOnlineBackend(ConnectionSettings const & _aSettings, CreationCo
// try the default wrapper if we only have a single backend
UnoSingleBackend xSingleRealBackend( xRealBackend, uno::UNO_QUERY);
if (xSingleRealBackend.is())
- xResult = wrapSingleBackend(_aSettings,_xCtx,_aInitArgs,xSingleRealBackend);
+ xResult = wrapSingleBackend(_aSettings,_aInitArgs,xSingleRealBackend);
else
OSL_ENSURE( !xRealBackend.is(), "Configuration Backend implements no known backend interface" );
@@ -206,52 +377,82 @@ UnoBackend createOnlineBackend(ConnectionSettings const & _aSettings, CreationCo
}
// -------------------------------------------------------------------------
-UnoBackend BackendFactory::createDefaultUnoBackend(CreationContext const & _xCtx)
+static UnoBackend createUnoBackend(CreationContext const& _xCtx)
{
- BootstrapSettings aBootstrapData( getBootstrapContext(_xCtx) );
+ ContextReader aSettings(_xCtx);
+ OSL_ENSURE( aSettings.isUnoBackend(), "ERROR - BackendFactory: Legacy backends are not supported any more");
- return createUnoBackend(aBootstrapData.settings,_xCtx);
-}
-// -------------------------------------------------------------------------
-
-UnoBackend BackendFactory::createUnoBackend(ConnectionSettings const & _aSettings, CreationContext const & _xCtx)
-{
- UnoInitArgs aArguments = createInitArgs(_aSettings);
+ UnoInitArgs aArguments = createInitArgs(aSettings);
- sal_Bool bOffline = _aSettings.hasOfflineSetting() ? _aSettings.getOfflineSetting() : !_aSettings.hasUnoBackendService();
+ sal_Bool bOffline = aSettings.hasOfflineSetting() ? aSettings.getOfflineSetting() : !aSettings.hasUnoBackendService();
UnoBackend xResult;
if (!bOffline)
- xResult = createOnlineBackend(_aSettings,_xCtx,aArguments);
+ xResult = createOnlineBackend (aSettings,aArguments);
if (!xResult.is())
- xResult = createOfflineBackend(_aSettings,_xCtx,aArguments);
+ 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 )
-rtl::Reference<IMergedDataProvider>
- BackendFactory::createBackend(ConnectionSettings const & _aSettings, CreationContext const & _xCtx)
+// -------------------------------------------------------------------------
+
+uno::Reference<uno::XInterface> SAL_CALL instantiateDefaultBackend( CreationContext const& xTargetContext )
{
- OSL_ENSURE( _aSettings.isUnoBackend(), "ERROR - BackendFactory: For legacy backends use createSessionBackend()");
+ CreationContext xContext = UnoContextTunnel::recoverContext(xTargetContext);
+
+ try
+ {
+ return createUnoBackend(xContext);
+ }
+ TUNNEL_ALL_EXCEPTIONS()
+}
+// -------------------------------------------------------------------------
+uno::Reference<uno::XInterface> SAL_CALL instantiateDefaultSingleBackend( CreationContext const& xTargetContext )
+{
+ CreationContext xContext = UnoContextTunnel::recoverContext(xTargetContext);
+
+ ContextReader aSettings( xContext );
+ UnoInitArgs aArguments = createInitArgs(aSettings);
+
+ try
+ {
+ return createRealBackend(aSettings,aArguments);
+ }
+ TUNNEL_ALL_EXCEPTIONS()
+}
+
+// -------------------------------------------------------------------------
+
+UnoBackend BackendFactory::getUnoBackend()
+{
+ return UnoBackend::query( getDefaultBackendSingleton(m_xCtx) );
+}
+// -------------------------------------------------------------------------
+
+rtl::Reference<IMergedDataProvider> BackendFactory::createBackend()
+{
rtl::Reference< IMergedDataProvider > xBackend;
- UnoBackend xBackendService = createUnoBackend(_aSettings, _xCtx);
+ UnoBackend xBackendService = this->getUnoBackend();
if (xBackendService.is())
- xBackend = new BackendAccess(xBackendService, _xCtx);
+ xBackend = new BackendAccess(xBackendService, m_xCtx);
return xBackend;
}
// -------------------------------------------------------------------------
-BackendFactory & BackendFactory::instance()
+BackendFactory BackendFactory::instance(CreationContext const & _xCtx)
{
- static BackendFactory aStaticFactory;
- return aStaticFactory;
+ return BackendFactory(_xCtx);
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/componentdatahelper.cxx b/configmgr/source/backend/componentdatahelper.cxx
index 2b04a3942c96..71a884499b02 100644
--- a/configmgr/source/backend/componentdatahelper.cxx
+++ b/configmgr/source/backend/componentdatahelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: componentdatahelper.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: ssmith $ $Date: 2002-10-24 12:59:33 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,21 +98,23 @@ DataBuilderContext::DataBuilderContext( )
}
// -----------------------------------------------------------------------------
-DataBuilderContext::DataBuilderContext( uno::XInterface * _pContext )
+DataBuilderContext::DataBuilderContext( uno::XInterface * _pContext, ITemplateDataProvider* aTemplateProvider )
: m_aParentStack()
, m_aActiveComponent()
, m_pContext(_pContext)
, m_aExpectedComponentName(OUString())
+, m_aTemplateProvider( aTemplateProvider )
{
}
// -----------------------------------------------------------------------------
-DataBuilderContext::DataBuilderContext( uno::XInterface * _pContext, const OUString& aExpectedComponentName )
+DataBuilderContext::DataBuilderContext( uno::XInterface * _pContext, const OUString& aExpectedComponentName, ITemplateDataProvider* aTemplateProvider )
: m_aParentStack()
, m_aActiveComponent()
, m_pContext(_pContext)
, m_aExpectedComponentName( aExpectedComponentName )
+, m_aTemplateProvider( aTemplateProvider )
{
}
@@ -227,21 +229,19 @@ ISubtree & DataBuilderContext::implGetCurrentParent() const
}
// -----------------------------------------------------------------------------
-void DataBuilderContext::ensureWritable(INode const * pNode) const
- CFG_UNO_THROW1( lang::IllegalAccessException )
+bool DataBuilderContext::isWritable(INode const * pNode) const
+ CFG_NOTHROW( )
{
OSL_PRECOND(pNode,"Unexpected NULL node pointer");
- if (!pNode->getAttributes().bWritable)
- raiseIllegalAccessException("Illegal Access: Cannot remove or replace. Item is mandatory.");
+ return pNode->getAttributes().bWritable;
}
// -----------------------------------------------------------------------------
-void DataBuilderContext::ensureRemovable(ISubtree const * pItem) const
- CFG_UNO_THROW1( lang::IllegalAccessException )
+bool DataBuilderContext::isRemovable(ISubtree const * pItem) const
+ CFG_NOTHROW( )
{
OSL_PRECOND(pItem,"Unexpected NULL item pointer");
- if (!pItem->getAttributes().bNullable && !pItem->getAttributes().isReplacedForUser())
- raiseIllegalAccessException("Illegal Access: Cannot remove or replace. Item is mandatory.");
+ return pItem->getAttributes().bNullable || pItem->getAttributes().isReplacedForUser();
}
// -----------------------------------------------------------------------------
@@ -473,8 +473,12 @@ void DataBuilderContext::endActiveComponent()
OSL_POSTCOND(!hasActiveComponent(), "Component Builder Context: Could not end Component/Template");
}
// -----------------------------------------------------------------------------
+TemplateResult DataBuilderContext::getTemplateData (TemplateRequest const & _aRequest )
+{
+ return(m_aTemplateProvider->getTemplateData (_aRequest));
+}
+// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-
ComponentDataFactory::ComponentDataFactory()
: m_rNodeFactory( getDefaultTreeNodeFactory() )
{
diff --git a/configmgr/source/backend/componentdatahelper.hxx b/configmgr/source/backend/componentdatahelper.hxx
index 33d876ff906e..b039ce448397 100644
--- a/configmgr/source/backend/componentdatahelper.hxx
+++ b/configmgr/source/backend/componentdatahelper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: componentdatahelper.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: ssmith $ $Date: 2002-10-24 12:59:33 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -111,6 +111,13 @@
#define INCLUDED_MEMORY
#endif
+#ifndef CONFIGMGR_BACKEND_MERGEDDATAPROVIDER_HXX
+#include "mergeddataprovider.hxx"
+#endif
+#ifndef CONFIGMGR_BACKEND_REQUEST_HXX_
+#include "request.hxx"
+#endif
+
namespace configmgr
{
// -----------------------------------------------------------------------------
@@ -138,10 +145,11 @@ namespace configmgr
OUString m_aActiveComponent;
uno::XInterface * m_pContext;
OUString m_aExpectedComponentName;
+ ITemplateDataProvider * m_aTemplateProvider;
public:
DataBuilderContext();
- explicit DataBuilderContext(uno::XInterface * _pContext );
- explicit DataBuilderContext(uno::XInterface * _pContext, const OUString& aExpectedComponentName );
+ explicit DataBuilderContext(uno::XInterface * _pContext , ITemplateDataProvider* aTemplateProvider = NULL);
+ explicit DataBuilderContext(uno::XInterface * _pContext, const OUString& aExpectedComponentName,ITemplateDataProvider* aTemplateProvider = NULL );
~DataBuilderContext();
bool isDone() const;
@@ -192,10 +200,10 @@ namespace configmgr
ISubtree * findNode(OUString const & _aName)
CFG_THROW2( MalformedDataException, uno::RuntimeException );
- void ensureWritable(INode const * pNode) const
- CFG_UNO_THROW1( lang::IllegalAccessException );
- void ensureRemovable(ISubtree const * pItem) const
- CFG_UNO_THROW1( lang::IllegalAccessException );
+ bool isWritable(INode const * pNode) const
+ CFG_NOTHROW( );
+ bool isRemovable(ISubtree const * pItem) const
+ CFG_NOTHROW( );
ISubtree * addNodeToCurrent(std::auto_ptr<ISubtree> _aNode)
CFG_THROW3( MalformedDataException, container::ElementExistException, uno::RuntimeException );
@@ -222,6 +230,7 @@ namespace configmgr
CFG_UNO_THROW1( beans::PropertyExistException );
void raiseIllegalTypeException (sal_Char const * _pText) const
CFG_UNO_THROW1( beans::IllegalTypeException );
+ TemplateResult getTemplateData (TemplateRequest const & _aRequest );
private:
INode * findChild(OUString const & _aName)
CFG_THROW2( MalformedDataException, uno::RuntimeException );
@@ -231,6 +240,7 @@ namespace configmgr
ISubtree & implGetCurrentParent() const
CFG_THROW2( MalformedDataException, uno::RuntimeException );
+
};
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/emptylayerimpl.hxx b/configmgr/source/backend/emptylayerimpl.hxx
index 0d2906bc22c1..30d532ebc459 100644
--- a/configmgr/source/backend/emptylayerimpl.hxx
+++ b/configmgr/source/backend/emptylayerimpl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: emptylayerimpl.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jb $ $Date: 2002-11-28 12:58:17 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -174,4 +174,4 @@ namespace configmgr
// -----------------------------------------------------------------------------
} // namespace configmgr
-#endif \ No newline at end of file
+#endif
diff --git a/configmgr/source/backend/importsvc.cxx b/configmgr/source/backend/importsvc.cxx
index ce459fca32c4..2f9df44eef50 100644
--- a/configmgr/source/backend/importsvc.cxx
+++ b/configmgr/source/backend/importsvc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: importsvc.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jb $ $Date: 2002-12-06 13:08:32 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -108,16 +108,16 @@ const ServiceRegistrationInfo* getMergeImportServiceInfo()
{ return getRegistrationInfo(& aMergeImporterSI); }
// -----------------------------------------------------------------------------
-MergeImportService::MergeImportService(CreationArg _xServiceFactory)
-: ImportService(_xServiceFactory, &aMergeImporterSI)
+MergeImportService::MergeImportService(CreationArg _xContext)
+: ImportService(_xContext, &aMergeImporterSI)
{
}
// -----------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL instantiateMergeImporter
-( CreationContext const& rServiceManager )
+( CreationContext const& xContext )
{
- return * new MergeImportService( rServiceManager );
+ return * new MergeImportService( xContext );
}
// -----------------------------------------------------------------------------
@@ -154,16 +154,16 @@ const ServiceRegistrationInfo* getCopyImportServiceInfo()
{ return getRegistrationInfo(& aCopyImporterSI); }
// -----------------------------------------------------------------------------
-CopyImportService::CopyImportService(CreationArg _xServiceFactory)
-: ImportService(_xServiceFactory, &aCopyImporterSI)
+CopyImportService::CopyImportService(CreationArg _xContext)
+: ImportService(_xContext, &aCopyImporterSI)
{
}
// -----------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL instantiateCopyImporter
-( CreationContext const& rServiceManager )
+( CreationContext const& xContext )
{
- return * new CopyImportService( rServiceManager );
+ return * new CopyImportService( xContext );
}
// -----------------------------------------------------------------------------
@@ -195,13 +195,13 @@ sal_Bool CopyImportService::setImplementationProperty(OUString const & aName, un
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-ImportService::ImportService(CreationArg _xServiceFactory, ServiceInfoHelper const & aSvcInfo )
+ImportService::ImportService(CreationArg _xContext, ServiceInfoHelper const & aSvcInfo )
: m_aMutex()
-, m_xServiceFactory(_xServiceFactory)
+, m_xContext(_xContext)
, m_xDestinationBackend()
, m_aServiceInfo(aSvcInfo)
{
- if (!m_xServiceFactory.is())
+ if (!m_xContext.is())
{
OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Importer: Unexpected NULL context"));
throw lang::NullPointerException(sMessage,NULL);
@@ -215,7 +215,7 @@ ImportService::~ImportService()
ImportService::Backend ImportService::createDefaultBackend() const
{
- return BackendFactory::createDefaultUnoBackend( m_xServiceFactory );
+ return BackendFactory::instance( m_xContext ).getUnoBackend();
}
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/importsvc.hxx b/configmgr/source/backend/importsvc.hxx
index f92589a1ceeb..380ab530bbd7 100644
--- a/configmgr/source/backend/importsvc.hxx
+++ b/configmgr/source/backend/importsvc.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: importsvc.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jb $ $Date: 2002-11-28 09:05:12 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,6 +73,9 @@
#include <osl/mutex.hxx>
#endif
+#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_
+#include <com/sun/star/uno/XComponentContext.hpp>
+#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
@@ -104,10 +107,10 @@ namespace configmgr
>
{
public:
- typedef uno::Reference< lang::XMultiServiceFactory > const & CreationArg;
+ typedef uno::Reference< uno::XComponentContext > const & CreationArg;
explicit
- ImportService(CreationArg _xServiceFactory, ServiceInfoHelper const & aSvcInfo);
+ ImportService(CreationArg _xContext, ServiceInfoHelper const & aSvcInfo);
~ImportService();
// XInitialization
@@ -147,14 +150,14 @@ namespace configmgr
throw ( lang::WrappedTargetException, lang::IllegalArgumentException,
lang::NullPointerException, uno::RuntimeException);
protected:
+ typedef uno::Reference< uno::XComponentContext > Context;
typedef uno::Reference< lang::XMultiServiceFactory > ServiceFactory;
typedef uno::Reference< backenduno::XBackend > Backend;
typedef uno::Reference< backenduno::XLayerHandler > InputHandler;
Backend createDefaultBackend() const;
- ServiceFactory getServiceFactory() const
- { return m_xServiceFactory; }
+ //ServiceFactory getServiceFactory() const
virtual sal_Bool setImplementationProperty( OUString const & aName, uno::Any const & aValue);
private:
@@ -163,7 +166,7 @@ namespace configmgr
private:
osl::Mutex m_aMutex;
- ServiceFactory m_xServiceFactory;
+ Context m_xContext;
Backend m_xDestinationBackend;
ServiceInfoHelper m_aServiceInfo;
@@ -175,7 +178,7 @@ namespace configmgr
class MergeImportService : public ImportService
{
public:
- explicit MergeImportService(CreationArg _xServiceFactory);
+ explicit MergeImportService(CreationArg _xContext);
private:
InputHandler createImportHandler(Backend const & xBackend, OUString const & aEntity);
};
@@ -184,7 +187,7 @@ namespace configmgr
class CopyImportService : public ImportService
{
public:
- explicit CopyImportService(CreationArg _xServiceFactory);
+ explicit CopyImportService(CreationArg _xContext);
private:
InputHandler createImportHandler(Backend const & xBackend, OUString const & aEntity);
sal_Bool setImplementationProperty( OUString const & aName, uno::Any const & aValue);
diff --git a/configmgr/source/backend/layermerge.cxx b/configmgr/source/backend/layermerge.cxx
index dc38b97493a2..25a1997a00b5 100644
--- a/configmgr/source/backend/layermerge.cxx
+++ b/configmgr/source/backend/layermerge.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: layermerge.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: jb $ $Date: 2002-08-20 10:21:31 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -112,7 +112,7 @@ namespace configmgr
MergedComponentData aData;
uno::Reference< backenduno::XLayerHandler >
- test(new LayerMergeHandler(_xServiceFactory, aData, localehelper::getDefaultLocale()));
+ test(new LayerMergeHandler(_xServiceFactory, aData));
}
// -----------------------------------------------------------------------------
@@ -132,15 +132,15 @@ struct LayerMergeHandler::Converter
bool m_bConvertData;
};
// -----------------------------------------------------------------------------
-LayerMergeHandler::LayerMergeHandler(ServiceFactory const & _xServiceFactory, MergedComponentData & _rData, OUString const & _aLocale )
+LayerMergeHandler::LayerMergeHandler(ServiceFactory const & _xServiceFactory, MergedComponentData & _rData, ITemplateDataProvider* aTemplateProvider )
: m_rData(_rData)
-, m_aContext(static_cast<backenduno::XLayerHandler*>(this))
+, m_aContext(static_cast<backenduno::XLayerHandler*>(this),aTemplateProvider )
, m_aFactory()
-, m_aLocale(_aLocale)
+, m_aLocale()
, m_pProperty(NULL)
, m_pConverter( new Converter(_xServiceFactory) )
, m_nSkipping(0)
-, m_bSublayer(_aLocale.getLength() != 0)
+, m_bSublayer(false)
{
OSL_ENSURE( m_rData.hasSchema(), "Creating layer merger without default data" );
}
@@ -152,9 +152,30 @@ LayerMergeHandler::~LayerMergeHandler( )
}
// -----------------------------------------------------------------------------
+void LayerMergeHandler::prepareLayer()
+{
+ OSL_ENSURE(isDone(), "LayerMergeHandler: Warning: Previous layer or schema not terminated properly");
+ m_aLocale = OUString();
+ m_bSublayer = false;
+
+ promoteToDefault(m_rData);
+}
+// -----------------------------------------------------------------------------
+
+bool LayerMergeHandler::prepareSublayer(OUString const & aLocale)
+{
+ OSL_ENSURE(isDone(), "LayerMergeHandler: Warning: Previous layer not terminated properly");
+
+ m_aLocale = aLocale;
+ m_bSublayer = (aLocale.getLength() != 0);
+
+ return m_bSublayer;
+}
+// -----------------------------------------------------------------------------
+
MergedComponentData & LayerMergeHandler::result()
{
- OSL_ENSURE(isDone(), "LayerMergeHandler: Warning: Schema not terminated properly");
+ OSL_ENSURE(isDone(), "LayerMergeHandler: Warning: Layer not terminated properly");
return m_rData;
}
@@ -162,7 +183,7 @@ MergedComponentData & LayerMergeHandler::result()
MergedComponentData const & LayerMergeHandler::result() const
{
- OSL_ENSURE(isDone(), "LayerMergeHandler: Warning: Schema not terminated properly");
+ OSL_ENSURE(isDone(), "LayerMergeHandler: Warning: Layer not terminated properly");
return m_rData;
}
@@ -477,12 +498,14 @@ void LayerMergeHandler::applyAttributes(INode * pNode, sal_Int16 aNodeAttributes
}
// -----------------------------------------------------------------------------
-void LayerMergeHandler::startOverride(INode * pNode) /* ensure writable, mark merged */
- CFG_UNO_THROW1( lang::IllegalAccessException )
+bool LayerMergeHandler::startOverride(INode * pNode) /* ensure writable, mark merged */
+ CFG_NOTHROW( )
{
- m_aContext.ensureWritable(pNode);
+ if (!m_aContext.isWritable(pNode)) return false;
if (pNode->isDefault()) pNode->modifyState( node::isMerged );
+
+ return true;
}
// -----------------------------------------------------------------------------
@@ -492,8 +515,9 @@ void LayerMergeHandler::ensureUnchanged(INode const * pNode) const
// to do: change state handling to detect this within sets
OSL_PRECOND(pNode,"INTERNAL ERROR: Unexpected NULL node pointer");
- if (pNode->getAttributes().state() == node::isMerged)
- m_aContext.raiseMalformedDataException("Layer merging: Duplicate node or property in this layer");
+ if (!this->isInSublayer())
+ if (pNode->getAttributes().state() == node::isMerged)
+ m_aContext.raiseMalformedDataException("Layer merging: Duplicate node or property in this layer");
}
// -----------------------------------------------------------------------------
@@ -529,6 +553,8 @@ void SAL_CALL LayerMergeHandler::endLayer( )
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");
}
@@ -550,14 +576,17 @@ void LayerMergeHandler::overrideLayerRoot( const OUString& aName, sal_Int16 aAtt
ensureUnchanged(pSchema);
- startOverride(pSchema);
-
- applyAttributes(pSchema,aAttributes);
+ if (startOverride(pSchema))
+ {
+ applyAttributes(pSchema,aAttributes);
- m_aContext.pushNode(pSchema);
+ 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");
+ 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
{
@@ -582,11 +611,14 @@ void SAL_CALL LayerMergeHandler::overrideNode( const OUString& aName, sal_Int16
{
ensureUnchanged(pNode);
- startOverride(pNode);
-
- applyAttributes(pNode, aAttributes);
+ if (startOverride(pNode))
+ {
+ applyAttributes(pNode, aAttributes);
- m_aContext.pushNode(pNode);
+ m_aContext.pushNode(pNode);
+ }
+ else
+ this->skipNode();
}
else // ignore non-matched data
{
@@ -598,20 +630,38 @@ void SAL_CALL LayerMergeHandler::overrideNode( const OUString& aName, sal_Int16
// -----------------------------------------------------------------------------
void LayerMergeHandler::implAddOrReplaceNode( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- CFG_THROW5 (MalformedDataException, container::NoSuchElementException, lang::IllegalAccessException, lang::IllegalArgumentException, uno::RuntimeException)
+ CFG_THROW4 (MalformedDataException, container::NoSuchElementException, lang::IllegalArgumentException, uno::RuntimeException)
{
- std::auto_ptr<INode> apNewInstance = m_rData.instantiateTemplate(aName, aTemplate);
+ ISubtree * pReplacedNode = m_aContext.findNode(aName);
+ if (pReplacedNode)
+ {
+ this->ensureUnchanged(pReplacedNode);
+
+ if (!m_aContext.isRemovable(pReplacedNode))
+ {
+ this->skipNode();
+ return;
+ }
+ }
+
+ std::auto_ptr<INode> apNewInstance;
+ if (aTemplate.Component == m_aContext.getActiveComponent())
+ {
+ apNewInstance = m_rData.instantiateTemplate(aName, aTemplate.Name);
+ }
+ else
+ {
+ TemplateRequest aTemplateRequest(configuration::makeName(aTemplate.Name, configuration::Name::NoValidate()),
+ configuration::makeName(aTemplate.Component, configuration::Name::NoValidate()) );
+ apNewInstance = m_aContext.getTemplateData( aTemplateRequest ).extractDataAndClear();
+ }
+
if (NULL == apNewInstance.get())
m_aContext.raiseNoSuchElementException("Layer merging: Cannot instantiate template.", aTemplate.Name);
applyAttributes(apNewInstance.get(), aAttributes);
- if (ISubtree * pReplaced = m_aContext.findNode(aName))
- {
- this->ensureUnchanged(pReplaced);
- m_aContext.ensureRemovable(pReplaced);
- m_aContext.getCurrentParent().removeChild( aName );
- }
+ if (pReplacedNode) m_aContext.getCurrentParent().removeChild( aName );
INode * pAddedInstance = m_aContext.getCurrentParent().addChild( apNewInstance );
@@ -670,7 +720,8 @@ void SAL_CALL LayerMergeHandler::dropNode( const OUString& aName )
if (ISubtree * pDropped = m_aContext.findNode(aName))
{
this->ensureUnchanged(pDropped);
- m_aContext.ensureRemovable(pDropped);
+ if (!m_aContext.isRemovable(pDropped))
+ return;
}
else
{
@@ -692,13 +743,16 @@ void SAL_CALL LayerMergeHandler::overrideProperty( const OUString& aName, sal_In
{
ensureUnchanged(pProp);
- startOverride(pProp);
-
- applyAttributes(pProp,aAttributes);
+ if (startOverride(pProp))
+ {
+ applyAttributes(pProp,aAttributes);
- m_pProperty = pProp;
+ m_pProperty = pProp;
- checkPropertyType(aType);
+ checkPropertyType(aType);
+ }
+ else
+ this->skipNode();
}
else // ignore non-matched data
{
diff --git a/configmgr/source/backend/layermerge.hxx b/configmgr/source/backend/layermerge.hxx
index 70fb0a7d77b1..084e75dc2b8f 100644
--- a/configmgr/source/backend/layermerge.hxx
+++ b/configmgr/source/backend/layermerge.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: layermerge.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jb $ $Date: 2002-07-11 16:58:27 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,11 +105,16 @@ namespace configmgr
typedef uno::Reference< lang::XMultiServiceFactory > ServiceFactory;
explicit
- LayerMergeHandler(ServiceFactory const & _xServiceFactory , MergedComponentData & _rData, OUString const & _aLocale);
+ LayerMergeHandler(ServiceFactory const & _xServiceFactory , MergedComponentData & _rData, ITemplateDataProvider* aTemplateProvider = NULL);
virtual ~LayerMergeHandler();
+ // prepare merging
+ void prepareLayer();
+ bool prepareSublayer(OUString const & aLocale);
+
// checking the result
bool isDone() const { return m_aContext.isDone(); }
+ bool isInSublayer() const { return m_bSublayer; }
MergedComponentData & result();
MergedComponentData const & result() const;
@@ -189,11 +194,11 @@ namespace configmgr
void overrideLayerRoot( const OUString& aName, sal_Int16 aAttributes )
CFG_THROW4 (MalformedDataException, lang::IllegalAccessException, lang::IllegalArgumentException, uno::RuntimeException);
- void startOverride(INode * pNode) /* ensure writable, mark merged */
- CFG_THROW3( MalformedDataException, lang::IllegalAccessException, uno::RuntimeException );
+ bool startOverride(INode * pNode) /* check if writable, mark merged */
+ CFG_NOTHROW( );
void implAddOrReplaceNode(const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes)
- CFG_THROW5 (MalformedDataException, container::NoSuchElementException, lang::IllegalAccessException, lang::IllegalArgumentException, uno::RuntimeException);
+ CFG_THROW4 (MalformedDataException, container::NoSuchElementException, lang::IllegalArgumentException, uno::RuntimeException);
void ensureUnchanged(INode const * pNode) const
CFG_THROW2( MalformedDataException, uno::RuntimeException );
diff --git a/configmgr/source/backend/layerupdatehandler.cxx b/configmgr/source/backend/layerupdatehandler.cxx
index bb87a0470fd1..27a012ce9dcf 100644
--- a/configmgr/source/backend/layerupdatehandler.cxx
+++ b/configmgr/source/backend/layerupdatehandler.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: layerupdatehandler.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: jb $ $Date: 2002-11-28 12:49:12 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,15 +87,15 @@ namespace configmgr
// -----------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL instantiateUpdateMerger
-( CreationContext const& rServiceManager )
+( CreationContext const& xContext )
{
- return * new LayerUpdateHandler( rServiceManager );
+ return * new LayerUpdateHandler( xContext );
}
// -----------------------------------------------------------------------------
-LayerUpdateHandler::LayerUpdateHandler(CreationArg _xServiceFactory)
-: UpdateService(_xServiceFactory)
+LayerUpdateHandler::LayerUpdateHandler(CreationArg _xContext)
+: UpdateService(_xContext)
, m_aBuilder()
{
}
diff --git a/configmgr/source/backend/layerupdatehandler.hxx b/configmgr/source/backend/layerupdatehandler.hxx
index 011f2af36422..3a9bb818a540 100644
--- a/configmgr/source/backend/layerupdatehandler.hxx
+++ b/configmgr/source/backend/layerupdatehandler.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: layerupdatehandler.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jb $ $Date: 2002-06-07 12:01:22 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,7 +98,7 @@ namespace configmgr
{
public:
explicit
- LayerUpdateHandler(CreationArg _xServiceFactory);
+ LayerUpdateHandler(CreationArg _xContext);
~LayerUpdateHandler();
diff --git a/configmgr/source/backend/makefile.mk b/configmgr/source/backend/makefile.mk
index c34c7255da8e..5d63e8ed0a4f 100644
--- a/configmgr/source/backend/makefile.mk
+++ b/configmgr/source/backend/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.10 $
+# $Revision: 1.11 $
#
-# last change: $Author: ssmith $ $Date: 2002-12-13 10:14:47 $
+# last change: $Author: hr $ $Date: 2003-03-19 16:18:48 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
diff --git a/configmgr/source/backend/mergedcomponentdata.cxx b/configmgr/source/backend/mergedcomponentdata.cxx
index 5f40ac1ac4fd..6b43d9c31f76 100644
--- a/configmgr/source/backend/mergedcomponentdata.cxx
+++ b/configmgr/source/backend/mergedcomponentdata.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: mergedcomponentdata.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jb $ $Date: 2002-05-27 10:34:15 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -112,10 +112,10 @@ OUString MergedComponentData::getTemplateAccessor (TemplateIdentifier const & _a
}
// -----------------------------------------------------------------------------
-bool MergedComponentData::hasTemplate(TemplateIdentifier const & _aTemplateName) const
+bool MergedComponentData::hasTemplate(OUString const & _aTemplateName) const
{
return m_pTemplatesTree.get() != NULL &&
- m_pTemplatesTree->getChild( getTemplateAccessor(_aTemplateName) ) != NULL;
+ m_pTemplatesTree->getChild( _aTemplateName ) != NULL;
}
// -----------------------------------------------------------------------------
@@ -131,12 +131,12 @@ std::auto_ptr<ISubtree> MergedComponentData::extractTemplatesTree()
}
// -----------------------------------------------------------------------------
-std::auto_ptr<INode> MergedComponentData::extractTemplateNode(TemplateIdentifier const & _aTemplateName)
+std::auto_ptr<INode> MergedComponentData::extractTemplateNode(OUString const & _aTemplateName)
{
if (m_pTemplatesTree.get() == NULL)
return std::auto_ptr<INode>();
- return m_pTemplatesTree->removeChild(getTemplateAccessor(_aTemplateName));
+ return m_pTemplatesTree->removeChild(_aTemplateName);
}
// -----------------------------------------------------------------------------
@@ -146,9 +146,9 @@ ISubtree const * MergedComponentData::getSchemaTree() const
}
// -----------------------------------------------------------------------------
-ISubtree const * MergedComponentData::findTemplate(TemplateIdentifier const & _aTemplateName) const
+ISubtree const * MergedComponentData::findTemplate(OUString const & _aTemplateName) const
{
- INode const * pTemplateNode = m_pTemplatesTree->getChild(getTemplateAccessor(_aTemplateName));
+ INode const * pTemplateNode = m_pTemplatesTree->getChild(_aTemplateName);
ISubtree const * pTemplateTree = pTemplateNode ? pTemplateNode->asISubtree() : NULL;
@@ -158,9 +158,9 @@ ISubtree const * MergedComponentData::findTemplate(TemplateIdentifier const & _a
}
// -----------------------------------------------------------------------------
-std::auto_ptr<INode> MergedComponentData::instantiateTemplate(OUString const & _aName, TemplateIdentifier const & _aTemplateName) const
+std::auto_ptr<INode> MergedComponentData::instantiateTemplate(OUString const & _aName, OUString const & _aTemplateName) const
{
- if (INode const * pTemplateNode = m_pTemplatesTree->getChild(getTemplateAccessor(_aTemplateName)))
+ if (INode const * pTemplateNode = m_pTemplatesTree->getChild(_aTemplateName))
{
std::auto_ptr<INode> aResult = pTemplateNode->clone();
aResult->setName(_aName);
diff --git a/configmgr/source/backend/mergedcomponentdata.hxx b/configmgr/source/backend/mergedcomponentdata.hxx
index e9294a173f1b..13f128000e70 100644
--- a/configmgr/source/backend/mergedcomponentdata.hxx
+++ b/configmgr/source/backend/mergedcomponentdata.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: mergedcomponentdata.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jb $ $Date: 2002-05-16 10:56:07 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,17 +99,17 @@ namespace configmgr
bool hasSchema() const;
bool hasTemplates() const;
- bool hasTemplate(TemplateIdentifier const & _aTemplateName) const;
+ bool hasTemplate(OUString const & _aTemplateName) const;
OUString getTemplateAccessor (TemplateIdentifier const & _aTemplateName) const;
ISubtree const * getSchemaTree() const;
- ISubtree const * findTemplate(TemplateIdentifier const & _aTemplateName) const;
+ ISubtree const * findTemplate(OUString const & _aTemplateName) const;
ISubtree * getSchemaTree() { return m_pSchemaTree.get(); }
ISubtree * getTemplatesTree() { return m_pTemplatesTree.get(); }
- std::auto_ptr<INode> instantiateTemplate(OUString const & _aName, TemplateIdentifier const & _aTemplateName) const;
+ std::auto_ptr<INode> instantiateTemplate(OUString const & _aName, OUString const & _aTemplateName) const;
void clear();
@@ -118,7 +118,7 @@ namespace configmgr
std::auto_ptr<ISubtree> extractSchemaTree();
std::auto_ptr<ISubtree> extractTemplatesTree();
- std::auto_ptr<INode> extractTemplateNode(TemplateIdentifier const & _aTemplateName);
+ std::auto_ptr<INode> extractTemplateNode(OUString const & _aTemplateName);
private:
std::auto_ptr<ISubtree> m_pSchemaTree;
std::auto_ptr<ISubtree> m_pTemplatesTree;
diff --git a/configmgr/source/backend/schemabuilder.cxx b/configmgr/source/backend/schemabuilder.cxx
index 859e1e7d5c17..24ad017ee2c6 100644
--- a/configmgr/source/backend/schemabuilder.cxx
+++ b/configmgr/source/backend/schemabuilder.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: schemabuilder.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: ssmith $ $Date: 2002-10-24 12:59:34 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,10 +100,11 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
-SchemaBuilder::SchemaBuilder( const OUString& aExpectedComponentName )
+SchemaBuilder::SchemaBuilder( const OUString& aExpectedComponentName, ITemplateDataProvider* aTemplateProvider )
: m_aData()
-, m_aContext(static_cast<backenduno::XSchemaHandler*>(this), aExpectedComponentName )
+, m_aContext(static_cast<backenduno::XSchemaHandler*>(this), aExpectedComponentName, aTemplateProvider )
, m_aFactory()
+, m_aTemplateProvider(aTemplateProvider)
{
}
@@ -160,7 +161,7 @@ void SAL_CALL SchemaBuilder::endSchema( )
void SAL_CALL SchemaBuilder::importComponent( const OUString& aName )
throw (MalformedDataException, container::NoSuchElementException, lang::IllegalArgumentException, uno::RuntimeException)
{
- OSL_TRACE("WARNING: Configuration schema parser: Cross-component references are not yet supported\n");
+ //OSL_TRACE("WARNING: Configuration schema parser: Cross-component references are not yet supported\n");
// OSL_ENSURE(false, "Cross-component references are not yet supported");
}
// -----------------------------------------------------------------------------
@@ -211,7 +212,7 @@ void SAL_CALL SchemaBuilder::startGroupTemplate( const TemplateIdentifier& aTemp
m_aContext.startActiveComponent(aTemplate.Component);
- if (m_aData.hasTemplate(aTemplate))
+ if (m_aData.hasTemplate(aTemplate.Name))
m_aContext.raiseElementExistException("Schema builder: Template already exists",aTemplate.Name);
OUString aName = m_aData.getTemplateAccessor(aTemplate);
@@ -234,7 +235,7 @@ void SAL_CALL SchemaBuilder::startSetTemplate( const TemplateIdentifier& aTempla
m_aContext.startActiveComponent(aTemplate.Component);
- if (m_aData.hasTemplate(aTemplate))
+ if (m_aData.hasTemplate(aTemplate.Name))
m_aContext.raiseElementExistException("Schema builder: Template already exists",aTemplate.Name);
OUString aName = m_aData.getTemplateAccessor(aTemplate);
@@ -422,9 +423,9 @@ namespace
InstanceList m_aReplacementList;
TemplateStack m_aTemplateStack;
public:
- SubstitutionHelper(MergedComponentData & _rData, uno::XInterface * _pContext)
+ SubstitutionHelper(MergedComponentData & _rData, uno::XInterface * _pContext, ITemplateDataProvider* aTemplateProvider=NULL )
: m_rData(_rData)
- , m_aContext(_pContext)
+ , m_aContext(_pContext,aTemplateProvider)
, m_aReplacementList()
, m_aTemplateStack()
{}
@@ -445,7 +446,7 @@ namespace
void SchemaBuilder::substituteInstances()
{
- SubstitutionHelper helper(m_aData, static_cast<backenduno::XSchemaHandler*>(this));
+ SubstitutionHelper helper(m_aData, static_cast<backenduno::XSchemaHandler*>(this),m_aTemplateProvider);
helper.substituteInData();
}
@@ -507,6 +508,7 @@ namespace
void SubstitutionHelper::substitute(OUString const & _aName)
{
+
ISubtree & rParent = m_aContext.getCurrentParent();
std::auto_ptr<INode> pReplacedNode = rParent.removeChild(_aName);
@@ -516,33 +518,46 @@ namespace
OSL_ASSERT( pReplacedInstance != NULL );
TemplateIdentifier aTemplateName = m_aFactory.getInstanceType(*pReplacedInstance);
-
- if (ISubtree const * pTemplate = m_rData.findTemplate(aTemplateName))
+ if (aTemplateName.Component == m_aContext.getActiveComponent())
{
- TemplateStack::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");
+ if (ISubtree const * pTemplate = m_rData.findTemplate(aTemplateName.Name))
+ {
+ TemplateStack::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);
+ m_aTemplateStack.push_back(pTemplate);
- std::auto_ptr< INode > pTemplateInstance = pTemplate->clone();
+ std::auto_ptr< INode > pTemplateInstance = pTemplate->clone();
- pTemplateInstance->setName(_aName);
- // TODO: adjust state/attributes here (?)
+ pTemplateInstance->setName(_aName);
+ // TODO: adjust state/attributes here (?)
- ISubtree * pAddedTree = rParent.addChild(pTemplateInstance)->asISubtree();
+ ISubtree * pAddedTree = rParent.addChild(pTemplateInstance)->asISubtree();
- OSL_ENSURE(pAddedTree, "Could not obtain added template instance");
+ OSL_ENSURE(pAddedTree, "Could not obtain added template instance");
- this->substituteInNode(*pAddedTree);
+ this->substituteInNode(*pAddedTree);
- m_aTemplateStack.pop_back();
+ m_aTemplateStack.pop_back();
+ }
+ else
+ {
+ m_aContext.raiseMalformedDataException("SchemaBuilder: Could not expand instances: Template not found");
+ }
}
+ //Import Template from different component
else
{
- m_aContext.raiseMalformedDataException("SchemaBuilder: Could not expand instances: Template not found");
+ TemplateRequest aTemplateRequest(configuration::makeName(aTemplateName.Name, configuration::Name::NoValidate()),
+ configuration::makeName(aTemplateName.Component, configuration::Name::NoValidate()) );
+ TemplateResult aResult = m_aContext.getTemplateData( aTemplateRequest );
+
+ std::auto_ptr<INode> pTemplateInstance = aResult.extractDataAndClear();
+ pTemplateInstance->setName(_aName);
+ ISubtree * pAddedTree = rParent.addChild(pTemplateInstance)->asISubtree();
+ OSL_ENSURE(pAddedTree, "Could not obtain added template instance");
}
-
}
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/schemabuilder.hxx b/configmgr/source/backend/schemabuilder.hxx
index bf2033cc9199..2b3406aafd46 100644
--- a/configmgr/source/backend/schemabuilder.hxx
+++ b/configmgr/source/backend/schemabuilder.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: schemabuilder.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: ssmith $ $Date: 2002-10-24 12:59:35 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,6 +68,9 @@
#ifndef CONFIGMGR_BACKEND_COMPONENTDATAHELPER_HXX
#include "componentdatahelper.hxx"
#endif
+#ifndef CONFIGMGR_BACKEND_MERGEDDATAPROVIDER_HXX
+#include "mergeddataprovider.hxx"
+#endif
#include <drafts/com/sun/star/configuration/backend/XSchemaHandler.hpp>
@@ -98,7 +101,7 @@ namespace configmgr
: public SchemaBuilder_Base
{
public:
- SchemaBuilder( const OUString& aExpectedComponentName );
+ SchemaBuilder( const OUString& aExpectedComponentName, ITemplateDataProvider* aTemplateProvider = NULL );
virtual ~SchemaBuilder();
// checking the result
@@ -181,6 +184,7 @@ namespace configmgr
MergedComponentData m_aData;
DataBuilderContext m_aContext;
ComponentDataFactory m_aFactory;
+ ITemplateDataProvider * m_aTemplateProvider;
};
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/singlebackendadapter.cxx b/configmgr/source/backend/singlebackendadapter.cxx
index ffc61ba07783..3ed89f92f964 100644
--- a/configmgr/source/backend/singlebackendadapter.cxx
+++ b/configmgr/source/backend/singlebackendadapter.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: singlebackendadapter.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: jb $ $Date: 2002-12-06 13:08:32 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,8 +80,8 @@ namespace configmgr { namespace backend {
//==============================================================================
SingleBackendAdapter::SingleBackendAdapter(
- const uno::Reference<lang::XMultiServiceFactory>& aFactory)
-: BackendBase(mMutex), mFactory(aFactory) {
+ const uno::Reference<uno::XComponentContext>& xContext)
+ : BackendBase(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY) {
}
//------------------------------------------------------------------------------
@@ -148,8 +148,25 @@ SAL_CALL SingleBackendAdapter::listLayers(const rtl::OUString& aComponent,
lang::IllegalArgumentException,
uno::RuntimeException)
{
- return mBackend->getLayers(mBackend->listLayerIds(aComponent, aEntity),
- rtl::OUString()) ;
+ uno::Sequence<uno::Reference<backenduno::XLayer> > retCode =
+ mBackend->getLayers(mBackend->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 ;
}
//------------------------------------------------------------------------------
@@ -200,9 +217,9 @@ const ServiceRegistrationInfo *getSingleBackendAdapterServiceInfo()
}
uno::Reference<uno::XInterface> SAL_CALL
-instantiateSingleBackendAdapter(const CreationContext& aContext)
+instantiateSingleBackendAdapter(const CreationContext& xContext)
{
- return *new SingleBackendAdapter(aContext) ;
+ return *new SingleBackendAdapter(xContext) ;
}
//------------------------------------------------------------------------------
diff --git a/configmgr/source/backend/singlebackendadapter.hxx b/configmgr/source/backend/singlebackendadapter.hxx
index 39b1cc5a3fd2..8e4ef0707ba2 100644
--- a/configmgr/source/backend/singlebackendadapter.hxx
+++ b/configmgr/source/backend/singlebackendadapter.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: singlebackendadapter.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: cyrillem $ $Date: 2002-06-17 14:28:57 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,10 @@
#include <drafts/com/sun/star/configuration/backend/XSingleBackend.hpp>
#endif // _COM_SUN_STAR_CONFIGURATION_BACKEND_XSINGLEBACKEND_HPP_
+#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_
+#include <com/sun/star/uno/XComponentContext.hpp>
+#endif
+
#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
#include <com/sun/star/lang/XInitialization.hpp>
#endif // _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
@@ -78,10 +82,6 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif // _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
-#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif // _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
-
#ifndef _CPPUHELPER_COMPBASE3_HXX_
#include <cppuhelper/compbase3.hxx>
#endif // _CPPUHELPER_COMPBASE3_HXX_
@@ -109,7 +109,7 @@ class SingleBackendAdapter : public BackendBase {
@param aFactory service factory
*/
SingleBackendAdapter(
- const uno::Reference<lang::XMultiServiceFactory>& aFactory) ;
+ const uno::Reference<uno::XComponentContext>& xContext) ;
/** Destructor */
~SingleBackendAdapter(void) ;
@@ -169,7 +169,7 @@ class SingleBackendAdapter : public BackendBase {
protected :
private :
/** Service factory */
- const uno::Reference<lang::XMultiServiceFactory>& mFactory ;
+ uno::Reference<lang::XMultiServiceFactory> mFactory ;
/** Mutex for resource protection */
osl::Mutex mMutex ;
/** Remote backend that the offline cache is handling */
diff --git a/configmgr/source/backend/updatesvc.cxx b/configmgr/source/backend/updatesvc.cxx
index 8ea0cada98be..ddc491f3f385 100644
--- a/configmgr/source/backend/updatesvc.cxx
+++ b/configmgr/source/backend/updatesvc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: updatesvc.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: jb $ $Date: 2002-12-06 13:08:32 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -112,13 +112,13 @@ ServiceInfoHelper UpdateService::getServiceInfo()
// -----------------------------------------------------------------------------
-UpdateService::UpdateService(CreationArg _xServiceFactory)
-: m_xServiceFactory(_xServiceFactory)
+UpdateService::UpdateService(CreationArg _xContext)
+: m_xServiceFactory(_xContext->getServiceManager(),uno::UNO_QUERY)
, m_aSourceMode(merge)
{
if (!m_xServiceFactory.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Update Merger: Unexpected NULL context"));
+ OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Update Merger: Context has no service manager (or missing interface)"));
throw uno::RuntimeException(sMessage,NULL);
}
}
diff --git a/configmgr/source/backend/updatesvc.hxx b/configmgr/source/backend/updatesvc.hxx
index 5105c025bd68..a254725bff07 100644
--- a/configmgr/source/backend/updatesvc.hxx
+++ b/configmgr/source/backend/updatesvc.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: updatesvc.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jb $ $Date: 2002-11-28 12:49:13 $
+ * last change: $Author: hr $ $Date: 2003-03-19 16:18:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,9 @@
#include <cppuhelper/implbase3.hxx>
#endif
+#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_
+#include <com/sun/star/uno/XComponentContext.hpp>
+#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
@@ -107,10 +110,10 @@ namespace configmgr
>
{
public:
- typedef uno::Reference< lang::XMultiServiceFactory > const & CreationArg;
+ typedef uno::Reference< uno::XComponentContext > const & CreationArg;
explicit
- UpdateService(CreationArg _xServiceFactory);
+ UpdateService(CreationArg _xContext);
// XInitialization
virtual void SAL_CALL