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 | 0 | public class MuleContainerStartupSplashScreen extends SplashScreen |
28 | |
{ |
29 | |
public void doBody() |
30 | |
{ |
31 | 0 | String notset = CoreMessages.notSet().getMessage(); |
32 | |
|
33 | |
|
34 | 0 | Manifest mf = MuleManifest.getManifest(); |
35 | 0 | Map att = mf.getMainAttributes(); |
36 | 0 | if (att.values().size() > 0) |
37 | |
{ |
38 | 0 | doBody(StringUtils.defaultString(MuleManifest.getProductDescription(), notset)); |
39 | 0 | doBody(String.format("%s Build: %s", |
40 | |
CoreMessages.version().getMessage(), |
41 | |
StringUtils.defaultString(MuleManifest.getBuildNumber(), notset))); |
42 | |
|
43 | 0 | doBody(StringUtils.defaultString(MuleManifest.getVendorName(), notset)); |
44 | 0 | doBody(StringUtils.defaultString(MuleManifest.getProductMoreInfo(), notset)); |
45 | |
} |
46 | |
else |
47 | |
{ |
48 | 0 | doBody(CoreMessages.versionNotSet().getMessage()); |
49 | |
} |
50 | 0 | doBody(" "); |
51 | |
|
52 | |
|
53 | 0 | doBody(CoreMessages.serverStartedAt(System.currentTimeMillis()).getMessage()); |
54 | |
|
55 | 0 | doBody(String.format("JDK: %s (%s)", |
56 | |
System.getProperty("java.version"), |
57 | |
System.getProperty("java.vm.info"))); |
58 | |
|
59 | 0 | String patch = System.getProperty("sun.os.patch.level", null); |
60 | |
|
61 | 0 | 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 | 0 | InetAddress host = InetAddress.getLocalHost(); |
69 | 0 | doBody(String.format("Host: %s (%s)", host.getHostName(), host.getHostAddress())); |
70 | |
} |
71 | 0 | catch (UnknownHostException e) |
72 | |
{ |
73 | |
|
74 | 0 | } |
75 | 0 | } |
76 | |
|
77 | |
protected void doFooter(MuleContext context) |
78 | |
{ |
79 | |
|
80 | 0 | if (!body.isEmpty()) |
81 | |
{ |
82 | 0 | footer.add(" "); |
83 | |
} |
84 | |
|
85 | 0 | Collection agents = context.getRegistry().lookupObjects(Agent.class); |
86 | 0 | if (agents.size() == 0) |
87 | |
{ |
88 | 0 | footer.add(CoreMessages.agentsRunning().getMessage() + " " |
89 | |
+ CoreMessages.none().getMessage()); |
90 | |
} |
91 | |
else |
92 | |
{ |
93 | 0 | footer.add(CoreMessages.agentsRunning().getMessage()); |
94 | |
Agent agent; |
95 | 0 | for (Iterator iterator = agents.iterator(); iterator.hasNext();) |
96 | |
{ |
97 | 0 | agent = (Agent) iterator.next(); |
98 | 0 | footer.add(" " + agent.getDescription()); |
99 | |
} |
100 | |
} |
101 | 0 | } |
102 | |
} |