1 /* 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package build.tools.cldrconverter; 27 28 import java.util.Calendar; 29 import java.util.GregorianCalendar; 30 import java.util.Locale; 31 import java.util.TimeZone; 32 33 class CopyrightHeaders { 34 private static final String ORACLE2012 = 35 "/*\n" + 36 " * Copyright (c) %d, Oracle and/or its affiliates. All rights reserved.\n" + 37 " */\n"; 38 39 private static final String ORACLE_AFTER2012 = 40 "/*\n" + 41 " * Copyright (c) 2012, %d, Oracle and/or its affiliates. All rights reserved.\n" + 42 " */\n"; 43 44 private static final String UNICODE = 45 "/*\n" + 46 " * COPYRIGHT AND PERMISSION NOTICE\n" + 47 " *\n" + 48 " * Copyright (C) 1991-2012 Unicode, Inc. All rights reserved. Distributed under\n" + 49 " * the Terms of Use in http://www.unicode.org/copyright.html.\n" + 50 " *\n" + 51 " * Permission is hereby granted, free of charge, to any person obtaining a copy\n" + 52 " * of the Unicode data files and any associated documentation (the \"Data\n" + 53 " * Files\") or Unicode software and any associated documentation (the\n" + 54 " * \"Software\") to deal in the Data Files or Software without restriction,\n" + 55 " * including without limitation the rights to use, copy, modify, merge,\n" + 56 " * publish, distribute, and/or sell copies of the Data Files or Software, and\n" + 57 " * to permit persons to whom the Data Files or Software are furnished to do so,\n" + 58 " * provided that (a) the above copyright notice(s) and this permission notice\n" + 59 " * appear with all copies of the Data Files or Software, (b) both the above\n" + 60 " * copyright notice(s) and this permission notice appear in associated\n" + 61 " * documentation, and (c) there is clear notice in each modified Data File or\n" + 62 " * in the Software as well as in the documentation associated with the Data\n" + 63 " * File(s) or Software that the data or software has been modified.\n" + 64 " *\n" + 65 " * THE DATA FILES AND SOFTWARE ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n" + 66 " * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" + 67 " * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n" + 68 " * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS\n" + 69 " * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR\n" + 70 " * CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,\n" + 71 " * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n" + 72 " * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n" + 73 " * OF THE DATA FILES OR SOFTWARE.\n" + 74 " *\n" + 75 " * Except as contained in this notice, the name of a copyright holder shall not\n" + 76 " * be used in advertising or otherwise to promote the sale, use or other\n" + 77 " * dealings in these Data Files or Software without prior written authorization\n" + 78 " * of the copyright holder.\n" + 79 " */\n"; 80 81 private static String OPENJDK2012 = 82 "/*\n" + 83 " * Copyright (c) %d, Oracle and/or its affiliates. All rights reserved.\n" + 84 " * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" + 85 " *\n" + 86 " * This code is free software; you can redistribute it and/or modify it\n" + 87 " * under the terms of the GNU General Public License version 2 only, as\n" + 88 " * published by the Free Software Foundation. Oracle designates this\n" + 89 " * particular file as subject to the \"Classpath\" exception as provided\n" + 90 " * by Oracle in the LICENSE file that accompanied this code.\n" + 91 " *\n" + 92 " * This code is distributed in the hope that it will be useful, but WITHOUT\n" + 93 " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" + 94 " * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n" + 95 " * version 2 for more details (a copy is included in the LICENSE file that\n" + 96 " * accompanied this code).\n" + 97 " *\n" + 98 " * You should have received a copy of the GNU General Public License version\n" + 99 " * 2 along with this work; if not, write to the Free Software Foundation,\n" + 100 " * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n" + 101 " *\n" + 102 " * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n" + 103 " * or visit www.oracle.com if you need additional information or have any\n" + 104 " * questions.\n" + 105 " */\n"; 106 107 private static String OPENJDK_AFTER2012 = 108 "/*\n" + 109 " * Copyright (c) 2012, %d, Oracle and/or its affiliates. All rights reserved.\n" + 110 " * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" + 111 " *\n" + 112 " * This code is free software; you can redistribute it and/or modify it\n" + 113 " * under the terms of the GNU General Public License version 2 only, as\n" + 114 " * published by the Free Software Foundation. Oracle designates this\n" + 115 " * particular file as subject to the \"Classpath\" exception as provided\n" + 116 " * by Oracle in the LICENSE file that accompanied this code.\n" + 117 " *\n" + 118 " * This code is distributed in the hope that it will be useful, but WITHOUT\n" + 119 " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" + 120 " * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n" + 121 " * version 2 for more details (a copy is included in the LICENSE file that\n" + 122 " * accompanied this code).\n" + 123 " *\n" + 124 " * You should have received a copy of the GNU General Public License version\n" + 125 " * 2 along with this work; if not, write to the Free Software Foundation,\n" + 126 " * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n" + 127 " *\n" + 128 " * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n" + 129 " * or visit www.oracle.com if you need additional information or have any\n" + 130 " * questions.\n" + 131 " */\n"; 132 getOracleCopyright()133 static String getOracleCopyright() { 134 int year = getYear(); 135 return String.format(year > 2012 ? ORACLE_AFTER2012 : ORACLE2012, year); 136 } 137 getUnicodeCopyright()138 static String getUnicodeCopyright() { 139 return UNICODE; 140 } 141 getOpenJDKCopyright()142 static String getOpenJDKCopyright() { 143 int year = getYear(); 144 return String.format(year > 2012 ? OPENJDK_AFTER2012 : OPENJDK2012, year); 145 } 146 getYear()147 private static int getYear() { 148 return new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"), 149 Locale.US).get(Calendar.YEAR); 150 } 151 152 // no instantiation CopyrightHeaders()153 private CopyrightHeaders() { 154 } 155 } 156 157