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("Sun Microsystems Inc.", SunInfo) 46 VENDOR_MAP_ENTRY("IBM Corporation", OtherInfo) 47 VENDOR_MAP_ENTRY("Blackdown Java-Linux Team", OtherInfo) 48 VENDOR_MAP_ENTRY("Apple Inc.", OtherInfo) 49 VENDOR_MAP_ENTRY("Apple Computer, Inc.", OtherInfo) 50 VENDOR_MAP_ENTRY("BEA Systems, Inc.", OtherInfo) 51 VENDOR_MAP_ENTRY("Free Software Foundation, Inc.", GnuInfo) 52 VENDOR_MAP_ENTRY("The FreeBSD Foundation", OtherInfo) 53 END_VENDOR_MAP() 54 55 56 Sequence<OUString> getVendorNames() 57 { 58 const size_t count = sizeof(gVendorMap) / sizeof (VendorSupportMapEntry) - 1; 59 OUString arNames[count]; 60 for ( size_t pos = 0; pos < count; ++pos ) 61 { 62 OString sVendor(gVendorMap[pos].sVendorName); 63 arNames[pos] = OStringToOUString(sVendor, RTL_TEXTENCODING_UTF8); 64 } 65 return Sequence<OUString>(arNames, count); 66 } 67 68 bool isVendorSupported(const rtl::OUString& sVendor) 69 { 70 Sequence<OUString> seqNames = getVendorNames(); 71 const OUString * arNames = seqNames.getConstArray(); 72 sal_Int32 count = seqNames.getLength(); 73 74 for (int i = 0; i < count; i++) 75 { 76 if (sVendor.equals(arNames[i])) 77 return true; 78 } 79 #if OSL_DEBUG_LEVEL >= 2 80 OString sVendorName = OUStringToOString(sVendor, osl_getThreadTextEncoding()); 81 fprintf(stderr, "[Java frameworksunjavaplugin.so]sunjavaplugin does not support vendor: %s.\n", 82 sVendorName.getStr()); 83 #endif 84 return false; 85 } 86 87 } 88