1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.launcher;
12
13 import org.mule.api.MuleContext;
14 import org.mule.api.agent.Agent;
15 import org.mule.config.MuleManifest;
16 import org.mule.config.i18n.CoreMessages;
17 import org.mule.util.SplashScreen;
18 import org.mule.util.StringUtils;
19
20 import java.net.InetAddress;
21 import java.net.UnknownHostException;
22 import java.util.Collection;
23 import java.util.Iterator;
24 import java.util.Map;
25 import java.util.jar.Manifest;
26
27 public class MuleContainerStartupSplashScreen extends SplashScreen
28 {
29 public void doBody()
30 {
31 String notset = CoreMessages.notSet().getMessage();
32
33
34 Manifest mf = MuleManifest.getManifest();
35 Map att = mf.getMainAttributes();
36 if (att.values().size() > 0)
37 {
38 doBody(StringUtils.defaultString(MuleManifest.getProductDescription(), notset));
39 doBody(String.format("%s Build: %s",
40 CoreMessages.version().getMessage(),
41 StringUtils.defaultString(MuleManifest.getBuildNumber(), notset)));
42
43 doBody(StringUtils.defaultString(MuleManifest.getVendorName(), notset));
44 doBody(StringUtils.defaultString(MuleManifest.getProductMoreInfo(), notset));
45 }
46 else
47 {
48 doBody(CoreMessages.versionNotSet().getMessage());
49 }
50 doBody(" ");
51
52
53 doBody(CoreMessages.serverStartedAt(System.currentTimeMillis()).getMessage());
54
55 doBody(String.format("JDK: %s (%s)",
56 System.getProperty("java.version"),
57 System.getProperty("java.vm.info")));
58
59 String patch = System.getProperty("sun.os.patch.level", null);
60
61 doBody(String.format("OS: %s%s (%s, %s)",
62 System.getProperty("os.name"),
63 (patch != null && !"unknown".equalsIgnoreCase(patch) ? " - " + patch : ""),
64 System.getProperty("os.version"),
65 System.getProperty("os.arch")));
66 try
67 {
68 InetAddress host = InetAddress.getLocalHost();
69 doBody(String.format("Host: %s (%s)", host.getHostName(), host.getHostAddress()));
70 }
71 catch (UnknownHostException e)
72 {
73
74 }
75 }
76
77 protected void doFooter(MuleContext context)
78 {
79
80 if (!body.isEmpty())
81 {
82 footer.add(" ");
83 }
84
85 Collection agents = context.getRegistry().lookupObjects(Agent.class);
86 if (agents.size() == 0)
87 {
88 footer.add(CoreMessages.agentsRunning().getMessage() + " "
89 + CoreMessages.none().getMessage());
90 }
91 else
92 {
93 footer.add(CoreMessages.agentsRunning().getMessage());
94 Agent agent;
95 for (Iterator iterator = agents.iterator(); iterator.hasNext();)
96 {
97 agent = (Agent) iterator.next();
98 footer.add(" " + agent.getDescription());
99 }
100 }
101 }
102 }