source: trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/MFCReplayDecorator.java @ 927

Last change on this file since 927 was 927, checked in by sherbold, 12 years ago
  • added copyright under the Apache License, Version 2.0
  • Property svn:mime-type set to text/plain
File size: 2.6 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest.plugin.mfc;
16
17import de.ugoe.cs.autoquest.IReplayDecorator;
18import de.ugoe.cs.util.StringTools;
19
20/**
21 * <p>
22 * {@link IReplayDecorator} for replay generated for EventBench's MFCReplay tool.
23 * </p>
24 *
25 * @author Steffen Herbold
26 * @version 1.0
27 */
28public class MFCReplayDecorator implements IReplayDecorator {
29
30        /**
31         * <p>
32         * Id for object serialization.
33         * </p>
34         */
35        private static final long serialVersionUID = 1L;
36
37        /**
38         * <p>
39         * The instance of the {@link MFCReplayDecorator} (implemented as
40         * singleton).
41         * </p>
42         */
43        transient private static MFCReplayDecorator theInstance;
44
45        /**
46         * <p>
47         * Constructor. Private to guarantee that only one instance of the replay
48         * generator exists.
49         * </p>
50         */
51        private MFCReplayDecorator() {
52        };
53
54        /**
55         * <p>
56         * Returns the instance of the MFCReplayDecorator.
57         * </p>
58         *
59         * @return instance of the MFCReplayDecorator.
60         */
61        public static MFCReplayDecorator getInstance() {
62                if (theInstance == null) {
63                        theInstance = new MFCReplayDecorator();
64                }
65                return theInstance;
66        }
67
68        /*
69         * (non-Javadoc)
70         *
71         * @see de.ugoe.cs.autoquest.IReplayDecorator#getHeader()
72         */
73        @Override
74        public String getHeader() {
75                return "<?xml version=\"1.0\" encoding=\"UTF-16\"?>"
76                                + StringTools.ENDLINE + "<log>" + StringTools.ENDLINE;
77
78        }
79
80        /*
81         * (non-Javadoc)
82         *
83         * @see de.ugoe.cs.autoquest.IReplayDecorator#getFooter()
84         */
85        @Override
86        public String getFooter() {
87                return "</log>" + StringTools.ENDLINE;
88        }
89
90        /*
91         * (non-Javadoc)
92         *
93         * @see de.ugoe.cs.autoquest.IReplayDecorator#getSessionHeader(int)
94         */
95        @Override
96        public String getSessionHeader(int sessionId) {
97                return " <session id=\"" + sessionId + "\">" + StringTools.ENDLINE;
98        }
99
100        /*
101         * (non-Javadoc)
102         *
103         * @see de.ugoe.cs.autoquest.IReplayDecorator#getSessionFooter(int)
104         */
105        @Override
106        public String getSessionFooter(int sessionId) {
107                return " </session>" + StringTools.ENDLINE;
108        }
109
110}
Note: See TracBrowser for help on using the repository browser.