LCOV - code coverage report
Current view: top level - jvmfwk/plugins/sunmajor/pluginlib - sunjre.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 20 22 90.9 %
Date: 2014-04-14 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          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             : namespace jfw_plugin
      29             : {
      30             : 
      31           2 : rtl::Reference<VendorBase> SunInfo::createInstance()
      32             : {
      33           2 :     return new SunInfo;
      34             : }
      35             : 
      36         142 : char const* const* SunInfo::getJavaExePaths(int * size)
      37             : {
      38             :     static char const * ar[] = {
      39             : #if defined(WNT)
      40             :         "java.exe",
      41             :         "bin/java.exe",
      42             :         "jre/bin/java.exe"
      43             : #elif defined UNX
      44             :         "java",
      45             :         "bin/java",
      46             :         "jre/bin/java"
      47             : #endif
      48             :     };
      49         142 :     *size = SAL_N_ELEMENTS(ar);
      50         142 :     return ar;
      51             : }
      52             : 
      53           2 : char const* const* SunInfo::getRuntimePaths(int * size)
      54             : {
      55             :     static char const* ar[]= {
      56             : #if defined(WNT)
      57             :         "/bin/client/jvm.dll",
      58             :         "/bin/hotspot/jvm.dll",
      59             :         "/bin/classic/jvm.dll",
      60             :         "/bin/jrockit/jvm.dll",
      61             :         // The 64-bit JRE has the jvm in bin/server
      62             :         "/bin/server/jvm.dll"
      63             : #elif defined MACOSX && defined X86_64
      64             :         // Oracle Java 7, under /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
      65             :         "/lib/server/libjvm.dylib"
      66             : #elif defined UNX
      67             :         "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so",
      68             :         "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so",
      69             :         "/lib/" JFW_PLUGIN_ARCH "/classic/libjvm.so",
      70             :         "/lib/" JFW_PLUGIN_ARCH "/jrockit/libjvm.so"
      71             : #endif
      72             :     };
      73           2 :     *size = SAL_N_ELEMENTS(ar);
      74           2 :     return ar;
      75             : }
      76             : 
      77           2 : char const* const* SunInfo::getLibraryPaths(int* size)
      78             : {
      79             : #if defined UNX && !defined MACOSX
      80             :     static char const * ar[] = {
      81             :         "/lib/" JFW_PLUGIN_ARCH "/client",
      82             :         "/lib/" JFW_PLUGIN_ARCH "/server",
      83             :         "/lib/" JFW_PLUGIN_ARCH "/native_threads",
      84             :         "/lib/" JFW_PLUGIN_ARCH
      85             :     };
      86           2 :     *size = SAL_N_ELEMENTS(ar);
      87           2 :     return ar;
      88             : #else
      89             :     *size = 0;
      90             :     return NULL;
      91             : #endif
      92             : }
      93             : 
      94           1 : int SunInfo::compareVersions(const OUString& sSecond) const
      95             : {
      96           1 :     OUString sFirst = getVersion();
      97             : 
      98           2 :     SunVersion version1(sFirst);
      99             :     JFW_ENSURE(version1, "[Java framework] sunjavaplugin" SAL_DLLEXTENSION
     100             :                          " does not know the version: "
     101             :                + sFirst + " as valid for a SUN/Oracle JRE.");
     102           2 :     SunVersion version2(sSecond);
     103           1 :     if ( ! version2)
     104           0 :         throw MalformedVersionException();
     105             : 
     106           1 :     if (version1 == version2)
     107           0 :         return 0;
     108           1 :     if (version1 > version2)
     109           1 :         return 1;
     110             :     else
     111           1 :         return -1;
     112             : }
     113             : 
     114             : 
     115             : }
     116             : 
     117             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10