1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_jvmfwk.hxx" 30 31 #include "osl/thread.h" 32 #include "sunjre.hxx" 33 #include "sunversion.hxx" 34 #include "diagnostics.h" 35 36 using namespace rtl; 37 using namespace std; 38 39 #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) 40 namespace jfw_plugin 41 { 42 43 Reference<VendorBase> SunInfo::createInstance() 44 { 45 return new SunInfo; 46 } 47 48 char const* const* SunInfo::getJavaExePaths(int * size) 49 { 50 static char const * ar[] = { 51 #if defined(WNT) || defined(OS2) 52 "java.exe", 53 "bin/java.exe", 54 "jre/bin/java.exe" 55 #elif UNX 56 "java", 57 "bin/java", 58 "jre/bin/java" 59 #endif 60 }; 61 *size = sizeof (ar) / sizeof (char*); 62 return ar; 63 } 64 65 char const* const* SunInfo::getRuntimePaths(int * size) 66 { 67 static char const* ar[]= { 68 #if defined(WNT) 69 "/bin/client/jvm.dll", 70 "/bin/hotspot/jvm.dll", 71 "/bin/classic/jvm.dll" 72 #elif defined(OS2) 73 "/bin/classic/jvm.dll", 74 #elif UNX 75 "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so", 76 "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so", 77 "/lib/" JFW_PLUGIN_ARCH "/classic/libjvm.so" 78 #endif 79 80 }; 81 *size = sizeof(ar) / sizeof (char*); 82 return ar; 83 } 84 85 char const* const* SunInfo::getLibraryPaths(int* size) 86 { 87 #ifdef UNX 88 static char const * ar[] = { 89 90 "/lib/" JFW_PLUGIN_ARCH "/client", 91 "/lib/" JFW_PLUGIN_ARCH "/native_threads", 92 "/lib/" JFW_PLUGIN_ARCH 93 94 }; 95 *size = sizeof(ar) / sizeof (char*); 96 return ar; 97 #else 98 size = 0; 99 return NULL; 100 #endif 101 } 102 103 int SunInfo::compareVersions(const rtl::OUString& sSecond) const 104 { 105 OUString sFirst = getVersion(); 106 107 SunVersion version1(sFirst); 108 JFW_ENSURE(version1, OUSTR("[Java framework] sunjavaplugin"SAL_DLLEXTENSION 109 " does not know the version: ") 110 + sFirst + OUSTR(" as valid for a SUN JRE.")); 111 SunVersion version2(sSecond); 112 if ( ! version2) 113 throw MalformedVersionException(); 114 115 if(version1 == version2) 116 return 0; 117 if(version1 > version2) 118 return 1; 119 else 120 return -1; 121 } 122 123 124 } 125