summaryrefslogtreecommitdiff
path: root/jvmaccess
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-03-26 11:41:32 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-03-26 11:41:32 +0000
commit44bf5dacd75eec3d27acf9590a29ce49a3b585cf (patch)
treed4bf189a381cfc27c683a3f105927c66a63fa0e9 /jvmaccess
parentb7ea5b0ca567c0ce8272148244e4579dcec548a7 (diff)
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'jvmaccess')
-rw-r--r--jvmaccess/inc/jvmaccess/virtualmachine.hxx11
-rw-r--r--jvmaccess/prj/build.lst2
-rw-r--r--jvmaccess/prj/d.lst1
-rw-r--r--jvmaccess/source/makefile.mk10
-rw-r--r--jvmaccess/source/virtualmachine.cxx12
-rw-r--r--jvmaccess/util/cc5_solaris_sparc.map34
-rw-r--r--jvmaccess/util/makefile.mk9
-rw-r--r--jvmaccess/util/msvc_win32_intel.map25
-rw-r--r--jvmaccess/workbench/javainfo/javainfotest.cxx403
-rw-r--r--jvmaccess/workbench/javainfo/makefile.mk77
10 files changed, 566 insertions, 18 deletions
diff --git a/jvmaccess/inc/jvmaccess/virtualmachine.hxx b/jvmaccess/inc/jvmaccess/virtualmachine.hxx
index 3fd8f1728ef5..e04cef4ee4bf 100644
--- a/jvmaccess/inc/jvmaccess/virtualmachine.hxx
+++ b/jvmaccess/inc/jvmaccess/virtualmachine.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: virtualmachine.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: sb $ $Date: 2002-12-06 11:33:26 $
+ * last change: $Author: hr $ $Date: 2003-03-26 12:41:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -138,7 +138,10 @@ public:
@param nVersion
The JNI version of the virtual machine pointed to by pVm. Must be at
- least JNI_VERSION_1_2.
+ 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
@@ -160,7 +163,7 @@ public:
the virtual machine use the context class loader of the "initial Java
thread."
*/
- VirtualMachine(JavaVM * pVm, jint nVersion, bool bDestroy,
+ VirtualMachine(JavaVM * pVm, int nVersion, bool bDestroy,
JNIEnv * pMainThreadEnv);
private:
diff --git a/jvmaccess/prj/build.lst b/jvmaccess/prj/build.lst
index ad55c8951a2a..b99f726fd941 100644
--- a/jvmaccess/prj/build.lst
+++ b/jvmaccess/prj/build.lst
@@ -1,4 +1,4 @@
-jv jvmaccess : sal salhelper NULL
+jv jvmaccess : 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
index 05e100209ede..0a4930b50fc3 100644
--- a/jvmaccess/prj/d.lst
+++ b/jvmaccess/prj/d.lst
@@ -1,4 +1,5 @@
mkdir: %_DEST%\inc%_EXT%\jvmaccess
+..\inc\jvmaccess\javainfo.hxx %_DEST%\inc%_EXT%\jvmaccess\javainfo.hxx
..\inc\jvmaccess\virtualmachine.hxx %_DEST%\inc%_EXT%\jvmaccess\virtualmachine.hxx
..\%__SRC%\bin\jvmaccess*.dll %_DEST%\bin%_EXT%\*
..\%__SRC%\lib\ijvmaccess.lib %_DEST%\lib%_EXT%\ijvmaccess.lib
diff --git a/jvmaccess/source/makefile.mk b/jvmaccess/source/makefile.mk
index f6a34ba39858..ac46bcb3a31a 100644
--- a/jvmaccess/source/makefile.mk
+++ b/jvmaccess/source/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: sb $ $Date: 2002-12-06 11:35:36 $
+# last change: $Author: hr $ $Date: 2003-03-26 12:41:24 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -68,6 +68,10 @@ ENABLE_EXCEPTIONS = TRUE
.INCLUDE: settings.mk
SLOFILES = \
- $(SLO)$/virtualmachine.obj
+ $(SLO)$/javainfo.obj \
+ $(SLO)$/javainfoimpl.obj \
+ $(SLO)$/sunversion.obj \
+ $(SLO)$/virtualmachine.obj \
+ $(SLO)$/windows.obj
.INCLUDE: target.mk
diff --git a/jvmaccess/source/virtualmachine.cxx b/jvmaccess/source/virtualmachine.cxx
index 13edcba11f06..91b512fe2739 100644
--- a/jvmaccess/source/virtualmachine.cxx
+++ b/jvmaccess/source/virtualmachine.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: virtualmachine.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: sb $ $Date: 2002-12-06 11:35:36 $
+ * last change: $Author: hr $ $Date: 2003-03-26 12:41:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,7 +98,7 @@ VirtualMachine::AttachGuard::~AttachGuard()
m_xMachine->detachThread();
}
-VirtualMachine::VirtualMachine(JavaVM * pVm, jint nVersion, bool bDestroy,
+VirtualMachine::VirtualMachine(JavaVM * pVm, int nVersion, bool bDestroy,
JNIEnv * pMainThreadEnv):
m_pVm(pVm), m_nVersion(nVersion), m_bDestroy(bDestroy)
{
@@ -112,8 +112,14 @@ VirtualMachine::~VirtualMachine()
releaseInitialContextClassLoader();
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");
+*/
}
}
diff --git a/jvmaccess/util/cc5_solaris_sparc.map b/jvmaccess/util/cc5_solaris_sparc.map
index 0a72ae39b3ec..60bca742c6e6 100644
--- a/jvmaccess/util/cc5_solaris_sparc.map
+++ b/jvmaccess/util/cc5_solaris_sparc.map
@@ -1,5 +1,33 @@
UDK_3.1 {
global:
+ # jvmaccess/javainfo.hxx:
+ __1cJjvmaccessIJavaInfoNInitException2t6M_v_; # jvmaccess::JavaInfo::InitException::InitException()
+ __1cJjvmaccessIJavaInfoNInitException2t6Mrk2_v_; # jvmaccess::JavaInfo::InitException::InitException(InitException const &)
+ __1cJjvmaccessIJavaInfoNInitException2T6M_v_; # jvmaccess::JavaInfo::InitException::~InitException()
+ __1cJjvmaccessIJavaInfoNInitException2G6Mrk2_r2_; # jvmaccess::JavaInfo::InitException&jvmaccess::JavaInfo::InitException::operator=(InitException const &)
+ __1cJjvmaccessbS__RTTI__1nJjvmaccessIJavaInfoNInitException__; # RTTI for jvmaccess::JavaInfo::InitException
+ __1cJjvmaccessIJavaInfo2t6MrknDrtlIOUString__v_; # jvmaccess::JavaInfo::JavaInfo(rtl::OUString const &)
+ __1cJjvmaccessIJavaInfo2t5B6MrknDrtlIOUString__v_; # jvmaccess::JavaInfo::JavaInfo(rtl::OUString const &) #Nvariant 1
+ __1cJjvmaccessIJavaInfo2t6MrknDrtlIOUString_i_v_; # jvmaccess::JavaInfo::JavaInfo(rtl::OUString const &, int)
+ __1cJjvmaccessIJavaInfo2t5B6MrknDrtlIOUString_i_v_; # jvmaccess::JavaInfo::JavaInfo(rtl::OUString const &, int) #Nvariant 1
+ __1cJjvmaccessIJavaInfo2t6Mrk1_v_; # jvmaccess::JavaInfo::JavaInfo(JavaInfo const &)
+ __1cJjvmaccessIJavaInfo2t5B6Mrk1_v_; # jvmaccess::JavaInfo::JavaInfo(JavaInfo const &) #Nvariant 1
+ __1cJjvmaccessIJavaInfo2T6M_v_; # jvmaccess::JavaInfo::~JavaInfo()
+ __1cJjvmaccessIJavaInfo2T5B6M_v_; # jvmaccess::JavaInfo::~JavaInfo() #Nvariant 1
+ __1cJjvmaccessIJavaInfo2G6Mrk1_r1_; # jvmaccess::JavaInfo::operator =(jvmaccess::JavaInfo const &)
+ __1cJjvmaccessIJavaInfoNcreateAllInfo6FpnE_STLGvector4n0B_n0CJallocator4n0B______v_; # jvmaccess::JavaInfo::createAllInfo(srd::vector< JavaInfo > *)
+ __1cJjvmaccessIJavaInfoOcreateBestInfo6Fb_1_; # jvmaccess::JavaInfo::createBestInfo(bool)
+ __1cJjvmaccessIJavaInfoGisSame6kMrk1_b_; # jvmaccess::JavaInfo::isSame(JavaInfo const &) const
+ __1cJjvmaccessIJavaInfoHisEqual6kMrk1_b_; # jvmaccess::JavaInfo::isEqual(JavaInfo const &) const
+ __1cJjvmaccessIJavaInfoPcompareVersions6kMrk1_i_; # jvmaccess::JavaInfo::compareVersions(JavaInfo const &) const
+ __1cJjvmaccessIJavaInfoKgetVersion6kM_rknDrtlIOUString__; # jvmaccess::JavaInfo::getVersion() const
+ __1cJjvmaccessIJavaInfoXgetInstallationLocation6kM_rknDrtlIOUString__; # jvmaccess::JavaInfo::getInstallationLocation() const
+ __1cJjvmaccessIJavaInfoHgetType6kM_rknDrtlIOUString__; # jvmaccess::JavaInfo::getType() const
+ __1cJjvmaccessIJavaInfoVgetRuntimeLibLocation6kM_rknDrtlIOUString__; # jvmaccess::JavaInfo::getRuntimeLibLocation() const
+ __1cJjvmaccessIJavaInfoVsupportsAccessibility6kM_b_; # jvmaccess::JavaInfo::supportsAccessibility() const
+ __1cJjvmaccessIJavaInfoPgetLibLocations6kM_rknDrtlIOUString__; # jvmaccess::JavaInfo::getLibLocations() const
+ __1cJjvmaccessIJavaInfoOgetJarFilePath6kMrknDrtlIOUString__3_; # jvmaccess::JavaInfo::getJarFilePath(rtl::OUString const &) const
+
# jvmaccess/virtualmachine.hxx:
__1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2t6M_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
__1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2t6Mrk3_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException(CreationException const &)
@@ -7,10 +35,10 @@ UDK_3.1 {
__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 #Nvariant 1(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 *, jint, bool, JNIEnv *)
+ __1cJjvmaccessOVirtualMachineLAttachGuard2T5B6M_v_; # jvmaccess::VirtualMachine::AttachGuard::~AttachGuard() #Nvariant 1
+ __1cJjvmaccessOVirtualMachine2t6MpnHJavaVM__ibpnHJNIEnv___v_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
local:
*;
diff --git a/jvmaccess/util/makefile.mk b/jvmaccess/util/makefile.mk
index 6e454b7beffa..d3db57d74a9b 100644
--- a/jvmaccess/util/makefile.mk
+++ b/jvmaccess/util/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: sb $ $Date: 2002-12-06 11:35:37 $
+# last change: $Author: hr $ $Date: 2003-03-26 12:41:30 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -79,7 +79,10 @@ SHL1TARGET = $(TARGET)$(COMID)
SHL1IMPLIB = i$(TARGET)
SHL1LIBS = $(SLB)$/$(TARGET).lib
-SHL1STDLIBS = $(SALLIB) $(SALHELPERLIB)
+SHL1STDLIBS = $(CPPULIB) $(SALLIB) $(SALHELPERLIB)
+.IF "$(OS)" == "WNT"
+SHL1STDLIBS += advapi32.lib
+.ENDIF # WNT
.IF "$(COMNAME)" == "msci"
SHL1VERSIONMAP = msvc_win32_intel.map
diff --git a/jvmaccess/util/msvc_win32_intel.map b/jvmaccess/util/msvc_win32_intel.map
index 9898e43b58d2..1bf5194b96ad 100644
--- a/jvmaccess/util/msvc_win32_intel.map
+++ b/jvmaccess/util/msvc_win32_intel.map
@@ -1,5 +1,28 @@
UDK_3.1 {
global:
+ # jvmaccess/javainfo.hxx:
+ ??0InitException@JavaInfo@jvmaccess@@QAE@XZ; # jvmaccess::JavaInfo::InitException::InitException()
+ ??0InitException@JavaInfo@jvmaccess@@QAE@ABV012@@Z; # jvmaccess::JavaInfo::InitException::InitException(InitException const &)
+ ??1InitException@JavaInfo@jvmaccess@@UAE@XZ; # jvmaccess::JavaInfo::InitException::~InitException()
+ ??4InitException@JavaInfo@jvmaccess@@QAEAAV012@ABV012@@Z; # jvmaccess::JavaInfo::InitException::operator=(InitException const &)
+ ??0JavaInfo@jvmaccess@@QAE@ABVOUString@rtl@@@Z; # jvmaccess::JavaInfo::JavaInfo(rtl::OUString const &)
+ ??0JavaInfo@jvmaccess@@QAE@ABVOUString@rtl@@H@Z; # jvmaccess::JavaInfo::JavaInfo(rtl::OUString const &, int)
+ ??0JavaInfo@jvmaccess@@QAE@ABV01@@Z; # jvmaccess::JavaInfo::JavaInfo(JavaInfo const &)
+ ??1JavaInfo@jvmaccess@@QAE@XZ; # jvmaccess::JavaInfo::~JavaInfo()
+ ??4JavaInfo@jvmaccess@@QAEAAV01@ABV01@@Z; # jvmaccess::JavaInfo::operator =(JavaInfo const &)
+ ?createAllInfo@JavaInfo@jvmaccess@@SAXPAV?$vector@VJavaInfo@jvmaccess@@V?$allocator@VJavaInfo@jvmaccess@@@_STL@@@_STL@@@Z; # jvmaccess::JavaInfo::createAllInfo(std::vector< JavaInfo > *)
+ ?createBestInfo@JavaInfo@jvmaccess@@SA?AV12@_N@Z; # jvmaccess::JavaInfo::createBestInfo(bool)
+ ?isSame@JavaInfo@jvmaccess@@QBE_NABV12@@Z; # jvmaccess::JavaInfo::isSame(JavaInfo const &) const
+ ?isEqual@JavaInfo@jvmaccess@@QBE_NABV12@@Z; # jvmaccess::JavaInfo::isEqual(JavaInfo const &) const
+ ?compareVersions@JavaInfo@jvmaccess@@QBEHABV12@@Z; # jvmaccess::JavaInfo::compareVersions(JavaInfo const &) const
+ ?getVersion@JavaInfo@jvmaccess@@QBEABVOUString@rtl@@XZ; # jvmaccess::JavaInfo::getVersion() const
+ ?getInstallationLocation@JavaInfo@jvmaccess@@QBEABVOUString@rtl@@XZ; # jvmaccess::JavaInfo::getInstallationLocation() const
+ ?getType@JavaInfo@jvmaccess@@QBEABVOUString@rtl@@XZ; # jvmaccess::JavaInfo::getType() const
+ ?getRuntimeLibLocation@JavaInfo@jvmaccess@@QBEABVOUString@rtl@@XZ; # jvmaccess::JavaInfo::getRuntimeLibLocation() const
+ ?supportsAccessibility@JavaInfo@jvmaccess@@QBE_NXZ; # jvmaccess::JavaInfo::supportsAccessibility() const
+ ?getLibLocations@JavaInfo@jvmaccess@@QBEABVOUString@rtl@@XZ; # jvmaccess::JavaInfo::getLibLocations() const
+ ?getJarFilePath@JavaInfo@jvmaccess@@QBE?AVOUString@rtl@@ABV34@@Z; # jvmaccess::JavaInfo::getJarFilePath(rtl::OUString const &) const
+
# 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 &)
@@ -7,7 +30,7 @@ UDK_3.1 {
??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_@@J_NPAUJNIEnv_@@@Z; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, jint, bool, JNIEnv *)
+ ??0VirtualMachine@jvmaccess@@QAE@PAUJavaVM_@@H_NPAUJNIEnv_@@@Z; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
local:
*;
diff --git a/jvmaccess/workbench/javainfo/javainfotest.cxx b/jvmaccess/workbench/javainfo/javainfotest.cxx
new file mode 100644
index 000000000000..f80633d9e40f
--- /dev/null
+++ b/jvmaccess/workbench/javainfo/javainfotest.cxx
@@ -0,0 +1,403 @@
+/*************************************************************************
+ *
+ * $RCSfile: javainfotest.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-26 12:41:31 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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 ))
+
+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(false);
+ // 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.0"));
+// 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.0"));
+// -----------------------------------------------------
+ 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("1.4.0")), JavaInfo::EqualVersion);
+ arRet[i++]= info.compareVersions(a) == 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR("1.4.0")), 0);
+ arRet[i++]= info.compareVersions(a) == 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+
+ try{
+ JavaInfo info(OUString(OUSTR("1.4.0")), JavaInfo::EqualVersion | JavaInfo::GreaterVersion);
+ arRet[i++]= info.compareVersions(a) >= 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR("1.4.0")), JavaInfo::EqualVersion | JavaInfo::SmallerVersion);
+ arRet[i++]= info.compareVersions(a) <= 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR("1.4.0")), JavaInfo::SmallerVersion);
+ arRet[i++]= info.compareVersions(a) < 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR("1.4.0")), JavaInfo::GreaterVersion);
+ arRet[i++]= info.compareVersions(a) > 0;
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+
+ try{
+ JavaInfo info(OUString(OUSTR("1.4.0")), JavaInfo::EqualVersion | JavaInfo::SmallerVersion
+ | JavaInfo::Accessibility);
+ arRet[i++]= info.compareVersions(a) <= 0 && info.supportsAccessibility();
+ }
+ catch( ...) {
+ arRet[i++]= false;
+ }
+ try{
+ JavaInfo info(OUString(OUSTR("1.4.0")), 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:///d:/java/jdk1.3.1"));
+// JavaInfo b(OUSTR("file:///d:/java/jdk1.3.1_03"));
+// JavaInfo c(OUSTR("file:///d:/java/jdk1.3.1_04"));
+// JavaInfo d(OUSTR("file:///d:/java/j2sdk1.4.0"));
+// 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("file:///d:/java/j2sdk1.4.0")); // accessible
+// JavaInfo b(OUSTR("file:///d:/java/j2sdk1.4.0"));
+
+// 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..ef62d42f429b
--- /dev/null
+++ b/jvmaccess/workbench/javainfo/makefile.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.2 $
+#
+# last change: $Author: hr $ $Date: 2003-03-26 12:41:32 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (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.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#*************************************************************************
+
+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