summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-11-27 11:00:51 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-11-28 13:06:18 +0100
commit7470cc532fe408dc9d8735cde0e2eb5bb62fd69c (patch)
tree3815c10cbd2473a19915d8057ca1eb19046592bc /connectivity
parent56ea15091c69d280310aa8b28bb1e9488eaad756 (diff)
fdo#46808, Adapt reflection::ProxyFactory UNO service to new style
The service is deprecated, but we still have a handful of in-tree users, and converting it lets me thread XComponentContext through a bunch of classes. Change-Id: Iffdfe537ada6b9e4a89f9b3c8dd82ca85f4bfaba
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/inc/connectivity/ConnectionWrapper.hxx3
-rw-r--r--connectivity/source/commontools/ConnectionWrapper.cxx6
-rw-r--r--connectivity/source/cpool/ZPoolCollection.cxx20
-rw-r--r--connectivity/source/drivers/hsqldb/HConnection.cxx11
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx2
-rw-r--r--connectivity/source/inc/hsqldb/HConnection.hxx4
6 files changed, 20 insertions, 26 deletions
diff --git a/connectivity/inc/connectivity/ConnectionWrapper.hxx b/connectivity/inc/connectivity/ConnectionWrapper.hxx
index 4c3966b0b27a..df89160d5c0d 100644
--- a/connectivity/inc/connectivity/ConnectionWrapper.hxx
+++ b/connectivity/inc/connectivity/ConnectionWrapper.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <comphelper/broadcasthelper.hxx>
#include "connectivity/CommonTools.hxx"
#include "connectivity/dbtoolsdllapi.hxx"
@@ -52,7 +53,7 @@ namespace connectivity
virtual ~OConnectionWrapper();
void setDelegation(::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >& _rxProxyConnection,oslInterlockedCount& _rRefCount);
void setDelegation(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
,oslInterlockedCount& _rRefCount);
// must be called from derived classes
void disposing();
diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx
index 7b3f14f235f9..fbf4082f37d4 100644
--- a/connectivity/source/commontools/ConnectionWrapper.cxx
+++ b/connectivity/source/commontools/ConnectionWrapper.cxx
@@ -24,7 +24,7 @@
#include <comphelper/uno3.hxx>
#include <comphelper/sequence.hxx>
#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/reflection/XProxyFactory.hpp>
+#include <com/sun/star/reflection/ProxyFactory.hpp>
#include <rtl/digest.h>
#include <algorithm>
#include <string.h>
@@ -65,7 +65,7 @@ void OConnectionWrapper::setDelegation(Reference< XAggregation >& _rxProxyConnec
}
// -----------------------------------------------------------------------------
void OConnectionWrapper::setDelegation(const Reference< XConnection >& _xConnection
- ,const Reference< XMultiServiceFactory>& _xORB
+ ,const Reference< XComponentContext>& _rxContext
,oslInterlockedCount& _rRefCount)
{
OSL_ENSURE(_xConnection.is(),"OConnectionWrapper: Connection must be valid!");
@@ -76,7 +76,7 @@ void OConnectionWrapper::setDelegation(const Reference< XConnection >& _xConnect
m_xUnoTunnel.set(m_xConnection,UNO_QUERY);
m_xServiceInfo.set(m_xConnection,UNO_QUERY);
- Reference< XProxyFactory > xProxyFactory(_xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.ProxyFactory"))),UNO_QUERY);
+ Reference< XProxyFactory > xProxyFactory = ProxyFactory::create( _rxContext );
Reference< XAggregation > xConProxy = xProxyFactory->createProxy(_xConnection);
if (xConProxy.is())
{
diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx
index 7740379990e6..68b5448b9506 100644
--- a/connectivity/source/cpool/ZPoolCollection.cxx
+++ b/connectivity/source/cpool/ZPoolCollection.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/reflection/ProxyFactory.hpp>
#include <comphelper/extract.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -78,11 +79,7 @@ OPoolCollection::OPoolCollection(const Reference< XMultiServiceFactory >& _rxF
m_xDriverAccess = Reference< XDriverAccess >(m_xManager, UNO_QUERY);
OSL_ENSURE(m_xDriverAccess.is(), "have no (or an invalid) driver manager!");
- m_xProxyFactory = Reference< XProxyFactory >(
- m_xServiceFactory->createInstance(
- ::rtl::OUString("com.sun.star.reflection.ProxyFactory")),
- UNO_QUERY);
- OSL_ENSURE(m_xProxyFactory.is(), "OConnectionPool::OConnectionPool: could not create a proxy factory!");
+ m_xProxyFactory = ProxyFactory::create( comphelper::getComponentContext(m_xServiceFactory) );
Reference<XPropertySet> xProp(getConfigPoolRoot(),UNO_QUERY);
if ( xProp.is() )
@@ -216,16 +213,11 @@ Reference< XDriver > SAL_CALL OPoolCollection::getDriverByURL( const ::rtl::OUSt
else
{ // create a new proxy for the driver
// this allows us to control the connections created by it
- if (m_xProxyFactory.is())
- {
- Reference< XAggregation > xDriverProxy = m_xProxyFactory->createProxy(xDriver.get());
- OSL_ENSURE(xDriverProxy.is(), "OConnectionPool::getDriverByURL: invalid proxy returned by the proxy factory!");
+ Reference< XAggregation > xDriverProxy = m_xProxyFactory->createProxy(xDriver.get());
+ OSL_ENSURE(xDriverProxy.is(), "OConnectionPool::getDriverByURL: invalid proxy returned by the proxy factory!");
- OConnectionPool* pConnectionPool = getConnectionPool(sImplName,xDriver,xDriverNode);
- xDriver = new ODriverWrapper(xDriverProxy, pConnectionPool);
- }
- else
- OSL_FAIL("OConnectionPool::getDriverByURL: could not instantiate a proxy factory!");
+ OConnectionPool* pConnectionPool = getConnectionPool(sImplName,xDriver,xDriverNode);
+ xDriver = new ODriverWrapper(xDriverProxy, pConnectionPool);
}
}
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx
index 2d447af76467..2b1f9c0464a0 100644
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ b/connectivity/source/drivers/hsqldb/HConnection.cxx
@@ -53,6 +53,7 @@ using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::sdbc::XStatement;
using ::com::sun::star::sdbc::XConnection;
using ::com::sun::star::sdbcx::XDataDefinitionSupplier;
@@ -118,15 +119,15 @@ namespace connectivity { namespace hsqldb
}
// -----------------------------------------------------------------------------
OHsqlConnection::OHsqlConnection( const Reference< XDriver > _rxDriver,
- const Reference< XConnection >& _xConnection ,const Reference< XMultiServiceFactory>& _xORB )
+ const Reference< XConnection >& _xConnection ,const Reference< XComponentContext >& _rxContext )
:OHsqlConnection_BASE( m_aMutex )
,m_aFlushListeners( m_aMutex )
,m_xDriver( _rxDriver )
- ,m_xORB( _xORB )
+ ,m_xContext( _rxContext )
,m_bIni(true)
,m_bReadOnly(false)
{
- setDelegation(_xConnection,_xORB,m_refCount);
+ setDelegation(_xConnection,_rxContext,m_refCount);
}
// -----------------------------------------------------------------------------
OHsqlConnection::~OHsqlConnection()
@@ -343,8 +344,8 @@ namespace connectivity { namespace hsqldb
{
// create a graphic provider
Reference< XGraphicProvider > xProvider;
- if ( m_xORB.is() )
- xProvider.set( GraphicProvider::create(::comphelper::getComponentContext(m_xORB)) );
+ if ( m_xContext.is() )
+ xProvider.set( GraphicProvider::create(m_xContext) );
// assemble the image URL
::rtl::OUStringBuffer aImageURL;
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 114c4402d9d5..471d67bd5fbf 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -381,7 +381,7 @@ namespace connectivity
xDesktop->addTerminateListener(s_xTerminateListener);
}
}
- Reference< XComponent> xIfc = new OHsqlConnection( this, xOrig, m_xFactory );
+ Reference< XComponent> xIfc = new OHsqlConnection( this, xOrig, comphelper::getComponentContext(m_xFactory) );
xConnection.set(xIfc,UNO_QUERY);
m_aConnections.push_back(TWeakPair(WeakReferenceHelper(xOrig),TWeakConnectionPair(sKey,TWeakRefPair(WeakReferenceHelper(xConnection),WeakReferenceHelper()))));
diff --git a/connectivity/source/inc/hsqldb/HConnection.hxx b/connectivity/source/inc/hsqldb/HConnection.hxx
index aad422e3817e..42748d9effc0 100644
--- a/connectivity/source/inc/hsqldb/HConnection.hxx
+++ b/connectivity/source/inc/hsqldb/HConnection.hxx
@@ -62,7 +62,7 @@ namespace connectivity
private:
::cppu::OInterfaceContainerHelper m_aFlushListeners;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xDriver;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
bool m_bIni;
bool m_bReadOnly;
@@ -74,7 +74,7 @@ namespace connectivity
OHsqlConnection(
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > _rxDriver,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
);
// XServiceInfo