1
2
3
4
5
6
7 package org.mule.util;
8
9 import org.mule.api.MuleContext;
10 import org.mule.api.agent.Agent;
11 import org.mule.config.i18n.CoreMessages;
12
13 import java.util.Collection;
14 import java.util.StringTokenizer;
15
16 public class ApplicationStartupSplashScreen extends SplashScreen
17 {
18 @Override
19 protected void doHeader(MuleContext context)
20 {
21 header.add("Application: " + context.getConfiguration().getId());
22 header.add(String.format("OS encoding: %s, Mule encoding: %s",
23 System.getProperty("file.encoding"),
24 context.getConfiguration().getDefaultEncoding()));
25 header.add(" ");
26 }
27
28 @Override
29 protected void doFooter(MuleContext context)
30 {
31
32 if (!body.isEmpty())
33 {
34 footer.add(" ");
35 }
36
37 Collection<Agent> agents = context.getRegistry().lookupObjects(Agent.class);
38 if (agents.size() == 0)
39 {
40 footer.add(CoreMessages.agentsRunning().getMessage() + " "
41 + CoreMessages.none().getMessage());
42 }
43 else
44 {
45 footer.add(CoreMessages.agentsRunning().getMessage());
46 for (Agent agent : agents)
47 {
48 String description = agent.getDescription();
49 if (description.startsWith("'''"))
50 {
51 description = description.substring("'''".length());
52
53 for (StringTokenizer st = new StringTokenizer(description, String.format("%n")); st.hasMoreTokens();)
54 {
55 footer.add(" " + st.nextToken());
56 }
57 }
58 else
59 {
60 footer.add(" " + description);
61 }
62 }
63 }
64 }
65 }