summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-04 09:12:44 +0200
committerNoel Grandin <noel@peralex.com>2013-01-09 08:08:14 +0200
commitfd5a2eb07011e8aedfd5ef0a82edaf07221554ba (patch)
treecae1b578b1f5a3faea88499274c23303401a9439 /connectivity
parent3a50e97499d0c1ff6307dcfe9883aea1af300947 (diff)
fdo#46808, new method OConfigurationTreeRoot::createWithComponentContext
and use it to replace usage of createWithServiceFactory, and thus replace usage of XMultiServiceFactory. Change-Id: Id2f44066683ce17cf7a22f80916031556ef0e82a
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/inc/connectivity/DriversConfig.hxx9
-rw-r--r--connectivity/inc/connectivity/dbtools.hxx2
-rw-r--r--connectivity/source/commontools/DriversConfig.cxx6
-rw-r--r--connectivity/source/commontools/dbmetadata.cxx2
-rw-r--r--connectivity/source/commontools/dbtools2.cxx4
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx27
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx4
-rw-r--r--connectivity/source/inc/hsqldb/HDriver.hxx5
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx2
9 files changed, 30 insertions, 31 deletions
diff --git a/connectivity/inc/connectivity/DriversConfig.hxx b/connectivity/inc/connectivity/DriversConfig.hxx
index 4520112a3cca..72b22386e57a 100644
--- a/connectivity/inc/connectivity/DriversConfig.hxx
+++ b/connectivity/inc/connectivity/DriversConfig.hxx
@@ -20,7 +20,6 @@
#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
#include <comphelper/stl_types.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/uno/Sequence.h>
#include "connectivity/dbtoolsdllapi.hxx"
@@ -44,11 +43,11 @@ namespace connectivity
{
mutable ::utl::OConfigurationTreeRoot m_aInstalled;
mutable TInstalledDrivers m_aDrivers;
- void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const;
+ void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) const;
public:
DriversConfigImpl();
- const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const { Load(_rxORB); return m_aDrivers; }
+ const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) const { Load(_rxORB); return m_aDrivers; }
};
//
// Allows to access all driver which are located in the configuration
@@ -59,7 +58,7 @@ namespace connectivity
const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const;
public:
- DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
+ DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB);
~DriversConfig();
DriversConfig( const DriversConfig& );
@@ -73,7 +72,7 @@ namespace connectivity
::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const;
private:
OSharedConfigNode m_aNode;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xORB;
};
}
#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx
index 1fd66e910bf3..78734d8abe27 100644
--- a/connectivity/inc/connectivity/dbtools.hxx
+++ b/connectivity/inc/connectivity/dbtools.hxx
@@ -375,7 +375,7 @@ namespace dbtools
::com::sun::star::uno::Any& /* [out] */ _rSettingsValue
);
- OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString getDefaultReportEngineServiceName(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString getDefaultReportEngineServiceName(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxFactory);
/** quote the given name with the given quote string.
*/
diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx
index 6a204bfb8bdc..8b94f6919d0c 100644
--- a/connectivity/source/commontools/DriversConfig.cxx
+++ b/connectivity/source/commontools/DriversConfig.cxx
@@ -90,14 +90,14 @@ DriversConfigImpl::DriversConfigImpl()
{
}
// -----------------------------------------------------------------------------
-void DriversConfigImpl::Load(const uno::Reference< lang::XMultiServiceFactory >& _rxORB) const
+void DriversConfigImpl::Load(const uno::Reference< uno::XComponentContext >& _rxORB) const
{
if ( m_aDrivers.empty() )
{
if ( !m_aInstalled.isValid() )
{
static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess.Drivers/Installed")); ///Installed
- m_aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
+ m_aInstalled = ::utl::OConfigurationTreeRoot::createWithComponentContext(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
}
if ( m_aInstalled.isValid() )
@@ -116,7 +116,7 @@ void DriversConfigImpl::Load(const uno::Reference< lang::XMultiServiceFactory >&
}
}
// -----------------------------------------------------------------------------
-DriversConfig::DriversConfig(const uno::Reference< lang::XMultiServiceFactory >& _rxORB)
+DriversConfig::DriversConfig(const uno::Reference< uno::XComponentContext >& _rxORB)
:m_xORB(_rxORB)
{
}
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index 06aed4ea1a76..ad9a1a3c01a4 100644
--- a/connectivity/source/commontools/dbmetadata.cxx
+++ b/connectivity/source/commontools/dbmetadata.cxx
@@ -89,7 +89,7 @@ namespace dbtools
DatabaseMetaData_Impl()
:xConnection()
,xConnectionMetaData()
- ,aDriverConfig( ::comphelper::getProcessServiceFactory() )
+ ,aDriverConfig( ::comphelper::getProcessComponentContext() )
,sCachedIdentifierQuoteString()
,sCachedCatalogSeparator()
{
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index acfb227703ab..1b6124a164ca 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -984,9 +984,9 @@ sal_Int32 DBTypeConversion::convertUnicodeStringToLength( const ::rtl::OUString&
return s_sNodeName;
}
// -----------------------------------------------------------------------------
-::rtl::OUString getDefaultReportEngineServiceName(const Reference< XMultiServiceFactory >& _rxORB)
+::rtl::OUString getDefaultReportEngineServiceName(const Reference< XComponentContext >& _rxORB)
{
- ::utl::OConfigurationTreeRoot aReportEngines = ::utl::OConfigurationTreeRoot::createWithServiceFactory(
+ ::utl::OConfigurationTreeRoot aReportEngines = ::utl::OConfigurationTreeRoot::createWithComponentContext(
_rxORB, lcl_getReportEngines(), -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
if ( aReportEngines.isValid() )
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 25087d2ebd24..193adbbf9247 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -74,7 +74,7 @@ namespace connectivity
{
Reference< XInterface > SAL_CALL ODriverDelegator_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFac) throw( Exception )
{
- return *(new ODriverDelegator(_rxFac));
+ return *(new ODriverDelegator(comphelper::getComponentContext(_rxFac)));
}
}
@@ -84,9 +84,9 @@ namespace connectivity
//= ODriverDelegator
//====================================================================
//--------------------------------------------------------------------
- ODriverDelegator::ODriverDelegator(const Reference< XMultiServiceFactory >& _rxFactory)
+ ODriverDelegator::ODriverDelegator(const Reference< XComponentContext >& _rxContext)
: ODriverDelegator_BASE(m_aMutex)
- ,m_xFactory(_rxFactory)
+ ,m_xContext(_rxContext)
,m_bInShutDownConnections(sal_False)
{
}
@@ -131,7 +131,7 @@ namespace connectivity
if ( !m_xDriver.is() )
{
::rtl::OUString sURL("jdbc:hsqldb:db");
- Reference<XDriverManager2> xDriverAccess = DriverManager::create( comphelper::getComponentContext(m_xFactory) );
+ Reference<XDriverManager2> xDriverAccess = DriverManager::create( m_xContext );
m_xDriver = xDriverAccess->getDriverByURL(sURL);
}
@@ -141,14 +141,14 @@ namespace connectivity
//--------------------------------------------------------------------
namespace
{
- ::rtl::OUString lcl_getPermittedJavaMethods_nothrow( const Reference< XMultiServiceFactory >& _rxORB )
+ ::rtl::OUString lcl_getPermittedJavaMethods_nothrow( const Reference< XComponentContext >& _rxContext )
{
::rtl::OUStringBuffer aConfigPath;
aConfigPath.appendAscii( "/org.openoffice.Office.DataAccess/DriverSettings/" );
aConfigPath.append ( ODriverDelegator::getImplementationName_Static() );
aConfigPath.appendAscii( "/PermittedJavaMethods" );
- ::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithServiceFactory(
- _rxORB, aConfigPath.makeStringAndClear() ) );
+ ::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithComponentContext(
+ _rxContext, aConfigPath.makeStringAndClear() ) );
::rtl::OUStringBuffer aPermittedMethods;
Sequence< ::rtl::OUString > aNodeNames( aConfig.getNodeNames() );
@@ -252,7 +252,7 @@ namespace connectivity
// security: permitted Java classes
NamedValue aPermittedClasses(
::rtl::OUString( "hsqldb.method_class_names" ),
- makeAny( lcl_getPermittedJavaMethods_nothrow( m_xFactory ) )
+ makeAny( lcl_getPermittedJavaMethods_nothrow( m_xContext ) )
);
aProperties.put( "SystemProperties", Sequence< NamedValue >( &aPermittedClasses, 1 ) );
@@ -372,12 +372,12 @@ namespace connectivity
static Reference< XTerminateListener> s_xTerminateListener;
if( !s_xTerminateListener.is() )
{
- Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(m_xFactory) );
+ Reference< XDesktop2 > xDesktop = Desktop::create( m_xContext );
s_xTerminateListener = new OConnectionController(this);
xDesktop->addTerminateListener(s_xTerminateListener);
}
- Reference< XComponent> xIfc = new OHsqlConnection( this, xOrig, comphelper::getComponentContext(m_xFactory) );
+ Reference< XComponent> xIfc = new OHsqlConnection( this, xOrig, m_xContext );
xConnection.set(xIfc,UNO_QUERY);
m_aConnections.push_back(TWeakPair(WeakReferenceHelper(xOrig),TWeakConnectionPair(sKey,TWeakRefPair(WeakReferenceHelper(xConnection),WeakReferenceHelper()))));
@@ -817,15 +817,14 @@ namespace connectivity
}
//..............................................................
- ::rtl::OUString lcl_getSystemLocale( const Reference< XMultiServiceFactory >& _rxORB )
+ ::rtl::OUString lcl_getSystemLocale( const Reference< XComponentContext >& _rxContext )
{
::rtl::OUString sLocaleString = ::rtl::OUString( "en-US" );
try
{
//.........................................................
Reference< XMultiServiceFactory > xConfigProvider(
- com::sun::star::configuration::theDefaultProvider::get(
- comphelper::getComponentContext( _rxORB ) ) );
+ com::sun::star::configuration::theDefaultProvider::get( _rxContext ) );
//.........................................................
// arguments for creating the config access
@@ -887,7 +886,7 @@ namespace connectivity
{
::rtl::OUStringBuffer aStatement;
aStatement.appendAscii( "SET DATABASE COLLATION \"" );
- aStatement.appendAscii( lcl_getCollationForLocale( lcl_getSystemLocale( m_xFactory ) ) );
+ aStatement.appendAscii( lcl_getCollationForLocale( lcl_getSystemLocale( m_xContext ) ) );
aStatement.appendAscii( "\"" );
xStatement->execute( aStatement.makeStringAndClear() );
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index a814c1b6665d..3ef5f0c60361 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -757,8 +757,8 @@ void java_sql_Connection::loadDriverFromProperties( const ::rtl::OUString& _sDri
::rtl::OUString java_sql_Connection::impl_getJavaDriverClassPath_nothrow(const ::rtl::OUString& _sDriverClass)
{
static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess/JDBC/DriverClassPaths"));
- ::utl::OConfigurationTreeRoot aNamesRoot = ::utl::OConfigurationTreeRoot::createWithServiceFactory(
- m_pDriver->getContext().getLegacyServiceFactory(), s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
+ ::utl::OConfigurationTreeRoot aNamesRoot = ::utl::OConfigurationTreeRoot::createWithComponentContext(
+ m_pDriver->getContext().getUNOContext(), s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
::rtl::OUString sURL;
if ( aNamesRoot.isValid() && aNamesRoot.hasByName( _sDriverClass ) )
{
diff --git a/connectivity/source/inc/hsqldb/HDriver.hxx b/connectivity/source/inc/hsqldb/HDriver.hxx
index 4288a66651e3..45cac22c8cf7 100644
--- a/connectivity/source/inc/hsqldb/HDriver.hxx
+++ b/connectivity/source/inc/hsqldb/HDriver.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/sdbcx/XCreateCatalog.hpp>
#include <com/sun/star/embed/XTransactionListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/compbase5.hxx>
#include <comphelper/uno3.hxx>
#include <comphelper/stl_types.hxx>
@@ -63,7 +64,7 @@ namespace connectivity
// of all the Connection objects
// for this Driver
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xDriver;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
sal_Bool m_bInShutDownConnections;
/** load the driver we want to delegate.
@@ -82,7 +83,7 @@ namespace connectivity
public:
/** creates a new delegator for a HSQLDB driver
*/
- ODriverDelegator(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
+ ODriverDelegator(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
// XServiceInfo
DECLARE_SERVICE_INFO();
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index 7f2d8fb30c2c..68411e75c778 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -242,7 +242,7 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
OSDBCDriverManager::OSDBCDriverManager( const Reference< XComponentContext >& _rxContext )
:m_aContext( _rxContext )
,m_aEventLogger( _rxContext, "org.openoffice.logging.sdbc.DriverManager" )
- ,m_aDriverConfig(m_aContext.getLegacyServiceFactory())
+ ,m_aDriverConfig(m_aContext.getUNOContext())
,m_nLoginTimeout(0)
{
// bootstrap all objects supporting the .sdb.Driver service