1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_plugin.hxx"
26 
27 #include "osl/thread.h"
28 #include "otherjre.hxx"
29 
30 using namespace rtl;
31 using namespace std;
32 
33 
34 namespace jfw_plugin
35 {
36 
createInstance()37 Reference<VendorBase> OtherInfo::createInstance()
38 {
39     return new OtherInfo;
40 }
41 
42 
getJavaExePaths(int * size)43 char const* const* OtherInfo::getJavaExePaths(int * size)
44 {
45     static char const * ar[] = {
46 #if defined(WNT) || defined(OS2)
47         "bin/java.exe",
48         "jre/bin/java.exe"
49 #elif UNX
50         "bin/java",
51         "jre/bin/java"
52 #endif
53     };
54         *size = sizeof (ar) / sizeof (char*);
55     return ar;
56 }
57 
getRuntimePaths(int * size)58 char const* const* OtherInfo::getRuntimePaths(int * size)
59 {
60     static char const* ar[]= {
61 #if defined(WNT)
62         "/bin/client/jvm.dll",
63         "/bin/hotspot/jvm.dll",
64         "/bin/classic/jvm.dll",
65 	"/bin/jrockit/jvm.dll"
66 #elif defined(OS2)
67         "/bin/classic/jvm.dll",
68         "/bin/client/jvm.dll",
69         "/bin/hotspot/jvm.dll"
70 #elif UNX
71 #ifdef MACOSX
72         "/../../../../../Frameworks/JavaVM.framework/JavaVM"  //as of  1.6.0_22
73 #else
74         "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so", // for Blackdown PPC
75         "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so", // for Blackdown AMD64
76         "/lib/" JFW_PLUGIN_ARCH "/classic/libjvm.so", // for Blackdown PPC
77         "/lib/" JFW_PLUGIN_ARCH "/jrockit/libjvm.so", // for Java of BEA Systems
78         "/lib/server/libjvm.so",                     // > 1.8
79         "/bin/classic/libjvm.so", // fallback for older for IBM Java
80         "/jre/bin/classic/libjvm.so" // fallback for older for IBM Java
81 #endif
82 #endif
83 
84     };
85     *size = sizeof(ar) / sizeof (char*);
86     return ar;
87 }
88 
getLibraryPaths(int * size)89 char const* const* OtherInfo::getLibraryPaths(int* size)
90 {
91 
92 #ifdef UNX
93     static char const * ar[] = {
94 #ifdef MACOSX
95         //mac version does not have a ld library path anymore
96 #else
97         "/bin",
98         "/jre/bin",
99         "/bin/classic",
100         "/jre/bin/classic",
101         "/lib/" JFW_PLUGIN_ARCH "/client",
102         "/lib/" JFW_PLUGIN_ARCH "/server",
103         "/lib/" JFW_PLUGIN_ARCH "/classic",
104         "/lib/" JFW_PLUGIN_ARCH "/jrockit",
105         "/lib/" JFW_PLUGIN_ARCH "/native_threads",
106         "/lib/" JFW_PLUGIN_ARCH,
107         "/lib" // > 1.8
108 #endif
109     };
110 
111     *size = sizeof(ar) / sizeof (char*);
112     return ar;
113 #else
114     size = 0;
115     return NULL;
116 #endif
117 }
118 
compareVersions(const rtl::OUString &) const119 int OtherInfo::compareVersions(const rtl::OUString& /*sSecond*/) const
120 {
121     //Need to provide an own algorithm for comparing version.
122     //Because this function returns always 0, which means the version of
123     //this JRE and the provided version "sSecond" are equal, one cannot put
124     //any excludeVersion entries in the javavendors.xml file.
125     return 0;
126 }
127 
128 }
129