All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.plantuml.version.License Maven / Gradle / Ivy

There is a newer version: 1.2024.8
Show newest version
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
/* +=======================================================================
 * |
 * |      PlantUML : a free UML diagram generator
 * |
 * +=======================================================================
 *
 * (C) Copyright 2009-2024, Arnaud Roques
 *
 * Project Info:  https://plantuml.com
 *
 * If you like this project or if you find it useful, you can support us at:
 *
 * https://plantuml.com/patreon (only 1$ per month!)
 * https://plantuml.com/liberapay (only 1€ per month!)
 * https://plantuml.com/paypal
 *
 *
 * PlantUML is free software; you can redistribute it and/or modify it
 * under the terms of the Eclipse Public License.
 *
 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
 *
 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
 *
 * You may obtain a copy of the License at
 *
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * PlantUML can occasionally display sponsored or advertising messages. Those
 * messages are usually generated on welcome or error images and never on
 * functional diagrams.
 * See https://plantuml.com/professional if you want to remove them
 *
 * Images (whatever their format : PNG, SVG, EPS...) generated by running PlantUML
 * are owned by the author of their corresponding sources code (that is, their
 * textual description in PlantUML language). Those images are not covered by
 * this EPL license.
 *
 * The generated images can then be used without any reference to the EPL license.
 * It is not even necessary to stipulate that they have been generated with PlantUML,
 * although this will be appreciated by the PlantUML team.
 *
 * There is an exception : if the textual description in PlantUML language is also covered
 * by any license, then the generated images are logically covered
 * by the very same license.
 *
 * This is the IGY distribution (Install GraphViz by Yourself).
 * You have to install GraphViz and to setup the GRAPHVIZ_DOT environment variable
 * (see https://plantuml.com/graphviz-dot )
 *
 * Icons provided by OpenIconic :  https://useiconic.com/open
 * Archimate sprites provided by Archi :  http://www.archimatetool.com
 * Stdlib AWS provided by https://github.com/milo-minderbinder/AWS-PlantUML
 * Stdlib Icons provided https://github.com/tupadr3/plantuml-icon-font-sprites
 * ASCIIMathML (c) Peter Jipsen http://www.chapman.edu/~jipsen
 * ASCIIMathML (c) David Lippman http://www.pierce.ctc.edu/dlippman
 * CafeUndZopfli ported by Eugene Klyuchnikov https://github.com/eustas/CafeUndZopfli
 * Brotli (c) by the Brotli Authors https://github.com/google/brotli
 * Themes (c) by Brett Schwarz https://github.com/bschwarz/puml-themes
 * Twemoji (c) by Twitter at https://twemoji.twitter.com/
 *
 */
package net.sourceforge.plantuml.version;

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.List;

import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.windowsdot.WindowsDotArchive;

public class License {

	public static void main(String[] args) {
		List lines = License.getCurrent().getTextFull();
		for (int line = 0; line < lines.size(); line++) {
			if (line == 0) {
				System.out.print("/* ");
			} else {
				System.out.print(" * ");
			}
			System.out.println(lines.get(line));
		}
		System.out.println(" */");
	}

	@Override
	public String toString() {
		// ::uncomment when __CORE__ or __MIT__
		// return "MIT";
		 return "EPL";
		// ::uncomment when __BSD__
		// return "BSD";
		// ::uncomment when __ASL__
		// return "APACHE";
		// ::uncomment when __LGPL__
		// return "LGPL";
	}

	public static License getCurrent() {
		return new License();
	}

	public List getTextFull() {
		final List text = new ArrayList<>();
		final LicenseInfo licenseInfo = LicenseInfo.retrieveQuick();
		header1(text, licenseInfo);
		header2(text, licenseInfo, false);
		end3(licenseInfo, text);
		return text;
	}

	public List getText1(LicenseInfo licenseInfo) {
		final List text = new ArrayList<>();
		header1(text, licenseInfo);
		return text;
	}

	public List getText2(LicenseInfo licenseInfo) {
		final List text = new ArrayList<>();
		header2(text, licenseInfo, true);
		end3(licenseInfo, text);
		return text;
	}

	private void header1(final List text, LicenseInfo licenseInfo) {

		// ::comment when __CORE__
		if (licenseInfo.isNone()) {
			text.add("+=======================================================================");
			text.add("| ");
			text.add("|      PlantUML : a free UML diagram generator");
			text.add("| ");
			text.add("+=======================================================================");
			// ::comment when __CORE__
		} else {
			text.add("+=======================================================================");
			text.add("| ");
			text.add("|      PlantUML Professional Edition");
			text.add("| ");
			text.add("+=======================================================================");
			addLicenseInfo(text, licenseInfo);
			text.add("+=======================================================================");
		}
	}

	private void header2(final List text, LicenseInfo licenseInfo, boolean withQrcode) {
		text.add(" ");
		text.add("(C) Copyright 2009-2024, Arnaud Roques");
		text.add(" ");
		text.add("Project Info:  https://plantuml.com");
		text.add(" ");

		if (licenseInfo.isValid() == false) {
			text.add("If you like this project or if you find it useful, you can support us at:");
			text.add(" ");
			text.add("https://plantuml.com/patreon (only 1$ per month!)");
			text.add("https://plantuml.com/liberapay (only 1\u20ac per month!)");
			text.add("https://plantuml.com/paypal");
			// ::comment when __CORE__
			if (withQrcode) {
				text.add(
						"\t\t\t\t\t");
			} else {
				text.add("");
				text.add(" ");
				// ::comment when __CORE__
			}
		}
	}

	private void end3(final LicenseInfo licenseInfo, final List text) {

		// ::uncomment when __CORE__
		// addCore(licenseInfo, text);
		// ::uncomment when __MIT__
		// addMit(licenseInfo, text);
		 addEpl(licenseInfo, text);
		// ::uncomment when __BSD__
		// addBsd(licenseInfo, text);
		// ::uncomment when __ASL__
		// addApache(licenseInfo, text);
		// ::uncomment when __LGPL__
		// addLgpl(licenseInfo, text);

		text.add(" ");
		if (licenseInfo.isValid() == false) {
			text.add("PlantUML can occasionally display sponsored or advertising messages. Those");
			text.add("messages are usually generated on welcome or error images and never on");
			text.add("functional diagrams.");
			text.add("See https://plantuml.com/professional if you want to remove them");
			text.add(" ");
		}

		text.add("Images (whatever their format : PNG, SVG, EPS...) generated by running PlantUML");
		text.add("are owned by the author of their corresponding sources code (that is, their");
		text.add("textual description in PlantUML language). Those images are not covered by");
		text.add("this " + this + " license.");
		text.add(" ");
		text.add("The generated images can then be used without any reference to the " + this + " license.");
		text.add("It is not even necessary to stipulate that they have been generated with PlantUML,");
		text.add("although this will be appreciated by the PlantUML team.");
		text.add(" ");
		text.add("There is an exception : if the textual description in PlantUML language is also covered");
		text.add("by any license, then the generated images are logically covered");
		text.add("by the very same license.");

		// ::comment when __CORE__
		if (OptionFlags.getInstance().isEnableStats()) {
			text.add(" ");
			text.add("This version of PlantUML records general local statistics about usage.");
			text.add("(more info on https://plantuml.com/statistics-report)");
		}
		text.add(" ");
		if (WindowsDotArchive.getInstance().isThereArchive()) {
			text.add("This distribution bundles a minimal set of GraphViz files and may install them");
			text.add(" if needed in the local temporary directory.");
		} else {
			text.add("This is the IGY distribution (Install GraphViz by Yourself).");
			text.add("You have to install GraphViz and to setup the GRAPHVIZ_DOT environment variable");
		}
		text.add("(see https://plantuml.com/graphviz-dot )");
		text.add(" ");
		text.add("Icons provided by OpenIconic :  https://useiconic.com/open");
		text.add("Archimate sprites provided by Archi :  http://www.archimatetool.com");
		text.add("Stdlib AWS provided by https://github.com/milo-minderbinder/AWS-PlantUML");
		text.add("Stdlib Icons provided https://github.com/tupadr3/plantuml-icon-font-sprites");
		text.add("ASCIIMathML (c) Peter Jipsen http://www.chapman.edu/~jipsen");
		text.add("ASCIIMathML (c) David Lippman http://www.pierce.ctc.edu/dlippman");
		text.add("CafeUndZopfli ported by Eugene Klyuchnikov https://github.com/eustas/CafeUndZopfli");
		text.add("Brotli (c) by the Brotli Authors https://github.com/google/brotli");
		text.add("Themes (c) by Brett Schwarz https://github.com/bschwarz/puml-themes");
		text.add("Twemoji (c) by Twitter at https://twemoji.twitter.com/");
		text.add(" ");
	}

// ::uncomment when __CORE__
//	private void addCore(final LicenseInfo licenseInfo, final List text) {
//		text.add("Powered by CheerpJ, a Leaning Technologies Java tool.");
//		text.add("This library is running using CheerpJ for PlantUML License provided by Leaning Technologies Limited.");
//		text.add(" ");
//		text.add(" ");
//		text.add("PlantUML is free software; you can redistribute it and/or modify it");
//		text.add("under the terms of the MIT License.");
//		text.add(" ");
//		text.add("See http://opensource.org/licenses/MIT");
//		text.add(" ");
//		text.add("Permission is hereby granted, free of charge, to any person obtaining");
//		text.add("a copy of this software and associated documentation files (the \"Software\"),");
//		text.add("to deal in the Software without restriction, including without limitation");
//		text.add("the rights to use, copy, modify, merge, publish, distribute, sublicense,");
//		text.add("and/or sell copies of the Software, and to permit persons to whom the");
//		text.add("Software is furnished to do so, subject to the following conditions:");
//		text.add(" ");
//		text.add("The above copyright notice and this permission notice shall be included");
//		text.add("in all copies or substantial portions of the Software.");
//		text.add(" ");
//		text.add("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS");
//		text.add("OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,");
//		text.add("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE");
//		text.add("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,");
//		text.add("WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR");
//		text.add("IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.");
//	}

// ::uncomment when __MIT__
//	private void addMit(final LicenseInfo licenseInfo, final List text) {
//		text.add("PlantUML is free software; you can redistribute it and/or modify it");
//		text.add("under the terms of the MIT License.");
//		text.add(" ");
//		text.add("See http://opensource.org/licenses/MIT");
//		text.add(" ");
//		text.add("Permission is hereby granted, free of charge, to any person obtaining");
//		text.add("a copy of this software and associated documentation files (the \"Software\"),");
//		text.add("to deal in the Software without restriction, including without limitation");
//		text.add("the rights to use, copy, modify, merge, publish, distribute, sublicense,");
//		text.add("and/or sell copies of the Software, and to permit persons to whom the");
//		text.add("Software is furnished to do so, subject to the following conditions:");
//		text.add(" ");
//		text.add("The above copyright notice and this permission notice shall be included");
//		text.add("in all copies or substantial portions of the Software.");
//		text.add(" ");
//		text.add("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS");
//		text.add("OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,");
//		text.add("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE");
//		text.add("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,");
//		text.add("WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR");
//		text.add("IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.");
//	}

	private void addEpl(final LicenseInfo licenseInfo, final List text) {
		text.add("PlantUML is free software; you can redistribute it and/or modify it");
		text.add("under the terms of the Eclipse Public License.");
		text.add(" ");
		text.add("THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC");
		text.add("LICENSE (\"AGREEMENT\"). [Eclipse Public License - v 1.0]");
		text.add(" ");
		text.add("ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES");
		text.add("RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.");
		text.add(" ");
		text.add("You may obtain a copy of the License at");
		text.add(" ");
		text.add("http://www.eclipse.org/legal/epl-v10.html");
		text.add(" ");
		text.add("Unless required by applicable law or agreed to in writing, software");
		text.add("distributed under the License is distributed on an \"AS IS\" BASIS,");
		text.add("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
		text.add("See the License for the specific language governing permissions and");
		text.add("limitations under the License.");
	}

// ::uncomment when __BSD__
//	private void addBsd(final LicenseInfo licenseInfo, final List text) {
//		text.add("PlantUML is free software; you can redistribute it and/or modify it");
//		text.add("under the terms of the Revised BSD License.");
//		text.add(" ");
//		text.add("All rights reserved.");
//		text.add("Redistribution and use in source and binary forms, with or without");
//		text.add("modification, are permitted provided that the following conditions are met:");
//		text.add(" ");
//		text.add("* Redistributions of source code must retain the above copyright");
//		text.add("  notice, this list of conditions and the following disclaimer.");
//		text.add("* Redistributions in binary form must reproduce the above copyright");
//		text.add("  notice, this list of conditions and the following disclaimer in the");
//		text.add("  documentation and/or other materials provided with the distribution.");
//		text.add("* Neither the name of the University of California, Berkeley nor the");
//		text.add("  names of its contributors may be used to endorse or promote products");
//		text.add("  derived from this software without specific prior written permission.");
//		text.add(" ");
//		text.add("THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY");
//		text.add("EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED");
//		text.add("WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE");
//		text.add("DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY");
//		text.add("DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES");
//		text.add("(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;");
//		text.add("LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND");
//		text.add("ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT");
//		text.add("(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS");
//		text.add("SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.");
//	}

// ::uncomment when __ASL__
//	private void addApache(final LicenseInfo licenseInfo, final List text) {
//		text.add("PlantUML is free software; you can redistribute it and/or modify it");
//		text.add("under the terms of the Apache Software License.");
//		text.add(" ");
//		text.add("Licensed under the Apache License, Version 2.0 (the \"License\");");
//		text.add("you may not use this file except in compliance with the License.");
//		text.add("You may obtain a copy of the License at");
//		text.add(" ");
//		text.add("http://www.apache.org/licenses/LICENSE-2.0");
//		text.add(" ");
//		text.add("Unless required by applicable law or agreed to in writing, software");
//		text.add("distributed under the License is distributed on an \"AS IS\" BASIS,");
//		text.add("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
//		text.add("See the License for the specific language governing permissions and");
//		text.add("limitations under the License.");
//	}

// ::uncomment when __LGPL__
//	private void addLgpl(final LicenseInfo licenseInfo, final List text) {
//		text.add("PlantUML is free software; you can redistribute it and/or modify it");
//		text.add("under the terms of the GNU Lesser General Public License as published by");
//		text.add("the Free Software Foundation, either version 3 of the License, or");
//		text.add("(at your option) any later version.");
//		text.add(" ");
//		text.add("PlantUML distributed in the hope that it will be useful, but");
//		text.add("WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY");
//		text.add("or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public");
//		text.add("License for more details.");
//		text.add(" ");
//		text.add("You should have received a copy of the GNU Lesser General Public License");
//		text.add("along with this library.  If not, see .");
//	}

	public static void addLicenseInfo(final List text, LicenseInfo licenseInfo) {
		if (licenseInfo.getLicenseType() == LicenseType.NAMED) {
			text.add("| ");
			text.add("|      LICENSED TO : " + licenseInfo.getOwner());
			text.add(
					"|      EXPIRATION DATE : " + DateFormat.getDateInstance().format(licenseInfo.getExpirationDate()));
			text.add("|  ");
		} else if (licenseInfo.getLicenseType() == LicenseType.DISTRIBUTOR) {
			text.add("|  ");
			text.add("|      DISTRIBUTED BY : " + licenseInfo.getOwner());
			text.add("|  ");
		}
		if (licenseInfo.getLicenseType() != LicenseType.UNKNOWN && licenseInfo.hasExpired()) {
			text.add("|      Warning: Your license has expired.");
			text.add("|  ");
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy