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