summaryrefslogtreecommitdiff
path: root/jvmaccess
diff options
context:
space:
mode:
Diffstat (limited to 'jvmaccess')
-rw-r--r--jvmaccess/inc/jvmaccess/classpath.hxx151
-rw-r--r--jvmaccess/inc/jvmaccess/unovirtualmachine.hxx109
-rw-r--r--jvmaccess/inc/jvmaccess/virtualmachine.hxx163
-rw-r--r--jvmaccess/prj/build.lst4
-rw-r--r--jvmaccess/prj/d.lst8
-rw-r--r--jvmaccess/source/classpath.cxx174
-rw-r--r--jvmaccess/source/makefile.mk41
-rw-r--r--jvmaccess/source/unovirtualmachine.cxx96
-rw-r--r--jvmaccess/source/virtualmachine.cxx124
-rw-r--r--jvmaccess/util/cc5_solaris_sparc.map81
-rw-r--r--jvmaccess/util/gcc3.map88
-rw-r--r--jvmaccess/util/makefile.mk66
-rw-r--r--jvmaccess/util/mingw.map71
-rw-r--r--jvmaccess/util/msvc_win32_intel.map37
-rw-r--r--jvmaccess/workbench/exceptiontest1.cxx46
-rw-r--r--jvmaccess/workbench/exceptiontest2.cxx46
-rw-r--r--jvmaccess/workbench/java/TestComponent.java104
-rw-r--r--jvmaccess/workbench/java/makefile.mk43
-rw-r--r--jvmaccess/workbench/java/manifest1
-rw-r--r--jvmaccess/workbench/javainfo/javainfotest.cxx372
-rw-r--r--jvmaccess/workbench/javainfo/makefile.mk43
-rw-r--r--jvmaccess/workbench/makefile.mk51
22 files changed, 1919 insertions, 0 deletions
diff --git a/jvmaccess/inc/jvmaccess/classpath.hxx b/jvmaccess/inc/jvmaccess/classpath.hxx
new file mode 100644
index 000000000000..a6c1343efb2f
--- /dev/null
+++ b/jvmaccess/inc/jvmaccess/classpath.hxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_JVMACCESS_CLASSPATH_HXX
+#define INCLUDED_JVMACCESS_CLASSPATH_HXX
+
+#include "sal/config.h"
+#include "com/sun/star/uno/Reference.hxx"
+
+#if defined SOLAR_JAVA
+#include "jni.h"
+#else
+struct JNIEnv;
+typedef void * jclass;
+typedef void * jobjectArray;
+#endif
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
+namespace rtl { class OUString; }
+
+namespace jvmaccess {
+
+/**
+ Helper functions for class path handling.
+*/
+class ClassPath {
+public:
+ /**
+ translates a class path into a java.net.URL[] instance.
+
+ @param context
+ a component context; must not be null.
+
+ @param environment
+ a JNI environment; must not be null.
+
+ @param classPath
+ a list of zero or more internal (see the
+ com.sun.star.uri.ExternalUriReferenceTranslator service) URI references,
+ where any space characters (U+0020) are ignored (and, in particular,
+ separate adjacent URI references). Any vnd.sun.star.expand URL
+ references in the list are expanded using the
+ com.sun.star.util.theMacroExpander singleton of the given context.
+
+ @returns
+ a local reference to a java.net.URL[] instance containing the external
+ (see the com.sun.star.uri.ExternalUriReferenceTranslator service)
+ equivalents of all the URI references in the given classPath. If null, a
+ (still pending) JNI exception occurred.
+
+ @throws com::sun::star::uno::RuntimeException
+ */
+ static inline ::jobjectArray
+ translateToUrls(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ ::JNIEnv * environment, ::rtl::OUString const & classPath)
+ {
+ return
+ static_cast< ::jobjectArray >(
+ doTranslateToUrls(context, environment, classPath));
+ }
+
+ /**
+ loads a class via a java.net.URLClassLoader.
+
+ @param context
+ a component context; must not be null.
+
+ @param environment
+ a JNI environment; must not be null.
+
+ @param classPath
+ a list of zero or more internal (see the
+ com.sun.star.uri.ExternalUriReferenceTranslator service) URI references,
+ where any space characters (U+0020) are ignored (and, in particular,
+ separate adjacent URI references). Any vnd.sun.star.expand URL
+ references in the list are expanded using the
+ com.sun.star.util.theMacroExpander singleton of the given context.
+
+ @param name
+ the Java binary name of the class to load.
+
+ @returns
+ a local reference to a java.lang.Class instance. If null, a (still
+ pending) JNI exception occurred.
+
+ @throws com::sun::star::uno::RuntimeException
+ */
+ static inline ::jclass loadClass(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ ::JNIEnv * environment, ::rtl::OUString const & classPath,
+ ::rtl::OUString const & name)
+ {
+ return
+ static_cast< ::jclass >(
+ doLoadClass(context, environment, classPath, name));
+ }
+
+private:
+ ClassPath(); // not defined
+ ClassPath(ClassPath &); // not defined
+ ~ClassPath(); // not defined
+ void operator =(ClassPath &); // not defined
+
+ // Functions that replace JNIEnv, jobjectArray, and jclass with void *, so
+ // that their mangled C++ names do not depend on the JDK version used at
+ // compile time:
+
+ static void * doTranslateToUrls(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ void * environment, ::rtl::OUString const & classPath);
+
+ static void * doLoadClass(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ void * environment, ::rtl::OUString const & classPath,
+ ::rtl::OUString const & name);
+};
+
+}
+
+#endif
diff --git a/jvmaccess/inc/jvmaccess/unovirtualmachine.hxx b/jvmaccess/inc/jvmaccess/unovirtualmachine.hxx
new file mode 100644
index 000000000000..aba06ddbffb0
--- /dev/null
+++ b/jvmaccess/inc/jvmaccess/unovirtualmachine.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
+#define INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
+
+#include "sal/config.h"
+#include "salhelper/simplereferenceobject.hxx"
+#include "rtl/ref.hxx"
+
+namespace jvmaccess {
+
+class VirtualMachine;
+
+/** An encapsulating wrapper around a Java virtual machine and an appropriate
+ UNO class loader.
+ */
+class UnoVirtualMachine: public salhelper::SimpleReferenceObject {
+public:
+ /** An exception indicating failure to create a UnoVirtualMachine.
+ */
+ class CreationException
+ {
+ public:
+ CreationException();
+
+ CreationException(CreationException const &);
+
+ virtual ~CreationException();
+
+ CreationException & operator =(CreationException const &);
+ };
+
+ /** Create a wrapper around a Java virtual machine and an appropriate UNO
+ class loader.
+
+ @param virtualMachine
+ A Java virtual machine wrapper. Must not be null.
+
+ @param classLoader
+ A local or global JNI reference, relative to the given virtualMachine,
+ to an appropriate UNO class loader instance. Must not be null. This
+ parameter should be of type jobject, not void *, but the exact
+ definition of jobject is different for different JDK versions, so that
+ the mangled C++ name of the constructor would depend on the JDK version
+ used at compile time.
+
+ @exception CreationException
+ Thrown in case creation fails (due to a JNI problem).
+ */
+ UnoVirtualMachine(
+ rtl::Reference< jvmaccess::VirtualMachine > const & virtualMachine,
+ void * classLoader);
+
+ /** Get the Java virtual machine wrapper.
+
+ @return
+ The Java virtual machine wrapper. Will never be null.
+ */
+ rtl::Reference< jvmaccess::VirtualMachine > getVirtualMachine() const;
+
+ /** Get the UNO class loader.
+
+ @return
+ A global JNI reference to the UNO class loader. (The JNI reference must
+ not be deleted by client code.) Will never be null. This should be of
+ type jobject, not void *, but the exact definition of jobject is
+ different for different JDK versions, so that the mangled C++ name of
+ the function would depend on the JDK version used at compile time.
+ */
+ void * getClassLoader() const;
+
+private:
+ UnoVirtualMachine(UnoVirtualMachine &); // not defined
+ void operator =(UnoVirtualMachine &); // not defined
+
+ virtual ~UnoVirtualMachine();
+
+ rtl::Reference< jvmaccess::VirtualMachine > m_virtualMachine;
+ void * m_classLoader;
+};
+
+}
+
+#endif
diff --git a/jvmaccess/inc/jvmaccess/virtualmachine.hxx b/jvmaccess/inc/jvmaccess/virtualmachine.hxx
new file mode 100644
index 000000000000..eef43e5013aa
--- /dev/null
+++ b/jvmaccess/inc/jvmaccess/virtualmachine.hxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#if !defined INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+#define INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+
+#include "rtl/ref.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+
+#ifdef SOLAR_JAVA
+#include "jni.h"
+#else
+struct JNIEnv;
+struct JavaVM;
+typedef int jint;
+typedef void * jobject;
+#endif
+
+namespace jvmaccess {
+
+/** An encapsulating wrapper around a Java virtual machine.
+ */
+class VirtualMachine: public salhelper::SimpleReferenceObject
+{
+public:
+ /** A helper to attach a thread to a Java virtual machine.
+
+ @descr
+ Upon construction of a guard the current thread is attached to the
+ virtual machine, and upon destruction of the guard the thread is
+ detached again. For any one thread, multiple instances of this class
+ may be used in a stack-like fashion (care is taken to only really
+ detach the thread from the virtual machine upon destruction of the guard
+ at the bottom of the stack).
+ */
+ class AttachGuard
+ {
+ public:
+ /** An exception indicating failure to create an AttachGuard.
+ */
+ class CreationException
+ {
+ public:
+ CreationException();
+
+ CreationException(CreationException const &);
+
+ virtual ~CreationException();
+
+ CreationException & operator =(CreationException const &);
+ };
+
+ /** Attach the current thread to a virtual machine.
+
+ @param rMachine
+ The virtual machine to attach to. Must not be a null reference.
+
+ @exception CreationException
+ Thrown in case attaching fails (due to a JNI problem).
+ */
+ explicit AttachGuard(rtl::Reference< VirtualMachine > const & rMachine);
+
+ /** Detach the current thread from the virtual machine again.
+ */
+ ~AttachGuard();
+
+ /** Get a JNI environment pointer for the current thread.
+
+ @return
+ A valid JNI environment pointer. Will never be null.
+ */
+ inline JNIEnv * getEnvironment() const { return m_pEnvironment; }
+
+ private:
+ AttachGuard(AttachGuard &); // not implemented
+ void operator =(AttachGuard); // not implemented
+
+ rtl::Reference< VirtualMachine > m_xMachine;
+ JNIEnv * m_pEnvironment;
+ bool m_bDetach;
+ };
+
+ /** Create a wrapper around a Java virtual machine.
+
+ @param pVm
+ A JNI pointer to virtual machine. Must not be null.
+
+ @param nVersion
+ The JNI version of the virtual machine pointed to by pVm. Must be at
+ least JNI_VERSION_1_2. This parameter should be of type jint, not int,
+ but at least on some platforms the definition of jint changed from
+ JDK 1.3 (long) to JDK 1.4 (int), so that the mangled C++ name of the
+ constructor would depend on the JDK version used at compile time.
+
+ @param bDestroy
+ Whether to destroy the virtual machine when destructing the wrapper
+ (i.e., whether the wrapper owns the virtual machine pointed to by pVm).
+
+ @param pMainThreadEnv
+ A valid JNI environment pointer for the current thread; must not be
+ null. The current thread must be "initially attached" to the virtual
+ machine while this constructor is being called (i.e., it must be the
+ thread that has called JNI_CreateJavaVM in case the virtual machine has
+ been started via the JNI Invocation API, and it must not already have
+ called DetachCurrentThread; or it must be executing native code called
+ from a "primordial" virtual machine). This environment pointer was
+ formerly used to obtain a reference to the thread's current context
+ class loader (java.lang.Thread.getCurrentClassLoader; if later a native
+ thread was attached to the virtual machine, that thread's context class
+ loader would be null, so the AttachGuard first of all set it to the
+ saved value; this feature has been removed again for performance reasons
+ and because the default context class loader is often not useful, so
+ that code relying on a context class loader has to set one explicitly,
+ anyway). This parameter is currently unused (but may be used again in
+ the future).
+ */
+ VirtualMachine(JavaVM * pVm, int nVersion, bool bDestroy,
+ JNIEnv * pMainThreadEnv);
+
+private:
+ VirtualMachine(VirtualMachine &); // not implemented
+ void operator =(VirtualMachine); // not implemented
+
+ virtual ~VirtualMachine();
+
+ JNIEnv * attachThread(bool * pAttached) const;
+
+ void detachThread() const;
+
+ JavaVM * m_pVm;
+ jint m_nVersion;
+ bool m_bDestroy;
+
+ friend class AttachGuard; // to access attachThread, detachThread
+};
+
+}
+
+#endif // INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
diff --git a/jvmaccess/prj/build.lst b/jvmaccess/prj/build.lst
new file mode 100644
index 000000000000..73d99c7e0166
--- /dev/null
+++ b/jvmaccess/prj/build.lst
@@ -0,0 +1,4 @@
+jv jvmaccess : offuh ridljar cppu sal salhelper NULL
+jv jvmaccess usr1 - all jv_mkout NULL
+jv jvmaccess\source nmake - all jv_source NULL
+jv jvmaccess\util nmake - all jv_util jv_source NULL
diff --git a/jvmaccess/prj/d.lst b/jvmaccess/prj/d.lst
new file mode 100644
index 000000000000..303e1e92ad26
--- /dev/null
+++ b/jvmaccess/prj/d.lst
@@ -0,0 +1,8 @@
+mkdir: %_DEST%\inc%_EXT%\jvmaccess
+..\inc\jvmaccess\classpath.hxx %_DEST%\inc%_EXT%\jvmaccess\classpath.hxx
+..\inc\jvmaccess\unovirtualmachine.hxx %_DEST%\inc%_EXT%\jvmaccess\unovirtualmachine.hxx
+..\inc\jvmaccess\virtualmachine.hxx %_DEST%\inc%_EXT%\jvmaccess\virtualmachine.hxx
+..\%__SRC%\bin\jvmacces*.dll %_DEST%\bin%_EXT%\*
+..\%__SRC%\lib\ijvmaccess.lib %_DEST%\lib%_EXT%\ijvmaccess.lib
+..\%__SRC%\lib\libjvmaccess*.*.* %_DEST%\lib%_EXT%\*
+linklib: libjvmaccess*.*.*
diff --git a/jvmaccess/source/classpath.cxx b/jvmaccess/source/classpath.cxx
new file mode 100644
index 000000000000..0520c8bf8926
--- /dev/null
+++ b/jvmaccess/source/classpath.cxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "sal/config.h"
+
+#include "jvmaccess/classpath.hxx"
+
+#include <vector>
+
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/uri/UriReferenceFactory.hpp"
+#include "com/sun/star/uri/XVndSunStarExpandUrlReference.hpp"
+#include "com/sun/star/util/XMacroExpander.hpp"
+#include "osl/diagnose.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#if defined SOLAR_JAVA
+#include "jni.h"
+#endif
+
+namespace {
+
+namespace css = ::com::sun::star;
+
+}
+
+void * ::jvmaccess::ClassPath::doTranslateToUrls(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ void * environment, ::rtl::OUString const & classPath)
+{
+ OSL_ASSERT(context.is() && environment != 0);
+#if defined SOLAR_JAVA
+ ::JNIEnv * const env = static_cast< ::JNIEnv * >(environment);
+ jclass classUrl(env->FindClass("java/net/URL"));
+ if (classUrl == 0) {
+ return 0;
+ }
+ jmethodID ctorUrl(
+ env->GetMethodID(classUrl, "<init>", "(Ljava/lang/String;)V"));
+ if (ctorUrl == 0) {
+ return 0;
+ }
+ ::std::vector< jobject > urls;
+ for (::sal_Int32 i = 0; i != -1;) {
+ ::rtl::OUString url(classPath.getToken(0, ' ', i));
+ if (url.getLength() != 0) {
+ css::uno::Reference< css::uri::XVndSunStarExpandUrlReference >
+ expUrl(
+ css::uri::UriReferenceFactory::create(context)->parse(url),
+ css::uno::UNO_QUERY);
+ if (expUrl.is()) {
+ css::uno::Reference< css::util::XMacroExpander > expander(
+ context->getValueByName(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/singletons/"
+ "com.sun.star.util.theMacroExpander"))),
+ css::uno::UNO_QUERY_THROW);
+ try {
+ url = expUrl->expand(expander);
+ } catch (css::lang::IllegalArgumentException & e) {
+ throw css::uno::RuntimeException(
+ (::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.lang.IllegalArgumentException: "))
+ + e.Message),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ jvalue arg;
+ arg.l = env->NewString(
+ static_cast< jchar const * >(url.getStr()),
+ static_cast< jsize >(url.getLength()));
+ if (arg.l == 0) {
+ return 0;
+ }
+ jobject o(env->NewObjectA(classUrl, ctorUrl, &arg));
+ if (o == 0) {
+ return 0;
+ }
+ urls.push_back(o);
+ }
+ }
+ jobjectArray result = env->NewObjectArray(
+ static_cast< jsize >(urls.size()), classUrl, 0);
+ // static_cast is ok, as each element of urls occupied at least one
+ // character of the ::rtl::OUString classPath
+ if (result == 0) {
+ return 0;
+ }
+ jsize idx = 0;
+ for (std::vector< jobject >::iterator i(urls.begin()); i != urls.end(); ++i)
+ {
+ env->SetObjectArrayElement(result, idx++, *i);
+ }
+ return result;
+#else
+ return 0;
+#endif
+}
+
+void * ::jvmaccess::ClassPath::doLoadClass(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ void * environment, ::rtl::OUString const & classPath,
+ ::rtl::OUString const & name)
+{
+ OSL_ASSERT(context.is() && environment != 0);
+#if defined SOLAR_JAVA
+ ::JNIEnv * const env = static_cast< ::JNIEnv * >(environment);
+ jclass classLoader(env->FindClass("java/net/URLClassLoader"));
+ if (classLoader == 0) {
+ return 0;
+ }
+ jmethodID ctorLoader(
+ env->GetMethodID(classLoader, "<init>", "([Ljava/net/URL;)V"));
+ if (ctorLoader == 0) {
+ return 0;
+ }
+ jvalue arg;
+ arg.l = translateToUrls(context, env, classPath);
+ if (arg.l == 0) {
+ return 0;
+ }
+ jobject cl = env->NewObjectA(classLoader, ctorLoader, &arg);
+ if (cl == 0) {
+ return 0;
+ }
+ jmethodID methLoadClass(
+ env->GetMethodID(
+ classLoader, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;"));
+ if (methLoadClass == 0) {
+ return 0;
+ }
+ arg.l = env->NewString(
+ static_cast< jchar const * >(name.getStr()),
+ static_cast< jsize >(name.getLength()));
+ if (arg.l == 0) {
+ return 0;
+ }
+ return env->CallObjectMethodA(cl, methLoadClass, &arg);
+#else
+ return 0;
+#endif
+}
diff --git a/jvmaccess/source/makefile.mk b/jvmaccess/source/makefile.mk
new file mode 100644
index 000000000000..44e0313398e6
--- /dev/null
+++ b/jvmaccess/source/makefile.mk
@@ -0,0 +1,41 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..
+PRJNAME = jvmaccess
+TARGET = $(PRJNAME)
+
+ENABLE_EXCEPTIONS = TRUE
+
+.INCLUDE: settings.mk
+
+SLOFILES = \
+ $(SLO)$/classpath.obj \
+ $(SLO)$/unovirtualmachine.obj \
+ $(SLO)$/virtualmachine.obj
+
+.INCLUDE: target.mk
diff --git a/jvmaccess/source/unovirtualmachine.cxx b/jvmaccess/source/unovirtualmachine.cxx
new file mode 100644
index 000000000000..48a19aeec1e8
--- /dev/null
+++ b/jvmaccess/source/unovirtualmachine.cxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "sal/config.h"
+
+#include "jvmaccess/unovirtualmachine.hxx"
+
+#include "osl/diagnose.h"
+
+#include "jvmaccess/virtualmachine.hxx"
+
+#if defined SOLAR_JAVA
+#include "jni.h"
+#endif
+
+namespace jvmaccess {
+
+UnoVirtualMachine::CreationException::CreationException() {}
+
+UnoVirtualMachine::CreationException::CreationException(
+ CreationException const &)
+{}
+
+UnoVirtualMachine::CreationException::~CreationException() {}
+
+UnoVirtualMachine::CreationException &
+UnoVirtualMachine::CreationException::operator =(CreationException const &) {
+ return *this;
+}
+
+UnoVirtualMachine::UnoVirtualMachine(
+ rtl::Reference< jvmaccess::VirtualMachine > const & virtualMachine,
+ void * classLoader):
+ m_virtualMachine(virtualMachine),
+ m_classLoader(0)
+{
+#if defined SOLAR_JAVA
+ try {
+ m_classLoader =
+ jvmaccess::VirtualMachine::AttachGuard(m_virtualMachine).
+ getEnvironment()->NewGlobalRef(static_cast< jobject >(classLoader));
+ } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {}
+#endif
+ if (m_classLoader == 0) {
+ throw CreationException();
+ }
+}
+
+rtl::Reference< jvmaccess::VirtualMachine >
+UnoVirtualMachine::getVirtualMachine() const {
+ return m_virtualMachine;
+}
+
+void * UnoVirtualMachine::getClassLoader() const {
+ return m_classLoader;
+}
+
+UnoVirtualMachine::~UnoVirtualMachine() {
+#if defined SOLAR_JAVA
+ try {
+ jvmaccess::VirtualMachine::AttachGuard(m_virtualMachine).
+ getEnvironment()->DeleteGlobalRef(
+ static_cast< jobject >(m_classLoader));
+ } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {
+ OSL_TRACE(
+ "jvmaccess::UnoVirtualMachine::~UnoVirtualMachine:"
+ " jvmaccess::VirtualMachine::AttachGuard::CreationException" );
+ }
+#endif
+}
+
+}
diff --git a/jvmaccess/source/virtualmachine.cxx b/jvmaccess/source/virtualmachine.cxx
new file mode 100644
index 000000000000..db6a596e1b56
--- /dev/null
+++ b/jvmaccess/source/virtualmachine.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "jvmaccess/virtualmachine.hxx"
+
+#include "osl/diagnose.h"
+
+using jvmaccess::VirtualMachine;
+
+VirtualMachine::AttachGuard::CreationException::CreationException()
+{}
+
+VirtualMachine::AttachGuard::CreationException::CreationException(
+ CreationException const &)
+{}
+
+VirtualMachine::AttachGuard::CreationException::~CreationException()
+{}
+
+VirtualMachine::AttachGuard::CreationException &
+VirtualMachine::AttachGuard::CreationException::operator =(
+ CreationException const &)
+{
+ return *this;
+}
+
+VirtualMachine::AttachGuard::AttachGuard(
+ rtl::Reference< VirtualMachine > const & rMachine):
+ m_xMachine(rMachine)
+{
+ OSL_ENSURE(m_xMachine.is(), "bad parameter");
+ m_pEnvironment = m_xMachine->attachThread(&m_bDetach);
+ if (m_pEnvironment == 0)
+ throw CreationException();
+}
+
+VirtualMachine::AttachGuard::~AttachGuard()
+{
+ if (m_bDetach)
+ m_xMachine->detachThread();
+}
+
+VirtualMachine::VirtualMachine(JavaVM * pVm, int nVersion, bool bDestroy,
+ JNIEnv * pMainThreadEnv):
+ m_pVm(pVm), m_nVersion(nVersion), m_bDestroy(bDestroy)
+{
+ (void) pMainThreadEnv; // avoid warnings
+#ifdef SOLAR_JAVA
+ OSL_ENSURE(pVm != 0 && nVersion >= JNI_VERSION_1_2 && pMainThreadEnv != 0,
+ "bad parameter");
+#endif
+}
+
+VirtualMachine::~VirtualMachine()
+{
+ if (m_bDestroy)
+ {
+ // Do not destroy the VM. Under Java 1.3, the AWT event loop thread is
+ // not a daemon thread and is never terminated, so that calling
+ // DestroyJavaVM (waiting for all non-daemon threads to terminate) hangs
+ // forever.
+/*
+ jint n = m_pVm->DestroyJavaVM();
+ OSL_ENSURE(n == JNI_OK, "JNI: DestroyJavaVM failed");
+*/
+ }
+}
+
+JNIEnv * VirtualMachine::attachThread(bool * pAttached) const
+{
+#ifndef SOLAR_JAVA
+ return 0;
+#else
+ OSL_ENSURE(pAttached != 0, "bad parameter");
+ JNIEnv * pEnv;
+ jint n = m_pVm->GetEnv(reinterpret_cast< void ** >(&pEnv), m_nVersion);
+ if (n != JNI_OK && n != JNI_EDETACHED) {
+ OSL_ENSURE(false, "JNI: GetEnv failed");
+ }
+ if (pEnv == 0)
+ {
+ if (m_pVm->AttachCurrentThread(reinterpret_cast< void ** >(&pEnv), 0)
+ != JNI_OK)
+ return 0;
+ *pAttached = true;
+ }
+ else
+ *pAttached = false;
+ return pEnv;
+#endif
+}
+
+void VirtualMachine::detachThread() const
+{
+#ifdef SOLAR_JAVA
+ if (m_pVm->DetachCurrentThread() != JNI_OK) {
+ OSL_ENSURE(false, "JNI: DetachCurrentThread failed");
+ }
+#endif
+}
diff --git a/jvmaccess/util/cc5_solaris_sparc.map b/jvmaccess/util/cc5_solaris_sparc.map
new file mode 100644
index 000000000000..e2cb767dc65e
--- /dev/null
+++ b/jvmaccess/util/cc5_solaris_sparc.map
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+UDK_3.1 {
+ global:
+ # jvmaccess/virtualmachine.hxx:
+ __1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2t6M_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
+ __1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2t6Mrk3_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException(CreationException const &)
+ __1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2T6M_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::~CreationException()
+ __1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2G6Mrk3_r3_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::operator =(CreationException const &)
+ __1cJjvmaccesscO__RTTI__1nJjvmaccessOVirtualMachineLAttachGuardRCreationException__; # RTTI for jvmaccess::VirtualMachine::AttachGuard::CreationException
+ __1cJjvmaccessOVirtualMachineLAttachGuard2t6MrknDrtlJReference4n0B____v_; # jvmaccess::VirtualMachine::AttachGuard::AttachGuard(rtl::Reference< VirtualMachine > const &)
+ __1cJjvmaccessOVirtualMachineLAttachGuard2t5B6MrknDrtlJReference4n0B____v_; # jvmaccess::VirtualMachine::AttachGuard::AttachGuard(rtl::Reference< VirtualMachine > const &) #Nvariant 1
+ __1cJjvmaccessOVirtualMachineLAttachGuard2T6M_v_; # jvmaccess::VirtualMachine::AttachGuard::~AttachGuard()
+ __1cJjvmaccessOVirtualMachineLAttachGuard2T5B6M_v_; # jvmaccess::VirtualMachine::AttachGuard::~AttachGuard() #Nvariant 1
+ __1cJjvmaccessOVirtualMachine2t6MpnHJavaVM__ibpnHJNIEnv___v_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
+
+ local:
+ *;
+};
+
+UDK_3.2 {
+ global:
+ # initially forgotten jvmaccess/virtualmachine.hxx:
+ __1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2t5B6M_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException() #Nvariant 1
+ __1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2t5B6Mrk3_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException(CreationException const &) #Nvariant 1
+ __1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2T5B6M_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::~CreationException() #Nvariant 1
+ __1cJjvmaccesscQ__RTTI__1CpnJjvmaccessOVirtualMachineLAttachGuardRCreationException__; # RTTI for jvmaccess::VirtualMachine::AttachGuard::CreationException *
+ __1cJjvmaccesscR__RTTI__1CpknJjvmaccessOVirtualMachineLAttachGuardRCreationException__; # RTTI for jvmaccess::VirtualMachine::AttachGuard::CreationException const *
+ __1cJjvmaccessOVirtualMachine2t5B6MpnHJavaVM__ibpnHJNIEnv___v_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *) #Nvariant 1
+} UDK_3.1;
+
+UDK_3.3 {
+ global:
+ # jvmaccess/unovirtualmachine.hxx:
+ __1cJjvmaccessRUnoVirtualMachineRCreationException2t6M_v_; # jvmaccess::UnoVirtualMachine::CreationException::CreationException()
+ __1cJjvmaccessRUnoVirtualMachineRCreationException2t5B6M_v_; # jvmaccess::UnoVirtualMachine::CreationException::CreationException() #Nvariant 1
+ __1cJjvmaccessRUnoVirtualMachineRCreationException2t6Mrk2_v_; # jvmaccess::UnoVirtualMachine::CreationException::CreationException(CreationException const &)
+ __1cJjvmaccessRUnoVirtualMachineRCreationException2t5B6Mrk2_v_; # jvmaccess::UnoVirtualMachine::CreationException::CreationException(CreationException const &) #Nvariant 1
+ __1cJjvmaccessRUnoVirtualMachineRCreationException2T6M_v_; # jvmaccess::UnoVirtualMachine::CreationException::~CreationException()
+ __1cJjvmaccessRUnoVirtualMachineRCreationException2T5B6M_v_; # jvmaccess::UnoVirtualMachine::CreationException::~CreationException() #Nvariant 1
+ __1cJjvmaccessRUnoVirtualMachineRCreationException2G6Mrk2_r2_; # jvmaccess::UnoVirtualMachine::CreationException::operator =(CreationException const &)
+ __1cJjvmaccesscF__RTTI__1nJjvmaccessRUnoVirtualMachineRCreationException__; # RTTI for jvmaccess::UnoVirtualMachine::CreationException
+ __1cJjvmaccesscH__RTTI__1CpnJjvmaccessRUnoVirtualMachineRCreationException__; # RTTI for jvmaccess::UnoVirtualMachine::CreationException *
+ __1cJjvmaccesscI__RTTI__1CpknJjvmaccessRUnoVirtualMachineRCreationException__; # RTTI for jvmaccess::UnoVirtualMachine::CreationException const *
+ __1cJjvmaccessRUnoVirtualMachine2t6MrknDrtlJReference4n0AOVirtualMachine___pv_v_; # jvmaccess::UnoVirtualMachine::UnoVirtualMachine(rtl::Reference< jvmaccess::VirtualMachine > const &, void *)
+ __1cJjvmaccessRUnoVirtualMachine2t5B6MrknDrtlJReference4n0AOVirtualMachine___pv_v_; # jvmaccess::UnoVirtualMachine::UnoVirtualMachine(rtl::Reference< jvmaccess::VirtualMachine > const &, void *) #Nvariant 1
+ __1cJjvmaccessRUnoVirtualMachineRgetVirtualMachine6kM_nDrtlJReference4n0AOVirtualMachine____; # jvmaccess::UnoVirtualMachine::getVirtualMachine() const
+ __1cJjvmaccessRUnoVirtualMachineOgetClassLoader6kM_pv_; # jvmaccess::UnoVirtualMachine::getClassLoader() const
+} UDK_3.2;
+
+UDK_3.4 { # OOo 2.3
+ global:
+ # jvmaccess/classpath.hxx:
+ __1cJjvmaccessJClassPathLdoLoadClass6FrknDcomDsunEstarDunoJReference4n0FRXComponentContext___pvrknDrtlIOUString_9E_9A_; # jvmaccess::ClassPath::doLoadClass(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &, void *, rtl::OUString const &, rtl::OUString const &)
+ __1cJjvmaccessJClassPathRdoTranslateToUrls6FrknDcomDsunEstarDunoJReference4n0FRXComponentContext___pvrknDrtlIOUString__9A_; # jvmaccess::ClassPath::doTranslateToUrls(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &, void *, rtl::OUString const &)
+} UDK_3.3;
diff --git a/jvmaccess/util/gcc3.map b/jvmaccess/util/gcc3.map
new file mode 100644
index 000000000000..330651a1cf6e
--- /dev/null
+++ b/jvmaccess/util/gcc3.map
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+UDK_3.1 {
+ global:
+ # jvmaccess/virtualmachine.hxx:
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC1Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC1ERKS2_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException(CreationException const &)
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionD0Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::~CreationException()
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionaSERKS2_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::operator =(CreationException const &)
+ # _ZTIN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionE; # typeinfo for jvmaccess::VirtualMachine::AttachGuard::CreationException
+ # _ZTSN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionE; # typeinfo name for jvmaccess::VirtualMachine::AttachGuard::CreationException
+ _ZN9jvmaccess14VirtualMachine11AttachGuardC1ERKN3rtl9ReferenceIS0_EE; # jvmaccess::VirtualMachine::AttachGuard::AttachGuard(rtl::Reference< VirtualMachine > const &)
+ _ZN9jvmaccess14VirtualMachine11AttachGuardC2ERKN3rtl9ReferenceIS0_EE; # jvmaccess::VirtualMachine::AttachGuard::AttachGuard(rtl::Reference< VirtualMachine > const &)
+ _ZN9jvmaccess14VirtualMachine11AttachGuardD1Ev; # jvmaccess::VirtualMachine::AttachGuard::~AttachGuard()
+ _ZN9jvmaccess14VirtualMachine11AttachGuardD2Ev; # jvmaccess::VirtualMachine::AttachGuard::~AttachGuard()
+ _ZN9jvmaccess14VirtualMachineC1EP7JavaVM_ibP7JNIEnv_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
+
+ local:
+ *;
+};
+
+UDK_3.2 {
+ global:
+ # initially forgotten jvmaccess/virtualmachine.hxx:
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC2Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC2ERKS2_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException(CreationException const &)
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionD1Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::~CreationException()
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionD2Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::~CreationException()
+ _ZN9jvmaccess14VirtualMachineC2EP7JavaVM_ibP7JNIEnv_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
+
+ # We prefix the next two symbols with a wildcard sign because they will only be generated by gcj. The Mac OS X linker doesn't support
+ # "Treat not existing symbols as warning" under certain circumstances and thus ends with an error when trying to find these symbols
+ # (see man ld on Mac OS X). For further details see also #i69351#. By using the wildcard the symbols will be filtered out before.
+ # We put the '*' at the beginning because its unlikely that these symbols will ever be a postfix of another symbol.
+ _*ZN9jvmaccess14VirtualMachineC1EP10_Jv_JavaVMibP10_Jv_JNIEnv; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
+ _*ZN9jvmaccess14VirtualMachineC2EP10_Jv_JavaVMibP10_Jv_JNIEnv; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
+} UDK_3.1;
+
+UDK_3.3 {
+ global:
+ # jvmaccess/unovirtualmachine.hxx:
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionC1Ev; # jvmaccess::UnoVirtualMachine::CreationException::CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionC2Ev; # jvmaccess::UnoVirtualMachine::CreationException::CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionC1ERKS1_; # jvmaccess::UnoVirtualMachine::CreationException::CreationException(CreationException const &)
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionC2ERKS1_; # jvmaccess::UnoVirtualMachine::CreationException::CreationException(CreationException const &)
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionD0Ev; # jvmaccess::UnoVirtualMachine::CreationException::~CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionD1Ev; # jvmaccess::UnoVirtualMachine::CreationException::~CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionD2Ev; # jvmaccess::UnoVirtualMachine::CreationException::~CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionaSERKS1_; # jvmaccess::UnoVirtualMachine::CreationException::operator =(CreationException const &)
+ # _ZTIN9jvmaccess17UnoVirtualMachine17CreationExceptionE; # typeinfo for jvmaccess::UnoVirtualMachine::CreationException
+ # _ZTSN9jvmaccess17UnoVirtualMachine17CreationExceptionE; # typeinfo name for jvmaccess::UnoVirtualMachine::CreationException
+ _ZN9jvmaccess17UnoVirtualMachineC1ERKN3rtl9ReferenceINS_14VirtualMachineEEEPv; # jvmaccess::UnoVirtualMachine::UnoVirtualMachine(rtl::Reference< jvmaccess::VirtualMachine > const &, void *)
+ _ZN9jvmaccess17UnoVirtualMachineC2ERKN3rtl9ReferenceINS_14VirtualMachineEEEPv; # jvmaccess::UnoVirtualMachine::UnoVirtualMachine(rtl::Reference< jvmaccess::VirtualMachine > const &, void *)
+ _ZNK9jvmaccess17UnoVirtualMachine17getVirtualMachineEv; # jvmaccess::UnoVirtualMachine::getVirtualMachine() const
+ _ZNK9jvmaccess17UnoVirtualMachine14getClassLoaderEv; # jvmaccess::UnoVirtualMachine::getClassLoader() const
+} UDK_3.2;
+
+UDK_3.4 { # OOo 2.3
+ global:
+ # jvmaccess/classpath.hxx:
+ _ZN9jvmaccess9ClassPath11doLoadClassERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEEPvRKN3rtl8OUStringESE_; # jvmaccess::ClassPath::doLoadClass(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &, void *, rtl::OUString const &, rtl::OUString const &)
+ _ZN9jvmaccess9ClassPath17doTranslateToUrlsERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEEPvRKN3rtl8OUStringE; # jvmaccess::ClassPath::doTranslateToUrls(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &, void *, rtl::OUString const &)
+} UDK_3.3;
diff --git a/jvmaccess/util/makefile.mk b/jvmaccess/util/makefile.mk
new file mode 100644
index 000000000000..1dc327c8c884
--- /dev/null
+++ b/jvmaccess/util/makefile.mk
@@ -0,0 +1,66 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..
+PRJNAME = jvmaccess
+TARGET = $(PRJNAME)
+
+ENABLE_EXCEPTIONS = TRUE
+
+.IF "$(OS)" != "WNT" && "$(OS)" != "OS2"
+UNIXVERSIONNAMES = UDK
+.ENDIF # WNT
+
+.INCLUDE: settings.mk
+
+.IF "$(UNIXVERSIONNAMES)" == ""
+SHL1TARGET = $(TARGET)$(UDK_MAJOR)$(COMID)
+.ELSE # UNIXVERSIONNAMES
+SHL1TARGET = $(TARGET)$(COMID)
+.ENDIF # UNIXVERSIONNAMES
+
+SHL1IMPLIB = i$(TARGET)
+SHL1LIBS = $(SLB)$/$(TARGET).lib
+SHL1STDLIBS = $(CPPULIB) $(SALLIB) $(SALHELPERLIB)
+.IF "$(OS)" == "WNT"
+SHL1STDLIBS += $(ADVAPI32LIB)
+.ENDIF # WNT
+SHL1RPATH = URELIB
+
+.IF "$(COMNAME)" == "msci"
+SHL1VERSIONMAP = msvc_win32_intel.map
+.ELIF "$(COMNAME)" == "sunpro5"
+SHL1VERSIONMAP = cc5_solaris_sparc.map
+.ELIF "$(GUI)$(COM)" == "WNTGCC"
+SHL1VERSIONMAP = mingw.map
+.ELIF "$(COMNAME)" == "gcc3"
+SHL1VERSIONMAP = gcc3.map
+.ENDIF
+
+DEF1NAME = $(SHL1TARGET)
+
+.INCLUDE: target.mk
diff --git a/jvmaccess/util/mingw.map b/jvmaccess/util/mingw.map
new file mode 100644
index 000000000000..ddc4da9a91ea
--- /dev/null
+++ b/jvmaccess/util/mingw.map
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+UDK_3_0_0 {
+ global:
+ # jvmaccess/virtualmachine.hxx:
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC1Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC1ERKS2_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException(CreationException const &)
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionD0Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::~CreationException()
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionaSERKS2_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::operator =(CreationException const &)
+ # _ZTIN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionE; # typeinfo for jvmaccess::VirtualMachine::AttachGuard::CreationException
+ # _ZTSN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionE; # typeinfo name for jvmaccess::VirtualMachine::AttachGuard::CreationException
+ _ZN9jvmaccess14VirtualMachine11AttachGuardC1ERKN3rtl9ReferenceIS0_EE; # jvmaccess::VirtualMachine::AttachGuard::AttachGuard(rtl::Reference< VirtualMachine > const &)
+ _ZN9jvmaccess14VirtualMachine11AttachGuardC2ERKN3rtl9ReferenceIS0_EE; # jvmaccess::VirtualMachine::AttachGuard::AttachGuard(rtl::Reference< VirtualMachine > const &)
+ _ZN9jvmaccess14VirtualMachine11AttachGuardD1Ev; # jvmaccess::VirtualMachine::AttachGuard::~AttachGuard()
+ _ZN9jvmaccess14VirtualMachine11AttachGuardD2Ev; # jvmaccess::VirtualMachine::AttachGuard::~AttachGuard()
+ _ZN9jvmaccess14VirtualMachineC1EP7JavaVM_ibP7JNIEnv_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
+
+ # initially forgotten jvmaccess/virtualmachine.hxx:
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC2Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC2ERKS2_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException(CreationException const &)
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionD1Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::~CreationException()
+ _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionD2Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::~CreationException()
+ _ZN9jvmaccess14VirtualMachineC2EP7JavaVM_ibP7JNIEnv_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
+
+ # jvmaccess/unovirtualmachine.hxx:
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionC1Ev; # jvmaccess::UnoVirtualMachine::CreationException::CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionC2Ev; # jvmaccess::UnoVirtualMachine::CreationException::CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionC1ERKS1_; # jvmaccess::UnoVirtualMachine::CreationException::CreationException(CreationException const &)
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionC2ERKS1_; # jvmaccess::UnoVirtualMachine::CreationException::CreationException(CreationException const &)
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionD0Ev; # jvmaccess::UnoVirtualMachine::CreationException::~CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionD1Ev; # jvmaccess::UnoVirtualMachine::CreationException::~CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionD2Ev; # jvmaccess::UnoVirtualMachine::CreationException::~CreationException()
+ _ZN9jvmaccess17UnoVirtualMachine17CreationExceptionaSERKS1_; # jvmaccess::UnoVirtualMachine::CreationException::operator =(CreationException const &)
+ # _ZTIN9jvmaccess17UnoVirtualMachine17CreationExceptionE; # typeinfo for jvmaccess::UnoVirtualMachine::CreationException
+ # _ZTSN9jvmaccess17UnoVirtualMachine17CreationExceptionE; # typeinfo name for jvmaccess::UnoVirtualMachine::CreationException
+ _ZN9jvmaccess17UnoVirtualMachineC1ERKN3rtl9ReferenceINS_14VirtualMachineEEEPv; # jvmaccess::UnoVirtualMachine::UnoVirtualMachine(rtl::Reference< jvmaccess::VirtualMachine > const &, void *)
+ _ZN9jvmaccess17UnoVirtualMachineC2ERKN3rtl9ReferenceINS_14VirtualMachineEEEPv; # jvmaccess::UnoVirtualMachine::UnoVirtualMachine(rtl::Reference< jvmaccess::VirtualMachine > const &, void *)
+ _ZNK9jvmaccess17UnoVirtualMachine17getVirtualMachineEv; # jvmaccess::UnoVirtualMachine::getVirtualMachine() const
+ _ZNK9jvmaccess17UnoVirtualMachine14getClassLoaderEv; # jvmaccess::UnoVirtualMachine::getClassLoader() const
+ # jvmaccess/classpath.hxx:
+ _ZN9jvmaccess9ClassPath11doLoadClassERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEEPvRKN3rtl8OUStringESE_; # jvmaccess::ClassPath::doLoadClass(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &, void *, rtl::OUString const &, rtl::OUString const &)
+ _ZN9jvmaccess9ClassPath17doTranslateToUrlsERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEEPvRKN3rtl8OUStringE; # jvmaccess::ClassPath::doTranslateToUrls(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &, void *, rtl::OUString const &)
+
+ local:
+ *;
+};
diff --git a/jvmaccess/util/msvc_win32_intel.map b/jvmaccess/util/msvc_win32_intel.map
new file mode 100644
index 000000000000..fd148b1892ba
--- /dev/null
+++ b/jvmaccess/util/msvc_win32_intel.map
@@ -0,0 +1,37 @@
+UDK_3.1 {
+ global:
+ # jvmaccess/virtualmachine.hxx:
+ ??0CreationException@AttachGuard@VirtualMachine@jvmaccess@@QAE@XZ; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
+ ??0CreationException@AttachGuard@VirtualMachine@jvmaccess@@QAE@ABV0123@@Z; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException(CreationException const &)
+ ??1CreationException@AttachGuard@VirtualMachine@jvmaccess@@UAE@XZ; # jvmaccess::VirtualMachine::AttachGuard::CreationException::~CreationException()
+ ??4CreationException@AttachGuard@VirtualMachine@jvmaccess@@QAEAAV0123@ABV0123@@Z; # jvmaccess::VirtualMachine::AttachGuard::CreationException::operator =(CreationException const &)
+ ??0AttachGuard@VirtualMachine@jvmaccess@@QAE@ABV?$Reference@VVirtualMachine@jvmaccess@@@rtl@@@Z; # jvmaccess::VirtualMachine::AttachGuard::AttachGuard(rtl::Reference< VirtualMachine > const &)
+ ??1AttachGuard@VirtualMachine@jvmaccess@@QAE@XZ; # jvmaccess::VirtualMachine::AttachGuard::~AttachGuard()
+ ??0VirtualMachine@jvmaccess@@QAE@PAUJavaVM_@@H_NPAUJNIEnv_@@@Z; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
+
+ local:
+ *;
+};
+
+UDK_3.2 {
+ global:
+} UDK_3.1;
+
+UDK_3.3 {
+ global:
+ # jvmaccess/unovirtualmachine.hxx:
+ ??0CreationException@UnoVirtualMachine@jvmaccess@@QAE@ABV012@@Z; # jvmaccess::UnoVirtualMachine::CreationException::CreationException(CreationException const &)
+ ??0CreationException@UnoVirtualMachine@jvmaccess@@QAE@XZ; # jvmaccess::UnoVirtualMachine::CreationException::CreationException()
+ ??1CreationException@UnoVirtualMachine@jvmaccess@@UAE@XZ; # jvmaccess::UnoVirtualMachine::CreationException::~CreationException()
+ ??4CreationException@UnoVirtualMachine@jvmaccess@@QAEAAV012@ABV012@@Z; # jvmaccess::UnoVirtualMachine::CreationException::operator =(CreationException const &)
+ ??0UnoVirtualMachine@jvmaccess@@QAE@ABV?$Reference@VVirtualMachine@jvmaccess@@@rtl@@PAX@Z; # jvmaccess::UnoVirtualMachine::UnoVirtualMachine(rtl::Reference< jvmaccess::VirtualMachine > const &, void *)
+ ?getVirtualMachine@UnoVirtualMachine@jvmaccess@@QBE?AV?$Reference@VVirtualMachine@jvmaccess@@@rtl@@XZ; # jvmaccess::UnoVirtualMachine::getVirtualMachine() const
+ ?getClassLoader@UnoVirtualMachine@jvmaccess@@QBEPAXXZ; # jvmaccess::UnoVirtualMachine::getClassLoader() const
+} UDK_3.2;
+
+UDK_3.4 { # OOo 2.3
+ global:
+ # jvmaccess/classpath.hxx:
+ ?doLoadClass@ClassPath@jvmaccess@@CAPAXABV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@PAXABVOUString@rtl@@2@Z; # jvmaccess::ClassPath::doLoadClass(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &, void *, rtl::OUString const &, rtl::OUString const &)
+ ?doTranslateToUrls@ClassPath@jvmaccess@@CAPAXABV?$Reference@VXComponentContext@uno@star@sun@com@@@uno@star@sun@com@@PAXABVOUString@rtl@@@Z; # jvmaccess::ClassPath::doTranslateToUrls(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const &, void *, rtl::OUString const &)
+} UDK_3.3;
diff --git a/jvmaccess/workbench/exceptiontest1.cxx b/jvmaccess/workbench/exceptiontest1.cxx
new file mode 100644
index 000000000000..1eec1cd6a137
--- /dev/null
+++ b/jvmaccess/workbench/exceptiontest1.cxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "jvmaccess/virtualmachine.hxx"
+
+#include <iostream>
+
+// Modify source/virtualmachine.cxx before running this test, by letting the
+// AttachGuard ctor directly throw a CreationExcepiton (without even setting the
+// m_xMachine member).
+
+int main()
+{
+ try
+ {
+ jvmaccess::VirtualMachine::AttachGuard aGuard(0);
+ }
+ catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &)
+ {
+ std::cout << "Exception caught" << std::endl;
+ }
+}
diff --git a/jvmaccess/workbench/exceptiontest2.cxx b/jvmaccess/workbench/exceptiontest2.cxx
new file mode 100644
index 000000000000..6a2718f6bb81
--- /dev/null
+++ b/jvmaccess/workbench/exceptiontest2.cxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "jvmaccess/virtualmachine.hxx"
+
+#include <iostream>
+
+// Modify source/virtualmachine.cxx before running this test, by letting the
+// AttachGuard ctor directly throw a CreationExcepiton (without even setting the
+// m_xMachine member).
+
+int main()
+{
+ try
+ {
+ jvmaccess::VirtualMachine::AttachGuard aGuard(0);
+ }
+ catch (...)
+ {
+ std::cout << "Exception caught" << std::endl;
+ }
+}
diff --git a/jvmaccess/workbench/java/TestComponent.java b/jvmaccess/workbench/java/TestComponent.java
new file mode 100644
index 000000000000..4b056b641101
--- /dev/null
+++ b/jvmaccess/workbench/java/TestComponent.java
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.comp.jvmaccess.workbench;
+
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.lang.XMain;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.uno.Type;
+
+/* Deploy this component with pkgchk, and call it with the Basic program
+
+ Sub Main
+ dim args$()
+ o = createunoservice("com.sun.star.comp.jvmaccess.workbench.TestComponent")
+ o.run args$()
+ End Sub
+
+ The name of the context class loader should appear on the console.
+ */
+
+public final class TestComponent implements XTypeProvider, XServiceInfo, XMain {
+ public Type[] getTypes() {
+ return new Type[] { new Type(XTypeProvider.class),
+ new Type(XServiceInfo.class),
+ new Type(XMain.class) };
+ }
+
+ public byte[] getImplementationId() {
+ byte[] id = new byte[16];
+ int n = hashCode();
+ id[0] = (byte) (n & 0xFF);
+ id[1] = (byte) ((n >> 8) & 0xFF);
+ id[2] = (byte) ((n >> 16) & 0xFF);
+ id[3] = (byte) ((n >> 24) & 0xFF);
+ return id;
+ }
+
+ public String getImplementationName() {
+ return getClass().getName();
+ }
+
+ public boolean supportsService(String serviceName) {
+ return serviceName.equals(serviceName);
+ }
+
+ public String[] getSupportedServiceNames() {
+ return new String[] { serviceName };
+ }
+
+ public int run(String[] arguments) {
+ System.out.println("context class loader: "
+ + Thread.currentThread().getContextClassLoader());
+ return 0;
+ }
+
+ public static XSingleServiceFactory __getServiceFactory(
+ String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey)
+ {
+ if (implName.equals(TestComponent.class.getName())) {
+ return FactoryHelper.getServiceFactory(TestComponent.class,
+ serviceName, multiFactory,
+ regKey);
+ } else {
+ return null;
+ }
+ }
+
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
+ return FactoryHelper.writeRegistryServiceInfo(
+ TestComponent.class.getName(), serviceName, regKey);
+ }
+
+ private static final String serviceName
+ = "com.sun.star.comp.jvmaccess.workbench.TestComponent";
+}
diff --git a/jvmaccess/workbench/java/makefile.mk b/jvmaccess/workbench/java/makefile.mk
new file mode 100644
index 000000000000..6840e265778b
--- /dev/null
+++ b/jvmaccess/workbench/java/makefile.mk
@@ -0,0 +1,43 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..
+PRJNAME = jvmaccess
+TARGET = workbench_java
+
+PACKAGE = com$/sun$/star$/comp$/jvmaccess$/workbench
+
+.INCLUDE: settings.mk
+
+JARFILES = ridl.jar jurt.jar
+JAVACLASSFILES = $(CLASSDIR)$/$(PACKAGE)$/TestComponent.class
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = jvmaccesstestcomponent.jar
+JARCOMPRESS = TRUE
+CUSTOMMANIFESTFILE = manifest
+
+.INCLUDE: target.mk
diff --git a/jvmaccess/workbench/java/manifest b/jvmaccess/workbench/java/manifest
new file mode 100644
index 000000000000..73b21eca3ca7
--- /dev/null
+++ b/jvmaccess/workbench/java/manifest
@@ -0,0 +1 @@
+RegistrationClassName: com.sun.star.comp.jvmaccess.workbench.TestComponent
diff --git a/jvmaccess/workbench/javainfo/javainfotest.cxx b/jvmaccess/workbench/javainfo/javainfotest.cxx
new file mode 100644
index 000000000000..30bd9bbfd318
--- /dev/null
+++ b/jvmaccess/workbench/javainfo/javainfotest.cxx
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "jvmaccess/javainfo.hxx"
+
+#include "osl/file.hxx"
+#include "osl/thread.h"
+#include "rtl/ustring.hxx"
+
+#include <stdio.h>
+#include <vector>
+
+using namespace rtl;
+using namespace std;
+using namespace osl;
+
+using jvmaccess::JavaInfo;
+
+#define OUSTR( x ) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( x ))
+
+#define JAVA_VERSION "1.4.1_01"
+
+bool test_constructor1();
+bool test_constructor2();
+bool test_createAllInfo();
+bool test_compareVersions();
+bool test_createAllInfo();
+bool test_createBestInfo();
+bool test_isEqual();
+bool test_getJarFilePath();
+
+void printInfo(const JavaInfo& info);
+
+int main( int argc, char * argv[], char * envp[])
+{
+ const int arSize= 20;
+ bool arRet[arSize];
+ int i =0;
+ arRet[i++]= test_createAllInfo();
+ arRet[i++]= test_constructor1();
+ arRet[i++]= test_constructor2();
+
+ arRet[i++]= test_compareVersions();
+ arRet[i++]= test_createBestInfo();
+ arRet[i++]= test_isEqual();
+ arRet[i++]= test_getJarFilePath();
+ bool error= true;
+ for(int j= 0; j < i; j++)
+ error &= arRet[j];
+
+ if( error == false)
+ printf("Errors occurred\n");
+ return 0;
+}
+
+bool test_constructor1()
+{
+ printf("\ntest JavaInfo::JavaInfo(const OUString& usJavaHome\n" \
+ "!Check output for correctness\n\n");
+ try{
+ JavaInfo info(OUSTR("file:///d:/java/j2sdk1.4.1_01"));
+// JavaInfo info(OUSTR("file:///local/jl/java/j2sdk1.4.0"));
+// JavaInfo info(OUSTR("file:///usr/local2/jl/java/j2sdk1.4.0"));
+
+ printInfo(info);
+ }catch( JavaInfo::InitException& )
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool test_constructor2()
+{
+ printf("\ntest JavaInfo::JavaInfo(const OUString& usVersion, int requirements)\n" \
+ "!Check output for correctness\n\n");
+ bool arRet[20];
+ int i= 0;
+
+ JavaInfo a(OUSTR("file:///d:/java/j2sdk1.4.1_01"));
+// -----------------------------------------------------
+// JavaInfo a(OUSTR("file:///usr/local2/jl/java/j2sdk1.4.0"));
+//------------------------------------------------------------
+// JavaInfo a(OUSTR("file:///local/jl/java/j2sdk1.4.0"));
+ try{
+ JavaInfo info= JavaInfo(OUString(), 0);
+ arRet[i++]= true;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ // make sure it supports accessibility
+ JavaInfo info= JavaInfo(OUString(), JavaInfo::Accessibility);
+ arRet[i++]= info.supportsAccessibility();
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+
+ try{
+ JavaInfo info(OUString(OUSTR(JAVA_VERSION)), JavaInfo::EqualVersion);
+ arRet[i++]= info.compareVersions(a) == 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR(JAVA_VERSION)), 0);
+ arRet[i++]= info.compareVersions(a) == 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+
+ try{
+ JavaInfo info(OUString(OUSTR(JAVA_VERSION)), JavaInfo::EqualVersion | JavaInfo::GreaterVersion);
+ arRet[i++]= info.compareVersions(a) >= 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR(JAVA_VERSION)), JavaInfo::EqualVersion | JavaInfo::SmallerVersion);
+ arRet[i++]= info.compareVersions(a) <= 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR(JAVA_VERSION)), JavaInfo::SmallerVersion);
+ arRet[i++]= info.compareVersions(a) < 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR(JAVA_VERSION)), JavaInfo::GreaterVersion);
+ arRet[i++]= info.compareVersions(a) > 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+
+ try{
+ JavaInfo info(OUString(OUSTR(JAVA_VERSION)), JavaInfo::EqualVersion | JavaInfo::SmallerVersion
+ | JavaInfo::Accessibility);
+ arRet[i++]= info.compareVersions(a) <= 0 && info.supportsAccessibility();
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR(JAVA_VERSION)), JavaInfo::GreaterVersion | JavaInfo::Accessibility);
+ arRet[i++]= info.compareVersions(a) > 0 && info.supportsAccessibility();
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+
+
+ bool err= true;
+ for(int j= 0; j < i; j++)
+ err &= arRet[j];
+ if( err)
+ printf("ok\n");
+ else
+ printf("failed\n");
+ return err;
+
+}
+
+bool test_createAllInfo()
+{
+ printf("\ntest JavaInfo::createAllInfo\n" \
+ "! Compare output with values in registry, PATH, JAVA_HOME, LD_LIBRARY_PATH !\n\n");
+ vector<JavaInfo> vec;
+ JavaInfo::createAllInfo(&vec);
+ for(vector<JavaInfo>::size_type i= 0; i < vec.size(); i++)
+ printInfo(vec[i]);
+ return true;
+}
+
+bool test_compareVersions()
+{
+ bool ret= false;
+ printf("\ntest JavaInfo::compareVersions \n" \
+ "! Check output for correctness\n\n");
+
+
+ JavaInfo a(OUSTR("file:///C:/Program%20Files/JavaSoft/JRE/1.3.1"));
+ JavaInfo b(OUSTR("file:///C:/Program%20Files/JavaSoft/JRE/1.3.1_04"));
+ JavaInfo c(OUSTR("file:///C:/Program%20Files/Java/j2re1.4.0_03"));
+ JavaInfo d(OUSTR("file:///C:/Program%20Files/Java/j2re1.4.2_04"));
+// JavaInfo e(OUSTR("file:///d:/java/j2sdk1.4.0_01"));
+// JavaInfo f(OUSTR("file:///d:/java/j2sdk1.4.0_02"));
+// JavaInfo g(OUSTR("file:///d:/java/j2sdk1.4.1"));
+// JavaInfo h(OUSTR("file:///d:/java/j2sdk1.4.1_01"));
+
+// JavaInfo a(OUSTR("file:///usr/local2/jl/java/j2re1_3_1_02"));
+// JavaInfo b(OUSTR("file:///usr/local2/jl/java/j2sdk1.4.0"));
+// JavaInfo c(OUSTR("file:///usr/local2/jl/java/j2sdk1.4.1"));
+// JavaInfo d(OUSTR("file:///usr/local2/jl/java/j2re1.4.1_01"));
+
+// JavaInfo a(OUSTR("file:///local/jl/java/jre1.3.1"));
+// JavaInfo b(OUSTR("file:///local/jl/java/jdk1.3.1_04"));
+// JavaInfo c(OUSTR("file:///local/jl/java/j2sdk1.4.0"));
+// JavaInfo d(OUSTR("file:///local/jl/java/j2sdk1.4.1"));
+// JavaInfo e(OUSTR("file:///local/jl/java/j2re1.4.1_01"));
+// fprintf(stderr,"###ok1");
+
+ if( (a.compareVersions(a) == 0
+ && a.compareVersions(b) < 0
+ && a.compareVersions(c) < 0
+// && a.compareVersions(d) < 0
+// && a.compareVersions(e) < 0
+// && a.compareVersions(h) < 0
+ )
+ &&
+ (a.compareVersions(a)== 0))
+
+ ret= true;
+
+ if(ret &&
+ (b.compareVersions(a) > 0
+ && b.compareVersions(b) == 0
+ && b.compareVersions(c) < 0
+ && b.compareVersions(d) < 0
+// && b.compareVersions(e) < 0
+// && b.compareVersions(h) < 0))
+ ))
+ ret= true;
+
+ if(ret &&
+ ( d.compareVersions(a) > 0
+ && d.compareVersions(b) > 0
+ && d.compareVersions(c) > 0
+ && d.compareVersions(d) == 0
+// && d.compareVersions(e) < 0
+// && d.compareVersions(f) < 0
+// && d.compareVersions(g) < 0
+// && d.compareVersions(h) < 0))
+ ))
+ ret= true;
+
+// if(ret
+// && e.compareVersions(a) > 0
+// && e.compareVersions(b) > 0
+// && e.compareVersions(c) > 0
+// && e.compareVersions(d) > 0
+// && e.compareVersions(e) == 0
+// )
+
+
+// if(ret &&
+// (f.compareVersions(a) > 0
+// && f.compareVersions(c) > 0
+// && f.compareVersions(d) > 0
+// && f.compareVersions(g) < 0
+// && f.compareVersions(h) < 0))
+// ret= true;
+
+ if( ! ret)
+ printf("failed\n");
+ else
+ printf("ok\n");
+
+ return ret;
+}
+
+bool test_createBestInfo()
+{
+ printf("\ntest JavaInfo::createBestInfo\n" \
+ "! Check output for correctness\n\n");
+ JavaInfo info= JavaInfo::createBestInfo(false);
+ printInfo(info);
+ return true;
+}
+
+bool test_isEqual()
+{
+ printf("\ntest JavaInfo::isEqual\n");
+ JavaInfo a(OUSTR(JAVA_VERSION)); // accessible
+ JavaInfo b(OUSTR(JAVA_VERSION));
+
+ JavaInfo c(OUSTR("file:///c:/local/r/j2sdk1.4.0"));// not Accessible
+ JavaInfo d(OUSTR("file:///d:/java/copy_j2sdk1.4.0"));
+//-------------------------------------------------------------------
+// JavaInfo a(OUSTR("file:///usr/local2/jl/java/j2re1_3_1_02"));
+// JavaInfo b(OUSTR("file:///usr/local2/jl/java/j2re1_3_1_02"));
+
+// JavaInfo c(OUSTR("file:///usr/local2/jl/java/j2sdk1.4.1"));
+// JavaInfo d(OUSTR("file:///usr/local2/jl/java/copyj2sdk1.4.1"));
+
+// JavaInfo a(OUSTR("file:///local/jl/java/jre1.3.1"));
+// JavaInfo b(OUSTR("file:///local/jl/java/jre1.3.1"));
+// JavaInfo c(OUSTR("file:///local/jl/java/j2sdk1.4.1"));
+// JavaInfo d(OUSTR("file:///local/jl/java/copyj2sdk1.4.1"));
+
+ bool arRet[20];
+ int i= 0;
+ arRet[i++]= a.isEqual(b);
+ arRet[i++]= ! a.isEqual(c); //must fail
+ arRet[i++]= a.isEqual(d);
+
+ bool err= true;
+ for(int j= 0; j < i; j++)
+ err &= arRet[j];
+ if( arRet == false)
+ printf("failed\n");
+ else
+ printf("ok\n");
+ return err;
+}
+
+bool test_getJarFilePath()
+{
+ printf("\ntest JavaInfo::getJarFilePath\n");
+ JavaInfo info(OUString(OUSTR("1.3.1")), JavaInfo::GreaterVersion | JavaInfo::EqualVersion );
+ OUString s= info.getJarFilePath(OUSTR("javaplugin.jar"));
+
+ printf("check if this URL is correct:\n");
+ OString oPath= OUStringToOString(s, osl_getThreadTextEncoding());
+ printf("%s\n", oPath.getStr());
+ return true;
+}
+
+void printInfo(const JavaInfo& info)
+{
+ OUString usVersion= info.getVersion();
+ OString sVersion= OUStringToOString( usVersion, osl_getThreadTextEncoding());
+ OUString usHome= info.getInstallationLocation();
+ OString sHome= OUStringToOString( usHome, osl_getThreadTextEncoding());
+ OUString usType= info.getType();
+ OString sType= OUStringToOString(usType, osl_getThreadTextEncoding());
+ OUString usLib= info.getRuntimeLibLocation();
+ OString sLib= OUStringToOString(usLib, osl_getThreadTextEncoding());
+ OUString usLibLocation= info.getLibLocations();
+ OString sLibLocation= OUStringToOString(usLibLocation, osl_getThreadTextEncoding());
+ sal_Bool baccess= info.supportsAccessibility();
+
+ printf("%s %s\n",sType.getStr(), sVersion.getStr());
+ printf("\t%s \n",sHome.getStr());
+ printf("\t%s \n",sLib.getStr());
+ printf("\tLibDir: %s \n", sLibLocation.getStr());
+ printf("\t%s\n", baccess ? "accessible" : "not accessible");
+}
diff --git a/jvmaccess/workbench/javainfo/makefile.mk b/jvmaccess/workbench/javainfo/makefile.mk
new file mode 100644
index 000000000000..e892829c83e2
--- /dev/null
+++ b/jvmaccess/workbench/javainfo/makefile.mk
@@ -0,0 +1,43 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..
+PRJNAME = jvmaccess
+TARGET = workbench_javainfo
+
+ENABLE_EXCEPTIONS = TRUE
+
+LIBTARGET = NO
+TARGETTYPE = CUI
+
+.INCLUDE: settings.mk
+
+APP1TARGET = $(TARGET)
+APP1OBJS = $(OBJ)$/javainfotest.obj
+APP1STDLIBS = $(CPPULIB) $(JVMACCESSLIB) $(SALLIB)
+
+.INCLUDE : target.mk
diff --git a/jvmaccess/workbench/makefile.mk b/jvmaccess/workbench/makefile.mk
new file mode 100644
index 000000000000..5bcfe169aa43
--- /dev/null
+++ b/jvmaccess/workbench/makefile.mk
@@ -0,0 +1,51 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..
+PRJNAME = jvmaccess
+TARGET = workbench
+
+ENABLE_EXCEPTIONS = TRUE
+
+LIBTARGET = NO
+TARGETTYPE = CUI
+
+.INCLUDE: settings.mk
+
+APP1TARGET = exceptiontest1
+APP1OBJS = $(OBJ)$/exceptiontest1.obj
+APP1STDLIBS = \
+ $(JVMACCESSLIB) \
+ $(SALLIB)
+
+APP2TARGET = exceptiontest2
+APP2OBJS = $(OBJ)$/exceptiontest2.obj
+APP2STDLIBS = \
+ $(JVMACCESSLIB) \
+ $(SALLIB)
+
+.INCLUDE: target.mk