Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Eye Candy: Add a Zanata banner when starting the app.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Munoz committed Oct 17, 2012
1 parent 93dcf90 commit 714ba95
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions zanata-war/src/main/java/org/zanata/ZanataInit.java
Expand Up @@ -70,12 +70,12 @@ public class ZanataInit
@Observer("org.jboss.seam.postInitialization")
public void initZanata() throws Exception
{
log.info(">>>>>>>>>>>> Starting Zanata...");

ServletContext servletContext = ServletLifecycle.getCurrentServletContext();
String appServerHome = servletContext.getRealPath("/");

File manifestFile = new File(appServerHome, "META-INF/MANIFEST.MF");
String version = "UNKOWN";
String buildTimestamp = "UNKOWN";

if (manifestFile.canRead())
{
Expand All @@ -92,8 +92,8 @@ public void initZanata() throws Exception

Attributes atts = mf.getMainAttributes();

String version = atts.getValue("Implementation-Version");
String buildTimestamp = atts.getValue("Implementation-Build");
version = atts.getValue("Implementation-Version");
buildTimestamp = atts.getValue("Implementation-Build");

if (version == null)
{
Expand All @@ -105,10 +105,11 @@ public void initZanata() throws Exception
}
this.applicationConfiguration.setVersion( version );
this.applicationConfiguration.setBuildTimestamp( buildTimestamp );

log.info("Server version: {}", version);
log.info("Server build: {}", buildTimestamp);

}

this.logBanner(version, buildTimestamp);

if (this.applicationConfiguration.isDebug())
{
log.info("debug: enabled");
Expand Down Expand Up @@ -324,4 +325,18 @@ else if (verbose)
buffer.append("error while listing context ").append(ctx.toString()).append(": ").append(ne.toString(true));
}
}

private void logBanner(final String version, final String build)
{
log.info( "============================================");
log.info( " _____ _ ");
log.info( " |__ /__ _ _ __ __ _| |_ __ _ ");
log.info( " / // _' | '_ \\ / _' | __/ _' | ");
log.info( " / /| (_| | | | | (_| | || (_| | ");
log.info( " /____\\__,_|_| |_|\\__,_|\\__\\__,_| ");
log.info( " ");
log.info( " version " + version + ", build " + build);
log.info( " Red Hat Inc 2012" );
log.info( "============================================");
}
}

0 comments on commit 714ba95

Please sign in to comment.