LCOV - code coverage report
Current view: top level - jvmfwk/plugins/sunmajor/pluginlib - vendorbase.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 1 2 50.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             : #ifndef INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_VENDORBASE_HXX
      21             : #define INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_VENDORBASE_HXX
      22             : 
      23             : #include "rtl/ustring.hxx"
      24             : #include "rtl/ref.hxx"
      25             : #include "osl/endian.h"
      26             : #include "salhelper/simplereferenceobject.hxx"
      27             : #include <vector>
      28             : 
      29             : namespace jfw_plugin
      30             : {
      31             : 
      32             : 
      33             : //Used by subclasses of VendorBase to build paths to Java runtime
      34             : #if defined(__sparcv9)
      35             : #define JFW_PLUGIN_ARCH "sparcv9"
      36             : #elif defined SPARC
      37             : #define JFW_PLUGIN_ARCH "sparc"
      38             : #elif defined X86_64
      39             : #define JFW_PLUGIN_ARCH "amd64"
      40             : #elif defined INTEL
      41             : #define JFW_PLUGIN_ARCH "i386"
      42             : #elif defined POWERPC64
      43             : #define JFW_PLUGIN_ARCH "ppc64"
      44             : #elif defined POWERPC
      45             : #define JFW_PLUGIN_ARCH "ppc"
      46             : #elif defined MIPS
      47             : #ifdef OSL_BIGENDIAN
      48             : #  define JFW_PLUGIN_ARCH "mips"
      49             : #else
      50             : /* FIXME: do JDKs have some JDK-specific define? This is for
      51             : OpenJDK at least, but probably not true for Lemotes JDK */
      52             : #  define JFW_PLUGIN_ARCH "mipsel"
      53             : #endif
      54             : #elif defined S390X
      55             : #define JFW_PLUGIN_ARCH "s390x"
      56             : #elif defined S390
      57             : #define JFW_PLUGIN_ARCH "s390"
      58             : #elif defined ARM
      59             : #define JFW_PLUGIN_ARCH "arm"
      60             : #elif defined IA64
      61             : #define JFW_PLUGIN_ARCH "ia64"
      62             : #elif defined M68K
      63             : #define JFW_PLUGIN_ARCH "m68k"
      64             : #elif defined HPPA
      65             : #define JFW_PLUGIN_ARCH "parisc"
      66             : #elif defined AXP
      67             : #define JFW_PLUGIN_ARCH "alpha"
      68             : #elif defined AARCH64
      69             : #define JFW_PLUGIN_ARCH "aarch64"
      70             : #else // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA, ALPHA
      71             : #error unknown platform
      72             : #endif // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA, ALPHA
      73             : 
      74             : 
      75             : class MalformedVersionException
      76             : {
      77             : public:
      78             :     MalformedVersionException();
      79             : 
      80             :     MalformedVersionException(const MalformedVersionException &);
      81             : 
      82             :     virtual ~MalformedVersionException();
      83             : 
      84             :     MalformedVersionException & operator =(const MalformedVersionException &);
      85             : };
      86             : 
      87         130 : class VendorBase: public salhelper::SimpleReferenceObject
      88             : {
      89             : public:
      90             :     VendorBase();
      91             :     /* static char const* const *  getJavaExePaths(int* size);
      92             : 
      93             :        returns relative paths to the java executable as
      94             :        file URLs.
      95             : 
      96             :        For example "bin/java.exe". You need
      97             :        to implement this function in a derived class, if
      98             :        the paths differ.  this implmentation provides for
      99             :        Windows "bin/java.exe" and for Unix "bin/java".
     100             :        The paths are relative file URLs. That is, they always
     101             :        contain '/' even on windows. The paths are relative
     102             :        to the installation directory of a JRE.
     103             : 
     104             : 
     105             :        The signature of this function must correspond to
     106             :        getJavaExePaths_func.
     107             :      */
     108             : 
     109             :     /* static rtl::Reference<VendorBase> createInstance();
     110             : 
     111             :        creates an instance of this class. MUST be overridden
     112             :        in a derived class.
     113             :        ####################################################
     114             :        OVERRIDE in derived class
     115             :        ###################################################
     116             :        @param
     117             :        Key - value pairs of the system properties of the JRE.
     118             :      */
     119             : 
     120             :     const OUString & getVendor() const;
     121             :     const OUString & getVersion() const;
     122             :     const OUString & getHome() const;
     123             :     const OUString & getRuntimeLibrary() const;
     124             :     const OUString & getLibraryPath() const;
     125             :     bool supportsAccessibility() const;
     126             :      /* determines if prior to running java something has to be done,
     127             :         like setting the LD_LIBRARY_PATH. This implementation checks
     128             :         if an LD_LIBRARY_PATH (getLD_LIBRARY_PATH) needs to be set and
     129             :         if so, needsRestart returns true.
     130             :       */
     131             :      bool needsRestart() const;
     132             : 
     133             :     /* compares versions of this vendor. MUST be overridden
     134             :        in a derived class.
     135             :        ####################################################
     136             :        OVERRIDE in derived class
     137             :        ###################################################
     138             :       @return
     139             :       0 this.version == sSecond
     140             :       1 this.version > sSecond
     141             :       -1 this.version < sSEcond
     142             : 
     143             :       @throw
     144             :       MalformedVersionException if the version string was not recognized.
     145             :      */
     146             :     virtual int compareVersions(const OUString& sSecond) const = 0;
     147             : 
     148             : protected:
     149             :     /* called automatically on the instance created by createInstance.
     150             : 
     151             :        @return
     152             :        true - the object could completely initialize.
     153             :        false - the object could not completely initialize. In this case
     154             :        it will be discarded by the caller.
     155             :     */
     156             :     virtual bool initialize(
     157             :         std::vector<std::pair<OUString, OUString> > props);
     158             : 
     159             :     /* returns relative file URLs to the runtime library.
     160             :        For example         "/bin/client/jvm.dll"
     161             :     */
     162             :     virtual char const* const* getRuntimePaths(int* size) = 0;
     163             : 
     164             :     virtual char const* const* getLibraryPaths(int* size) = 0;
     165             : 
     166             :     OUString m_sVendor;
     167             :     OUString m_sVersion;
     168             :     OUString m_sHome;
     169             :     OUString m_sRuntimeLibrary;
     170             :     OUString m_sLD_LIBRARY_PATH;
     171             :     bool m_bAccessibility;
     172             : 
     173             : 
     174             :     typedef rtl::Reference<VendorBase> (* createInstance_func) ();
     175             :     friend rtl::Reference<VendorBase> createInstance(
     176             :         createInstance_func pFunc,
     177             :         std::vector<std::pair<OUString, OUString> > properties);
     178             : };
     179             : 
     180             : }
     181             : 
     182             : #endif
     183             : 
     184             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10