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