View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.rat.api.domain;
20  
21  import static org.apache.rat.api.domain.LicenseFamilyBuilder.aLicenseFamily;
22  
23  /**
24   * Enumerates standard license families known to Rat.
25   */
26  public enum RatLicenseFamily {
27  
28  	APACHE(
29  			"Apache License Version 2.0",
30  			"AL   ",
31  			"Note that APACHE requires a NOTICE. All modifications require notes. See http://www.apache.org/licenses/LICENSE-2.0."),
32  	GPL1(
33  			"GNU General Public License, version 1",
34  			"GPL1 ",
35  			"Note that GPL1 requires a NOTICE. All modifications require notes. See http://www.gnu.org/licenses/gpl-1.0.html."),
36  	GPL2(
37  			"GNU General Public License, version 2",
38  			"GPL2 ",
39  			"Note that GPL2 requires a NOTICE. All modifications require notes. See http://www.gnu.org/licenses/gpl-2.0.html."),
40  	GPL3(
41  			"GNU General Public License, version 3",
42  			"GPL3 ",
43  			"Note that GPL3 requires a NOTICE. All modifications require notes. See http://www.gnu.org/licenses/gpl-3.0.html."),
44  	MIT(
45  			"The MIT License",
46  			"MIT  ",
47  			"Note that MIT requires a NOTICE. All modifications require notes. See http://opensource.org/licenses/MIT."),
48  	CDDL1(
49  			"COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0",
50  			"CDDL1",
51  			"Note that CDDL1 requires a NOTICE. All modifications require notes. See https://oss.oracle.com/licenses/CDDL."),
52  	OASIS(
53  			"OASIS Open License",
54  			"OASIS",
55  			"Note that OASIS requires a NOTICE. All modifications require notes. See https://www.oasis-open.org/policies-guidelines/ipr."),
56  	TMF854(
57  			"Modified BSD License",
58  			"TMF  ",
59  			"Note that TMF854 requires a NOTICE. All modifications require notes. See http://opensource.org/licenses/BSD-3-Clause."),
60  	 DOJO(
61  			"Modified BSD License",
62  			"DOJO ",
63  			"Note that DOJO requires a NOTICE. All modifications require notes. See http://dojotoolkit.org/community/licensing.shtml."),
64      W3C(
65              "W3C Software Copyright",
66              "W3C  ",
67              "Note that W3C requires a NOTICE. All modifications require notes. See http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231."),
68  
69      W3C_DOCUMENTATION(
70              "W3C Document Copyright",
71              "W3CD ",
72              "Note that W3CD does not allow modifications. See http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231.");
73  
74      /** @see LicenseFamily#getName() */
75      private final String name;
76      /** @see LicenseFamily#getCategory() */
77      private final String category;
78      /** @see LicenseFamily#getNotes() */
79      private final String notes;
80      /** Constructed from other data */
81      private final LicenseFamily licenseFamily;
82  
83      /**
84       * Constructs an instance.
85       * 
86       * @param name
87       *            not null
88       * @param category
89       *            not null
90       * @param notes
91       *            not null
92       */
93      private RatLicenseFamily(final String name, final String category,
94              final String notes) {
95          this.name = name;
96          this.category = category;
97          this.notes = notes;
98          this.licenseFamily = aLicenseFamily().withCategory(getCategory())
99                  .withName(getName()).withNotes(getNotes()).build();
100     }
101 
102     /**
103      * @see LicenseFamily#getName()
104      * 
105      * @return not null
106      */
107     public String getName() {
108         return this.name;
109     }
110 
111     /**
112      * @see LicenseFamily#getCategory()
113      * 
114      * @return possibly null
115      */
116     public String getCategory() {
117         return this.category;
118     }
119 
120     /**
121      * @see LicenseFamily#getNotes()
122      * 
123      * @return possibly null
124      */
125     public String getNotes() {
126         return this.notes;
127     }
128 
129     /**
130      * Gets a {@link LicenseFamily} representing this data.
131      * 
132      * @return not null
133      */
134     public LicenseFamily licenseFamily() {
135         return this.licenseFamily;
136     }
137 }