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