diff options
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/javaloader/javaloader.component | 5 | ||||
-rw-r--r-- | stoc/source/javaloader/javaloader.cxx | 53 |
2 files changed, 11 insertions, 47 deletions
diff --git a/stoc/source/javaloader/javaloader.component b/stoc/source/javaloader/javaloader.component index 9299097c4fd0..cc4ae610bdb2 100644 --- a/stoc/source/javaloader/javaloader.component +++ b/stoc/source/javaloader/javaloader.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="javaloader" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.stoc.JavaComponentLoader"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.stoc.JavaComponentLoader" + constructor="stoc_JavaComponentLoader_get_implementation"> <service name="com.sun.star.loader.Java"/> <service name="com.sun.star.loader.Java2"/> </implementation> diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx index 191703b103c0..2b40cdd219db 100644 --- a/stoc/source/javaloader/javaloader.cxx +++ b/stoc/source/javaloader/javaloader.cxx @@ -64,18 +64,6 @@ using namespace ::osl; namespace stoc_javaloader { -static Mutex & getInitMutex(); - -static Sequence< OUString > loader_getSupportedServiceNames() -{ - return { "com.sun.star.loader.Java", "com.sun.star.loader.Java2" }; -} - -static OUString loader_getImplementationName() -{ - return "com.sun.star.comp.stoc.JavaComponentLoader"; -} - namespace { class JavaComponentLoader : public WeakImplHelper<XImplementationLoader, XServiceInfo> @@ -117,7 +105,8 @@ public: const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaLoader() { - MutexGuard aGuard(getInitMutex()); + static Mutex ourMutex; + MutexGuard aGuard(ourMutex); if (m_javaLoader.is()) return m_javaLoader; @@ -290,7 +279,7 @@ JavaComponentLoader::JavaComponentLoader(const css::uno::Reference<XComponentCon // XServiceInfo OUString SAL_CALL JavaComponentLoader::getImplementationName() { - return loader_getImplementationName(); + return "com.sun.star.comp.stoc.JavaComponentLoader"; } sal_Bool SAL_CALL JavaComponentLoader::supportsService(const OUString & ServiceName) @@ -300,7 +289,7 @@ sal_Bool SAL_CALL JavaComponentLoader::supportsService(const OUString & ServiceN Sequence<OUString> SAL_CALL JavaComponentLoader::getSupportedServiceNames() { - return loader_getSupportedServiceNames(); + return { "com.sun.star.loader.Java", "com.sun.star.loader.Java2" }; } @@ -326,18 +315,12 @@ css::uno::Reference<XInterface> SAL_CALL JavaComponentLoader::activate( return loader->activate(rImplName, blabla, rLibName, xKey); } -static Mutex & getInitMutex() -{ - static Mutex ourMutex; - - return ourMutex; -} - -/// @throws Exception -static css::uno::Reference<XInterface> JavaComponentLoader_CreateInstance(const css::uno::Reference<XComponentContext> & xCtx) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +stoc_JavaComponentLoader_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { try { - return *new JavaComponentLoader(xCtx); + return cppu::acquire(new JavaComponentLoader(context)); } catch(const RuntimeException &) { TOOLS_INFO_EXCEPTION("stoc", "could not init javaloader"); @@ -348,25 +331,5 @@ static css::uno::Reference<XInterface> JavaComponentLoader_CreateInstance(const } //end namespace -using namespace stoc_javaloader; - -const struct ImplementationEntry g_entries[] = -{ - { - JavaComponentLoader_CreateInstance, loader_getImplementationName, - loader_getSupportedServiceNames, createOneInstanceComponentFactory, - nullptr , 0 - }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - -extern "C" -{ -SAL_DLLPUBLIC_EXPORT void * javaloader_component_getFactory( - const char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); -} -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |