Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "osl/thread.h"
22 : #include "sunjre.hxx"
23 : #include "sunversion.hxx"
24 : #include "diagnostics.h"
25 :
26 : using namespace std;
27 :
28 : #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
29 : namespace jfw_plugin
30 : {
31 :
32 0 : rtl::Reference<VendorBase> SunInfo::createInstance()
33 : {
34 0 : return new SunInfo;
35 : }
36 :
37 0 : char const* const* SunInfo::getJavaExePaths(int * size)
38 : {
39 : static char const * ar[] = {
40 : #if defined(WNT)
41 : "java.exe",
42 : "bin/java.exe",
43 : "jre/bin/java.exe"
44 : #elif UNX
45 : "java",
46 : "bin/java",
47 : "jre/bin/java"
48 : #endif
49 : };
50 0 : *size = SAL_N_ELEMENTS(ar);
51 0 : return ar;
52 : }
53 :
54 0 : char const* const* SunInfo::getRuntimePaths(int * size)
55 : {
56 : static char const* ar[]= {
57 : #if defined(WNT)
58 : "/bin/client/jvm.dll",
59 : "/bin/hotspot/jvm.dll",
60 : "/bin/classic/jvm.dll",
61 : // The 64-bit JRE has the jvm in bin/server
62 : "/bin/server/jvm.dll"
63 : #elif UNX
64 : "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so",
65 : "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so",
66 : "/lib/" JFW_PLUGIN_ARCH "/classic/libjvm.so"
67 : #endif
68 : };
69 0 : *size = SAL_N_ELEMENTS(ar);
70 0 : return ar;
71 : }
72 :
73 0 : char const* const* SunInfo::getLibraryPaths(int* size)
74 : {
75 : #ifdef UNX
76 : static char const * ar[] = {
77 : "/lib/" JFW_PLUGIN_ARCH "/client",
78 : "/lib/" JFW_PLUGIN_ARCH "/server",
79 : "/lib/" JFW_PLUGIN_ARCH "/native_threads",
80 : "/lib/" JFW_PLUGIN_ARCH
81 : };
82 0 : *size = SAL_N_ELEMENTS(ar);
83 0 : return ar;
84 : #else
85 : *size = 0;
86 : return NULL;
87 : #endif
88 : }
89 :
90 0 : int SunInfo::compareVersions(const rtl::OUString& sSecond) const
91 : {
92 0 : rtl::OUString sFirst = getVersion();
93 :
94 0 : SunVersion version1(sFirst);
95 : JFW_ENSURE(version1, OUSTR("[Java framework] sunjavaplugin" SAL_DLLEXTENSION
96 : " does not know the version: ")
97 : + sFirst + OUSTR(" as valid for a SUN/Oracle JRE."));
98 0 : SunVersion version2(sSecond);
99 0 : if ( ! version2)
100 0 : throw MalformedVersionException();
101 :
102 0 : if (version1 == version2)
103 0 : return 0;
104 0 : if (version1 > version2)
105 0 : return 1;
106 : else
107 0 : return -1;
108 : }
109 :
110 :
111 : }
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|