From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- desktop/test/deployment/active/Addons.xcu | 58 +++++ desktop/test/deployment/active/MANIFEST.MF | 3 + .../test/deployment/active/META-INF/manifest.xml | 34 +++ desktop/test/deployment/active/ProtocolHandler.xcu | 39 +++ desktop/test/deployment/active/active_native.cxx | 276 +++++++++++++++++++++ desktop/test/deployment/active/active_python.py | 112 +++++++++ .../sun/star/comp/test/deployment/Dispatch.java | 95 +++++++ .../sun/star/comp/test/deployment/Provider.java | 74 ++++++ .../sun/star/comp/test/deployment/Services.java | 65 +++++ desktop/test/deployment/active/description.xml | 27 ++ 10 files changed, 783 insertions(+) create mode 100644 desktop/test/deployment/active/Addons.xcu create mode 100644 desktop/test/deployment/active/MANIFEST.MF create mode 100644 desktop/test/deployment/active/META-INF/manifest.xml create mode 100644 desktop/test/deployment/active/ProtocolHandler.xcu create mode 100644 desktop/test/deployment/active/active_native.cxx create mode 100644 desktop/test/deployment/active/active_python.py create mode 100644 desktop/test/deployment/active/com/sun/star/comp/test/deployment/Dispatch.java create mode 100644 desktop/test/deployment/active/com/sun/star/comp/test/deployment/Provider.java create mode 100644 desktop/test/deployment/active/com/sun/star/comp/test/deployment/Services.java create mode 100644 desktop/test/deployment/active/description.xml (limited to 'desktop/test/deployment/active') diff --git a/desktop/test/deployment/active/Addons.xcu b/desktop/test/deployment/active/Addons.xcu new file mode 100644 index 0000000000..d3b481ef43 --- /dev/null +++ b/desktop/test/deployment/active/Addons.xcu @@ -0,0 +1,58 @@ + + + + + + + + + active + + + + + vnd.org.openoffice.test.desktop.deployment.active_native: + + + native + + + + + vnd.org.openoffice.test.desktop.deployment.active_java: + + + java + + + + + vnd.org.openoffice.test.desktop.deployment.active_python: + + + python + + + + + + + diff --git a/desktop/test/deployment/active/MANIFEST.MF b/desktop/test/deployment/active/MANIFEST.MF new file mode 100644 index 0000000000..63480874dd --- /dev/null +++ b/desktop/test/deployment/active/MANIFEST.MF @@ -0,0 +1,3 @@ +Sealed: true +RegistrationClassName: com.sun.star.comp.test.deployment.active_java.Services +UNO-Type-Path: diff --git a/desktop/test/deployment/active/META-INF/manifest.xml b/desktop/test/deployment/active/META-INF/manifest.xml new file mode 100644 index 0000000000..7cca7841d4 --- /dev/null +++ b/desktop/test/deployment/active/META-INF/manifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + diff --git a/desktop/test/deployment/active/ProtocolHandler.xcu b/desktop/test/deployment/active/ProtocolHandler.xcu new file mode 100644 index 0000000000..984ed981d9 --- /dev/null +++ b/desktop/test/deployment/active/ProtocolHandler.xcu @@ -0,0 +1,39 @@ + + + + + + + + vnd.org.openoffice.test.desktop.deployment.active_native:* + + + + + vnd.org.openoffice.test.desktop.deployment.active_java:* + + + + + vnd.org.openoffice.test.desktop.deployment.active_python:* + + + + diff --git a/desktop/test/deployment/active/active_native.cxx b/desktop/test/deployment/active/active_native.cxx new file mode 100644 index 0000000000..753f0da773 --- /dev/null +++ b/desktop/test/deployment/active/active_native.cxx @@ -0,0 +1,276 @@ +/* -*- 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 + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + +class Provider: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatchProvider > +{ +public: + Provider(const Provider&) = delete; + const Provider& operator=(const Provider&) = delete; + + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + { return static_cast< cppu::OWeakObject * >(new Provider(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames(); + +private: + explicit Provider( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { assert(context.is()); } + + virtual ~Provider() {} + + virtual rtl::OUString SAL_CALL getImplementationName() override + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) override + { return cppu::supportsService(this, ServiceName); } + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() override + { return static_getSupportedServiceNames(); } + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) override; + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > + SAL_CALL queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) override; + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Provider::static_getImplementationName() { + return rtl::OUString("com.sun.star.comp.test.deployment.active_native"); +} + +css::uno::Sequence< rtl::OUString > Provider::static_getSupportedServiceNames() +{ + rtl::OUString name("com.sun.star.test.deployment.active_native"); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + +css::uno::Reference< css::frame::XDispatch > Provider::queryDispatch( + css::util::URL const &, rtl::OUString const &, sal_Int32) +{ + css::uno::Reference< css::frame::XDispatch > dispatch; + if (!(context_->getValueByName( + "/singletons/com.sun.star.test.deployment." + "active_native_singleton") >>= + dispatch) || + !dispatch.is()) + { + throw css::uno::DeploymentException( + "component context fails to supply singleton" + " com.sun.star.test.deployment.active_native_singleton of type" + " com.sun.star.frame.XDispatch", + context_); + } + return dispatch; +} + +css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > +Provider::queryDispatches( + css::uno::Sequence< css::frame::DispatchDescriptor > const & Requests) +{ + css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > s( + Requests.getLength()); + for (sal_Int32 i = 0; i < s.getLength(); ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; +} + +class Dispatch: + public cppu::WeakImplHelper2< + css::lang::XServiceInfo, css::frame::XDispatch > +{ +public: + Dispatch(const Dispatch&) = delete; + const Dispatch& operator=(const Dispatch&) = delete; + + static css::uno::Reference< css::uno::XInterface > SAL_CALL static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + { return static_cast< cppu::OWeakObject * >(new Dispatch(xContext)); } + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static css::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames() + { return css::uno::Sequence< rtl::OUString >(); } + +private: + explicit Dispatch( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) { assert(context.is()); } + + virtual ~Dispatch() {} + + virtual rtl::OUString SAL_CALL getImplementationName() override + { return static_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) override + { return cppu::supportsService(this, ServiceName); } + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() override + { return static_getSupportedServiceNames(); } + + virtual void SAL_CALL dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) override; + + virtual void SAL_CALL addStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) override + {} + + virtual void SAL_CALL removeStatusListener( + css::uno::Reference< css::frame::XStatusListener > const &, + css::util::URL const &) override + {} + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +rtl::OUString Dispatch::static_getImplementationName() { + return rtl::OUString( + "com.sun.star.comp.test.deployment.active_native_singleton"); +} + +void Dispatch::dispatch( + css::util::URL const &, + css::uno::Sequence< css::beans::PropertyValue > const &) +{ + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(context_); + css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->getCurrentFrame(); + css::uno::Reference< css::awt::XWindowPeer > xWindowPeer( xFrame->getComponentWindow(), css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create(context_); + css::uno::Reference< css::awt::XMessageBox > box( + xToolkit->createMessageBox( + xWindowPeer, + css::awt::MessageBoxType_INFOBOX, + css::awt::MessageBoxButtons::BUTTONS_OK, "active", "native"), + css::uno::UNO_SET_THROW); + + box->execute(); + + css::uno::Reference< css::lang::XComponent > xComponent(box, css::uno::UNO_QUERY_THROW); + xComponent->dispose(); +} + +cppu::ImplementationEntry const services[] = { + { &Provider::static_create, &Provider::static_getImplementationName, + &Provider::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, nullptr, 0 }, + { &Dispatch::static_create, &Dispatch::static_getImplementationName, + &Dispatch::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, nullptr, 0 }, + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } +}; + +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); +} + +extern "C" SAL_DLLPUBLIC_EXPORT void +component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool component_writeInfo( + void * pServiceManager, void * pRegistryKey) +{ + if (!component_writeInfoHelper(pServiceManager, pRegistryKey, services)) { + return false; + } + try { + css::uno::Reference< css::registry::XRegistryKey >( + (css::uno::Reference< css::registry::XRegistryKey >( + static_cast< css::registry::XRegistryKey * >(pRegistryKey))-> + createKey( + "/" + Dispatch::static_getImplementationName() + + ("/UNO/SINGLETONS/com.sun.star.test.deployment." + "active_native_singleton"))), + css::uno::UNO_SET_THROW)-> + setStringValue(Dispatch::static_getImplementationName()); + } catch (const css::uno::Exception & e) { + SAL_INFO( + "desktop.test", + "active_native component_writeInfo exception: " << e.Message); + return false; + } + return true; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/test/deployment/active/active_python.py b/desktop/test/deployment/active/active_python.py new file mode 100644 index 0000000000..7f6e5bbd44 --- /dev/null +++ b/desktop/test/deployment/active/active_python.py @@ -0,0 +1,112 @@ +# +# 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 . +# + +import uno +import unohelper + +from com.sun.star.awt import Rectangle +from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK +from com.sun.star.awt.MessageBoxType import INFOBOX +from com.sun.star.frame import XDispatch, XDispatchProvider +from com.sun.star.lang import XServiceInfo +from com.sun.star.registry import InvalidRegistryException + +class Provider(unohelper.Base, XServiceInfo, XDispatchProvider): + implementationName = "com.sun.star.comp.test.deployment.active_python" + + serviceNames = ("com.sun.star.test.deployment.active_python",) + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def queryDispatch(self, URL, TargetFrame, SearchFlags): + return self.context.getValueByName( \ + "/singletons/com.sun.star.test.deployment.active_python_singleton") + + def queryDispatches(self, Requests): + tuple( \ + self.queryDispatch(i.FeatureURL, i.FrameName, i.SearchFlags) \ + for i in Requests) + +class Dispatch(unohelper.Base, XServiceInfo, XDispatch): + implementationName = \ + "com.sun.star.comp.test.deployment.active_python_singleton" + + serviceNames = () + + def __init__(self, context): + self.context = context + + def getImplementationName(self): + return self.implementationName + + def supportsService(self, ServiceName): + return ServiceName in self.serviceNames + + def getSupportedServiceNames(self): + return self.serviceNames + + def dispatch(self, URL, Arguments): + smgr = self.context.getServiceManager() + box = smgr.createInstanceWithContext( \ + "com.sun.star.awt.Toolkit", self.context).createMessageBox( \ + smgr.createInstanceWithContext( \ + "com.sun.star.frame.Desktop", self.context). \ + getCurrentFrame().getComponentWindow(), \ + INFOBOX, BUTTONS_OK, "active", "python") + box.execute(); + box.dispose(); + + def addStatusListener(self, Control, URL): + pass + + def removeStatusListener(self, Control, URL): + pass + +def getComponentFactory(implementationName, smgr, regKey): + if implementationName == Provider.implementationName: + return unohelper.createSingleServiceFactory( \ + Provider, Provider.implementationName, Provider.serviceNames) + elif implementationName == Dispatch.implementationName: + return unohelper.createSingleServiceFactory( \ + Dispatch, Dispatch.implementationName, Dispatch.serviceNames) + else: + return None + +def writeRegistryInfo(smgr, regKey): + try: + for i in (Provider, Dispatch): + key = regKey.createKey("/" + i.implementationName + "/UNO") + for j in i.serviceNames: + key.createKey("/SERVICES/" + j); + regKey.createKey( \ + "/" + Dispatch.implementationName + "/UNO/SINGLETONS/" \ + "com.sun.star.test.deployment.active_python_singleton"). \ + setStringValue(Dispatch.implementationName) + except InvalidRegistryException: + return False + return True diff --git a/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Dispatch.java b/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Dispatch.java new file mode 100644 index 0000000000..e224c94183 --- /dev/null +++ b/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Dispatch.java @@ -0,0 +1,95 @@ +/* + * 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 . + */ + +package com.sun.star.comp.test.deployment.active_java; + +import com.sun.star.awt.MessageBoxButtons; +import com.sun.star.awt.MessageBoxType; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XMessageBox; +import com.sun.star.awt.XMessageBoxFactory; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.beans.PropertyValue; +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XStatusListener; +import com.sun.star.lang.WrappedTargetRuntimeException; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Dispatch extends WeakBase implements XServiceInfo, XDispatch +{ + public Dispatch(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return false; //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public void dispatch(URL URL, PropertyValue[] Arguments) { + try { + XMultiComponentFactory smgr = UnoRuntime.queryInterface( + XMultiComponentFactory.class, context.getServiceManager()); + XMessageBox box = UnoRuntime.queryInterface( + XMessageBoxFactory.class, + smgr.createInstanceWithContext( + "com.sun.star.awt.Toolkit", context)). + createMessageBox( + UnoRuntime.queryInterface( + XWindowPeer.class, + (UnoRuntime.queryInterface( + XDesktop.class, + smgr.createInstanceWithContext( + "com.sun.star.frame.Desktop", context)). + getCurrentFrame().getComponentWindow())), + MessageBoxType.INFOBOX, MessageBoxButtons.BUTTONS_OK, + "active", "java"); + box.execute(); + UnoRuntime.queryInterface(XComponent.class, box).dispose(); + } catch (com.sun.star.uno.RuntimeException e) { + throw e; + } catch (com.sun.star.uno.Exception e) { + throw new WrappedTargetRuntimeException(e, + "wrapped: " + e.getMessage(), this, e); + } + } + + public void addStatusListener(XStatusListener Control, URL URL) {} + + public void removeStatusListener(XStatusListener Control, URL URL) {} + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.active_java_singleton"; + + static final String[] serviceNames = new String[0]; +} diff --git a/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Provider.java b/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Provider.java new file mode 100644 index 0000000000..3b9f8b88ee --- /dev/null +++ b/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Provider.java @@ -0,0 +1,74 @@ +/* + * 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 . + */ + +package com.sun.star.comp.test.deployment.active_java; + +import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XDispatchProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.util.URL; + +public final class Provider extends WeakBase + implements XServiceInfo, XDispatchProvider +{ + public Provider(XComponentContext context) { + this.context = context; + } + + public String getImplementationName() { return implementationName; } + + public boolean supportsService(String ServiceName) { + return ServiceName.equals(getSupportedServiceNames()[0]); //TODO + } + + public String[] getSupportedServiceNames() { + return serviceNames; + } + + public XDispatch queryDispatch( + URL URL, String TargetFrameName, int SearchFlags) + { + return UnoRuntime.queryInterface( + XDispatch.class, + context.getValueByName( + "/singletons/" + + "com.sun.star.test.deployment.active_java_singleton")); + } + + public XDispatch[] queryDispatches(DispatchDescriptor[] Requests) { + XDispatch[] s = new XDispatch[Requests.length]; + for (int i = 0; i < s.length; ++i) { + s[i] = queryDispatch( + Requests[i].FeatureURL, Requests[i].FrameName, + Requests[i].SearchFlags); + } + return s; + } + + private final XComponentContext context; + + static final String implementationName = + "com.sun.star.comp.test.deployment.active_java"; + + static final String[] serviceNames = new String[] { + "com.sun.star.test.deployment.active_java" }; +} diff --git a/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Services.java b/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Services.java new file mode 100644 index 0000000000..1af3f42b7d --- /dev/null +++ b/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Services.java @@ -0,0 +1,65 @@ +/* + * 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 . + */ + +package com.sun.star.comp.test.deployment.active_java; + +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.registry.InvalidRegistryException; +import com.sun.star.registry.XRegistryKey; + +public final class Services { + private Services() {} + + public static XSingleComponentFactory __getComponentFactory( + String implementation) + { + if (implementation.equals(Dispatch.implementationName)) { + return Factory.createComponentFactory( + Dispatch.class, Dispatch.implementationName, + Dispatch.serviceNames); + } else if (implementation.equals(Provider.implementationName)) { + return Factory.createComponentFactory( + Provider.class, Provider.implementationName, + Provider.serviceNames); + } else { + return null; + } + } + + public static boolean __writeRegistryServiceInfo(XRegistryKey key) { + if (!(Factory.writeRegistryServiceInfo( + Dispatch.implementationName, Dispatch.serviceNames, key) && + Factory.writeRegistryServiceInfo( + Provider.implementationName, Provider.serviceNames, key))) + { + return false; + } + try { + key. + createKey( + "/" + Dispatch.implementationName + + "/UNO/SINGLETONS/" + + "com.sun.star.test.deployment.active_java_singleton"). + setStringValue(Dispatch.implementationName); + } catch (InvalidRegistryException e) { + return false; + } + return true; + } +} diff --git a/desktop/test/deployment/active/description.xml b/desktop/test/deployment/active/description.xml new file mode 100644 index 0000000000..685d721322 --- /dev/null +++ b/desktop/test/deployment/active/description.xml @@ -0,0 +1,27 @@ + + + + + + + + + + -- cgit v1.2.3