summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-11-15 12:37:06 +0000
committerOliver Bolte <obo@openoffice.org>2004-11-15 12:37:06 +0000
commit394456025fa9fc2516946a9ff8328a880451c296 (patch)
treed6d56683c49b8893f89b48a409752819a71f8a34 /configmgr
parentbfa7c57ec48790d8878c9e3d20d6abb71316021c (diff)
INTEGRATION: CWS cfglooseends (1.2.150); FILE MERGED
2004/11/02 16:57:22 jb 1.2.150.1: #109882# Use own servicemanager (-wrapper) for bootstrap context
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/misc/bootstrapcontext.cxx38
1 files changed, 32 insertions, 6 deletions
diff --git a/configmgr/source/misc/bootstrapcontext.cxx b/configmgr/source/misc/bootstrapcontext.cxx
index aa3aa027ce20..12a93012a1a9 100644
--- a/configmgr/source/misc/bootstrapcontext.cxx
+++ b/configmgr/source/misc/bootstrapcontext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: bootstrapcontext.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: hr $ $Date: 2003-03-19 16:19:22 $
+ * last change: $Author: obo $ $Date: 2004-11-15 13:37:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -108,6 +108,7 @@ ComponentContext::ComponentContext(Context const & _xContext)
, m_aMutex()
, m_xContext(_xContext)
, m_hBootstrapData(NULL)
+, m_xServiceManager()
{
}
// ---------------------------------------------------------------------------
@@ -192,11 +193,36 @@ uno::Reference< lang::XMultiComponentFactory > SAL_CALL
ComponentContext::getServiceManager( )
throw (uno::RuntimeException)
{
- Context xBase = basecontext();
- if (!xBase.is())
- throw lang::DisposedException(OUSTR("Parent context has been disposed"),*this);
+ osl::MutexGuard lock(mutex());
+
+ if (!m_xServiceManager.is())
+ {
+ Context xBase = basecontext();
+ if (!xBase.is())
+ throw lang::DisposedException(OUSTR("Parent context has been disposed"),*this);
+
+ ServiceManager xBaseServiceManager = xBase->getServiceManager();
+ OSL_ENSURE( xBaseServiceManager.is(), "Base context has no service manager");
- return xBase->getServiceManager();
+ if (xBaseServiceManager.is())
+ {
+ // create new smgr based on delegate's one
+ m_xServiceManager.set(
+ xBaseServiceManager->createInstanceWithContext( OUSTR("com.sun.star.comp.stoc.OServiceManagerWrapper"), xBase ),
+ uno::UNO_QUERY );
+ // patch DefaultContext property of new one
+ uno::Reference< beans::XPropertySet > xProps( m_xServiceManager, uno::UNO_QUERY );
+ OSL_ASSERT( xProps.is() );
+ if (xProps.is())
+ {
+ uno::Reference< XComponentContext > xThis( this );
+ xProps->setPropertyValue( OUSTR("DefaultContext"), uno::makeAny( xThis ) );
+ }
+ else
+ OSL_ENSURE(!m_xServiceManager.is(), "Cannot set Default Context of Service Manager Wrapper: no property set");
+ }
+ }
+ return m_xServiceManager;
}
// ---------------------------------------------------------------------------