Coverage Report - org.mule.util.ServerStartupSplashScreen
 
Classes in this File Line Coverage Branch Coverage Complexity
ServerStartupSplashScreen
3%
1/33
0%
0/14
4
 
 1  
 /*
 2  
  * $Id: ServerStartupSplashScreen.java 12375 2008-07-17 15:42:50Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.util;
 12  
 
 13  
 import org.mule.RegistryContext;
 14  
 import org.mule.api.MuleContext;
 15  
 import org.mule.api.agent.Agent;
 16  
 import org.mule.config.MuleManifest;
 17  
 import org.mule.config.i18n.CoreMessages;
 18  
 
 19  
 import java.net.InetAddress;
 20  
 import java.net.UnknownHostException;
 21  
 import java.util.Collection;
 22  
 import java.util.Iterator;
 23  
 import java.util.Map;
 24  
 import java.util.jar.Manifest;
 25  
 
 26  2
 public class ServerStartupSplashScreen extends SplashScreen
 27  
 {
 28  
     protected void doHeader(MuleContext context)
 29  
     {
 30  0
         String notset = CoreMessages.notSet().getMessage();
 31  
 
 32  
         // Mule Version, Timestamp, and Server ID
 33  0
         Manifest mf = MuleManifest.getManifest();
 34  0
         Map att = mf.getMainAttributes();
 35  0
         if (att.values().size() > 0)
 36  
         {
 37  0
             header.add(StringUtils.defaultString(MuleManifest.getProductDescription(), notset));
 38  0
             header.add(CoreMessages.version().getMessage() + " Build: "
 39  
                     + StringUtils.defaultString(MuleManifest.getBuildNumber(), notset));
 40  
 
 41  0
             header.add(StringUtils.defaultString(MuleManifest.getVendorName(), notset));
 42  0
             header.add(StringUtils.defaultString(MuleManifest.getProductMoreInfo(), notset));
 43  
         }
 44  
         else
 45  
         {
 46  0
             header.add(CoreMessages.versionNotSet().getMessage());
 47  
         }
 48  0
         header.add(" ");
 49  0
         if (context.getStartDate() > 0)
 50  
         {
 51  0
             header.add(CoreMessages.serverStartedAt(context.getStartDate()).getMessage());
 52  
         }
 53  0
         header.add("Server ID: " + context.getConfiguration().getId());
 54  
 
 55  
         // JDK, OS, and Host
 56  0
         header.add("JDK: " + System.getProperty("java.version") + " (" + System.getProperty("java.vm.info")
 57  
                 + ")");
 58  0
         String patch = System.getProperty("sun.os.patch.level", null);
 59  0
         header.add("OS: " + System.getProperty("os.name")
 60  
                 + (patch != null && !"unknown".equalsIgnoreCase(patch) ? " - " + patch : "") + " ("
 61  
                 + System.getProperty("os.version") + ", " + System.getProperty("os.arch") + ")");
 62  
         try
 63  
         {
 64  0
             InetAddress host = InetAddress.getLocalHost();
 65  0
             header.add("Host: " + host.getHostName() + " (" + host.getHostAddress() + ")");
 66  
         }
 67  0
         catch (UnknownHostException e)
 68  
         {
 69  
             // ignore
 70  0
         }
 71  0
         header.add(" ");
 72  0
     }
 73  
    
 74  
     protected void doFooter(MuleContext context)
 75  
     {
 76  
         // Mule Agents
 77  0
         if (!body.isEmpty())
 78  
         {
 79  0
             footer.add(" ");
 80  
         }
 81  
         //List agents
 82  0
         Collection agents = RegistryContext.getRegistry().lookupObjects(Agent.class);
 83  0
         if (agents.size() == 0)
 84  
         {
 85  0
             footer.add(CoreMessages.agentsRunning().getMessage() + " "
 86  
                     + CoreMessages.none().getMessage());
 87  
         }
 88  
         else
 89  
         {
 90  0
             footer.add(CoreMessages.agentsRunning().getMessage());
 91  
             Agent umoAgent;
 92  0
             for (Iterator iterator = agents.iterator(); iterator.hasNext();)
 93  
             {
 94  0
                 umoAgent = (Agent) iterator.next();
 95  0
                 footer.add("  " + umoAgent.getDescription());
 96  
             }
 97  
         }
 98  0
     }    
 99  
 }