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