source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/data/WebEvent.java

Last change on this file was 300, checked in by sherbold, 13 years ago
  • added command parseJFC for parsing log files created with the JFCMonitor
  • added de.ugoe.cs.eventbench.jfc.JFCLogParser for parsing of log files created with the JFCMonitor
  • added de.ugoe.cs.eventbench.jfc.data.JFCEvent for working with JFC events
  • Property svn:mime-type set to text/plain
File size: 2.5 KB
RevLine 
[51]1package de.ugoe.cs.eventbench.web.data;
2
[53]3import java.util.List;
[51]4
[53]5import de.ugoe.cs.eventbench.data.ReplayableEvent;
[51]6
[171]7/**
8 * <p>
9 * This class defines web events (of PHP-based web applications).
10 * </p>
11 *
12 * @author Steffen Herbold
13 * @version 1.0
14 *
15 */
[53]16public class WebEvent extends ReplayableEvent<WebRequest> {
17
[87]18        private static final long serialVersionUID = 1L;
[171]19
20        /**
[300]21         * <p>
[171]22         * Timestamp of the event.
[300]23         * </p>
[171]24         */
[51]25        private final long timestamp;
[171]26
27        /**
28         * <p>
29         * Helper method that generates the type of the event based on the of the
30         * URI, the POST variables, and the GET variables.
31         * </p>
32         *
33         * @param path
34         *            path of the URI of the event
35         * @param postVars
36         *            POST variables send with the event
37         * @param getVars
38         *            GET variables send with the event
39         * @return type of the event
40         */
41        private final static String makeType(String path, List<String> postVars,
42                        List<String> getVars) {
[111]43                String type = path;
[171]44                if (getVars != null && !getVars.isEmpty()) {
45                        type += "+GET" + getVars.toString().replace(" ", "");
[111]46                }
[171]47                if (postVars != null && !postVars.isEmpty()) {
48                        type += "+POST" + postVars.toString().replace(" ", "");
[53]49                }
50                return type;
51        }
[171]52
53        /**
54         * <p>
55         * Constructor. Creates a new WebEvent.
56         * </p>
57         *
[225]58         * @param url
59         *            URL of the server that received the event
[171]60         * @param path
61         *            path of the URI
62         * @param timestamp
63         *            timestamp of when the event took place
64         * @param postVars
65         *            POST variables send with the event
66         * @param getVars
67         *            GET variables send with the event
68         */
[225]69        public WebEvent(String url, String path, long timestamp,
70                        List<String> postVars, List<String> getVars) {
[111]71                super(makeType(path, postVars, getVars));
[51]72                this.timestamp = timestamp;
[231]73                super.setTarget(path);
[225]74                addReplayEvent(new WebRequest(url, path, postVars, getVars));
[51]75        }
[171]76
77        /**
78         * <p>
79         * Returns the timestamp of the event.
80         * </p>
81         *
82         * @return timestamp of th event
83         */
[51]84        public long getTimestamp() {
85                return timestamp;
86        }
87
[284]88        /*
89         * (non-Javadoc)
90         *
91         * @see de.ugoe.cs.eventbench.data.ReplayableEvent#equals(java.lang.Object)
92         */
93        @Override
94        public boolean equals(Object other) {
95                return super.equals(other);
96        }
97
98        /*
99         * (non-Javadoc)
100         *
101         * @see de.ugoe.cs.eventbench.data.ReplayableEvent#hashCode()
102         */
103        @Override
104        public int hashCode() {
105                return super.hashCode();
106        }
107
[51]108}
Note: See TracBrowser for help on using the repository browser.