1 | package de.ugoe.cs.quest.plugin.mfc;
|
---|
2 |
|
---|
3 | import de.ugoe.cs.quest.IReplayDecorator;
|
---|
4 | import de.ugoe.cs.util.StringTools;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * <p>
|
---|
8 | * {@link IReplayDecorator} for replay generated for EventBench's MFCReplay tool.
|
---|
9 | * </p>
|
---|
10 | *
|
---|
11 | * @author Steffen Herbold
|
---|
12 | * @version 1.0
|
---|
13 | */
|
---|
14 | public class MFCReplayDecorator implements IReplayDecorator {
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * <p>
|
---|
18 | * Id for object serialization.
|
---|
19 | * </p>
|
---|
20 | */
|
---|
21 | private static final long serialVersionUID = 1L;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * <p>
|
---|
25 | * The instance of the {@link MFCReplayDecorator} (implemented as
|
---|
26 | * singleton).
|
---|
27 | * </p>
|
---|
28 | */
|
---|
29 | transient private static MFCReplayDecorator theInstance;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * <p>
|
---|
33 | * Constructor. Private to guarantee that only one instance of the replay
|
---|
34 | * generator exists.
|
---|
35 | * </p>
|
---|
36 | */
|
---|
37 | private MFCReplayDecorator() {
|
---|
38 | };
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * <p>
|
---|
42 | * Returns the instance of the MFCReplayDecorator.
|
---|
43 | * </p>
|
---|
44 | *
|
---|
45 | * @return instance of the MFCReplayDecorator.
|
---|
46 | */
|
---|
47 | public static MFCReplayDecorator getInstance() {
|
---|
48 | if (theInstance == null) {
|
---|
49 | theInstance = new MFCReplayDecorator();
|
---|
50 | }
|
---|
51 | return theInstance;
|
---|
52 | }
|
---|
53 |
|
---|
54 | /*
|
---|
55 | * (non-Javadoc)
|
---|
56 | *
|
---|
57 | * @see de.ugoe.cs.quest.IReplayDecorator#getHeader()
|
---|
58 | */
|
---|
59 | @Override
|
---|
60 | public String getHeader() {
|
---|
61 | return "<?xml version=\"1.0\" encoding=\"UTF-16\"?>"
|
---|
62 | + StringTools.ENDLINE + "<log>" + StringTools.ENDLINE;
|
---|
63 |
|
---|
64 | }
|
---|
65 |
|
---|
66 | /*
|
---|
67 | * (non-Javadoc)
|
---|
68 | *
|
---|
69 | * @see de.ugoe.cs.quest.IReplayDecorator#getFooter()
|
---|
70 | */
|
---|
71 | @Override
|
---|
72 | public String getFooter() {
|
---|
73 | return "</log>" + StringTools.ENDLINE;
|
---|
74 | }
|
---|
75 |
|
---|
76 | /*
|
---|
77 | * (non-Javadoc)
|
---|
78 | *
|
---|
79 | * @see de.ugoe.cs.quest.IReplayDecorator#getSessionHeader(int)
|
---|
80 | */
|
---|
81 | @Override
|
---|
82 | public String getSessionHeader(int sessionId) {
|
---|
83 | return " <session id=\"" + sessionId + "\">" + StringTools.ENDLINE;
|
---|
84 | }
|
---|
85 |
|
---|
86 | /*
|
---|
87 | * (non-Javadoc)
|
---|
88 | *
|
---|
89 | * @see de.ugoe.cs.quest.IReplayDecorator#getSessionFooter(int)
|
---|
90 | */
|
---|
91 | @Override
|
---|
92 | public String getSessionFooter(int sessionId) {
|
---|
93 | return " </session>" + StringTools.ENDLINE;
|
---|
94 | }
|
---|
95 |
|
---|
96 | }
|
---|