diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /ure | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ure')
29 files changed, 2441 insertions, 0 deletions
diff --git a/ure/Makefile b/ure/Makefile new file mode 100644 index 000000000..ccb1c85a0 --- /dev/null +++ b/ure/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/ure/Module_ure.mk b/ure/Module_ure.mk new file mode 100644 index 000000000..88cbc71b3 --- /dev/null +++ b/ure/Module_ure.mk @@ -0,0 +1,17 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_Module_Module,ure)) + +$(eval $(call gb_Module_add_targets,ure,\ + Package_install \ + Rdb_ure \ +)) + +# vim:set noet sw=4 ts=4: diff --git a/ure/Package_install.mk b/ure/Package_install.mk new file mode 100644 index 000000000..e8b6515fd --- /dev/null +++ b/ure/Package_install.mk @@ -0,0 +1,22 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_Package_Package,ure_install,$(SRCDIR)/ure/source)) + +ifneq (,$(filter-out MACOSX WNT,$(OS))) +$(eval $(call gb_Package_add_file,ure_install,$(LIBO_URE_BIN_FOLDER)/uno,uno)) +endif + +ifeq (MACOSX,$(OS)) +ifneq ($(ENABLE_MACOSX_SANDBOX),TRUE) +$(eval $(call gb_Package_add_symbolic_link,ure_install,MacOS/urelibs,../Frameworks)) +endif +endif + +# vim:set noet sw=4 ts=4: diff --git a/ure/README b/ure/README new file mode 100644 index 000000000..23b15bf86 --- /dev/null +++ b/ure/README @@ -0,0 +1,8 @@ +Contains the UNO Runtime Environment (URE). + +Beginnings of standalone UNO distribution. + + +You may also want to read the README located at: +[git:ure/source/README] + diff --git a/ure/Rdb_ure.mk b/ure/Rdb_ure.mk new file mode 100644 index 000000000..7a64cfb22 --- /dev/null +++ b/ure/Rdb_ure.mk @@ -0,0 +1,33 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_Rdb_Rdb_install,ure/services,$(LIBO_URE_MISC_FOLDER)/services.rdb)) + +$(eval $(call gb_Rdb_add_components,ure/services,\ + binaryurp/source/binaryurp \ + io/source/io \ + stoc/util/bootstrap \ + stoc/source/inspect/introspection \ + stoc/source/invocation_adapterfactory/invocadapt \ + stoc/source/invocation/invocation \ + stoc/source/namingservice/namingservice \ + stoc/source/proxy_factory/proxyfac \ + stoc/source/corereflection/reflection \ + stoc/util/stocservices \ + remotebridges/source/unourl_resolver/uuresolver \ +)) + +ifneq ($(ENABLE_JAVA),) +$(eval $(call gb_Rdb_add_components,ure/services,\ + stoc/source/javaloader/javaloader \ + stoc/source/javavm/javavm \ +)) +endif + +# vim:set noet sw=4 ts=4: diff --git a/ure/source/README b/ure/source/README new file mode 100644 index 000000000..aad11505e --- /dev/null +++ b/ure/source/README @@ -0,0 +1,345 @@ +# +# 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 . +# + +Overview of URE installation +----------------------------- + +ELF platforms (Linux, Solaris, *BSD): + +/opt/libreoffice/ure/LICENSE +/opt/libreoffice/ure/THIRDPARTYLICENSEREADME.html +/opt/libreoffice/ure/README +/opt/libreoffice/ure/bin/uno +/opt/libreoffice/ure/bin/regmerge +/opt/libreoffice/ure/bin/regview +/opt/libreoffice/ure/bin/javaldx +/opt/libreoffice/ure/lib/libuno_cppu.so.3 +/opt/libreoffice/ure/lib/libuno_cppuhelpergcc3.so.3 +/opt/libreoffice/ure/lib/libuno_purpenvhelpergcc3.so.3 +/opt/libreoffice/ure/lib/libuno_sal.so.3 +/opt/libreoffice/ure/lib/libuno_salhelpergcc3.so.3 +/opt/libreoffice/ure/share/java/unoloader.jar +/opt/libreoffice/ure/share/java/juh.jar +/opt/libreoffice/ure/share/java/jurt.jar +/opt/libreoffice/ure/share/java/libreoffice.jar +/opt/libreoffice/ure/share/java/ridl.jar +/opt/libreoffice/ure/share/misc/types.rdb +/opt/libreoffice/ure/share/misc/services.rdb +/opt/libreoffice/ure/lib/libxml2.so.2 [external] +/opt/libreoffice/ure/bin/uno.bin [private] +/opt/libreoffice/ure/lib/unorc [private] +/opt/libreoffice/ure/lib/libreglo.so [private] +/opt/libreoffice/ure/lib/libstorelo.so [private] +/opt/libreoffice/ure/lib/libunoidllo.so [private] +/opt/libreoffice/ure/lib/libxmlreaderlo.so [private] +/opt/libreoffice/ure/lib/libjvmaccesslo.so [private] +/opt/libreoffice/ure/lib/libjvmfwklo.so [private] +/opt/libreoffice/ure/lib/JREProperties.class [private] +/opt/libreoffice/ure/lib/jvmfwk3rc [private] +/opt/libreoffice/ure/lib/libgcc3_uno.so [private] +/opt/libreoffice/ure/lib/libjava_uno.so [private] +/opt/libreoffice/ure/lib/libunsafe_uno_uno.so [private] +/opt/libreoffice/ure/lib/libaffine_uno_uno.so [private] +/opt/libreoffice/ure/lib/liblog_uno_uno.so [private] +/opt/libreoffice/ure/lib/libjpipe.so [private] +/opt/libreoffice/ure/lib/libjuh.so [private] +/opt/libreoffice/ure/lib/libjuhx.so [private] +/opt/libreoffice/ure/lib/libsal_textenclo.so [private] +/opt/libreoffice/ure/lib/libacceptorlo.so [private] +/opt/libreoffice/ure/lib/libbinaryurplo.so [private] +/opt/libreoffice/ure/lib/libbootstraplo.so [private] +/opt/libreoffice/ure/lib/libconnectorlo.so [private] +/opt/libreoffice/ure/lib/libintrospectionlo.so [private] +/opt/libreoffice/ure/lib/libinvocadaptlo.so [private] +/opt/libreoffice/ure/lib/libinvocationlo.so [private] +/opt/libreoffice/ure/lib/libjavaloaderlo.so [private] +/opt/libreoffice/ure/lib/libjavavmlo.so [private] +/opt/libreoffice/ure/lib/libnamingservicelo.so [private] +/opt/libreoffice/ure/lib/libproxyfaclo.so [private] +/opt/libreoffice/ure/lib/libreflectionlo.so [private] +/opt/libreoffice/ure/lib/libstreamslo.so [private] +/opt/libreoffice/ure/lib/libtextinstreamlo.so [private] +/opt/libreoffice/ure/lib/libtextoutstreamlo.so [private] +/opt/libreoffice/ure/lib/libstocserviceslo.so [private] +/opt/libreoffice/ure/lib/libuuresolverlo.so [private] +/opt/libreoffice/ure/share/java/java_uno.jar [private] +/opt/libreoffice/ure/share/misc/javavendors.xml [private] + +Windows: + +Program Files\URE\LICENSE +Program Files\URE\THIRDPARTYLICENSEREADME.html +Program Files\URE\README +Program Files\URE\bin\uno.exe +Program Files\URE\bin\regmerge.exe +Program Files\URE\bin\regview.exe +Program Files\URE\bin\cppu3.dll +Program Files\URE\bin\cppuhelper3MSC.dll +Program Files\URE\bin\purpenvhelper3MSC.dll +Program Files\URE\bin\sal3.dll +Program Files\URE\bin\salhelper3MSC.dll +Program Files\URE\java\unoloader.jar +Program Files\URE\java\libreoffice.jar +Program Files\URE\java\juh.jar +Program Files\URE\java\jurt.jar +Program Files\URE\java\ridl.jar +Program Files\URE\misc\types.rdb +Program Files\URE\misc\services.rdb +Program Files\URE\bin\libxml2.dll [external] +Program Files\URE\bin\uno.ini [private] +Program Files\URE\bin\reglo.dll [private] +Program Files\URE\bin\storelo.dll [private] +Program Files\URE\bin\unoidllo.dll [private] +Program Files\URE\bin\xmlreaderlo.dll [private] +Program Files\URE\bin\jvmaccesslo.dll [private] +Program Files\URE\bin\jvmfwklo.dll [private] +Program Files\URE\bin\JREProperties.class [private] +Program Files\URE\bin\jvmfwk3.ini [private] +Program Files\URE\bin\msci_uno.dll [private] +Program Files\URE\bin\java_uno.dll [private] +Program Files\URE\bin\cli_uno.dll [private] +Program Files\URE\bin\unsafe_uno_uno.dll [private] +Program Files\URE\bin\affine_uno_uno.dll [private] +Program Files\URE\bin\log_uno_uno.dll [private] +Program Files\URE\bin\jpipe.dll [private] +Program Files\URE\bin\jpipx.dll [private] +Program Files\URE\bin\juh.dll [private] +Program Files\URE\bin\juhx.dll [private] +Program Files\URE\bin\sal_textenclo.dll [private] +Program Files\URE\bin\acceptorlo.dll [private] +Program Files\URE\bin\binaryurplo.dll [private] +Program Files\URE\bin\bootstraplo.dll [private] +Program Files\URE\bin\connectorlo.dll [private] +Program Files\URE\bin\introspectionlo.dll [private] +Program Files\URE\bin\invocadaptlo.dll [private] +Program Files\URE\bin\invocationlo.dll [private] +Program Files\URE\bin\javaloaderlo.dll [private] +Program Files\URE\bin\javavmlo.dll [private] +Program Files\URE\bin\namingservicelo.dll [private] +Program Files\URE\bin\proxyfaclo.dll [private] +Program Files\URE\bin\reflectionlo.dll [private] +Program Files\URE\bin\streamslo.dll [private] +Program Files\URE\bin\textinstreamlo.dll [private] +Program Files\URE\bin\textoutstreamlo.dll [private] +Program Files\URE\bin\stocserviceslo.dll [private] +Program Files\URE\bin\uuresolverlo.dll [private] +Program Files\URE\bin\uwinapi.dll [private] +Program Files\URE\java\java_uno.jar [private] +Program Files\URE\misc\javavendors.xml [private] + +%windir%\assembly\cli_basetypes.dll [GAC] +%windir%\assembly\cli_ure.dll [GAC] +%windir%\assembly\cli_uretypes.dll [GAC] +%windir%\assembly\cli_cppuhelper.dll [GAC] +%windir%\assembly\policy.1.0.cli_basetypes.dll [GAC] +%windir%\assembly\policy.1.0.cli_ure.dll [GAC] +%windir%\assembly\policy.1.0.cli_uretypes.dll [GAC] +%windir%\assembly\policy.1.0.cli_cppuhelper.dll [GAC] + +Files marked as [external] are included in the URE installation because the URE +needs them and it cannot be guaranteed that they are available on a given +system. Applications using the URE may need those files too, so they are made +available as non-private files of the URE installation. However, in an ideal +world, those files would not need to be included in the URE installation. + +Files marked as [private] are private to the URE installation. To avoid +stability issues, applications that use the URE should not access the +functionality of these files. + +Files marked as [GAC] are installed in the Global Assembly Cache on Windows. The +file path reflects the path as seen in the Explorer with the Assembly +Cache Viewer Tool (Shfusion.dll) installed. The actual paths are different. + + +Public Files in a URE Installation +---------------------------------- + +A URE installation contains the following public files: + +- uno is the executable file that runs UNO components. For more details, see +the SDK Developer's Guide. + +- regmerge and regview are tools that work with binary registries that contain +UNO type or UNO service information. For more details, see the SDK Developer's +Guide. + +- javaldx is a helper program on Linux, Solaris, and *BSD that +enables Java executables to use a Java VM, such as OpenJDK or the Sun JDK/JRE. +Executables such as uno run this helper automatically. + +- cppu, cppuhelper, purpenvhelper, sal, and salhelper are the public C++ UNO +runtime dynamic libraries that client code can call. For details on the +functionality that these libraries offer, see the "C++ Reference" section of the +SDK HTML documentation. The corresponding C++ header files are not in the URE, +but rather in the SDK. + +- libreoffice.jar and unoloader.jar are the public Java UNO runtime +Java[tm] Archives (JARs) that client code can call. +juh.jar, jurt.jar, ridl.jar, unoil.jar are still provided for backwards compatibility, +but are basically empty and have been merged into libreoffice.jar. +For details on the functionality that these files offer, see the +"Java UNO Runtime Reference" section of the SDK HTML documentation. + +- types.rdb and services.rdb are preconfigured UNO type and service registries. +For more details, see the "Deploying a URE" section of this README. + + +Deploying a URE +--------------- + +By default, the URE is installed in /opt/libreoffice/ure on Linux, +Solaris, and *BSD, and in Program Files\URE on Windows. If you +want, you can override this location when you install the URE, for example, with +rpm --relocate on Linux. The URE is designed so that multiple instances of the +URE can coexist on a single system in different locations. + +On Windows, the path to the installed URE is stored in the registry under the +path "HKEY_CLASSES_ROOT\Software\LibreOffice\URE" and key "Path". + + +UNO Deployment Variables +------------------------ + +The URE installation is preconfigured with several UNO types and UNO services. +The available types and services are listed in the types.rdb and services.rdb +files respectively. The location of these files is stored by two UNO deployment +variables, namely UNO_TYPES and UNO_SERVICES. These variables are set up by a +unorc or uno.ini that is private to the URE installation. This private file +also contains the private deployment variables URE_INTERNAL_LIB_DIR, +URE_INTERNAL_JAVA_DIR, and URE_INTERNAL_JAVA_CLASSPATH, which are required by +the URE. + +The UNO_TYPES and UNO_SERVICES variables automatically search the following +locations for types.rdb and services.rdb files: + +Linux, Solaris, and *BSD: + +- <URE installation>/share/misc/ types.rdb and services.rdb, respectively +- any URLs listed in the public deployment variables URE_MORE_TYPES and + URE_MORE_SERVICES, respectively + +Windows: + +- <URE installation>\misc\ types.rdb and services.rdb, respectively +- any URLs listed in the public deployment variables URE_MORE_TYPES and + URE_MORE_SERVICES, respectively + +NOTE: The URE on Windows does not support a system-wide deployment of additional +types.rdb and services.rdb files. That is, you cannot store additional +types.rdb and services.rdb files in a Documents and Settings\All +Users\Application Data\URE directory. + +URE_MORE_TYPES and URE_MORE_SERVICES each contain zero or more space-separated +URI descriptors. A URI descriptor is either a URI (denoting an individual file) +or a URI embedded in "<" and ">*" (denoting all the files contained non- +recursively within the directory denoted by the given URI). + +The Java UNO environment needs type information in the form of Java class files +instead of rdb files. Additional types are searched for in any URLs listed in +the public deployment variable URE_MORE_JAVA_TYPES. + +For details on how to override the UNO deployment variables, see the SDK +Developer's Guide or go to http://udk.openoffice.org/common/man/concept/ +micro_deployment.html. + + +URE Java Framework +------------------ + +When a URE executable, such as uno, starts a Java VM, the URE Java Framework +searches for a suitable JDK/JRE installation. For more information on the URE +Java Framework, go to http://udk.openoffice.org/common/man/spec/ +javavendorextension.sxw. The private javavendors.xml file in a URE installation +provides preconfigured support for various JDK/JRE versions. The private +jvmfwk3rc or jvmfwk3.ini file specifies the location of a suitable JDK/JRE +installation. When an executable tries to start a Java VM, the URE searches the +relevant Java settings file for information on a suitable JDK/JRE version. + +NOTE: On any platform, you can delete the javasettings_${_OS}_${_ARCH}.xml file +if the file contains problematic stale data. + +By default, the URE does not search for a Java settings file, but instead +searches for a suitable JDK/JRE installation whenever necessary. You can +override this by setting the URE_OVERRIDE_JAVA_JFW_SHARED_DATA and +URE_OVERRIDE_JAVA_JFW_USER_DATA deployment variables. If +URE_OVERRIDE_JAVA_JFW_USER_DATA is set, the URE will update the relevant +information in +${URE_OVERRIDE_JAVA_JFW_USER_DATA}/javasettings_${_OS}_${_ARCH}.xml when it +searches for a suitable JDK/JRE installation. You can also use the +UNO_JAVA_JFW_JREHOME deployment variable to specify the location of a JDK/JRE +installation. For more information on this variable, see +http://udk.openoffice.org/common/man/spec/javavendorextension.sxw. + +The URE allows clients to extend the content of UNO_JAVA_JFW_CLASSPATH_URLS (see +http://udk.openoffice.org/common/man/spec/javavendorextension.sxw): The content +of the public deployment variable URE_MORE_JAVA_CLASSPATH_URLS, if set, is +added to the end of the URE's UNO_JAVA_JFW_CLASSPATH_URLS list. + +You might experience problems in an SDK environment that uses different JDK/JRE +versions for the SDK and the URE. This problem arises when the OO_SDK_JAVA_HOME +SDK environment variable specifies a different Java VM than the Java VM that is +used in the URE Java Framework. See the "Installation Guide" section of the SDK +HTML documentation to find out how to set the OO_SDK_JAVA_HOME environment +variable. + + +C++ and Java UNO Components +--------------------------- + +C++ UNO components run from within the uno executable can depend on an +environment in which the public C++ UNO runtime dynamic libraries (cppu, +cppuhelper, purpenvhelper, sal, salhelper) and the external dynamic libraries +(libxml2 etc.) are already available (that is, on Linux, Solaris, and +*BSD, a component dynamic library need not make sure that the UNO +runtime dynamic libraries it needs can be found on its RPATH). + +Similarly, Java UNO components can depend on an environment in which the public +Java UNO runtime JARs are already available (that is, a component JAR need not +list in its manifest Class-Path the UNO runtime JARs it needs). + +If a Java UNO component requires additional UNO types, use the UNO-Type-Path +manifest entry to specify the location of the UNO types. The UNO-Type-Path is +similar to the Class-Path manifest entry and can contain URLs of JARs and +directories that contain the Java classes that represent additional UNO types. +The UnoClassLoader evaluates the UNO-Type-Path manifest entry to ensure that the +additional UNO types are available to the Java UNO environment. + +The UNO-Type-Path can have the following entries: + +- UNO-Type-Path: +Current JAR does not contain UNO types. + +- UNO-Type-Path: <> +Current JAR contains UNO types. + +- UNO-Type-Path: any/other/jar.jar yet/another/jar.jar +Current JAR brings other JARs that contain UNO types. + +- UNO-Type-Path: any/other/jar.jar <> yet/another/jar.jar +Current JAR and other JARs that the current JARs uses contain UNO types. + +NOTE: If you do not include the UNO-Type-Path manifest entry, the URE assumes +that the current JAR contains UNO types. + +If a Java application requires the Java UNO environment, the UnoClassLoader must +be set up to load the relevant Java classes. For example, Runner.java in the +uretest bundle is packed as runner.jar, which the makefiles use to launch the +javaclient.jar application. For more information, see +com.sun.star.lib.unoloader.UnoClassLoader and +com.sun.star.lib.unoloader.UnoLoader in the "Java UNO Runtime Reference" section +of the SDK HTML documentation. diff --git a/ure/source/THIRDPARTYLICENSEREADME.html b/ure/source/THIRDPARTYLICENSEREADME.html new file mode 100644 index 000000000..0f08b281f --- /dev/null +++ b/ure/source/THIRDPARTYLICENSEREADME.html @@ -0,0 +1,490 @@ +DO NOT TRANSLATE OR LOCALIZE + +*************************************************************************** + +%%The following software may be included in this product: +libxml2 + +Use of any of this software is governed by the terms of the license below: + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Additional License(s) + +Except where otherwise noted in the source code (trio files, hash.c and list.c) +covered by a similar licence but with different Copyright notices: + + Copyright (C) 1998-2002 Daniel Veillard. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Daniel Veillard shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from him. + +*************************************************************************** + +%%The following software may be included in this product: +libstdc++ + +Use of any of this software is governed by the terms of the license below: + +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +Additional License(s) + +I didn't search the source code, our program is dynamically linking +against the libstdc++ library installed on the system. However, here +is the additional Licenses info from opensource review#1994: + + +here is header one of the source files from the libstdc++ directory + +// Explicit instantiation file. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free +software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you +compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be +covered by +// the GNU General Public License. + +// +// ISO C++ 14882: +// + + + +And here is a header from a file from libgcc, they look the same +version to me + +/* Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Contributed by Jakub Jelinek . + + This file is part of GNU CC. + + GNU CC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GNU CC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU CC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public +License. */ + +/* Locate the FDE entry for a given address, using PT_GNU_EH_FRAME ELF + segment and dl_iterate_phdr to avoid register/deregister calls at + DSO load/unload. */ + +*************************************************************************** + diff --git a/ure/source/uno b/ure/source/uno new file mode 100755 index 000000000..f5222ba1c --- /dev/null +++ b/ure/source/uno @@ -0,0 +1,47 @@ +#!/bin/sh +# +# 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 . +# + +# Pass -env arguments on to javaldx; needs to be fixed: +my_envargs= +for my_arg in "$@" ; do + case ${my_arg} in + -env:*) my_envargs="${my_envargs} ${my_arg}" ;; + esac +done + +# Extend the LD_LIBRARY_PATH for Java: +epath=$(dirname "$0") +if [ -x "${epath}/javaldx" ] ; then + jpath=$("${epath}/javaldx" $my_envargs) + if [ -n "${jpath}" ]; then + sd_platform=$(uname -s) + case $sd_platform in + AIX) + LIBPATH=${jpath}${LIBPATH:+:${LIBPATH}} + export LIBPATH + ;; + *) + LD_LIBRARY_PATH=${jpath}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} + export LD_LIBRARY_PATH + ;; + esac + fi +fi + +exec "$0.bin" "$@" diff --git a/ure/source/uretest/JavaClient.java b/ure/source/uretest/JavaClient.java new file mode 100644 index 000000000..f86d61af6 --- /dev/null +++ b/ure/source/uretest/JavaClient.java @@ -0,0 +1,58 @@ +/* + * 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 test.java.javaclient; + +import com.sun.star.bridge.XBridge; +import com.sun.star.bridge.XBridgeFactory; +import com.sun.star.comp.helper.Bootstrap; +import com.sun.star.connection.Connector; +import com.sun.star.lang.XComponent; +import com.sun.star.lib.uno.helper.UnoUrl; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import test.types.Data; +import test.types.XServer; + +public final class JavaClient { + public static void main(String[] arguments) throws Exception { + XComponentContext context = Bootstrap.createInitialComponentContext( + null); + XBridgeFactory factory = UnoRuntime.queryInterface( + XBridgeFactory.class, + context.getServiceManager().createInstanceWithContext( + "com.sun.star.bridge.BridgeFactory", context)); + if (factory == null) { + throw new NullPointerException("no bridge factory"); + } + UnoUrl url = UnoUrl.parseUnoUrl(arguments[0]); + XBridge bridge = factory.createBridge( + "", url.getProtocolAndParametersAsString(), + Connector.create(context).connect( + url.getConnectionAndParametersAsString()), + null); + Data d = UnoRuntime.queryInterface( + XServer.class, bridge.getInstance(url.getRootOid())).getData(); + UnoRuntime.queryInterface(XComponent.class, bridge).dispose(); + if (!d.m1.equals("Hello") || d.m2 != 42) { + throw new RuntimeException("Data object contains bad values"); + } + } + + private JavaClient() {} +} diff --git a/ure/source/uretest/JavaMain.java b/ure/source/uretest/JavaMain.java new file mode 100644 index 000000000..be0632293 --- /dev/null +++ b/ure/source/uretest/JavaMain.java @@ -0,0 +1,61 @@ +/* + * 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 test.java.javamain; + +import com.sun.star.comp.loader.FactoryHelper; +import com.sun.star.lang.XMain; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.registry.XRegistryKey; +import com.sun.star.uno.XComponentContext; +import test.java.tester.Tester; + +public final class JavaMain implements XMain { + public JavaMain(XComponentContext context) { + this.context = context; + } + + public int run(String[] arguments) { + Tester.test(context); + return 0; + } + + public static boolean __writeRegistryServiceInfo(XRegistryKey key) { + return + FactoryHelper.writeRegistryServiceInfo( + IMPLEMENTATION_NAME, SERVICE_NAME, key); + } + + public static XSingleServiceFactory __getServiceFactory( + String name, XMultiServiceFactory factory, XRegistryKey key) + { + if (name.equals(IMPLEMENTATION_NAME)) { + return FactoryHelper.getServiceFactory( + JavaMain.class, SERVICE_NAME, factory, key); + } else { + return null; + } + } + + private static final String IMPLEMENTATION_NAME + = "test.java.javamain.Component"; + private static final String SERVICE_NAME = "test.dummy.JavaMain"; + + private final XComponentContext context; +} diff --git a/ure/source/uretest/JavaNative.java b/ure/source/uretest/JavaNative.java new file mode 100644 index 000000000..289f00909 --- /dev/null +++ b/ure/source/uretest/JavaNative.java @@ -0,0 +1,30 @@ +/* + * 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 test.java.javanative; + +import com.sun.star.comp.helper.Bootstrap; +import test.java.tester.Tester; + +public final class JavaNative { + public static void main(String[] arguments) throws Exception { + Tester.test(Bootstrap.defaultBootstrap_InitialComponentContext()); + } + + private JavaNative() {} +} diff --git a/ure/source/uretest/JavaTest.java b/ure/source/uretest/JavaTest.java new file mode 100644 index 000000000..2bc1b0c72 --- /dev/null +++ b/ure/source/uretest/JavaTest.java @@ -0,0 +1,49 @@ +/* + * 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 test.java.javatest; + +import com.sun.star.comp.loader.FactoryHelper; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.registry.XRegistryKey; +import test.types.TestException; +import test.types.XTest; + +public final class JavaTest implements XTest { + public JavaTest() {} + + public void throwException() throws TestException { + throw new TestException("test", this); + } + + public static XSingleServiceFactory __getServiceFactory( + String name, XMultiServiceFactory factory, XRegistryKey key) + { + if (name.equals(IMPLEMENTATION_NAME)) { + return FactoryHelper.getServiceFactory( + JavaTest.class, SERVICE_NAME, factory, key); + } else { + return null; + } + } + + private static final String IMPLEMENTATION_NAME + = "test.java.javatest.Component"; + private static final String SERVICE_NAME = "test.types.JavaTest"; +} diff --git a/ure/source/uretest/Makefile b/ure/source/uretest/Makefile new file mode 100644 index 000000000..5f17a099d --- /dev/null +++ b/ure/source/uretest/Makefile @@ -0,0 +1,286 @@ +# +# 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 . +# + +# The following variable can be set, if necessary (see README): +#GCCS_COMPAT := LD_PRELOAD=/lib/libgcc_s.so.1 + + +.DELETE_ON_ERROR: + + +PRJ = $(OO_SDK_HOME) + +include $(PRJ)/settings/settings.mk +include $(PRJ)/settings/std.mk + +ifeq "$(PLATFORM)" "windows" +qt = " +qt2 = +cwd = $(subst \,/,$(shell cd)) +link_output_switch = -out: +ure_java_url = $(subst $(subst .,., ),%%20,$(subst \,/,$(URLPREFIX)$(OO_SDK_URE_JAVA_DIR))) +else +qt = ' +qt2 = ' +cwd = $(PWD) +link_output_switch = $(subst .,.,-o ) +ure_java_url = $(URLPREFIX)$(OO_SDK_URE_JAVA_DIR) +endif + + +.PHONY: ALL +ALL: check + +include $(PRJ)/settings/stdtarget.mk + + +.PHONY: check +check: test-cpptest test-javatest test-javanative test-clientserver + +.PHONY: test-cpptest +test-cpptest: out.sdk/cppmain.uno.$(SHAREDLIB_EXT) out.sdk/types.rdb \ + out.sdk/services.rdb + $(GCCS_COMPAT) uno \ + -c test.cpp.cppmain.Component -l $(URLPREFIX)$(cwd)/$< \ + -env:URE_MORE_TYPES=$(URLPREFIX)$(cwd)/out.sdk/types.rdb \ + -env:URE_MORE_SERVICES=$(URLPREFIX)$(cwd)/out.sdk/services.rdb + +.PHONY: test-javatest +test-javatest: out.sdk/javamain.uno.jar out.sdk/types.rdb out.sdk/services.rdb + $(GCCS_COMPAT) uno \ + -c test.java.javamain.Component -l $(URLPREFIX)$(cwd)/$< \ + -env:URE_MORE_TYPES=$(URLPREFIX)$(cwd)/out.sdk/types.rdb \ + -env:URE_MORE_SERVICES=$(URLPREFIX)$(cwd)/out.sdk/services.rdb + +ifeq "$(PLATFORM)" "windows" +set_vars = set URE_MORE_TYPES=$(URLPREFIX)$(cwd)/out.sdk/types.rdb && \ + set URE_MORE_SERVICES=$(URLPREFIX)$(cwd)/out.sdk/services.rdb && +else +set_vars = URE_MORE_TYPES=$(URLPREFIX)$(cwd)/out.sdk/types.rdb \ + URE_MORE_SERVICES=$(URLPREFIX)$(cwd)/out.sdk/services.rdb +endif +.PHONY: test-javanative +test-javanative: out.sdk/runner.jar out.sdk/javanative.jar \ + out.sdk/services.rdb out.sdk/types.rdb + $(set_vars) $(GCCS_COMPAT) $(SDK_JAVA) -jar out.sdk/runner.jar \ + $(ure_java_url)/ $(URLPREFIX)$(cwd)/out.sdk/javanative.jar + +do_server = $(GCCS_COMPAT) uno -c test.cpp.cppserver.Component \ + -l $(URLPREFIX)$(cwd)/out.sdk/cppserver.uno.$(SHAREDLIB_EXT) \ + -env:URE_MORE_TYPES=$(URLPREFIX)$(cwd)/out.sdk/types.rdb \ + -env:URE_MORE_SERVICES=$(URLPREFIX)$(cwd)/out.sdk/services.rdb \ + -u "uno:pipe,name=ure_test;urp;server" --singleaccept +do_client = $(SDK_JAVA) -jar out.sdk/runner.jar $(ure_java_url)/ \ + $(URLPREFIX)$(cwd)/out.sdk/javaclient.jar \ + "uno:pipe,name=ure_test;urp;server" +.PHONY: test-clientserver +test-clientserver: out.sdk/cppserver.uno.$(SHAREDLIB_EXT) out.sdk/types.rdb \ + out.sdk/services.rdb out.sdk/runner.jar out.sdk/javaclient.jar +ifeq "$(PLATFORM)" "windows" + echo $(subst %,%%,$(do_server)) > out.sdk/server.bat + echo $(subst %,%%,$(do_client)) > out.sdk/client.bat + @ echo Execute test-clientserver manually: start out.sdk\server.bat + @ echo and then simultaneously start out.sdk\client.bat +else + $(do_server) & + sleep 5 && $(do_client) +endif + + +.PHONY: clean +clean: + $(DELRECURSIVE) $(subst /,$(PS),out.sdk) + + +out.sdk/cppmain.uno.$(SHAREDLIB_EXT): out.sdk/cppmain.$(OBJ_EXT) | out.sdk + $(LINK) $(COMP_LINK_FLAGS) $(link_output_switch)$@ $< $(LINK_LIBS) \ + $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(SALHELPERLIB) \ + $(LIBO_SDK_LDFLAGS_STDLIBS) + +out.sdk/cppmain.$(OBJ_EXT): cppmain.cc out.sdk/cpputypes.cppumaker.flag \ + out.sdk/types.cppumaker.flag | out.sdk + $(CC) $(CC_FLAGS) $(CC_OUTPUT_SWITCH)$@ $(CC_INCLUDES) \ + -Iout.sdk/include/cpputypes -Iout.sdk/include/types $(CC_DEFINES) $< + + +out.sdk/cpptest.uno.$(SHAREDLIB_EXT): out.sdk/cpptest.$(OBJ_EXT) | out.sdk + $(LINK) $(COMP_LINK_FLAGS) $(link_output_switch)$@ $< $(LINK_LIBS) \ + $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(LIBO_SDK_LDFLAGS_STDLIBS) + +out.sdk/cpptest.$(OBJ_EXT): cpptest.cc out.sdk/cpputypes.cppumaker.flag \ + out.sdk/types.cppumaker.flag | out.sdk + $(CC) $(CC_FLAGS) $(CC_OUTPUT_SWITCH)$@ $(CC_INCLUDES) \ + -Iout.sdk/include/cpputypes -Iout.sdk/include/types $(CC_DEFINES) $< + + +out.sdk/cppserver.uno.$(SHAREDLIB_EXT): out.sdk/cppserver.$(OBJ_EXT) | out.sdk + $(LINK) $(COMP_LINK_FLAGS) $(link_output_switch)$@ $< $(LINK_LIBS) \ + $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(LIBO_SDK_LDFLAGS_STDLIBS) + +out.sdk/cppserver.$(OBJ_EXT): cppserver.cc out.sdk/cpputypes.cppumaker.flag \ + out.sdk/types.cppumaker.flag | out.sdk + $(CC) $(CC_FLAGS) $(CC_OUTPUT_SWITCH)$@ $(CC_INCLUDES) \ + -Iout.sdk/include/cpputypes -Iout.sdk/include/types $(CC_DEFINES) $< + + +out.sdk/cpputypes.cppumaker.flag: | out.sdk + $(CPPUMAKER) -O./out.sdk/include/cpputypes \ + "-Tcom.sun.star.beans.Introspection;com.sun.star.beans.theIntrospection;com.sun.star.bridge.BridgeFactory;com.sun.star.bridge.UnoUrlResolver;com.sun.star.connection.Acceptor;com.sun.star.connection.Connector;com.sun.star.io.Pipe;com.sun.star.io.TextInputStream;com.sun.star.io.TextOutputStream;com.sun.star.java.JavaVirtualMachine;com.sun.star.lang.DisposedException;com.sun.star.lang.EventObject;com.sun.star.lang.XMain;com.sun.star.lang.XMultiComponentFactory;com.sun.star.lang.XMultiServiceFactory;com.sun.star.lang.XSingleComponentFactory;com.sun.star.lang.XSingleServiceFactory;com.sun.star.lang.XTypeProvider;com.sun.star.loader.Java;com.sun.star.loader.SharedLibrary;com.sun.star.reflection.ProxyFactory;com.sun.star.registry.ImplementationRegistration;com.sun.star.registry.SimpleRegistry;com.sun.star.registry.XRegistryKey;com.sun.star.script.Converter;com.sun.star.script.Invocation;com.sun.star.security.AccessController;com.sun.star.security.Policy;com.sun.star.uno.DeploymentException;com.sun.star.uno.Exception;com.sun.star.uno.NamingService;com.sun.star.uno.RuntimeException;com.sun.star.uno.XAggregation;com.sun.star.uno.XComponentContext;com.sun.star.uno.XCurrentContext;com.sun.star.uno.XInterface;com.sun.star.uno.XWeak;com.sun.star.uri.ExternalUriReferenceTranslator;com.sun.star.uri.UriReferenceFactory;com.sun.star.uri.VndSunStarPkgUrlReferenceFactory;com.sun.star.util.theMacroExpander" \ + "$(URE_TYPES)" + touch $@ + +out.sdk/types.cppumaker.flag: out.sdk/types.rdb | out.sdk + $(CPPUMAKER) -O./out.sdk/include/types $< "-X$(URE_TYPES)" + touch $@ + + +out.sdk/javamain.uno.jar: \ + out.sdk/class/javamain/test/java/javamain/JavaMain.class \ + out.sdk/javamain.mf | out.sdk + $(SDK_JAR) cfm $@ out.sdk/javamain.mf -C out.sdk/class/javamain test + +out.sdk/javamain.mf: javamain.mf.template | out.sdk + sed -e $(qt)s~^Class-Path:$$~& tester.jar~$(qt) \ + -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ + +out.sdk/class/javamain/test/java/javamain/JavaMain.class: JavaMain.java \ + out.sdk/tester.jar | out.sdk/class + - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javamain) + $(MKDIR) $(subst /,$(PS),out.sdk/class/javamain) + $(SDK_JAVAC) $(JAVAC_FLAGS) \ + -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/tester.jar" \ + -sourcepath . -d out.sdk/class/javamain $< + + +out.sdk/runner.jar: out.sdk/class/runner/test/java/runner/Runner.class \ + out.sdk/runner.mf | out.sdk + $(SDK_JAR) cfm $@ out.sdk/runner.mf -C out.sdk/class/runner test + +out.sdk/runner.mf: runner.mf.template | out.sdk + sed -e \ + $(qt)s~^Class-Path:$$~& $(ure_java_url)/unoloader.jar~$(qt) \ + -e $(qt)s~^UNO-Type-Path:$$~& ~$(qt) $< > $@ + +out.sdk/class/runner/test/java/runner/Runner.class: Runner.java | out.sdk/class + - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/runner) + $(MKDIR) $(subst /,$(PS),out.sdk/class/runner) + $(SDK_JAVAC) $(JAVAC_FLAGS) -sourcepath . -d out.sdk/class/runner $< + + +out.sdk/tester.jar: out.sdk/class/tester/test/java/tester/Tester.class \ + out.sdk/tester.mf | out.sdk + $(SDK_JAR) cfm $@ out.sdk/tester.mf -C out.sdk/class/tester test + +out.sdk/tester.mf: tester.mf.template | out.sdk + sed -e $(qt)s~^Class-Path:$$~& types.jar~$(qt) \ + -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ + +out.sdk/class/tester/test/java/tester/Tester.class: Tester.java \ + out.sdk/types.jar | out.sdk/class + - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/tester) + $(MKDIR) $(subst /,$(PS),out.sdk/class/tester) + $(SDK_JAVAC) $(JAVAC_FLAGS) \ + -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/types.jar" \ + -sourcepath . -d out.sdk/class/tester $< + + +out.sdk/javatest.uno.jar: \ + out.sdk/class/javatest/test/java/javatest/JavaTest.class \ + out.sdk/javatest.mf | out.sdk + $(SDK_JAR) cfm $@ out.sdk/javatest.mf -C out.sdk/class/javatest test + +out.sdk/javatest.mf: javatest.mf.template | out.sdk + sed -e $(qt)s~^Class-Path:$$~& types.jar~$(qt) \ + -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ + +out.sdk/class/javatest/test/java/javatest/JavaTest.class: JavaTest.java \ + out.sdk/types.jar | out.sdk/class + - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javatest) + $(MKDIR) $(subst /,$(PS),out.sdk/class/javatest) + $(SDK_JAVAC) $(JAVAC_FLAGS) \ + -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/types.jar" \ + -sourcepath . -d out.sdk/class/javatest $< + + +out.sdk/javanative.jar: \ + out.sdk/class/javanative/test/java/javanative/JavaNative.class \ + out.sdk/javanative.mf | out.sdk + $(SDK_JAR) cfm $@ out.sdk/javanative.mf -C out.sdk/class/javanative test + +out.sdk/javanative.mf: javanative.mf.template | out.sdk + sed -e $(qt)s~^Class-Path:$$~& tester.jar~$(qt) \ + -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ + +out.sdk/class/javanative/test/java/javanative/JavaNative.class: \ + JavaNative.java out.sdk/tester.jar | out.sdk/class + - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javanative) + $(MKDIR) $(subst /,$(PS),out.sdk/class/javanative) + $(SDK_JAVAC) $(JAVAC_FLAGS) \ + -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/tester.jar" \ + -sourcepath . -d out.sdk/class/javanative $< + + +out.sdk/javaclient.jar: \ + out.sdk/class/javaclient/test/java/javaclient/JavaClient.class \ + out.sdk/javaclient.mf | out.sdk + $(SDK_JAR) cfm $@ out.sdk/javaclient.mf -C out.sdk/class/javaclient test + +out.sdk/javaclient.mf: javaclient.mf.template | out.sdk + sed -e $(qt)s~^Class-Path:$$~& types.jar~$(qt) \ + -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ + +out.sdk/class/javaclient/test/java/javaclient/JavaClient.class: \ + JavaClient.java out.sdk/types.jar | out.sdk/class + - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javaclient) + $(MKDIR) $(subst /,$(PS),out.sdk/class/javaclient) + $(SDK_JAVAC) $(JAVAC_FLAGS) \ + -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/types.jar" \ + -sourcepath . -d out.sdk/class/javaclient $< + + +out.sdk/types.jar: out.sdk/types.javamaker.flag out.sdk/types.mf | out.sdk + $(SDK_JAR) cfm $@ out.sdk/types.mf -C out.sdk/class/types test + +out.sdk/types.mf: types.mf.template | out.sdk + sed -e $(qt)s~^Class-Path:$$~& ~$(qt) \ + -e $(qt)s~^UNO-Type-Path:$$~& \<\>~$(qt) $< > $@ + +out.sdk/types.javamaker.flag: out.sdk/types.rdb | out.sdk out.sdk/class + - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/types) + $(JAVAMAKER) -O./out.sdk/class/types $< "-X$(URE_TYPES)" + touch $@ + + +out.sdk/types.rdb: out.sdk/types.urd | out.sdk + $(REGMERGE) $@ /UCR $< + +out.sdk/types.urd: types.idl | out.sdk + $(IDLC) -O$(@D) -I$(IDL_DIR) -cid -we $< + + +out.sdk/services.rdb: services.rdb.in | out.sdk/cpptest.uno.$(SHAREDLIB_EXT) \ + out.sdk/javatest.uno.jar out.sdk + $(DEL) $(subst /,$(PS),$@) + sed -e s/@SHAREDLIB_EXT@/$(SHAREDLIB_EXT)/ < $^ > $@ + + +out.sdk: + $(MKDIR) $(subst /,$(PS),$@) + +out.sdk/class: | out.sdk + $(MKDIR) $(subst /,$(PS),$@) diff --git a/ure/source/uretest/Makefile.pln b/ure/source/uretest/Makefile.pln new file mode 100644 index 000000000..3ea8c3482 --- /dev/null +++ b/ure/source/uretest/Makefile.pln @@ -0,0 +1,283 @@ +# +# 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 . +# + +# The following variable must be set (see README): +#SDK_HOME := /opt/libreoffice/basis3.1/sdk + +# The following variables can be set, if necessary (see README): +#URE_HOME := /opt/libreoffice +#GCCS_COMPAT := LD_PRELOAD=/lib/libgcc_s.so.1 + + +URE_HOME ?= /opt/libreoffice + +.DELETE_ON_ERROR: + + +.PHONY: check +check: test-regview test-cpptest test-javatest test-javanative test-clientserver + +.PHONY: test-regview +test-regview: out.pln/types.rdb + $(URE_HOME)/program/regview $< > /dev/null + +.PHONY: test-cpptest +test-cpptest: out.pln/cppmain.uno.so out.pln/types.rdb out.pln/services.rdb + $(GCCS_COMPAT) $(URE_HOME)/program/uno \ + -c test.cpp.cppmain.Component -l file://$(PWD)/$< \ + -env:URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \ + -env:URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb + +.PHONY: test-javatest +test-javatest: out.pln/javamain.uno.jar out.pln/types.rdb out.pln/services.rdb + $(GCCS_COMPAT) $(URE_HOME)/program/uno \ + -c test.java.javamain.Component -l file://$(PWD)/$< \ + -env:URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \ + -env:URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb + +.PHONY: test-javanative +test-javanative: out.pln/runner.jar out.pln/javanative.jar \ + out.pln/types.rdb out.pln/services.rdb + URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \ + URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb \ + $(GCCS_COMPAT) LD_LIBRARY_PATH=$(URE_HOME)/program java \ + -jar out.pln/runner.jar file://$(URE_HOME)/program/classes/ \ + file://$(PWD)/out.pln/javanative.jar + +.PHONY: test-clientserver +test-clientserver: out.pln/cppserver.uno.so out.pln/types.rdb \ + out.pln/services.rdb out.pln/runner.jar out.pln/javaclient.jar + $(GCCS_COMPAT) $(URE_HOME)/program/uno -c test.cpp.cppserver.Component \ + -l file://$(PWD)/out.pln/cppserver.uno.so \ + -env:URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \ + -env:URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb \ + -u 'uno:pipe,name=ure_test;urp;server' --singleaccept & + sleep 5 && \ + java -jar out.pln/runner.jar file://$(URE_HOME)/program/classes/ \ + file://$(PWD)/out.pln/javaclient.jar \ + 'uno:pipe,name=ure_test;urp;server' + + +.PHONY: clean +clean: + rm -rf out.pln + + +out.pln/cppmain.uno.so: out.pln/cppmain.o | out.pln out.pln/lib/libuno_cppu.so \ + out.pln/lib/libuno_cppuhelpergcc3.so out.pln/lib/libuno_sal.so \ + out.pln/lib/libuno_salhelpergcc3.so + g++ -shared -o $@ -Wl,-z,defs -Wl,--fatal-warnings $< -Lout.pln/lib \ + -luno_cppu -luno_cppuhelpergcc3 -luno_sal -luno_salhelpergcc3 + +out.pln/cppmain.o: cppmain.cc out.pln/cpputypes.cppumaker.flag \ + out.pln/types.cppumaker.flag | out.pln + g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \ + -I $(SDK_HOME)/include -I out.pln/include/cpputypes \ + -I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $< + + +out.pln/cpptest.uno.so: out.pln/cpptest.o | out.pln out.pln/lib/libuno_cppu.so \ + out.pln/lib/libuno_cppuhelpergcc3.so out.pln/lib/libuno_sal.so + g++ -shared -o $@ -Wl,-z,defs -Wl,--fatal-warnings $< -Lout.pln/lib \ + -luno_cppu -luno_cppuhelpergcc3 -luno_sal + +out.pln/cpptest.o: cpptest.cc out.pln/cpputypes.cppumaker.flag \ + out.pln/types.cppumaker.flag | out.pln + g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \ + -I $(SDK_HOME)/include -I out.pln/include/cpputypes \ + -I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $< + + +out.pln/cppserver.uno.so: out.pln/cppserver.o | out.pln \ + out.pln/lib/libuno_cppu.so out.pln/lib/libuno_cppuhelpergcc3.so \ + out.pln/lib/libuno_sal.so + g++ -shared -o $@ -Wl,-z,defs -Wl,--fatal-warnings $< -Lout.pln/lib \ + -luno_cppu -luno_cppuhelpergcc3 -luno_sal + +out.pln/cppserver.o: cppserver.cc out.pln/cpputypes.cppumaker.flag \ + out.pln/types.cppumaker.flag | out.pln + g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \ + -I $(SDK_HOME)/include -I out.pln/include/cpputypes \ + -I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $< + + +out.pln/cpputypes.cppumaker.flag: | out.pln + LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/cppumaker \ + -O./out.pln/include/cpputypes \ + '-Tcom.sun.star.beans.Introspection;com.sun.star.beans.theIntrospection;com.sun.star.bridge.BridgeFactory;com.sun.star.bridge.UnoUrlResolver;com.sun.star.connection.Acceptor;com.sun.star.connection.Connector;com.sun.star.io.Pipe;com.sun.star.io.TextInputStream;com.sun.star.io.TextOutputStream;com.sun.star.java.JavaVirtualMachine;com.sun.star.lang.DisposedException;com.sun.star.lang.EventObject;com.sun.star.lang.XMain;com.sun.star.lang.XMultiComponentFactory;com.sun.star.lang.XMultiServiceFactory;com.sun.star.lang.XSingleComponentFactory;com.sun.star.lang.XSingleServiceFactory;com.sun.star.lang.XTypeProvider;com.sun.star.loader.Java;com.sun.star.loader.SharedLibrary;com.sun.star.reflection.ProxyFactory;com.sun.star.registry.ImplementationRegistration;com.sun.star.registry.SimpleRegistry;com.sun.star.registry.XRegistryKey;com.sun.star.script.Converter;com.sun.star.script.Invocation;com.sun.star.security.AccessController;com.sun.star.security.Policy;com.sun.star.uno.DeploymentException;com.sun.star.uno.Exception;com.sun.star.uno.NamingService;com.sun.star.uno.RuntimeException;com.sun.star.uno.XAggregation;com.sun.star.uno.XComponentContext;com.sun.star.uno.XCurrentContext;com.sun.star.uno.XInterface;com.sun.star.uno.XWeak;com.sun.star.uri.ExternalUriReferenceTranslator;com.sun.star.uri.UriReferenceFactory;com.sun.star.uri.VndSunStarPkgUrlReferenceFactory;com.sun.star.util.theMacroExpander' \ + $(URE_HOME)/program/types.rdb + touch $@ + +out.pln/types.cppumaker.flag: out.pln/types.rdb | out.pln + LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/cppumaker \ + -O./out.pln/include/types $< -X$(URE_HOME)/program/types.rdb + touch $@ + + +out.pln/javamain.uno.jar: \ + out.pln/class/javamain/test/java/javamain/JavaMain.class \ + out.pln/javamain.mf | out.pln + jar cfm $@ out.pln/javamain.mf -C out.pln/class/javamain test + +out.pln/javamain.mf: javamain.mf.template | out.pln + sed -e 's~^Class-Path:$$~& tester.jar~' \ + -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@ + +out.pln/class/javamain/test/java/javamain/JavaMain.class: JavaMain.java \ + out.pln/tester.jar | out.pln/class + rm -rf out.pln/class/javamain + mkdir out.pln/class/javamain + javac -classpath \ + $(URE_HOME)/program/classes/libreoffice.jar:out.pln/tester.jar \ + -sourcepath . -d out.pln/class/javamain $< + + +out.pln/runner.jar: out.pln/class/runner/test/java/runner/Runner.class \ + out.pln/runner.mf | out.pln + jar cfm $@ out.pln/runner.mf -C out.pln/class/runner test + +out.pln/runner.mf: runner.mf.template | out.pln + sed -e \ + 's~^Class-Path:$$~& file://$(URE_HOME)/program/classes/unoloader.jar~' \ + -e 's~^UNO-Type-Path:$$~& ~' $< > $@ + +out.pln/class/runner/test/java/runner/Runner.class: Runner.java | out.pln/class + rm -rf out.pln/class/runner + mkdir out.pln/class/runner + javac -classpath $(URE_HOME)/program/classes/unoloader.jar \ + -sourcepath . -d out.pln/class/runner $< + + +out.pln/tester.jar: out.pln/class/tester/test/java/tester/Tester.class \ + out.pln/tester.mf | out.pln + jar cfm $@ out.pln/tester.mf -C out.pln/class/tester test + +out.pln/tester.mf: tester.mf.template | out.pln + sed -e 's~^Class-Path:$$~& types.jar~' \ + -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@ + +out.pln/class/tester/test/java/tester/Tester.class: Tester.java \ + out.pln/types.jar | out.pln/class + rm -rf out.pln/class/tester + mkdir out.pln/class/tester + javac -classpath \ + $(URE_HOME)/program/classes/libreoffice.jar:out.pln/types.jar \ + -sourcepath . -d out.pln/class/tester $< + + +out.pln/javatest.uno.jar: \ + out.pln/class/javatest/test/java/javatest/JavaTest.class \ + out.pln/javatest.mf | out.pln + jar cfm $@ out.pln/javatest.mf -C out.pln/class/javatest test + +out.pln/javatest.mf: javatest.mf.template | out.pln + sed -e 's~^Class-Path:$$~& types.jar~' \ + -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@ + +out.pln/class/javatest/test/java/javatest/JavaTest.class: JavaTest.java \ + out.pln/types.jar | out.pln/class + rm -rf out.pln/class/javatest + mkdir out.pln/class/javatest + javac -classpath \ + $(URE_HOME)/program/classes/libreoffice.jar:out.pln/types.jar \ + -sourcepath . -d out.pln/class/javatest $< + + +out.pln/javanative.jar: \ + out.pln/class/javanative/test/java/javanative/JavaNative.class \ + out.pln/javanative.mf | out.pln + jar cfm $@ out.pln/javanative.mf -C out.pln/class/javanative test + +out.pln/javanative.mf: javanative.mf.template | out.pln + sed -e 's~^Class-Path:$$~& tester.jar~' \ + -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@ + +out.pln/class/javanative/test/java/javanative/JavaNative.class: \ + JavaNative.java out.pln/tester.jar | out.pln/class + rm -rf out.pln/class/javanative + mkdir out.pln/class/javanative + javac -classpath \ + $(URE_HOME)/program/classes/libreoffice.jar:out.pln/tester.jar \ + -sourcepath . -d out.pln/class/javanative $< + + +out.pln/javaclient.jar: \ + out.pln/class/javaclient/test/java/javaclient/JavaClient.class \ + out.pln/javaclient.mf | out.pln + jar cfm $@ out.pln/javaclient.mf -C out.pln/class/javaclient test + +out.pln/javaclient.mf: javaclient.mf.template | out.pln + sed -e 's~^Class-Path:$$~& types.jar~' \ + -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@ + +out.pln/class/javaclient/test/java/javaclient/JavaClient.class: \ + JavaClient.java out.pln/types.jar | out.pln/class + rm -rf out.pln/class/javaclient + mkdir out.pln/class/javaclient + javac -classpath \ + $(URE_HOME)/program/classes/libreoffice.jar:out.pln/types.jar \ + -sourcepath . -d out.pln/class/javaclient $< + + +out.pln/types.jar: out.pln/types.javamaker.flag out.pln/types.mf | out.pln + jar cfm $@ out.pln/types.mf -C out.pln/class/types test + +out.pln/types.mf: types.mf.template | out.pln + sed -e 's~^Class-Path:$$~& ~' -e 's~^UNO-Type-Path:$$~& \<\>~' $< > $@ + +out.pln/types.javamaker.flag: out.pln/types.rdb | out.pln out.pln/class + rm -rf out.pln/class/types + LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/javamaker \ + -O./out.pln/class/types $< -X$(URE_HOME)/program/types.rdb + touch $@ + + +out.pln/types.rdb: out.pln/types.urd | out.pln + $(URE_HOME)/program/regmerge $@ /UCR $< + +out.pln/types.urd: types.idl | out.pln + LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/idlc -O$(@D) \ + -I$(SDK_HOME)/idl -cid -we $< + + +out.pln/services.rdb: services.rdb.in | out.pln/cpptest.uno.so \ + out.pln/javatest.uno.jar out.pln + sed -e s/@SHAREDLIB_EXT@/so/ < $^ > $@ + + +out.pln/lib/libuno_cppu.so: | out.pln/lib + ln -fs $(URE_HOME)/program/libuno_cppu.so.3 $@ + +out.pln/lib/libuno_cppuhelpergcc3.so: | out.pln/lib + ln -fs $(URE_HOME)/program/libuno_cppuhelpergcc3.so.3 $@ + +out.pln/lib/libuno_sal.so: | out.pln/lib + ln -fs $(URE_HOME)/program/libuno_sal.so.3 $@ + +out.pln/lib/libuno_salhelpergcc3.so: | out.pln/lib + ln -fs $(URE_HOME)/program/libuno_salhelpergcc3.so.3 $@ + + +out.pln: + mkdir $@ + +out.pln/class: | out.pln + mkdir $@ + +out.pln/lib: | out.pln + mkdir $@ diff --git a/ure/source/uretest/README b/ure/source/uretest/README new file mode 100644 index 000000000..8b4f8dcb7 --- /dev/null +++ b/ure/source/uretest/README @@ -0,0 +1,101 @@ +# +# 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 . +# + +This directory contains test files for the UNO Runtime Environment (URE) as well +as the Makefile and Makefile.pln makefiles. To execute the makefiles, you need +GNU make 3.80 or later. + + +Makefile +-------- + +Before you execute Makefile, you need to configure the Software Development Kit +(SDK) environment to work with a URE installation, a C++ compiler, and a JDK. +For more information, read the .../docs/install.html file in the SDK +installation. + +NOTE: On Linux x86, if the Makefile accesses a GCC that is incompatible with the +GCC that was used to build the URE, use the GCCS_COMPAT environment variable as +a workaround. For more details, see the UDK README file. + + +Makefile.pln +------------ + +You can only run Makefile.pln on Linux x86. You do not need to configure your +SDK environment to use this makefile, however, you do need to set the following +environment variables: + +- SDK_HOME +Points to the base directory of an OpenOffice.org SDK so that you can access UNO +programming tools and files that are not part of the URE. For example, idlc, +cppumaker, javamaker, UNOIDL files, and C++ headers. + +- PATH +Points to a GCC installation (including g++) as well as a JDK installation that +contains the java, javac, and jar executables. For the minimum version +requirements, see the SDK Installation Guide ($SDK_HOME/docs/install.html). + +- URE_HOME (optional) +Overwrites the default URE location, that is, /opt/libreoffice. + +- GCCS_COMPAT (optional) +Fixes incompatibility issues between the GCC that was used to build the URE and +the GCC that Makefile.pln accesses. For more details, see the UDK README file. + + +Tests +----- + +Makefile and Makefile.pln can execute the following tests: + +- test-cpptest +Builds a C++ UNO component, cppmain.uno, and runs the component with the uno +executable. The component first attempts to instantiate all the UNO services +and singletons that are part of the URE installation. The component then tries +to instantiate and to call another C++ UNO component (ccptest.uno) as well as a +Java UNO component (javatest.uno). The test completes when these components +throw a special exception that is caught by cppmain.uno. + +- test-javatest +Builds a Java UNO component, javamain.uno, and runs the component with the uno +executable. The component tries to instantiate and to call a C++ UNO component +(cpptest.uno) as well as a Java UNO component (javatest.uno). The test +completes when these components throw a special exception that is caught by +javamain.uno. + +- test-javanative +Builds a Java UNO application, javanative.jar, and runs the application with the +java executable. The application bootstraps a native UNO environment, and then +tries to instantiate and to call a C++ UNO component (cpptest.uno) as well as a +Java UNO component( javatest.uno). The test completes when these components +throw a special exception that is caught by javanative.jar. + +- test-clientserver +Builds a server C++ UNO component, cppserver.uno, and a Java UNO application, +javaclient.uno. The uno executable runs the cppserver.uno component which +listens on a pipe connection. The java executable runs the javaclient.uno +component which connects to the server after a five second pause so that the +server has enough time to start. + +- test-regview (Makefile.pln only) +Checks that the regview executable of the URE installation works reliably. + +NOTE: The files that are generated when Makefile and Makefile.pln execute are +saved to different local directories. Makefile outputs the generated files to +./out.sdk whereas Makefile.pln outputs the files to ./out.pln. diff --git a/ure/source/uretest/Runner.java b/ure/source/uretest/Runner.java new file mode 100644 index 000000000..829ae3328 --- /dev/null +++ b/ure/source/uretest/Runner.java @@ -0,0 +1,32 @@ +/* + * 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 test.java.runner; + +import java.net.URL; +import com.sun.star.lib.unoloader.UnoLoader; + +public final class Runner { + public static void main(String[] arguments) throws Exception { + String[] args = new String[arguments.length - 2]; + System.arraycopy(arguments, 2, args, 0, args.length); + UnoLoader.execute(new URL(arguments[0]), new URL(arguments[1]), args); + } + + private Runner() {} +} diff --git a/ure/source/uretest/Tester.java b/ure/source/uretest/Tester.java new file mode 100644 index 000000000..547f89046 --- /dev/null +++ b/ure/source/uretest/Tester.java @@ -0,0 +1,46 @@ +/* + * 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 test.java.tester; + +import com.sun.star.uno.XComponentContext; +import test.types.CppTest; +import test.types.JavaTest; +import test.types.TestException; +import test.types.XTest; + +public final class Tester { + public static void test(XComponentContext context) { + testService(CppTest.create(context), CppTest.class.getName()); + testService(JavaTest.create(context), JavaTest.class.getName()); + } + + private static void testService(XTest test, String name) { + boolean ok = false; + try { + test.throwException(); + } catch (TestException e) { + ok = true; + } + if (!ok) { + throw new RuntimeException(name + ".throwException failed"); + } + } + + private Tester() {} +} diff --git a/ure/source/uretest/cppmain.cc b/ure/source/uretest/cppmain.cc new file mode 100644 index 000000000..143494703 --- /dev/null +++ b/ure/source/uretest/cppmain.cc @@ -0,0 +1,240 @@ +/* + * 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 "sal/config.h" +#include "sal/macros.h" + +#include <cstddef> +#include <memory> + +#include "com/sun/star/beans/Introspection.hpp" +#include "com/sun/star/beans/theIntrospection.hpp" +#include "com/sun/star/bridge/BridgeFactory.hpp" +#include "com/sun/star/bridge/UnoUrlResolver.hpp" +#include "com/sun/star/connection/Acceptor.hpp" +#include "com/sun/star/connection/Connector.hpp" +#include "com/sun/star/io/Pipe.hpp" +#include "com/sun/star/io/TextInputStream.hpp" +#include "com/sun/star/io/TextOutputStream.hpp" +#include "com/sun/star/java/JavaVirtualMachine.hpp" +#include "com/sun/star/lang/XMain.hpp" +#include "com/sun/star/loader/Java.hpp" +#include "com/sun/star/loader/SharedLibrary.hpp" +#include "com/sun/star/reflection/ProxyFactory.hpp" +#include "com/sun/star/registry/ImplementationRegistration.hpp" +#include "com/sun/star/registry/SimpleRegistry.hpp" +#include "com/sun/star/script/Converter.hpp" +#include "com/sun/star/script/Invocation.hpp" +#include "com/sun/star/security/AccessController.hpp" +#include "com/sun/star/security/Policy.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/NamingService.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uri/ExternalUriReferenceTranslator.hpp" +#include "com/sun/star/uri/UriReferenceFactory.hpp" +#include "com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.hpp" +#include "com/sun/star/util/theMacroExpander.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/interfacecontainer.hxx" +#include "cppuhelper/unourl.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/thread.h" +#include "rtl/malformeduriexception.hxx" +#include "rtl/string.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "salhelper/simplereferenceobject.hxx" +#include "uno/current_context.hxx" +#include "uno/environment.h" + +#include "test/types/CppTest.hpp" +#include "test/types/JavaTest.hpp" +#include "test/types/TestException.hpp" +#include "test/types/XTest.hpp" + +namespace { + +class Service: public ::cppu::WeakImplHelper1< css::lang::XMain > { +public: + explicit Service( + css::uno::Reference< css::uno::XComponentContext > const & context): + context_(context) {} + + virtual ::sal_Int32 SAL_CALL run( + css::uno::Sequence< OUString > const &); + +private: + Service(Service &); // not defined + void operator =(Service &); // not defined + + virtual ~Service() {} + + void test( + css::uno::Reference< test::types::XTest > const & test, + OUString const & name); + + css::uno::Reference< css::uno::XComponentContext > context_; +}; + +::sal_Int32 Service::run(css::uno::Sequence< OUString > const &) { + osl_getThreadIdentifier(0); // check for sal + (new salhelper::SimpleReferenceObject)->release(); // check for salhelper + css::uno::getCurrentContext(); // check for cppu + try { // check for cppuhelper + std::auto_ptr< cppu::UnoUrl > dummy(new cppu::UnoUrl(OUString())); + } catch (rtl::MalformedUriException &) {} + static char const * const services[] = { + "com.sun.star.io.DataInputStream", + "com.sun.star.io.DataOutputStream", + "com.sun.star.io.MarkableInputStream", + "com.sun.star.io.MarkableOutputStream", + "com.sun.star.io.ObjectInputStream", + "com.sun.star.io.ObjectOutputStream", + "com.sun.star.io.Pump", + "com.sun.star.lang.RegistryServiceManager", + "com.sun.star.lang.ServiceManager", + "com.sun.star.reflection.CoreReflection", + "com.sun.star.registry.NestedRegistry", + "com.sun.star.script.InvocationAdapterFactory", + "com.sun.star.uri.UriSchemeParser_vndDOTsunDOTstarDOTscript" + }; + for (::std::size_t i = 0; i < SAL_N_ELEMENTS(services); ++i) { + OUString name(OUString::createFromAscii(services[i])); + css::uno::Reference< css::uno::XInterface > instance; + try { + instance = context_->getServiceManager()->createInstanceWithContext( + name, context_); + } catch (css::uno::RuntimeException &) { + throw; + } catch (css::uno::Exception &) { + throw css::uno::RuntimeException( + OUString("error creating instance"), + static_cast< ::cppu::OWeakObject * >(this)); + } + if (!instance.is()) { + throw css::uno::RuntimeException( + "no instance: " + name, + static_cast< ::cppu::OWeakObject * >(this)); + } + } + css::beans::Introspection::create(context_); + css::beans::theIntrospection::get(context_); + css::bridge::BridgeFactory::create(context_); + css::bridge::UnoUrlResolver::create(context_); + css::connection::Acceptor::create(context_); + css::connection::Connector::create(context_); + css::io::Pipe::create(context_); + css::io::TextInputStream::create(context_); + css::io::TextOutputStream::create(context_); + css::java::JavaVirtualMachine::create(context_); + css::loader::Java::create(context_); + css::loader::SharedLibrary::create(context_); + css::reflection::ProxyFactory::create(context_); + css::registry::ImplementationRegistration::create(context_); + css::registry::SimpleRegistry::create(context_); + css::script::Converter::create(context_); + css::script::Invocation::create(context_); + css::security::AccessController::create(context_); + css::security::Policy::create(context_); + css::uno::NamingService::create(context_); + css::uri::ExternalUriReferenceTranslator::create(context_); + css::uri::UriReferenceFactory::create(context_); + css::uri::VndSunStarPkgUrlReferenceFactory::create(context_); + static char const * const singletons[] = { + "com.sun.star.reflection.theTypeDescriptionManager" + }; + for (std::size_t i = 0; i != SAL_N_ELEMENTS(singletons); ++i) { + css::uno::Reference< css::uno::XInterface > instance( + context_->getValueByName( + "/singletons/" + OUString::createFromAscii(singletons[i])), + css::uno::UNO_QUERY_THROW); + } + css::util::theMacroExpander::get(context_); + test( + ::test::types::CppTest::create(context_), + OUString("test.types.CppTest")); + test( + ::test::types::JavaTest::create(context_), + OUString("test.types.JavaTest")); + return 0; +} + +void Service::test( + css::uno::Reference< test::types::XTest > const & test, + OUString const & name) +{ + bool ok = false; + try { + test->throwException(); + } catch (::test::types::TestException &) { + ok = true; + } + if (!ok) { + throw css::uno::RuntimeException( + (name + + OUString(".throwException failed")), + static_cast< ::cppu::OWeakObject * >(this)); + } +} + +namespace CppMain { + +css::uno::Reference< css::uno::XInterface > create( + css::uno::Reference< css::uno::XComponentContext > const & context) +{ + return static_cast< ::cppu::OWeakObject * >(new Service(context)); +} + +OUString getImplementationName() { + return OUString("test.cpp.cppmain.Component"); +} + +css::uno::Sequence< OUString > getSupportedServiceNames() { + return css::uno::Sequence< OUString >(); +} + +} + +::cppu::ImplementationEntry entries[] = { + { CppMain::create, CppMain::getImplementationName, + CppMain::getSupportedServiceNames, ::cppu::createSingleComponentFactory, + 0, 0 }, + { 0, 0, 0, 0, 0, 0 } }; + +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::sal_Bool SAL_CALL component_writeInfo( + void * serviceManager, void * registryKey) +{ + return ::cppu::component_writeInfoHelper( + serviceManager, registryKey, entries); +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + char const * implName, void * serviceManager, void * registryKey) +{ + return ::cppu::component_getFactoryHelper( + implName, serviceManager, registryKey, entries); +} diff --git a/ure/source/uretest/cppserver.cc b/ure/source/uretest/cppserver.cc new file mode 100644 index 000000000..48f63e0b9 --- /dev/null +++ b/ure/source/uretest/cppserver.cc @@ -0,0 +1,93 @@ +/* + * 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 "sal/config.h" + +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/environment.h" + +#include "test/types/Data.hpp" +#include "test/types/XServer.hpp" + +namespace { + +class Service: public ::cppu::WeakImplHelper1< ::test::types::XServer > { +public: + Service() {} + + virtual ::test::types::Data SAL_CALL getData() { + return ::test::types::Data(OUString("Hello"), 42); + } + +private: + Service(Service &); // not defined + void operator =(Service &); // not defined + + virtual ~Service() {} +}; + +namespace CppServer { + +css::uno::Reference< css::uno::XInterface > create( + css::uno::Reference< css::uno::XComponentContext > const &) +{ + return static_cast< ::cppu::OWeakObject * >(new Service); +} + +OUString getImplementationName() { + return OUString("test.cpp.cppserver.Component"); +} + +css::uno::Sequence< OUString > getSupportedServiceNames() { + return css::uno::Sequence< OUString >(); +} + +} + +::cppu::ImplementationEntry entries[] = { + { CppServer::create, CppServer::getImplementationName, + CppServer::getSupportedServiceNames, ::cppu::createSingleComponentFactory, + 0, 0 }, + { 0, 0, 0, 0, 0, 0 } }; + +} + +extern "C" SAL_DLLPUBLIC_EXPORT ::sal_Bool SAL_CALL component_writeInfo( + void * serviceManager, void * registryKey) +{ + return ::cppu::component_writeInfoHelper( + serviceManager, registryKey, entries); +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + char const * implName, void * serviceManager, void * registryKey) +{ + return ::cppu::component_getFactoryHelper( + implName, serviceManager, registryKey, entries); +} diff --git a/ure/source/uretest/cpptest.cc b/ure/source/uretest/cpptest.cc new file mode 100644 index 000000000..3545a88b5 --- /dev/null +++ b/ure/source/uretest/cpptest.cc @@ -0,0 +1,89 @@ +/* + * 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 "sal/config.h" + +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/weak.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/environment.h" + +#include "test/types/TestException.hpp" +#include "test/types/XTest.hpp" + +namespace { + +class Service: public cppu::WeakImplHelper1< test::types::XTest > { +public: + Service() {} + + virtual void SAL_CALL throwException() { + throw test::types::TestException( + OUString("test"), + static_cast< cppu::OWeakObject * >(this)); + } + +private: + Service(Service &); // not defined + void operator =(Service &); // not defined + + virtual ~Service() {} +}; + +namespace CppTest { + +css::uno::Reference< css::uno::XInterface > create( + css::uno::Reference< css::uno::XComponentContext > const &) +{ + return static_cast< cppu::OWeakObject * >(new Service); +} + +OUString getImplementationName() { + return OUString("test.cpp.cpptest.Component"); +} + +css::uno::Sequence< OUString > getSupportedServiceNames() { + OUString s("test.types.CppTest"); + return css::uno::Sequence< OUString >(&s, 1); +} + +} + +cppu::ImplementationEntry entries[] = { + { CppTest::create, CppTest::getImplementationName, + CppTest::getSupportedServiceNames, cppu::createSingleComponentFactory, 0, + 0 }, + { 0, 0, 0, 0, 0, 0 } }; + +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + char const * implName, void * serviceManager, void * registryKey) +{ + return cppu::component_getFactoryHelper( + implName, serviceManager, registryKey, entries); +} diff --git a/ure/source/uretest/javaclient.mf.template b/ure/source/uretest/javaclient.mf.template new file mode 100644 index 000000000..745d23afb --- /dev/null +++ b/ure/source/uretest/javaclient.mf.template @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Class-Path: +Main-Class: test/java/javaclient/JavaClient +Sealed: true +UNO-Type-Path: diff --git a/ure/source/uretest/javamain.mf.template b/ure/source/uretest/javamain.mf.template new file mode 100644 index 000000000..8ef4aa210 --- /dev/null +++ b/ure/source/uretest/javamain.mf.template @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Class-Path: +Sealed: true +UNO-Type-Path: +RegistrationClassName: test.java.javamain.JavaMain diff --git a/ure/source/uretest/javanative.mf.template b/ure/source/uretest/javanative.mf.template new file mode 100644 index 000000000..bb1103e02 --- /dev/null +++ b/ure/source/uretest/javanative.mf.template @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Class-Path: +Main-Class: test/java/javanative/JavaNative +Sealed: true +UNO-Type-Path: diff --git a/ure/source/uretest/javatest.mf.template b/ure/source/uretest/javatest.mf.template new file mode 100644 index 000000000..8fc858aec --- /dev/null +++ b/ure/source/uretest/javatest.mf.template @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Class-Path: +Sealed: true +UNO-Type-Path: +RegistrationClassName: test.java.javatest.JavaTest diff --git a/ure/source/uretest/runner.mf.template b/ure/source/uretest/runner.mf.template new file mode 100644 index 000000000..dc9c26613 --- /dev/null +++ b/ure/source/uretest/runner.mf.template @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Class-Path: +Main-Class: test/java/runner/Runner +Sealed: true +UNO-Type-Path: diff --git a/ure/source/uretest/services.rdb.in b/ure/source/uretest/services.rdb.in new file mode 100644 index 000000000..0bec749e8 --- /dev/null +++ b/ure/source/uretest/services.rdb.in @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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/. + * +--> + +<components xmlns="http://openoffice.org/2010/uno-components"> + <component + loader="com.sun.star.loader.SharedLibrary" + uri="./cpptest.uno.@SHAREDLIB_EXT@"> + <implementation name="test.cpp.cpptest.Component"> + <service name="test.types.CppTest"/> + </implementation> + </component> + <component loader="com.sun.star.loader.Java2" uri="./javatest.uno.jar"> + <implementation name="test.java.javatest.Component"> + <service name="test.types.JavaTest"/> + </implementation> + </component> +</components> diff --git a/ure/source/uretest/tester.mf.template b/ure/source/uretest/tester.mf.template new file mode 100644 index 000000000..fc483bc7d --- /dev/null +++ b/ure/source/uretest/tester.mf.template @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Class-Path: +Main-Class: test/java/tester/Tester +Sealed: true +UNO-Type-Path: diff --git a/ure/source/uretest/types.idl b/ure/source/uretest/types.idl new file mode 100644 index 000000000..b23a76c8c --- /dev/null +++ b/ure/source/uretest/types.idl @@ -0,0 +1,46 @@ +/* -*- 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 <com/sun/star/uno/Exception.idl> +#include <com/sun/star/uno/XInterface.idl> + +module test { module types { + +exception TestException: com::sun::star::uno::Exception {}; + +interface XTest { + void throwException() raises (TestException); +}; + +service CppTest: XTest; + +service JavaTest: XTest; + +struct Data { + string m1; + long m2; +}; + +interface XServer { + Data getData(); +}; + +}; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ure/source/uretest/types.mf.template b/ure/source/uretest/types.mf.template new file mode 100644 index 000000000..c8fcee4b1 --- /dev/null +++ b/ure/source/uretest/types.mf.template @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Class-Path: +Sealed: true +UNO-Type-Path: |