Changeset 53 for trunk/EventBenchConsole/src/de
- Timestamp:
- 06/09/11 15:06:49 (13 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/commands/CMDloadSessionsFromClickstream.java
r51 r53 6 6 import java.text.SimpleDateFormat; 7 7 import java.util.ArrayList; 8 import java.util.Date;9 8 import java.util.HashMap; 10 9 import java.util.LinkedList; … … 12 11 import java.util.Map; 13 12 14 import de.ugoe.cs.eventbench.data.Event;15 13 import de.ugoe.cs.eventbench.web.data.WebEvent; 16 14 import de.ugoe.cs.util.console.Command; … … 22 20 public void run(List<Object> parameters) { 23 21 // TODO Auto-generated method stub 24 if( parameters.size() < 2) {22 if( parameters.size() < 1 ) { 25 23 throw new InvalidParameterException(); 26 24 } … … 45 43 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 46 44 47 for( int i=0; i<lines.length ; i++) {48 String[] values = line s[i].split(" ");45 for( String line : lines ) { 46 String[] values = line.trim().split(" "); 49 47 50 48 // use cookie as session identifier … … 54 52 long timestamp = dateFormat.parse(dateString).getTime(); 55 53 String uri = values[3]; 54 String ref = values[4]; 55 List<String> postedVars = new ArrayList<String>(); 56 for( int i=5 ; i<values.length ; i++ ) { 57 postedVars.add(values[i]); 58 } 56 59 60 61 WebEvent event = new WebEvent(uri, timestamp, postedVars); 62 63 64 // find session and add event 57 65 List<Integer> sessionIds = cookieSessionMap.get(cookie); 58 66 if( sessionIds==null ) { … … 72 80 sessionIds.add(++lastId); 73 81 List<WebEvent> newSession = new LinkedList<WebEvent>(); 74 newSession.add( new WebEvent(uri, timestamp));82 newSession.add(event); 75 83 sessions.add(newSession); 76 84 } else { 77 lastSession.add( new WebEvent(uri, timestamp));85 lastSession.add(event); 78 86 } 79 87 } … … 84 92 85 93 } 86 94 87 95 @Override 88 96 public void help() { -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/data/WebEvent.java
r51 r53 1 1 package de.ugoe.cs.eventbench.web.data; 2 2 3 import de.ugoe.cs.eventbench.data.Event;3 import java.util.List; 4 4 5 public class WebEvent extends Event<String> { 5 import de.ugoe.cs.eventbench.data.ReplayableEvent; 6 7 public class WebEvent extends ReplayableEvent<WebRequest> { 6 8 7 9 private final long timestamp; 10 private String uri; 8 11 9 public WebEvent(String type, long timestamp) { 10 super(type); 12 private final static String makeType(String uri, List<String> postVars) { 13 String type = uri; 14 if( postVars!=null && !postVars.isEmpty() ) { 15 type += postVars.toString().replace(" ", ""); 16 } 17 return type; 18 } 19 20 public WebEvent(String uri, long timestamp, List<String> postVars) { 21 super(makeType(uri, postVars)); 11 22 this.timestamp = timestamp; 23 this.uri = uri; 24 addReplayEvent(new WebRequest(uri, postVars)); 12 25 } 13 26
Note: See TracChangeset
for help on using the changeset viewer.