- Timestamp:
- 09/09/11 06:23:36 (13 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/data/WebEvent.java
r111 r171 5 5 import de.ugoe.cs.eventbench.data.ReplayableEvent; 6 6 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 */ 7 16 public class WebEvent extends ReplayableEvent<WebRequest> { 8 17 … … 13 22 */ 14 23 private static final long serialVersionUID = 1L; 15 24 25 /** 26 * Timestamp of the event. 27 */ 16 28 private final long timestamp; 17 18 19 private final static String makeType(String path, List<String> postVars, List<String> getVars) { 29 30 /** 31 * <p> 32 * Helper method that generates the type of the event based on the of the 33 * URI, the POST variables, and the GET variables. 34 * </p> 35 * 36 * @param path 37 * path of the URI of the event 38 * @param postVars 39 * POST variables send with the event 40 * @param getVars 41 * GET variables send with the event 42 * @return type of the event 43 */ 44 private final static String makeType(String path, List<String> postVars, 45 List<String> getVars) { 20 46 String type = path; 21 if ( getVars!=null && !getVars.isEmpty()) {22 type += "+GET" +getVars.toString().replace(" ", "");47 if (getVars != null && !getVars.isEmpty()) { 48 type += "+GET" + getVars.toString().replace(" ", ""); 23 49 } 24 if ( postVars!=null && !postVars.isEmpty()) {25 type += "+POST" +postVars.toString().replace(" ", "");50 if (postVars != null && !postVars.isEmpty()) { 51 type += "+POST" + postVars.toString().replace(" ", ""); 26 52 } 27 53 return type; 28 54 } 29 30 public WebEvent(String path, long timestamp, List<String> postVars, List<String> getVars) { 55 56 /** 57 * <p> 58 * Constructor. Creates a new WebEvent. 59 * </p> 60 * 61 * @param path 62 * path of the URI 63 * @param timestamp 64 * timestamp of when the event took place 65 * @param postVars 66 * POST variables send with the event 67 * @param getVars 68 * GET variables send with the event 69 */ 70 public WebEvent(String path, long timestamp, List<String> postVars, 71 List<String> getVars) { 31 72 super(makeType(path, postVars, getVars)); 32 73 this.timestamp = timestamp; 33 74 addReplayEvent(new WebRequest(path, postVars, getVars)); 34 75 } 35 76 77 /** 78 * <p> 79 * Returns the timestamp of the event. 80 * </p> 81 * 82 * @return timestamp of th event 83 */ 36 84 public long getTimestamp() { 37 85 return timestamp; -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/data/WebRequest.java
r111 r171 6 6 import de.ugoe.cs.eventbench.data.IReplayable; 7 7 8 /** 9 * <p> 10 * Contains all information related to a web request, i.e., the path, the POST 11 * variables and the GET variables. 12 * </p> 13 * 14 * @author Steffen Herbold 15 * @version 1.0 16 */ 8 17 public class WebRequest implements IReplayable { 9 18 10 19 /** 20 * <p> 11 21 * Id for object serialization. 22 * </p> 12 23 */ 13 24 private static final long serialVersionUID = 1L; 14 25 26 /** 27 * <p> 28 * POST variables of the web request. 29 * </p> 30 */ 15 31 List<String> postVars; 32 33 /** 34 * <p> 35 * GET variables of the web request. 36 * </p> 37 */ 16 38 List<String> getVars; 17 39 40 /** 41 * <p> 42 * URI of the web request. 43 * </p> 44 */ 18 45 String targetUri; 19 46 47 /** 48 * <p> 49 * Constructor. Creates a new WebRequest. 50 * </p> 51 * 52 * @param uri 53 * URI of the request 54 * @param postVars 55 * POST variables of the request 56 * @param getVars 57 * GET variables of the request 58 */ 20 59 public WebRequest(String uri, List<String> postVars, List<String> getVars) { 21 60 targetUri = uri; … … 23 62 this.getVars = new ArrayList<String>(getVars); 24 63 } 25 64 65 /* 66 * (non-Javadoc) 67 * 68 * @see de.ugoe.cs.eventbench.data.IReplayable#getReplay() 69 */ 26 70 @Override 27 71 public String getReplay() { … … 30 74 } 31 75 76 /* 77 * (non-Javadoc) 78 * 79 * @see de.ugoe.cs.eventbench.data.IReplayable#getTarget() 80 */ 32 81 @Override 33 82 public String getTarget() { … … 35 84 return null; 36 85 } 37 86 87 /** 88 * <p> 89 * Two {@link WebRequest}s are equal, if their {@link #targetUri}, 90 * {@link #postVars}, and {@link #getVars} are equal. 91 * </p> 92 * 93 * @see java.lang.Object#equals(java.lang.Object) 94 */ 38 95 @Override 39 96 public boolean equals(Object other) { 40 if ( this==other) {97 if (this == other) { 41 98 return true; 42 99 } 43 if( other instanceof WebRequest ) { 44 return targetUri.equals(((WebRequest) other).targetUri) && postVars.equals(((WebRequest) other).postVars); 100 if (other instanceof WebRequest) { 101 return targetUri.equals(((WebRequest) other).targetUri) 102 && postVars.equals(((WebRequest) other).postVars) 103 && getVars.equals(((WebRequest) other).getVars); 45 104 } 46 105 return false; 47 106 } 48 107 108 /* 109 * (non-Javadoc) 110 * 111 * @see java.lang.Object#hashCode() 112 */ 49 113 @Override 50 114 public int hashCode() { … … 54 118 hash = multiplier * hash + targetUri.hashCode(); 55 119 hash = multiplier * hash + postVars.hashCode(); 120 hash = multiplier * hash + getVars.hashCode(); 56 121 57 122 return hash;
Note: See TracChangeset
for help on using the changeset viewer.