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