summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorAriel Constenla-Haile <arielch@apache.org>2012-09-19 18:22:46 +0000
committerAriel Constenla-Haile <arielch@apache.org>2012-09-19 18:22:46 +0000
commit78b2bf15963704fafb823e80bbccb287847fe1db (patch)
tree68066f288e72d69ba79133a016c4af755cc2a820 /connectivity
parent54b984f7f33609f693ba99c24552d2261658ff5e (diff)
Ensure UNO context propagation on drivers instantiation
Notes
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx8
-rw-r--r--connectivity/source/manager/mdrivermanager.hxx7
2 files changed, 10 insertions, 5 deletions
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index 42ac5d37c566..49cff889a686 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -125,7 +125,8 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
// we did not load this driver, yet
if ( _rDescriptor.xComponentFactory.is() )
// we have a factory for it
- const_cast< DriverAccess& >( _rDescriptor ).xDriver = _rDescriptor.xDriver.query( _rDescriptor.xComponentFactory->createInstance() );
+ const_cast< DriverAccess& >( _rDescriptor ).xDriver = _rDescriptor.xDriver.query(
+ _rDescriptor.xComponentFactory->createInstanceWithContext( _rDescriptor.xUNOContext ) );
return _rDescriptor;
}
};
@@ -318,7 +319,7 @@ void OSDBCDriverManager::bootstrapDrivers()
OSL_ENSURE( xEnumDrivers.is(), "OSDBCDriverManager::bootstrapDrivers: no enumeration for the drivers available!" );
if (xEnumDrivers.is())
{
- Reference< XSingleServiceFactory > xFactory;
+ Reference< XSingleComponentFactory > xFactory;
Reference< XServiceInfo > xSI;
while (xEnumDrivers->hasMoreElements())
{
@@ -337,6 +338,7 @@ void OSDBCDriverManager::bootstrapDrivers()
{ // yes -> no need to load the driver immediately (load it later when needed)
aDriverDescriptor.sImplementationName = xSI->getImplementationName();
aDriverDescriptor.xComponentFactory = xFactory;
+ aDriverDescriptor.xUNOContext = m_aContext.getUNOContext();
bValidDescriptor = sal_True;
m_aEventLogger.log( LogLevel::CONFIG,
@@ -347,7 +349,7 @@ void OSDBCDriverManager::bootstrapDrivers()
else
{
// no -> create the driver
- Reference< XDriver > xDriver( xFactory->createInstance(), UNO_QUERY );
+ Reference< XDriver > xDriver( xFactory->createInstanceWithContext( m_aContext.getUNOContext() ), UNO_QUERY );
OSL_ENSURE( xDriver.is(), "OSDBCDriverManager::bootstrapDrivers: a driver which is no driver?!" );
if ( xDriver.is() )
diff --git a/connectivity/source/manager/mdrivermanager.hxx b/connectivity/source/manager/mdrivermanager.hxx
index 8e8201f7de2a..1d4755184ec4 100644
--- a/connectivity/source/manager/mdrivermanager.hxx
+++ b/connectivity/source/manager/mdrivermanager.hxx
@@ -30,7 +30,8 @@
#include <com/sun/star/uno/XNamingService.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/XDriverAccess.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+//#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <cppuhelper/implbase5.hxx>
#include <comphelper/stl_types.hxx>
@@ -48,11 +49,13 @@ namespace drivermanager
typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > SdbcDriver;
DECLARE_STL_USTRINGACCESS_MAP( SdbcDriver, DriverCollection );
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > DriverFactory;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > DriverFactory;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > UNOContext;
struct DriverAccess
{
::rtl::OUString sImplementationName; /// the implementation name of the driver
DriverFactory xComponentFactory; /// the factory to create the driver component (if not already done so)
+ UNOContext xUNOContext; /// ensure UNO context propagation
SdbcDriver xDriver; /// the driver itself
};