136f55ffcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
336f55ffcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
436f55ffcSAndrew Rist * or more contributor license agreements. See the NOTICE file
536f55ffcSAndrew Rist * distributed with this work for additional information
636f55ffcSAndrew Rist * regarding copyright ownership. The ASF licenses this file
736f55ffcSAndrew Rist * to you under the Apache License, Version 2.0 (the
836f55ffcSAndrew Rist * "License"); you may not use this file except in compliance
936f55ffcSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
1136f55ffcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
1336f55ffcSAndrew Rist * Unless required by applicable law or agreed to in writing,
1436f55ffcSAndrew Rist * software distributed under the License is distributed on an
1536f55ffcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1636f55ffcSAndrew Rist * KIND, either express or implied. See the License for the
1736f55ffcSAndrew Rist * specific language governing permissions and limitations
1836f55ffcSAndrew Rist * under the License.
19cdf0e10cSrcweir *
2036f55ffcSAndrew Rist *************************************************************/
2136f55ffcSAndrew Rist
2236f55ffcSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_jvmfwk.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "vendorlist.hxx"
28cdf0e10cSrcweir #include "gnujre.hxx"
29cdf0e10cSrcweir #include "sunjre.hxx"
30cdf0e10cSrcweir #include "otherjre.hxx"
31cdf0e10cSrcweir #include "osl/thread.h"
32cdf0e10cSrcweir #include <stdio.h>
33cdf0e10cSrcweir
34cdf0e10cSrcweir using namespace com::sun::star::uno;
35cdf0e10cSrcweir using namespace rtl;
36cdf0e10cSrcweir
37cdf0e10cSrcweir namespace jfw_plugin
38cdf0e10cSrcweir {
39cdf0e10cSrcweir
40cdf0e10cSrcweir /* Note: The vendor strings must be UTF-8. For example, if
41cdf0e10cSrcweir the string contains an a umlaut then it must be expressed
42cdf0e10cSrcweir by "\xXX\xXX"
43cdf0e10cSrcweir */
44cdf0e10cSrcweir BEGIN_VENDOR_MAP()
45696f238bSAriel Constenla-Haile VENDOR_MAP_ENTRY("Oracle Corporation", SunInfo)
46cdf0e10cSrcweir VENDOR_MAP_ENTRY("Sun Microsystems Inc.", SunInfo)
47cdf0e10cSrcweir VENDOR_MAP_ENTRY("IBM Corporation", OtherInfo)
48cdf0e10cSrcweir VENDOR_MAP_ENTRY("Blackdown Java-Linux Team", OtherInfo)
49cdf0e10cSrcweir VENDOR_MAP_ENTRY("Apple Inc.", OtherInfo)
50cdf0e10cSrcweir VENDOR_MAP_ENTRY("Apple Computer, Inc.", OtherInfo)
51cdf0e10cSrcweir VENDOR_MAP_ENTRY("BEA Systems, Inc.", OtherInfo)
52cdf0e10cSrcweir VENDOR_MAP_ENTRY("Free Software Foundation, Inc.", GnuInfo)
53cdf0e10cSrcweir VENDOR_MAP_ENTRY("The FreeBSD Foundation", OtherInfo)
5476c3a0c5SDamjan Jovanovic VENDOR_MAP_ENTRY("AdoptOpenJDK", OtherInfo)
55*7ffb764aSDamjan Jovanovic VENDOR_MAP_ENTRY("OpenJDK", SunInfo)
END_VENDOR_MAP()56cdf0e10cSrcweir END_VENDOR_MAP()
57cdf0e10cSrcweir
58cdf0e10cSrcweir
59cdf0e10cSrcweir Sequence<OUString> getVendorNames()
60cdf0e10cSrcweir {
61cdf0e10cSrcweir const size_t count = sizeof(gVendorMap) / sizeof (VendorSupportMapEntry) - 1;
62cdf0e10cSrcweir OUString arNames[count];
63cdf0e10cSrcweir for ( size_t pos = 0; pos < count; ++pos )
64cdf0e10cSrcweir {
65cdf0e10cSrcweir OString sVendor(gVendorMap[pos].sVendorName);
66cdf0e10cSrcweir arNames[pos] = OStringToOUString(sVendor, RTL_TEXTENCODING_UTF8);
67cdf0e10cSrcweir }
68cdf0e10cSrcweir return Sequence<OUString>(arNames, count);
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
isVendorSupported(const rtl::OUString & sVendor)71cdf0e10cSrcweir bool isVendorSupported(const rtl::OUString& sVendor)
72cdf0e10cSrcweir {
73cdf0e10cSrcweir Sequence<OUString> seqNames = getVendorNames();
74cdf0e10cSrcweir const OUString * arNames = seqNames.getConstArray();
75cdf0e10cSrcweir sal_Int32 count = seqNames.getLength();
76cdf0e10cSrcweir
77cdf0e10cSrcweir for (int i = 0; i < count; i++)
78cdf0e10cSrcweir {
79cdf0e10cSrcweir if (sVendor.equals(arNames[i]))
80cdf0e10cSrcweir return true;
81cdf0e10cSrcweir }
82cdf0e10cSrcweir #if OSL_DEBUG_LEVEL >= 2
83cdf0e10cSrcweir OString sVendorName = OUStringToOString(sVendor, osl_getThreadTextEncoding());
84cdf0e10cSrcweir fprintf(stderr, "[Java frameworksunjavaplugin.so]sunjavaplugin does not support vendor: %s.\n",
85cdf0e10cSrcweir sVendorName.getStr());
86cdf0e10cSrcweir #endif
87cdf0e10cSrcweir return false;
88cdf0e10cSrcweir }
89cdf0e10cSrcweir
90cdf0e10cSrcweir }
91