1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_jvmfwk.hxx" 30 31 #include "vendorlist.hxx" 32 #include "gnujre.hxx" 33 #include "sunjre.hxx" 34 #include "otherjre.hxx" 35 #include "osl/thread.h" 36 #include <stdio.h> 37 38 using namespace com::sun::star::uno; 39 using namespace rtl; 40 41 namespace jfw_plugin 42 { 43 44 /* Note: The vendor strings must be UTF-8. For example, if 45 the string contains an a umlaut then it must be expressed 46 by "\xXX\xXX" 47 */ 48 BEGIN_VENDOR_MAP() 49 VENDOR_MAP_ENTRY("Sun Microsystems Inc.", SunInfo) 50 VENDOR_MAP_ENTRY("IBM Corporation", OtherInfo) 51 VENDOR_MAP_ENTRY("Blackdown Java-Linux Team", OtherInfo) 52 VENDOR_MAP_ENTRY("Apple Inc.", OtherInfo) 53 VENDOR_MAP_ENTRY("Apple Computer, Inc.", OtherInfo) 54 VENDOR_MAP_ENTRY("BEA Systems, Inc.", OtherInfo) 55 VENDOR_MAP_ENTRY("Free Software Foundation, Inc.", GnuInfo) 56 VENDOR_MAP_ENTRY("The FreeBSD Foundation", OtherInfo) 57 END_VENDOR_MAP() 58 59 60 Sequence<OUString> getVendorNames() 61 { 62 const size_t count = sizeof(gVendorMap) / sizeof (VendorSupportMapEntry) - 1; 63 OUString arNames[count]; 64 for ( size_t pos = 0; pos < count; ++pos ) 65 { 66 OString sVendor(gVendorMap[pos].sVendorName); 67 arNames[pos] = OStringToOUString(sVendor, RTL_TEXTENCODING_UTF8); 68 } 69 return Sequence<OUString>(arNames, count); 70 } 71 72 bool isVendorSupported(const rtl::OUString& sVendor) 73 { 74 Sequence<OUString> seqNames = getVendorNames(); 75 const OUString * arNames = seqNames.getConstArray(); 76 sal_Int32 count = seqNames.getLength(); 77 78 for (int i = 0; i < count; i++) 79 { 80 if (sVendor.equals(arNames[i])) 81 return true; 82 } 83 #if OSL_DEBUG_LEVEL >= 2 84 OString sVendorName = OUStringToOString(sVendor, osl_getThreadTextEncoding()); 85 fprintf(stderr, "[Java frameworksunjavaplugin.so]sunjavaplugin does not support vendor: %s.\n", 86 sVendorName.getStr()); 87 #endif 88 return false; 89 } 90 91 } 92