mdrivermanager.cxx (9b5730f6) | mdrivermanager.cxx (8f985ee8) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 111 unchanged lines hidden (view full) --- 120 struct EnsureDriver : public ::std::unary_function< DriverAccess, DriverAccess > 121 { 122 const DriverAccess& operator()( const DriverAccess& _rDescriptor ) const 123 { 124 if ( !_rDescriptor.xDriver.is() ) 125 // we did not load this driver, yet 126 if ( _rDescriptor.xComponentFactory.is() ) 127 // we have a factory for it | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 111 unchanged lines hidden (view full) --- 120 struct EnsureDriver : public ::std::unary_function< DriverAccess, DriverAccess > 121 { 122 const DriverAccess& operator()( const DriverAccess& _rDescriptor ) const 123 { 124 if ( !_rDescriptor.xDriver.is() ) 125 // we did not load this driver, yet 126 if ( _rDescriptor.xComponentFactory.is() ) 127 // we have a factory for it |
128 const_cast< DriverAccess& >( _rDescriptor ).xDriver = _rDescriptor.xDriver.query( _rDescriptor.xComponentFactory->createInstance() ); | 128 const_cast< DriverAccess& >( _rDescriptor ).xDriver = _rDescriptor.xDriver.query( 129 _rDescriptor.xComponentFactory->createInstanceWithContext( _rDescriptor.xUNOContext ) ); |
129 return _rDescriptor; 130 } 131 }; 132 133 //--------------------------------------------------------------------- 134 //--- 24.08.01 11:28:04 ----------------------------------------------- 135 136 /// an STL functor which extracts a SdbcDriver from a DriverAccess --- 176 unchanged lines hidden (view full) --- 313 Reference< XContentEnumerationAccess > xEnumAccess( m_aContext.getLegacyServiceFactory(), UNO_QUERY ); 314 Reference< XEnumeration > xEnumDrivers; 315 if (xEnumAccess.is()) 316 xEnumDrivers = xEnumAccess->createContentEnumeration(SERVICE_SDBC_DRIVER); 317 318 OSL_ENSURE( xEnumDrivers.is(), "OSDBCDriverManager::bootstrapDrivers: no enumeration for the drivers available!" ); 319 if (xEnumDrivers.is()) 320 { | 130 return _rDescriptor; 131 } 132 }; 133 134 //--------------------------------------------------------------------- 135 //--- 24.08.01 11:28:04 ----------------------------------------------- 136 137 /// an STL functor which extracts a SdbcDriver from a DriverAccess --- 176 unchanged lines hidden (view full) --- 314 Reference< XContentEnumerationAccess > xEnumAccess( m_aContext.getLegacyServiceFactory(), UNO_QUERY ); 315 Reference< XEnumeration > xEnumDrivers; 316 if (xEnumAccess.is()) 317 xEnumDrivers = xEnumAccess->createContentEnumeration(SERVICE_SDBC_DRIVER); 318 319 OSL_ENSURE( xEnumDrivers.is(), "OSDBCDriverManager::bootstrapDrivers: no enumeration for the drivers available!" ); 320 if (xEnumDrivers.is()) 321 { |
321 Reference< XSingleServiceFactory > xFactory; | 322 Reference< XSingleComponentFactory > xFactory; |
322 Reference< XServiceInfo > xSI; 323 while (xEnumDrivers->hasMoreElements()) 324 { 325 ::cppu::extractInterface( xFactory, xEnumDrivers->nextElement() ); 326 OSL_ENSURE( xFactory.is(), "OSDBCDriverManager::bootstrapDrivers: no factory extracted" ); 327 328 if ( xFactory.is() ) 329 { 330 // we got a factory for the driver 331 DriverAccess aDriverDescriptor; 332 sal_Bool bValidDescriptor = sal_False; 333 334 // can it tell us something about the implementation name? 335 xSI = xSI.query( xFactory ); 336 if ( xSI.is() ) 337 { // yes -> no need to load the driver immediately (load it later when needed) 338 aDriverDescriptor.sImplementationName = xSI->getImplementationName(); 339 aDriverDescriptor.xComponentFactory = xFactory; | 323 Reference< XServiceInfo > xSI; 324 while (xEnumDrivers->hasMoreElements()) 325 { 326 ::cppu::extractInterface( xFactory, xEnumDrivers->nextElement() ); 327 OSL_ENSURE( xFactory.is(), "OSDBCDriverManager::bootstrapDrivers: no factory extracted" ); 328 329 if ( xFactory.is() ) 330 { 331 // we got a factory for the driver 332 DriverAccess aDriverDescriptor; 333 sal_Bool bValidDescriptor = sal_False; 334 335 // can it tell us something about the implementation name? 336 xSI = xSI.query( xFactory ); 337 if ( xSI.is() ) 338 { // yes -> no need to load the driver immediately (load it later when needed) 339 aDriverDescriptor.sImplementationName = xSI->getImplementationName(); 340 aDriverDescriptor.xComponentFactory = xFactory; |
341 aDriverDescriptor.xUNOContext = m_aContext.getUNOContext(); |
|
340 bValidDescriptor = sal_True; 341 342 m_aEventLogger.log( LogLevel::CONFIG, 343 "found SDBC driver $1$, no need to load it", 344 aDriverDescriptor.sImplementationName 345 ); 346 } 347 else 348 { 349 // no -> create the driver | 342 bValidDescriptor = sal_True; 343 344 m_aEventLogger.log( LogLevel::CONFIG, 345 "found SDBC driver $1$, no need to load it", 346 aDriverDescriptor.sImplementationName 347 ); 348 } 349 else 350 { 351 // no -> create the driver |
350 Reference< XDriver > xDriver( xFactory->createInstance(), UNO_QUERY ); | 352 Reference< XDriver > xDriver( xFactory->createInstanceWithContext( m_aContext.getUNOContext() ), UNO_QUERY ); |
351 OSL_ENSURE( xDriver.is(), "OSDBCDriverManager::bootstrapDrivers: a driver which is no driver?!" ); 352 353 if ( xDriver.is() ) 354 { 355 aDriverDescriptor.xDriver = xDriver; 356 // and obtain it's implementation name 357 xSI = xSI.query( xDriver ); 358 OSL_ENSURE( xSI.is(), "OSDBCDriverManager::bootstrapDrivers: a driver without service info?" ); --- 379 unchanged lines hidden --- | 353 OSL_ENSURE( xDriver.is(), "OSDBCDriverManager::bootstrapDrivers: a driver which is no driver?!" ); 354 355 if ( xDriver.is() ) 356 { 357 aDriverDescriptor.xDriver = xDriver; 358 // and obtain it's implementation name 359 xSI = xSI.query( xDriver ); 360 OSL_ENSURE( xSI.is(), "OSDBCDriverManager::bootstrapDrivers: a driver without service info?" ); --- 379 unchanged lines hidden --- |