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