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

Last change on this file since 2146 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
RevLine 
[927]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
[922]15package de.ugoe.cs.autoquest.plugin.mfc;
[58]16
[922]17import de.ugoe.cs.autoquest.IReplayDecorator;
[58]18import de.ugoe.cs.util.StringTools;
19
[171]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 */
[58]28public class MFCReplayDecorator implements IReplayDecorator {
29
[87]30        /**
[171]31         * <p>
[87]32         * Id for object serialization.
[171]33         * </p>
[87]34         */
35        private static final long serialVersionUID = 1L;
[171]36
37        /**
38         * <p>
39         * The instance of the {@link MFCReplayDecorator} (implemented as
40         * singleton).
41         * </p>
42         */
[87]43        transient private static MFCReplayDecorator theInstance;
[171]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         */
[58]61        public static MFCReplayDecorator getInstance() {
[171]62                if (theInstance == null) {
[58]63                        theInstance = new MFCReplayDecorator();
64                }
65                return theInstance;
66        }
[171]67
68        /*
69         * (non-Javadoc)
70         *
[922]71         * @see de.ugoe.cs.autoquest.IReplayDecorator#getHeader()
[171]72         */
[58]73        @Override
74        public String getHeader() {
[171]75                return "<?xml version=\"1.0\" encoding=\"UTF-16\"?>"
76                                + StringTools.ENDLINE + "<log>" + StringTools.ENDLINE;
77
[58]78        }
79
[171]80        /*
81         * (non-Javadoc)
82         *
[922]83         * @see de.ugoe.cs.autoquest.IReplayDecorator#getFooter()
[171]84         */
[58]85        @Override
86        public String getFooter() {
87                return "</log>" + StringTools.ENDLINE;
88        }
89
[171]90        /*
91         * (non-Javadoc)
92         *
[922]93         * @see de.ugoe.cs.autoquest.IReplayDecorator#getSessionHeader(int)
[171]94         */
[58]95        @Override
[98]96        public String getSessionHeader(int sessionId) {
[171]97                return " <session id=\"" + sessionId + "\">" + StringTools.ENDLINE;
[58]98        }
99
[171]100        /*
101         * (non-Javadoc)
102         *
[922]103         * @see de.ugoe.cs.autoquest.IReplayDecorator#getSessionFooter(int)
[171]104         */
[58]105        @Override
[98]106        public String getSessionFooter(int sessionId) {
[58]107                return " </session>" + StringTools.ENDLINE;
108        }
109
110}
Note: See TracBrowser for help on using the repository browser.