summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-13 16:51:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-14 10:37:14 +0200
commit30ee17749a8c755982e8927e68fbe162844c7b03 (patch)
tree3c24d85c579a59429a147e2c0a7990f81a17d2fa /connectivity
parentd1038da54d02f39019b47cffcbf5f94b8cfbcbce (diff)
connectivity/dbpool2: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: Ib621b48f9c542a8cdeea6d7627770784abbd44fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98689 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/Library_dbpool2.mk1
-rw-r--r--connectivity/source/cpool/ZPoolCollection.cxx30
-rw-r--r--connectivity/source/cpool/ZPoolCollection.hxx10
-rw-r--r--connectivity/source/cpool/Zregistration.cxx63
-rw-r--r--connectivity/source/cpool/dbpool2.component5
5 files changed, 14 insertions, 95 deletions
diff --git a/connectivity/Library_dbpool2.mk b/connectivity/Library_dbpool2.mk
index d4c60675f855..fee4d3477087 100644
--- a/connectivity/Library_dbpool2.mk
+++ b/connectivity/Library_dbpool2.mk
@@ -38,7 +38,6 @@ $(eval $(call gb_Library_add_exception_objects,dbpool2,\
connectivity/source/cpool/ZPooledConnection \
connectivity/source/cpool/ZConnectionPool \
connectivity/source/cpool/ZPoolCollection \
- connectivity/source/cpool/Zregistration \
))
# vim: set noet sw=4 ts=4:
diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx
index 3bc3b496088e..4160790ad93e 100644
--- a/connectivity/source/cpool/ZPoolCollection.cxx
+++ b/connectivity/source/cpool/ZPoolCollection.cxx
@@ -136,7 +136,7 @@ sal_Int32 SAL_CALL OPoolCollection::getLoginTimeout( )
OUString SAL_CALL OPoolCollection::getImplementationName( )
{
- return getImplementationName_Static();
+ return "com.sun.star.sdbc.OConnectionPool";
}
sal_Bool SAL_CALL OPoolCollection::supportsService( const OUString& _rServiceName )
@@ -147,26 +147,7 @@ sal_Bool SAL_CALL OPoolCollection::supportsService( const OUString& _rServiceNam
Sequence< OUString > SAL_CALL OPoolCollection::getSupportedServiceNames( )
{
- return getSupportedServiceNames_Static();
-}
-
-//---------------------------------------OPoolCollection----------------------------------
-Reference< XInterface > OPoolCollection::CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory)
-{
- return static_cast<XDriverManager*>(new OPoolCollection(comphelper::getComponentContext(_rxFactory)));
-}
-
-
-OUString OPoolCollection::getImplementationName_Static( )
-{
- return "com.sun.star.sdbc.OConnectionPool";
-}
-
-
-Sequence< OUString > OPoolCollection::getSupportedServiceNames_Static( )
-{
- Sequence< OUString > aSupported { "com.sun.star.sdbc.ConnectionPool" };
- return aSupported;
+ return { "com.sun.star.sdbc.ConnectionPool" };
}
Reference< XDriver > SAL_CALL OPoolCollection::getDriverByURL( const OUString& _rURL )
@@ -478,5 +459,12 @@ void OPoolCollection::clearDesktop()
m_xDesktop.clear();
}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+connectivity_OPoolCollection_get_implementation(
+ css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new OPoolCollection(context));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/cpool/ZPoolCollection.hxx b/connectivity/source/cpool/ZPoolCollection.hxx
index 7671e32493ba..f9078c1baa72 100644
--- a/connectivity/source/cpool/ZPoolCollection.hxx
+++ b/connectivity/source/cpool/ZPoolCollection.hxx
@@ -73,13 +73,14 @@ namespace connectivity
css::uno::Reference< css::uno::XInterface > m_xConfigNode; // config node for general connection pooling
css::uno::Reference< css::frame::XDesktop2> m_xDesktop;
- private:
+ public:
OPoolCollection(const OPoolCollection&) = delete;
int operator= (const OPoolCollection&) = delete;
explicit OPoolCollection(
const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+ private:
// some configuration helper methods
css::uno::Reference< css::uno::XInterface > const & getConfigPoolRoot();
static css::uno::Reference< css::uno::XInterface > createWithProvider( const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxConfProvider,
@@ -119,13 +120,6 @@ namespace connectivity
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
- // XServiceInfo - static methods
- static css::uno::Reference< css::uno::XInterface > CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
- /// @throws css::uno::RuntimeException
- static OUString getImplementationName_Static( );
- /// @throws css::uno::RuntimeException
- static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
-
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
// XPropertyChangeListener
diff --git a/connectivity/source/cpool/Zregistration.cxx b/connectivity/source/cpool/Zregistration.cxx
deleted file mode 100644
index eb65e6158a75..000000000000
--- a/connectivity/source/cpool/Zregistration.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include "ZPoolCollection.hxx"
-
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-using namespace connectivity;
-
-extern "C"
-{
-
-
-SAL_DLLPUBLIC_EXPORT void* dbpool2_component_getFactory(const char* _pImplName, void * _pServiceManager, void* /*_pRegistryKey*/)
-{
- void* pRet = nullptr;
-
- if (OPoolCollection::getImplementationName_Static().equalsAscii(_pImplName))
- {
- Reference< XSingleServiceFactory > xFactory(
- ::cppu::createOneInstanceFactory(
- static_cast<css::lang::XMultiServiceFactory *>(
- _pServiceManager),
- OPoolCollection::getImplementationName_Static(),
- OPoolCollection::CreateInstance,
- OPoolCollection::getSupportedServiceNames_Static()
- )
- );
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
-}
-
-} // extern "C"
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/cpool/dbpool2.component b/connectivity/source/cpool/dbpool2.component
index 6f41d8aceabb..13f3bac3835a 100644
--- a/connectivity/source/cpool/dbpool2.component
+++ b/connectivity/source/cpool/dbpool2.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="dbpool2" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.sdbc.OConnectionPool">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.sdbc.OConnectionPool"
+ constructor="connectivity_OPoolCollection_get_implementation">
<service name="com.sun.star.sdbc.ConnectionPool"/>
</implementation>
</component>