connectivity/Library_hsqldb.mk | 1 connectivity/source/drivers/hsqldb/HDriver.cxx | 34 ++---- connectivity/source/drivers/hsqldb/Hservices.cxx | 108 -------------------- connectivity/source/drivers/hsqldb/hsqldb.component | 5 connectivity/source/inc/hsqldb/HDriver.hxx | 7 - 5 files changed, 16 insertions(+), 139 deletions(-)
New commits: commit 3616a43f8d7da0379a7f6441c4900304de40952a Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jul 13 16:17:35 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jul 14 09:09:31 2020 +0200 connectivity/hsqldb: create instances with uno constructors See tdf#74608 for motivation. Change-Id: I80d9c854640073038d1a4d79997111912d924f69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98685 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/connectivity/Library_hsqldb.mk b/connectivity/Library_hsqldb.mk index 0685402145bb..3c85fc462240 100644 --- a/connectivity/Library_hsqldb.mk +++ b/connectivity/Library_hsqldb.mk @@ -52,7 +52,6 @@ $(eval $(call gb_Library_add_exception_objects,hsqldb,\ connectivity/source/drivers/hsqldb/HUsers \ connectivity/source/drivers/hsqldb/HView \ connectivity/source/drivers/hsqldb/HViews \ - connectivity/source/drivers/hsqldb/Hservices \ connectivity/source/drivers/hsqldb/StorageFileAccess \ connectivity/source/drivers/hsqldb/StorageNativeInputStream \ connectivity/source/drivers/hsqldb/StorageNativeOutputStream \ diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 05b9478a9f12..87c940a1c17c 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -71,13 +71,8 @@ namespace connectivity using namespace css::util; using namespace css::reflection; - namespace hsqldb - { - Reference< XInterface > ODriverDelegator_CreateInstance(const Reference< css::lang::XMultiServiceFactory >& _rxFac) - { - return *(new ODriverDelegator(comphelper::getComponentContext(_rxFac))); - } - } + constexpr OUStringLiteral IMPL_NAME = "com.sun.star.sdbcx.comp.hsqldb.Driver"; + ODriverDelegator::ODriverDelegator(const Reference< XComponentContext >& _rxContext) @@ -140,7 +135,7 @@ namespace connectivity { OUString aConfigPath = "/org.openoffice.Office.DataAccess/DriverSettings/" + - ODriverDelegator::getImplementationName_Static() + + IMPL_NAME + "/PermittedJavaMethods"; ::utl::OConfigurationTreeRoot aConfig( ::utl::OConfigurationTreeRoot::createWithComponentContext( _rxContext, aConfigPath ) ); @@ -475,20 +470,9 @@ namespace connectivity // XServiceInfo - - OUString ODriverDelegator::getImplementationName_Static( ) - { - return "com.sun.star.sdbcx.comp.hsqldb.Driver"; - } - - Sequence< OUString > ODriverDelegator::getSupportedServiceNames_Static( ) - { - return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" }; - } - OUString SAL_CALL ODriverDelegator::getImplementationName( ) { - return getImplementationName_Static(); + return IMPL_NAME; } sal_Bool SAL_CALL ODriverDelegator::supportsService( const OUString& _rServiceName ) @@ -498,7 +482,7 @@ namespace connectivity Sequence< OUString > SAL_CALL ODriverDelegator::getSupportedServiceNames( ) { - return getSupportedServiceNames_Static(); + return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" }; } void SAL_CALL ODriverDelegator::createCatalog( const Sequence< PropertyValue >& /*info*/ ) @@ -867,4 +851,12 @@ namespace connectivity } // namespace connectivity +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +connectivity_hsqldb_ODriverDelegator_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new connectivity::ODriverDelegator(context)); +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/Hservices.cxx b/connectivity/source/drivers/hsqldb/Hservices.cxx deleted file mode 100644 index 5ca8a0962636..000000000000 --- a/connectivity/source/drivers/hsqldb/Hservices.cxx +++ /dev/null @@ -1,108 +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 <hsqldb/HDriver.hxx> -#include <cppuhelper/factory.hxx> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> - -using namespace connectivity::hsqldb; -using css::uno::Reference; -using css::uno::Sequence; -using css::lang::XSingleServiceFactory; -using css::lang::XMultiServiceFactory; - -typedef Reference< XSingleServiceFactory > (*createFactoryFunc) - ( - const Reference< XMultiServiceFactory > & rServiceManager, - const OUString & rComponentName, - ::cppu::ComponentInstantiation pCreateFunction, - const Sequence< OUString > & rServiceNames, - rtl_ModuleCount* - ); - -namespace { - -struct ProviderRequest -{ - Reference< XSingleServiceFactory > xRet; - Reference< XMultiServiceFactory > const xServiceManager; - OUString const sImplementationName; - - ProviderRequest( - void* pServiceManager, - char const* pImplementationName - ) - : xServiceManager(static_cast<XMultiServiceFactory*>(pServiceManager)) - , sImplementationName(OUString::createFromAscii(pImplementationName)) - { - } - - bool CREATE_PROVIDER( - const OUString& Implname, - const Sequence< OUString > & Services, - ::cppu::ComponentInstantiation Factory, - createFactoryFunc creator - ) - { - if (!xRet.is() && (Implname == sImplementationName)) - { - try - { - xRet = creator( xServiceManager, sImplementationName,Factory, Services,nullptr); - } - catch(...) - { - } - } - return xRet.is(); - } - - void* getProvider() const { return xRet.get(); } -}; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void* hsqldb_component_getFactory( - const char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - void* pRet = nullptr; - if (pServiceManager) - { - ProviderRequest aReq(pServiceManager,pImplementationName); - - aReq.CREATE_PROVIDER( - ODriverDelegator::getImplementationName_Static(), - ODriverDelegator::getSupportedServiceNames_Static(), - ODriverDelegator_CreateInstance, ::cppu::createSingleFactory) - ; - - if(aReq.xRet.is()) - aReq.xRet->acquire(); - - pRet = aReq.getProvider(); - } - - return pRet; -}; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/hsqldb.component b/connectivity/source/drivers/hsqldb/hsqldb.component index ab8318861416..a541e02aa8d8 100644 --- a/connectivity/source/drivers/hsqldb/hsqldb.component +++ b/connectivity/source/drivers/hsqldb/hsqldb.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="hsqldb" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.sdbcx.comp.hsqldb.Driver"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.sdbcx.comp.hsqldb.Driver" + constructor="connectivity_hsqldb_ODriverDelegator_implementation"> <service name="com.sun.star.sdbc.Driver"/> <service name="com.sun.star.sdbcx.Driver"/> </implementation> diff --git a/connectivity/source/inc/hsqldb/HDriver.hxx b/connectivity/source/inc/hsqldb/HDriver.hxx index 4df9a546dafe..f376dc83a1bf 100644 --- a/connectivity/source/inc/hsqldb/HDriver.hxx +++ b/connectivity/source/inc/hsqldb/HDriver.hxx @@ -37,9 +37,6 @@ namespace connectivity namespace hsqldb { - /// @throws css::uno::Exception - css::uno::Reference< css::uno::XInterface > ODriverDelegator_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); - typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver , css::sdbcx::XDataDefinitionSupplier , css::lang::XServiceInfo @@ -87,10 +84,6 @@ namespace connectivity // XServiceInfo DECLARE_SERVICE_INFO(); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_Static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_Static( ); // XDriver virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits