diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2013-12-16 13:38:14 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2013-12-18 07:15:49 +0100 |
commit | e20f27f0a04a3c0c0ba38a2b78f5c2591e27bbc0 (patch) | |
tree | 42f53ae75e98031ca70563fe69471e0a148c94ee | |
parent | 291e846db9840b9f82bc28e495b54ae5ac51d0fc (diff) |
bootstrap component: Split into implementation functions.
Change-Id: I91cb0177edd79485eab885e995e79b1a19a769d5
-rw-r--r-- | cppuhelper/source/shlib.cxx | 24 | ||||
-rw-r--r-- | include/osl/detail/component-declarations.h | 9 | ||||
-rw-r--r-- | stoc/Library_bootstrap.mk | 1 | ||||
-rw-r--r-- | stoc/inc/bootstrapservices.hxx | 89 | ||||
-rw-r--r-- | stoc/source/bootstrap/services.cxx | 102 | ||||
-rw-r--r-- | stoc/source/defaultregistry/defaultregistry.cxx | 47 | ||||
-rw-r--r-- | stoc/source/implementationregistration/implreg.cxx | 55 | ||||
-rw-r--r-- | stoc/source/loader/dllcomponentloader.cxx | 41 | ||||
-rw-r--r-- | stoc/source/security/access_controller.cxx | 58 | ||||
-rw-r--r-- | stoc/source/security/file_policy.cxx | 50 | ||||
-rw-r--r-- | stoc/source/servicemanager/servicemanager.cxx | 104 | ||||
-rw-r--r-- | stoc/source/simpleregistry/simpleregistry.cxx | 37 | ||||
-rw-r--r-- | stoc/util/bootstrap.component | 2 |
13 files changed, 213 insertions, 406 deletions
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx index 68abeaa02e74..44d647bc263c 100644 --- a/cppuhelper/source/shlib.cxx +++ b/cppuhelper/source/shlib.cxx @@ -247,12 +247,6 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory( { #ifndef DISABLE_DYNLOADING OUString moduleUri(uri); - -#ifdef ANDROID - if ( uri == "bootstrap.uno" SAL_DLLEXTENSION ) - moduleUri = "libbootstrap.uno" SAL_DLLEXTENSION; -#endif - oslModule lib = osl_loadModule( moduleUri.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL ); if (! lib) @@ -291,13 +285,6 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory( // First test library names that aren't app-specific. static lib_to_component_mapping components_mapping[] = { - // Sigh, the name under which the bootstrap component is looked for - // varies a lot? Or then I just have been confused by some mixed-up - // incremental build. - { "bootstrap.uno" SAL_DLLEXTENSION, bootstrap_component_getFactory }, - { "bootstrap.uno.a", bootstrap_component_getFactory }, - { "libbootstraplo.a", bootstrap_component_getFactory }, - { "libintrospectionlo.a", introspection_component_getFactory }, { "libreflectionlo.a", reflection_component_getFactory }, { "libstocserviceslo.a", stocservices_component_getFactory }, @@ -322,8 +309,17 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory( }; static lib_to_component_mapping direct_components_mapping[] = { { "com.sun.star.comp.extensions.xml.sax.ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory }, - { "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory }, { "com.sun.star.comp.extensions.xml.sax.FastParser", com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory }, + { "com.sun.star.comp.stoc.DLLComponentLoader.component.getFactory", com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory }, + { "com.sun.star.comp.stoc.ImplementationRegistration.component.getFactory", com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory }, + { "com.sun.star.comp.stoc.NestedRegistry.component.getFactory", com_sun_star_comp_stoc_NestedRegistry_component_getFactory }, + { "com.sun.star.comp.stoc.ORegistryServiceManager.component.getFactory", com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory }, + { "com.sun.star.comp.stoc.OServiceManager.component.getFactory", com_sun_star_comp_stoc_OServiceManager_component_getFactory }, + { "com.sun.star.comp.stoc.OServiceManagerWrapper.component.getFactory", com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory }, + { "com.sun.star.comp.stoc.SimpleRegistry.component.getFactory", com_sun_star_comp_stoc_SimpleRegistry_component_getFactory }, + { "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory }, + { "com.sun.star.security.comp.stoc.AccessController.component.getFactory", com_sun_star_security_comp_stoc_AccessController_component_getFactory }, + { "com.sun.star.security.comp.stoc.FilePolicy.component.getFactory", com_sun_star_security_comp_stoc_FilePolicy_component_getFactory }, { NULL, NULL } }; lib_to_component_mapping *non_app_specific_map = components_mapping; diff --git a/include/osl/detail/component-declarations.h b/include/osl/detail/component-declarations.h index b559792dadec..8bcbda373bc6 100644 --- a/include/osl/detail/component-declarations.h +++ b/include/osl/detail/component-declarations.h @@ -99,7 +99,16 @@ void * xstor_component_getFactory( const char * , void * , void * ); void * com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory( const char * , void * , void * ); void * com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory( const char * , void * , void * ); +void * com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory( const char * , void * , void * ); +void * com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory( const char * , void * , void * ); +void * com_sun_star_comp_stoc_NestedRegistry_component_getFactory( const char * , void * , void * ); +void * com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory( const char * , void * , void * ); +void * com_sun_star_comp_stoc_OServiceManager_component_getFactory( const char * , void * , void * ); +void * com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory( const char * , void * , void * ); +void * com_sun_star_comp_stoc_SimpleRegistry_component_getFactory( const char * , void * , void * ); void * com_sun_star_extensions_xml_sax_Writer_component_getFactory( const char * , void * , void * ); +void * com_sun_star_security_comp_stoc_AccessController_component_getFactory( const char * , void * , void * ); +void * com_sun_star_security_comp_stoc_FilePolicy_component_getFactory( const char * , void * , void * ); #ifdef __cplusplus } diff --git a/stoc/Library_bootstrap.mk b/stoc/Library_bootstrap.mk index a636917dfcb1..6c68a7f13bfe 100644 --- a/stoc/Library_bootstrap.mk +++ b/stoc/Library_bootstrap.mk @@ -42,7 +42,6 @@ $(eval $(call gb_Library_use_libraries,bootstrap,\ $(eval $(call gb_Library_set_componentfile,bootstrap,stoc/util/bootstrap)) $(eval $(call gb_Library_add_exception_objects,bootstrap,\ - stoc/source/bootstrap/services \ stoc/source/defaultregistry/defaultregistry \ stoc/source/implementationregistration/implreg \ stoc/source/implementationregistration/mergekeys \ diff --git a/stoc/inc/bootstrapservices.hxx b/stoc/inc/bootstrapservices.hxx deleted file mode 100644 index 43a10bab02ca..000000000000 --- a/stoc/inc/bootstrapservices.hxx +++ /dev/null @@ -1,89 +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 <rtl/ustring.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/RuntimeException.hpp> - -namespace com { namespace sun { namespace star { namespace uno { - class XInterface; - class XComponentContext; -} } } } - -namespace stoc_bootstrap -{ - //servicemanager - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OServiceManager_CreateInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext ); - ::com::sun::star::uno::Sequence< OUString > smgr_wrapper_getSupportedServiceNames(); - OUString smgr_wrapper_getImplementationName(); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OServiceManagerWrapper_CreateInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext ) - throw (::com::sun::star::uno::Exception); - ::com::sun::star::uno::Sequence< OUString > smgr_getSupportedServiceNames(); - OUString smgr_getImplementationName(); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ORegistryServiceManager_CreateInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext ) - throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< OUString > regsmgr_getSupportedServiceNames(); - OUString regsmgr_getImplementationName(); - - //security - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ac_create( - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xComponentContext ) - SAL_THROW( (::com::sun::star::uno::Exception) ); - ::com::sun::star::uno::Sequence< OUString > ac_getSupportedServiceNames() SAL_THROW(()); - OUString ac_getImplementationName() SAL_THROW(()); - - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL filepolicy_create( - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xComponentContext ) - SAL_THROW( (com::sun::star::uno::Exception) ); - ::com::sun::star::uno::Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW(()); - OUString filepolicy_getImplementationName() SAL_THROW(()); - - //defaultregistry - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL NestedRegistry_CreateInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ) - throw( ::com::sun::star::uno::Exception); - ::com::sun::star::uno::Sequence< OUString > defreg_getSupportedServiceNames(); - OUString defreg_getImplementationName(); - - //simpleregistry - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SimpleRegistry_CreateInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); - ::com::sun::star::uno::Sequence< OUString > simreg_getSupportedServiceNames(); - OUString simreg_getImplementationName(); - - //implementationregistry - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplementationRegistration_CreateInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); // throw(Exception) - ::com::sun::star::uno::Sequence< OUString > impreg_getSupportedServiceNames(); - OUString impreg_getImplementationName(); - - //loader - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DllComponentLoader_CreateInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ) - throw(::com::sun::star::uno::Exception); - ::com::sun::star::uno::Sequence< OUString > loader_getSupportedServiceNames(); - OUString loader_getImplementationName(); -} // namespace - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/bootstrap/services.cxx b/stoc/source/bootstrap/services.cxx deleted file mode 100644 index 126558ebdb1f..000000000000 --- a/stoc/source/bootstrap/services.cxx +++ /dev/null @@ -1,102 +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 "bootstrapservices.hxx" - -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "sal/types.h" -#include "uno/environment.h" - -#include <stdio.h> - -using namespace com::sun::star; -using namespace com::sun::star::uno; -using namespace cppu; -using namespace osl; - -using namespace stoc_bootstrap; - -static const struct ImplementationEntry g_entries[] = -{ - //servicemanager - { - OServiceManager_CreateInstance, smgr_getImplementationName, - smgr_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - { - ORegistryServiceManager_CreateInstance, regsmgr_getImplementationName, - regsmgr_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - { - OServiceManagerWrapper_CreateInstance, smgr_wrapper_getImplementationName, - smgr_wrapper_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - //security - { - ac_create, ac_getImplementationName, - ac_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - { - filepolicy_create, filepolicy_getImplementationName, - filepolicy_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - //simpleregistry - { - SimpleRegistry_CreateInstance, simreg_getImplementationName, - simreg_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - //defaultregistry - { - NestedRegistry_CreateInstance, defreg_getImplementationName, - defreg_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - //implementationregistry - { - ImplementationRegistration_CreateInstance, impreg_getImplementationName, - impreg_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - //loader - { - DllComponentLoader_CreateInstance, loader_getImplementationName, - loader_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - //end - { 0, 0, 0, 0, 0, 0 } -}; - -#define component_getFactory bootstrap_component_getFactory - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx index cf41a8d5327d..7074683c1906 100644 --- a/stoc/source/defaultregistry/defaultregistry.cxx +++ b/stoc/source/defaultregistry/defaultregistry.cxx @@ -37,8 +37,6 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> -#include <bootstrapservices.hxx> - using namespace com::sun::star::uno; using namespace com::sun::star::registry; using namespace com::sun::star::lang; @@ -46,29 +44,15 @@ using namespace com::sun::star::container; using namespace cppu; using namespace osl; -#define SERVICENAME "com.sun.star.registry.NestedRegistry" -#define IMPLNAME "com.sun.star.comp.stoc.NestedRegistry" - -namespace stoc_bootstrap -{ -Sequence< OUString > defreg_getSupportedServiceNames() +static Sequence< OUString > NestedRegistryImpl_getSupportedServiceNames() { Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(SERVICENAME); + seqNames.getArray()[0] = OUString("com.sun.star.registry.NestedRegistry"); return seqNames; } -OUString defreg_getImplementationName() -{ - return OUString(IMPLNAME); -} -} +namespace { -namespace stoc_defreg -{ -//************************************************************************* -// NestedRegistryImpl -//************************************************************************* class NestedKeyImpl; class NestedRegistryImpl : public WeakAggImplHelper4 < XSimpleRegistry, XInitialization, XServiceInfo, XEnumerationAccess > @@ -1211,7 +1195,7 @@ sal_Bool SAL_CALL NestedRegistryImpl::hasElements( ) throw (RuntimeException) OUString SAL_CALL NestedRegistryImpl::getImplementationName( ) throw(RuntimeException) { - return stoc_bootstrap::defreg_getImplementationName(); + return OUString("com.sun.star.comp.stoc.NestedRegistry"); } sal_Bool SAL_CALL NestedRegistryImpl::supportsService( const OUString& ServiceName ) @@ -1223,7 +1207,7 @@ sal_Bool SAL_CALL NestedRegistryImpl::supportsService( const OUString& ServiceNa Sequence<OUString> SAL_CALL NestedRegistryImpl::getSupportedServiceNames( ) throw(RuntimeException) { - return stoc_bootstrap::defreg_getSupportedServiceNames(); + return NestedRegistryImpl_getSupportedServiceNames(); } //************************************************************************* @@ -1368,17 +1352,15 @@ void SAL_CALL NestedRegistryImpl::mergeKey( const OUString& aKeyName, const OUSt m_state++; } } -} // namespace stco_defreg -namespace stoc_bootstrap -{ -//************************************************************************* -Reference<XInterface> SAL_CALL NestedRegistry_CreateInstance( +} // namespace + +static Reference<XInterface> NestedRegistry_CreateInstance( SAL_UNUSED_PARAMETER const Reference<XComponentContext>& ) throw(Exception) { Reference<XInterface> xRet; - XSimpleRegistry *pRegistry = (XSimpleRegistry*) new stoc_defreg::NestedRegistryImpl; + XSimpleRegistry *pRegistry = (XSimpleRegistry*) new NestedRegistryImpl; if (pRegistry) { @@ -1388,6 +1370,17 @@ Reference<XInterface> SAL_CALL NestedRegistry_CreateInstance( return xRet; } +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL +com_sun_star_comp_stoc_NestedRegistry_component_getFactory( + const char * , void * , void * ) +{ + Reference< XSingleComponentFactory > xFactory; + xFactory = createSingleComponentFactory( + NestedRegistry_CreateInstance, + "com.sun.star.comp.stoc.NestedRegistry", + NestedRegistryImpl_getSupportedServiceNames() ); + xFactory->acquire(); + return xFactory.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 66626a8eb9c4..4e8e6970fff5 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -65,14 +65,11 @@ using namespace osl; #define IMPLNAME "com.sun.star.comp.stoc.ImplementationRegistration" #define SERVICENAME "com.sun.star.registry.ImplementationRegistration" -namespace stoc_impreg -{ + +namespace { + struct StringPool { - OUString sImplementationName; - OUString sServiceName; - OUString TMP; - OUString TEMP; OUString slash_UNO_slash_REGISTRY_LINKS; OUString slash_IMPLEMENTATIONS; OUString slash_UNO; @@ -85,11 +82,7 @@ struct StringPool OUString com_sun_star_registry_SimpleRegistry; OUString Registry; StringPool() - : sImplementationName( IMPLNAME ) - , sServiceName( SERVICENAME ) - , TMP( "TMP" ) - , TEMP( "TEMP" ) - , slash_UNO_slash_REGISTRY_LINKS( "/UNO/REGISTRY_LINKS") + : slash_UNO_slash_REGISTRY_LINKS( "/UNO/REGISTRY_LINKS") , slash_IMPLEMENTATIONS( "/IMPLEMENTATIONS" ) , slash_UNO( "/UNO") , slash_UNO_slash_SERVICES( "/UNO/SERVICES") @@ -119,25 +112,14 @@ const StringPool &spool() } return *pPool; } -} -namespace stoc_bootstrap -{ -Sequence< OUString > impreg_getSupportedServiceNames() +static Sequence< OUString > ImplementationRegistration_getSupportedServiceNames() { Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = stoc_impreg::spool().sServiceName; + seqNames.getArray()[0] = SERVICENAME; return seqNames; } -OUString impreg_getImplementationName() -{ - return stoc_impreg::spool().sImplementationName; -} -} - -namespace stoc_impreg -{ //************************************************************************* // static deleteAllLinkReferences() // @@ -1327,7 +1309,7 @@ ImplementationRegistration::~ImplementationRegistration() {} // XServiceInfo OUString ImplementationRegistration::getImplementationName() throw(RuntimeException) { - return stoc_bootstrap::impreg_getImplementationName(); + return OUString(IMPLNAME); } // XServiceInfo @@ -1339,7 +1321,7 @@ sal_Bool ImplementationRegistration::supportsService(const OUString& ServiceName // XServiceInfo Sequence< OUString > ImplementationRegistration::getSupportedServiceNames(void) throw(RuntimeException) { - return stoc_bootstrap::impreg_getSupportedServiceNames(); + return ImplementationRegistration_getSupportedServiceNames(); } Reference< XSimpleRegistry > ImplementationRegistration::getRegistryFromServiceManager() @@ -1801,7 +1783,7 @@ void ImplementationRegistration::doRegister( xSourceKey = xReg->getRootKey(); Reference < XRegistryKey > xDestKey = xDest->getRootKey(); - mergeKeys( xDestKey, xSourceKey ); + stoc_impreg::mergeKeys( xDestKey, xSourceKey ); xDestKey->closeKey(); xSourceKey->closeKey(); } @@ -1840,17 +1822,26 @@ Reference< XSimpleRegistry > ImplementationRegistration::createTemporarySimpleRe OSL_ASSERT( xReg.is() ); return xReg; } + } -namespace stoc_bootstrap -{ -//************************************************************************* -Reference<XInterface> SAL_CALL ImplementationRegistration_CreateInstance( +static Reference<XInterface> ImplementationRegistration_CreateInstance( const Reference<XComponentContext> & xCtx ) // throw(Exception) { - return (XImplementationRegistration *)new stoc_impreg::ImplementationRegistration(xCtx); + return (XImplementationRegistration *)new ImplementationRegistration(xCtx); } +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL +com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory( + const char * , void * , void * ) +{ + Reference< css::lang::XSingleComponentFactory > xFactory; + xFactory = createSingleComponentFactory( + ImplementationRegistration_CreateInstance, + IMPLNAME, + ImplementationRegistration_getSupportedServiceNames() ); + xFactory->acquire(); + return xFactory.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx index c10d8b3d2099..402ed4a110af 100644 --- a/stoc/source/loader/dllcomponentloader.cxx +++ b/stoc/source/loader/dllcomponentloader.cxx @@ -54,26 +54,15 @@ using namespace com::sun::star::registry; using namespace cppu; using namespace osl; -namespace stoc_bootstrap -{ -Sequence< OUString > loader_getSupportedServiceNames() +namespace { + +static Sequence< OUString > DllComponentLoader_getSupportedServiceNames() { Sequence< OUString > seqNames(1); seqNames.getArray()[0] = OUString(SERVICENAME); return seqNames; } -OUString loader_getImplementationName() -{ - return OUString(IMPLNAME); -} -} - -namespace stoc_loader -{ -//************************************************************************* -// DllComponentLoader -//************************************************************************* class DllComponentLoader : public WeakImplHelper3< XImplementationLoader, XInitialization, @@ -112,7 +101,7 @@ DllComponentLoader::~DllComponentLoader() {} OUString SAL_CALL DllComponentLoader::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { - return stoc_bootstrap::loader_getImplementationName(); + return OUString(IMPLNAME); } sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceName ) @@ -124,7 +113,7 @@ sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceNa Sequence<OUString> SAL_CALL DllComponentLoader::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) { - return stoc_bootstrap::loader_getSupportedServiceNames(); + return DllComponentLoader_getSupportedServiceNames(); } //************************************************************************* @@ -182,16 +171,15 @@ sal_Bool SAL_CALL DllComponentLoader::writeRegistryInfo( return sal_True; #endif } + } -namespace stoc_bootstrap -{ -//************************************************************************* -Reference<XInterface> SAL_CALL DllComponentLoader_CreateInstance( const Reference<XComponentContext> & xCtx ) throw(Exception) +static Reference<XInterface> DllComponentLoader_CreateInstance( + const Reference<XComponentContext> & xCtx ) throw(Exception) { Reference<XInterface> xRet; - XImplementationLoader *pXLoader = (XImplementationLoader *)new stoc_loader::DllComponentLoader(xCtx); + XImplementationLoader *pXLoader = (XImplementationLoader *)new DllComponentLoader(xCtx); if (pXLoader) { @@ -201,6 +189,17 @@ Reference<XInterface> SAL_CALL DllComponentLoader_CreateInstance( const Referenc return xRet; } +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL +com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory( + const char * , void * , void * ) +{ + Reference< css::lang::XSingleComponentFactory > xFactory; + xFactory = createSingleComponentFactory( + DllComponentLoader_CreateInstance, + IMPLNAME, + DllComponentLoader_getSupportedServiceNames() ); + xFactory->acquire(); + return xFactory.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index 30f4efb361f5..6de5cceef057 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -49,7 +49,6 @@ #include "lru_cache.h" #include "permissions.h" -#include "bootstrapservices.hxx" #define SERVICE_NAME "com.sun.star.security.AccessController" @@ -62,9 +61,10 @@ using namespace ::osl; using namespace ::cppu; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using namespace stoc_sec; + +namespace { -namespace stoc_sec -{ // static stuff initialized when loading lib static OUString s_envType = CPPU_CURRENT_LANGUAGE_BINDING_NAME; const char s_acRestriction[] = "access-control.restriction"; @@ -962,7 +962,7 @@ Reference< security::XAccessControlContext > AccessController::getContext() OUString AccessController::getImplementationName() throw (RuntimeException) { - return stoc_bootstrap::ac_getImplementationName(); + return OUString(IMPL_NAME); } //__________________________________________________________________________________________________ sal_Bool AccessController::supportsService( OUString const & serviceName ) @@ -971,41 +971,39 @@ sal_Bool AccessController::supportsService( OUString const & serviceName ) return cppu::supportsService(this, serviceName); } //__________________________________________________________________________________________________ +static Sequence< OUString > AccessController_getSupportedServiceNames() +{ + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString(SERVICE_NAME); + return aSNS; +} + Sequence< OUString > AccessController::getSupportedServiceNames() throw (RuntimeException) { - return stoc_bootstrap::ac_getSupportedServiceNames(); + return AccessController_getSupportedServiceNames(); } + } -//################################################################################################## -namespace stoc_bootstrap { -//-------------------------------------------------------------------------------------------------- -Reference< XInterface > SAL_CALL ac_create( + +static Reference< XInterface > SAL_CALL AccessController_create( Reference< XComponentContext > const & xComponentContext ) SAL_THROW( (Exception) ) { - return (OWeakObject *)new stoc_sec::AccessController( xComponentContext ); -} -//-------------------------------------------------------------------------------------------------- -Sequence< OUString > ac_getSupportedServiceNames() SAL_THROW(()) -{ - Sequence< OUString > aSNS( 1 ); - aSNS.getArray()[0] = OUString(SERVICE_NAME); - return aSNS; -} -//-------------------------------------------------------------------------------------------------- -OUString ac_getImplementationName() SAL_THROW(()) -{ - return OUString(IMPL_NAME); + return (OWeakObject *)new AccessController( xComponentContext ); } -//-------------------------------------------------------------------------------------------------- -Reference< XInterface > SAL_CALL filepolicy_create( - Reference< XComponentContext > const & xComponentContext ) - SAL_THROW( (Exception) ); -//-------------------------------------------------------------------------------------------------- -Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW(()); -//-------------------------------------------------------------------------------------------------- -OUString filepolicy_getImplementationName() SAL_THROW(()); + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL +com_sun_star_security_comp_stoc_AccessController_component_getFactory( + const char * , void * , void * ) +{ + Reference< css::lang::XSingleComponentFactory > xFactory; + xFactory = createSingleComponentFactory( + AccessController_create, + IMPL_NAME, + AccessController_getSupportedServiceNames() ); + xFactory->acquire(); + return xFactory.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 36bb86641757..4d51240f6017 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -39,8 +39,6 @@ #include <com/sun/star/io/FilePermission.hpp> #include <com/sun/star/connection/SocketPermission.hpp> -#include "bootstrapservices.hxx" - #define SERVICE_NAME "com.sun.star.security.Policy" #define IMPL_NAME "com.sun.star.security.comp.stoc.FilePolicy" @@ -50,8 +48,7 @@ using namespace ::cppu; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -namespace stoc_sec -{ +namespace { struct MutexHolder { @@ -526,7 +523,7 @@ void FilePolicy::refresh() OUString FilePolicy::getImplementationName() throw (RuntimeException) { - return stoc_bootstrap::filepolicy_getImplementationName(); + return OUString(IMPL_NAME); } //__________________________________________________________________________________________________ sal_Bool FilePolicy::supportsService( OUString const & serviceName ) @@ -535,34 +532,39 @@ sal_Bool FilePolicy::supportsService( OUString const & serviceName ) return cppu::supportsService(this, serviceName); } //__________________________________________________________________________________________________ +static Sequence< OUString > FilePolicy_getSupportedServiceNames() SAL_THROW(()) +{ + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString(SERVICE_NAME); + return aSNS; +} + Sequence< OUString > FilePolicy::getSupportedServiceNames() throw (RuntimeException) { - return stoc_bootstrap::filepolicy_getSupportedServiceNames(); + return FilePolicy_getSupportedServiceNames(); } -} -//################################################################################################## -namespace stoc_bootstrap -{ -//-------------------------------------------------------------------------------------------------- -Reference< XInterface > SAL_CALL filepolicy_create( + +} // namespace + +static Reference< XInterface > FilePolicy_CreateInstance( Reference< XComponentContext > const & xComponentContext ) SAL_THROW( (Exception) ) { - return (OWeakObject *)new stoc_sec::FilePolicy( xComponentContext ); -} -//-------------------------------------------------------------------------------------------------- -Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW(()) -{ - Sequence< OUString > aSNS( 1 ); - aSNS.getArray()[0] = OUString(SERVICE_NAME); - return aSNS; + return (OWeakObject *)new FilePolicy( xComponentContext ); } -//-------------------------------------------------------------------------------------------------- -OUString filepolicy_getImplementationName() SAL_THROW(()) + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL +com_sun_star_security_comp_stoc_FilePolicy_component_getFactory( + const char * , void * , void * ) { - return OUString(IMPL_NAME); -} + Reference< css::lang::XSingleComponentFactory > xFactory; + xFactory = createSingleComponentFactory( + FilePolicy_CreateInstance, + IMPL_NAME, + FilePolicy_getSupportedServiceNames() ); + xFactory->acquire(); + return xFactory.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 13d5725ebb82..97eda24b564c 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -55,9 +55,6 @@ #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/uno/XUnloadingPreference.hpp> -#include <bootstrapservices.hxx> - - using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::beans; @@ -68,21 +65,9 @@ using namespace cppu; using namespace osl; using namespace std; -namespace stoc_bootstrap -{ -Sequence< OUString > smgr_wrapper_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory"; - return seqNames; -} - -OUString smgr_wrapper_getImplementationName() -{ - return OUString("com.sun.star.comp.stoc.OServiceManagerWrapper"); -} +namespace { -Sequence< OUString > smgr_getSupportedServiceNames() +Sequence< OUString > OServiceManager_getSupportedServiceNames() { Sequence< OUString > seqNames(2); seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory"; @@ -90,12 +75,7 @@ Sequence< OUString > smgr_getSupportedServiceNames() return seqNames; } -OUString smgr_getImplementationName() -{ - return OUString("com.sun.star.comp.stoc.OServiceManager"); -} - -Sequence< OUString > regsmgr_getSupportedServiceNames() +Sequence< OUString > ORegistryServiceManager_getSupportedServiceNames() { Sequence< OUString > seqNames(2); seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory"; @@ -103,15 +83,13 @@ Sequence< OUString > regsmgr_getSupportedServiceNames() return seqNames; } -OUString regsmgr_getImplementationName() +Sequence< OUString > OServiceManagerWrapper_getSupportedServiceNames() { - return OUString( "com.sun.star.comp.stoc.ORegistryServiceManager" ); -} + Sequence< OUString > seqNames(1); + seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory"; + return seqNames; } -namespace stoc_smgr -{ - static Sequence< OUString > retrieveAsciiValueList( const Reference< XSimpleRegistry > &xReg, const OUString &keyName ) { @@ -437,8 +415,6 @@ public: // XServiceInfo virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); - static OUString getImplementationName_Static() throw(::com::sun::star::uno::RuntimeException) - { return stoc_bootstrap::smgr_getImplementationName(); } virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException); virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); @@ -1108,7 +1084,7 @@ OUString OServiceManager::getImplementationName() throw(::com::sun::star::uno::RuntimeException) { check_undisposed(); - return getImplementationName_Static(); + return OUString("com.sun.star.comp.stoc.OServiceManager"); } // XServiceInfo @@ -1123,7 +1099,7 @@ Sequence< OUString > OServiceManager::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) { check_undisposed(); - return stoc_bootstrap::smgr_getSupportedServiceNames(); + return OServiceManager_getSupportedServiceNames(); } @@ -1387,7 +1363,7 @@ public: // XServiceInfo OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException) - { return stoc_bootstrap::regsmgr_getImplementationName(); } + { return OUString("com.sun.star.comp.stoc.ORegistryServiceManager"); } Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); @@ -1626,7 +1602,7 @@ Sequence< OUString > ORegistryServiceManager::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) { check_undisposed(); - return stoc_bootstrap::regsmgr_getSupportedServiceNames(); + return ORegistryServiceManager_getSupportedServiceNames(); } @@ -1715,37 +1691,67 @@ Any ORegistryServiceManager::getPropertyValue(const OUString& PropertyName) } // namespace -namespace stoc_bootstrap -{ -/** - * Create the ServiceManager - */ -Reference<XInterface > SAL_CALL OServiceManager_CreateInstance( +static Reference<XInterface > OServiceManager_CreateInstance( const Reference< XComponentContext > & xContext ) { return Reference<XInterface >( static_cast< XInterface * >( - static_cast< OWeakObject * >( new stoc_smgr::OServiceManager( xContext ) ) ) ); + static_cast< OWeakObject * >( new OServiceManager( xContext ) ) ) ); } -/** - * Create the ServiceManager - */ -Reference<XInterface > SAL_CALL ORegistryServiceManager_CreateInstance( +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL +com_sun_star_comp_stoc_OServiceManager_component_getFactory( + const char * , void * , void * ) +{ + Reference< css::lang::XSingleComponentFactory > xFactory; + xFactory = createSingleComponentFactory( + OServiceManager_CreateInstance, + "com.sun.star.comp.stoc.OServiceManager", + OServiceManager_getSupportedServiceNames() ); + xFactory->acquire(); + return xFactory.get(); +} + +static Reference<XInterface > ORegistryServiceManager_CreateInstance( const Reference< XComponentContext > & xContext ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { return Reference<XInterface >( static_cast< XInterface * >( - static_cast< OWeakObject * >( new stoc_smgr::ORegistryServiceManager( xContext ) ) ) ); + static_cast< OWeakObject * >( new ORegistryServiceManager( xContext ) ) ) ); +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL +com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory( + const char * , void * , void * ) +{ + Reference< css::lang::XSingleComponentFactory > xFactory; + xFactory = createSingleComponentFactory( + ORegistryServiceManager_CreateInstance, + "com.sun.star.comp.stoc.ORegistryServiceManager", + ORegistryServiceManager_getSupportedServiceNames() ); + xFactory->acquire(); + return xFactory.get(); } -Reference<XInterface > SAL_CALL OServiceManagerWrapper_CreateInstance( +static Reference<XInterface > OServiceManagerWrapper_CreateInstance( const Reference< XComponentContext > & xContext ) throw (Exception) { - return (OWeakObject *)new stoc_smgr::OServiceManagerWrapper( xContext ); + return (OWeakObject *)new OServiceManagerWrapper( xContext ); } + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL +com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory( + const char * , void * , void * ) +{ + Reference< css::lang::XSingleComponentFactory > xFactory; + xFactory = createSingleComponentFactory( + OServiceManagerWrapper_CreateInstance, + "com.sun.star.comp.stoc.OServiceManagerWrapper", + OServiceManagerWrapper_getSupportedServiceNames() ); + xFactory->acquire(); + return xFactory.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index a3e517c6be94..80e30daeab0b 100644 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -34,6 +34,7 @@ #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/Sequence.hxx" +#include <cppuhelper/factory.hxx> #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" #include "cppuhelper/weak.hxx" @@ -49,10 +50,14 @@ #include "rtl/ustring.hxx" #include "sal/types.h" -#include "bootstrapservices.hxx" - namespace { +static css::uno::Sequence< OUString > SimpleRegistry_getSupportedServiceNames() { + css::uno::Sequence< OUString > names(1); + names[0] = "com.sun.star.registry.SimpleRegistry"; + return names; +} + class SimpleRegistry: public cppu::WeakImplHelper2< css::registry::XSimpleRegistry, css::lang::XServiceInfo > @@ -96,7 +101,7 @@ private: virtual OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException) - { return stoc_bootstrap::simreg_getImplementationName(); } + { return OUString("com.sun.star.comp.stoc.SimpleRegistry"); } virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) throw (css::uno::RuntimeException) @@ -104,7 +109,7 @@ private: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) - { return stoc_bootstrap::simreg_getSupportedServiceNames(); } + { return SimpleRegistry_getSupportedServiceNames(); } Registry registry_; }; @@ -1120,24 +1125,24 @@ void SimpleRegistry::mergeKey( } -namespace stoc_bootstrap { - -css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance( +static css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance( SAL_UNUSED_PARAMETER css::uno::Reference< css::uno::XComponentContext > const &) { return static_cast< cppu::OWeakObject * >(new SimpleRegistry); } -css::uno::Sequence< OUString > simreg_getSupportedServiceNames() { - css::uno::Sequence< OUString > names(1); - names[0] = "com.sun.star.registry.SimpleRegistry"; - return names; -} - -OUString simreg_getImplementationName() { - return OUString("com.sun.star.comp.stoc.SimpleRegistry"); +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL +com_sun_star_comp_stoc_SimpleRegistry_component_getFactory( + const char * , void * , void * ) +{ + css::uno::Reference< css::lang::XSingleComponentFactory > xFactory; + xFactory = cppu::createSingleComponentFactory( + SimpleRegistry_CreateInstance, + "com.sun.star.comp.stoc.SimpleRegistry", + SimpleRegistry_getSupportedServiceNames() ); + xFactory->acquire(); + return xFactory.get(); } -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component index ee62700b3e81..f06de749e6ac 100644 --- a/stoc/util/bootstrap.component +++ b/stoc/util/bootstrap.component @@ -18,7 +18,7 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="bootstrap" xmlns="http://openoffice.org/2010/uno-components"> + prefix="direct" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.stoc.DLLComponentLoader"> <service name="com.sun.star.loader.SharedLibrary"/> </implementation> |