Author: tchemit Date: 2008-10-12 20:42:31 +0000 (Sun, 12 Oct 2008) New Revision: 1170 Removed: maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/LicenseType.java Log: no more license type Deleted: maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/LicenseType.java =================================================================== --- maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/LicenseType.java 2008-10-12 20:42:16 UTC (rev 1169) +++ maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/LicenseType.java 2008-10-12 20:42:31 UTC (rev 1170) @@ -1,63 +0,0 @@ -/** - * *##% Plugin maven pour switcher les licenses - * Copyright (C) 2008 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* - */ -package org.codelutin.license; - -import java.io.File; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.UnsupportedEncodingException; - -/** - * Une enumeration pour definir le type d'une licence a utiliser. - * <p/> - * Chaque licence doit definir 2 fichiers textes (licence.txt et header.txt) dans le repertoire <code>name().toLowerCase()</code> - * du classpath. - * <p/> - * La methode {@link #getLicenceFileReader(String)} permet de recuperer le contenu de la licence. - * <p/> - * La methode {@link #getLicenceHeaderReader(String)} permet de recuperer le contenu de l'en-tete de la licence a appliquer. - * - * @author chemit - */ -public enum LicenseType { - GPL_V1, - GPL_V2, - GPL_V3, - LGPL_V2_1, - LGPL_V3; - - public Reader getLicenceFileReader(String encoding) throws UnsupportedEncodingException { - String prefix = File.separator + "META-INF" + File.separator + "licenses" + File.separator + name().toLowerCase() + File.separator; - InputStream resource = getClass().getResourceAsStream(prefix + "license.txt"); - if (resource == null) { - throw new IllegalStateException("could not find license for " + this); - } - return new InputStreamReader(resource, encoding); - } - - public Reader getLicenceHeaderReader(String encoding) throws UnsupportedEncodingException { - String prefix = File.separator + "META-INF" + File.separator + "licenses" + File.separator + name().toLowerCase() + File.separator; - InputStream resource = getClass().getResourceAsStream(prefix + "header.txt"); - if (resource == null) { - throw new IllegalStateException("could not find license header for " + this); - } - return new InputStreamReader(resource, encoding); - } -}