Java tutorial
/******************************************************************************* * Copyright (c) 2012-2014 Codenvy, S.A. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Codenvy, S.A. - initial API and implementation *******************************************************************************/ package com.codenvy.dev.shell.view; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.shell.plugin.support.DefaultBannerProvider; import org.springframework.stereotype.Component; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import static org.springframework.shell.support.util.OsUtils.LINE_SEPARATOR; /** @author Vladyslav Zhukovskii */ @Component @Order(Ordered.HIGHEST_PRECEDENCE) public class ShellBannerProvider extends DefaultBannerProvider { @Override public String getBanner() { return " ______ ______ _____ ______ __ __ __ __ __ __ " + LINE_SEPARATOR + "/\\ ___\\ /\\ __ \\ /\\ __-. /\\ ___\\ /\\ \"-.\\ \\ /\\ \\ / / /\\ \\_\\ \\ " + LINE_SEPARATOR + "\\ \\ \\____ \\ \\ \\/\\ \\ \\ \\ \\/\\ \\ \\ \\ __\\ \\ \\ \\-. \\ \\ \\ \\'/ \\ \\____ \\ " + LINE_SEPARATOR + " \\ \\_____\\ \\ \\_____\\ \\ \\____- \\ \\_____\\ \\ \\_\\\\\"\\_\\ \\ \\__| \\/\\_____\\ " + LINE_SEPARATOR + " \\/_____/ \\/_____/ \\/____/ \\/_____/ \\/_/ \\/_/ \\/_/ \\/_____/ " + LINE_SEPARATOR + " " + LINE_SEPARATOR + " _____ ______ __ __ " + LINE_SEPARATOR + " /\\ __-. /\\ ___\\ /\\ \\ / / " + LINE_SEPARATOR + " \\ \\ \\/\\ \\ \\ \\ __\\ \\ \\ \\'/ " + LINE_SEPARATOR + " \\ \\____- \\ \\_____\\ \\ \\__| " + LINE_SEPARATOR + " \\/____/ \\/_____/ \\/_/ " + LINE_SEPARATOR + " " + LINE_SEPARATOR + LINE_SEPARATOR + getVersion() + LINE_SEPARATOR; } @Override public String getVersion() { try (InputStream is = ClassLoader.getSystemResourceAsStream("BuildNumber.properties")) { Properties buildInfo = new Properties(); buildInfo.load(is); return String.format("v%s, %s, rev. %s", buildInfo.getProperty("version"), buildInfo.getProperty("buildTime"), buildInfo.getProperty("buildNumber")); } catch (IOException e) { return "undefined"; } } @Override public String getWelcomeMessage() { return "Hit 'help' for a list of available commands" + LINE_SEPARATOR + "and '[cmd] --help' for help on a specific command." + LINE_SEPARATOR + "Hit 'ctrl-d' or type 'exit' to exit from developer shell." + LINE_SEPARATOR; } @Override public String getProviderName() { return "ShellBannerProvider"; } }