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