LCOV - code coverage report
Current view: top level - jvmfwk/plugins/sunmajor/pluginlib - vendorbase.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 1 1 100.0 %
Date: 2014-04-14 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_JFW_PLUGIN_VENDORBASE_HXX
      21             : #define INCLUDED_JFW_PLUGIN_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             : #else // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA, ALPHA
      69             : #error unknown platform
      70             : #endif // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA, ALPHA
      71             : 
      72             : 
      73             : class MalformedVersionException
      74             : {
      75             : public:
      76             :     MalformedVersionException();
      77             : 
      78             :     MalformedVersionException(const MalformedVersionException &);
      79             : 
      80             :     virtual ~MalformedVersionException();
      81             : 
      82             :     MalformedVersionException & operator =(const MalformedVersionException &);
      83             : };
      84             : 
      85           2 : class VendorBase: public salhelper::SimpleReferenceObject
      86             : {
      87             : public:
      88             :     VendorBase();
      89             :     /* returns relative paths to the java executable as
      90             :        file URLs.
      91             : 
      92             :        For example "bin/java.exe". You need
      93             :        to implement this function in a derived class, if
      94             :        the paths differ.  this implmentation provides for
      95             :        Windows "bin/java.exe" and for Unix "bin/java".
      96             :        The paths are relative file URLs. That is, they always
      97             :        contain '/' even on windows. The paths are relative
      98             :        to the installation directory of a JRE.
      99             : 
     100             : 
     101             :        The signature of this function must correspond to
     102             :        getJavaExePaths_func.
     103             :      */
     104             :     static char const* const *  getJavaExePaths(int* size);
     105             : 
     106             :     /* creates an instance of this class. MUST be overridden
     107             :        in a derived class.
     108             :        ####################################################
     109             :        OVERRIDE in derived class
     110             :        ###################################################
     111             :        @param
     112             :        Key - value pairs of the system properties of the JRE.
     113             :      */
     114             :     static rtl::Reference<VendorBase> createInstance();
     115             : 
     116             :     /* called automatically on the instance created by createInstance.
     117             : 
     118             :        @return
     119             :        true - the object could completely initialize.
     120             :        false - the object could not completely initialize. In this case
     121             :        it will be discarded by the caller.
     122             :     */
     123             :     virtual bool initialize(
     124             :         std::vector<std::pair<OUString, OUString> > props);
     125             : 
     126             :     /* returns relative file URLs to the runtime library.
     127             :        For example         "/bin/client/jvm.dll"
     128             :     */
     129             :     virtual char const* const* getRuntimePaths(int* size);
     130             : 
     131             :     virtual char const* const* getLibraryPaths(int* size);
     132             : 
     133             :     virtual const OUString & getVendor() const;
     134             :     virtual const OUString & getVersion() const;
     135             :     virtual const OUString & getHome() const;
     136             :     virtual const OUString & getRuntimeLibrary() const;
     137             :     virtual const OUString & getLibraryPaths() const;
     138             :     virtual bool supportsAccessibility() const;
     139             :     /* determines if prior to running java something has to be done,
     140             :        like setting the LD_LIBRARY_PATH. This implementation checks
     141             :        if an LD_LIBRARY_PATH (getLD_LIBRARY_PATH) needs to be set and
     142             :        if so, needsRestart returns true.
     143             :      */
     144             :     virtual bool needsRestart() const;
     145             : 
     146             :     /* compares versions of this vendor. MUST be overridden
     147             :        in a derived class.
     148             :        ####################################################
     149             :        OVERRIDE in derived class
     150             :        ###################################################
     151             :       @return
     152             :       0 this.version == sSecond
     153             :       1 this.version > sSecond
     154             :       -1 this.version < sSEcond
     155             : 
     156             :       @throw
     157             :       MalformedVersionException if the version string was not recognized.
     158             :      */
     159             :     virtual int compareVersions(const OUString& sSecond) const;
     160             : 
     161             : protected:
     162             : 
     163             :     OUString m_sVendor;
     164             :     OUString m_sVersion;
     165             :     OUString m_sHome;
     166             :     OUString m_sRuntimeLibrary;
     167             :     OUString m_sLD_LIBRARY_PATH;
     168             :     bool m_bAccessibility;
     169             : 
     170             : 
     171             :     typedef rtl::Reference<VendorBase> (* createInstance_func) ();
     172             :     friend rtl::Reference<VendorBase> createInstance(
     173             :         createInstance_func pFunc,
     174             :         std::vector<std::pair<OUString, OUString> > properties);
     175             : };
     176             : 
     177             : }
     178             : 
     179             : #endif
     180             : 
     181             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10