1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #if !defined INCLUDED_JFW_PLUGIN_VENDORBASE_HXX 29*cdf0e10cSrcweir #define INCLUDED_JFW_PLUGIN_VENDORBASE_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "rtl/ustring.hxx" 32*cdf0e10cSrcweir #include "rtl/ref.hxx" 33*cdf0e10cSrcweir #include "osl/endian.h" 34*cdf0e10cSrcweir #include "salhelper/simplereferenceobject.hxx" 35*cdf0e10cSrcweir #include <vector> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir namespace jfw_plugin 38*cdf0e10cSrcweir { 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir //Used by subclasses of VendorBase to build paths to Java runtime 42*cdf0e10cSrcweir #if defined(__sparcv9) 43*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "sparcv9" 44*cdf0e10cSrcweir #elif defined SPARC 45*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "sparc" 46*cdf0e10cSrcweir #elif defined X86_64 47*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "amd64" 48*cdf0e10cSrcweir #elif defined INTEL 49*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "i386" 50*cdf0e10cSrcweir #elif defined POWERPC64 51*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "ppc64" 52*cdf0e10cSrcweir #elif defined POWERPC 53*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "ppc" 54*cdf0e10cSrcweir #elif defined MIPS 55*cdf0e10cSrcweir #ifdef OSL_BIGENDIAN 56*cdf0e10cSrcweir # define JFW_PLUGIN_ARCH "mips" 57*cdf0e10cSrcweir #else 58*cdf0e10cSrcweir # define JFW_PLUGIN_ARCH "mips32" 59*cdf0e10cSrcweir #endif 60*cdf0e10cSrcweir #elif defined S390X 61*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "s390x" 62*cdf0e10cSrcweir #elif defined S390 63*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "s390" 64*cdf0e10cSrcweir #elif defined ARM 65*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "arm" 66*cdf0e10cSrcweir #elif defined IA64 67*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "ia64" 68*cdf0e10cSrcweir #elif defined M68K 69*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "m68k" 70*cdf0e10cSrcweir #elif defined HPPA 71*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "parisc" 72*cdf0e10cSrcweir #elif defined AXP 73*cdf0e10cSrcweir #define JFW_PLUGIN_ARCH "alpha" 74*cdf0e10cSrcweir #else // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA, ALPHA 75*cdf0e10cSrcweir #error unknown plattform 76*cdf0e10cSrcweir #endif // SPARC, INTEL, POWERPC, MIPS, ARM, IA64, M68K, HPPA, ALPHA 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir class MalformedVersionException 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir public: 82*cdf0e10cSrcweir MalformedVersionException(); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir MalformedVersionException(const MalformedVersionException &); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir virtual ~MalformedVersionException(); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir MalformedVersionException & operator =(const MalformedVersionException &); 89*cdf0e10cSrcweir }; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir class VendorBase: public salhelper::SimpleReferenceObject 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir public: 94*cdf0e10cSrcweir VendorBase(); 95*cdf0e10cSrcweir /* returns relativ paths to the java executable as 96*cdf0e10cSrcweir file URLs. 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir For example "bin/java.exe". You need 99*cdf0e10cSrcweir to implement this function in a derived class, if 100*cdf0e10cSrcweir the paths differ. this implmentation provides for 101*cdf0e10cSrcweir Windows "bin/java.exe" and for Unix "bin/java". 102*cdf0e10cSrcweir The paths are relative file URLs. That is, they always 103*cdf0e10cSrcweir contain '/' even on windows. The paths are relative 104*cdf0e10cSrcweir to the installation directory of a JRE. 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir The signature of this function must correspond to 108*cdf0e10cSrcweir getJavaExePaths_func. 109*cdf0e10cSrcweir */ 110*cdf0e10cSrcweir static char const* const * getJavaExePaths(int* size); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir /* creates an instance of this class. MUST be overridden 113*cdf0e10cSrcweir in a derived class. 114*cdf0e10cSrcweir #################################################### 115*cdf0e10cSrcweir OVERRIDE in derived class 116*cdf0e10cSrcweir ################################################### 117*cdf0e10cSrcweir @param 118*cdf0e10cSrcweir Key - value pairs of the system properties of the JRE. 119*cdf0e10cSrcweir */ 120*cdf0e10cSrcweir static rtl::Reference<VendorBase> createInstance(); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir /* called automatically on the instance created by createInstance. 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir @return 125*cdf0e10cSrcweir true - the object could completely initialize. 126*cdf0e10cSrcweir false - the object could not completly initialize. In this case 127*cdf0e10cSrcweir it will be discarded by the caller. 128*cdf0e10cSrcweir */ 129*cdf0e10cSrcweir virtual bool initialize( 130*cdf0e10cSrcweir std::vector<std::pair<rtl::OUString, rtl::OUString> > props); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir /* returns relative file URLs to the runtime library. 133*cdf0e10cSrcweir For example "/bin/client/jvm.dll" 134*cdf0e10cSrcweir */ 135*cdf0e10cSrcweir virtual char const* const* getRuntimePaths(int* size); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir virtual char const* const* getLibraryPaths(int* size); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir virtual const rtl::OUString & getVendor() const; 140*cdf0e10cSrcweir virtual const rtl::OUString & getVersion() const; 141*cdf0e10cSrcweir virtual const rtl::OUString & getHome() const; 142*cdf0e10cSrcweir virtual const rtl::OUString & getRuntimeLibrary() const; 143*cdf0e10cSrcweir virtual const rtl::OUString & getLibraryPaths() const; 144*cdf0e10cSrcweir virtual bool supportsAccessibility() const; 145*cdf0e10cSrcweir /* determines if prior to running java something has to be done, 146*cdf0e10cSrcweir like setting the LD_LIBRARY_PATH. This implementation checks 147*cdf0e10cSrcweir if an LD_LIBRARY_PATH (getLD_LIBRARY_PATH) needs to be set and 148*cdf0e10cSrcweir if so, needsRestart returns true. 149*cdf0e10cSrcweir */ 150*cdf0e10cSrcweir virtual bool needsRestart() const; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir /* compares versions of this vendor. MUST be overridden 153*cdf0e10cSrcweir in a derived class. 154*cdf0e10cSrcweir #################################################### 155*cdf0e10cSrcweir OVERRIDE in derived class 156*cdf0e10cSrcweir ################################################### 157*cdf0e10cSrcweir @return 158*cdf0e10cSrcweir 0 this.version == sSecond 159*cdf0e10cSrcweir 1 this.version > sSecond 160*cdf0e10cSrcweir -1 this.version < sSEcond 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir @throw 163*cdf0e10cSrcweir MalformedVersionException if the version string was not recognized. 164*cdf0e10cSrcweir */ 165*cdf0e10cSrcweir virtual int compareVersions(const rtl::OUString& sSecond) const; 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir protected: 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir rtl::OUString m_sVendor; 170*cdf0e10cSrcweir rtl::OUString m_sVersion; 171*cdf0e10cSrcweir rtl::OUString m_sHome; 172*cdf0e10cSrcweir rtl::OUString m_sRuntimeLibrary; 173*cdf0e10cSrcweir rtl::OUString m_sLD_LIBRARY_PATH; 174*cdf0e10cSrcweir bool m_bAccessibility; 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir typedef rtl::Reference<VendorBase> (* createInstance_func) (); 178*cdf0e10cSrcweir friend rtl::Reference<VendorBase> createInstance( 179*cdf0e10cSrcweir createInstance_func pFunc, 180*cdf0e10cSrcweir std::vector<std::pair<rtl::OUString, rtl::OUString> > properties); 181*cdf0e10cSrcweir }; 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir #endif 186