Merge "Bump transportpce-models upstream dependency"
[transportpce.git] / lighty / src / main / java / io / lighty / controllers / tpce / utils / TpceBanner.java
1 /*
2  * Copyright © 2020 Orange, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package io.lighty.controllers.tpce.utils;
9
10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory;
12
13 public final class TpceBanner {
14
15     private static final String[] BANNER = {
16         " ___________     ___________________ ___________",
17         " \\__    ___/     \\______   \\_   ___ \\\\_   _____/",
18         "   |    |  ______ |     ___/    \\  \\/ |    __)_",
19         "   |    | /_____/ |    |   \\     \\____|        \\",
20         "   |____|         |____|    \\______  /_______  /",
21         "                                   \\/        \\/",
22         ".__  .__       .__     __              .__          ",
23         "|  | |__| ____ |  |___/  |_ ___.__.    |__| ____    ",
24         "|  | |  |/ ___\\|  |  \\   __<   |  |    |  |/  _ \\",
25         "|  |_|  / /_/  >   Y  \\  |  \\___  |    |  (  <_> )",
26         "|____/__\\___  /|___|  /__|  / ____| /\\ |__|\\____/",
27         "/_____/     \\/      \\/      \\/           ",
28         "Starting lighty.io TransportPCE application ...",
29         "https://lighty.io/",
30         "https://github.com/PantheonTechnologies/lighty-core" };
31
32     private static final Logger LOG = LoggerFactory.getLogger(TpceBanner.class);
33
34     /**
35      * Private constructor.
36      */
37     private TpceBanner() {
38
39     }
40
41     public static void print() {
42         for (String line : BANNER) {
43             LOG.info(line);
44         }
45         LOG.info(":: Version :: {}", getVersion());
46     }
47
48     private static String getVersion() {
49         Package tpcePackage = TpceBanner.class.getPackage();
50         if (tpcePackage != null && tpcePackage.getImplementationVersion() != null) {
51             return tpcePackage.getImplementationVersion();
52         }
53         return "not defined";
54     }
55
56 }