You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/09/19 21:22:46 UTC
svn commit: r1387711 - in
/incubator/ooo/trunk/main/connectivity/source/manager: mdrivermanager.cxx
mdrivermanager.hxx
Author: arielch
Date: Wed Sep 19 19:22:46 2012
New Revision: 1387711
URL: http://svn.apache.org/viewvc?rev=1387711&view=rev
Log:
Ensure UNO context propagation on drivers instantiation
Modified:
incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.cxx
incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.hxx
Modified: incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.cxx?rev=1387711&r1=1387710&r2=1387711&view=diff
==============================================================================
--- incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.cxx (original)
+++ incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.cxx Wed Sep 19 19:22:46 2012
@@ -125,7 +125,8 @@ Any SAL_CALL ODriverEnumeration::nextEle
// 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::bootstrapDriver
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::bootstrapDriver
{ // 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::bootstrapDriver
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() )
Modified: incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.hxx?rev=1387711&r1=1387710&r2=1387711&view=diff
==============================================================================
--- incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.hxx (original)
+++ incubator/ooo/trunk/main/connectivity/source/manager/mdrivermanager.hxx Wed Sep 19 19:22:46 2012
@@ -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
};