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