Changeset 177 for trunk/EventBenchConsole/src/de/ugoe/cs/eventbench
- Timestamp:
- 09/10/11 00:30:54 (13 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/WeblogParser.java
r176 r177 135 135 * @throws ParseException 136 136 * thrown the date format is invalid 137 * @throws URISyntaxException138 * thrown if the URI is invalid139 137 */ 140 138 public void parseFile(String filename) throws IOException, 141 FileNotFoundException, ParseException , URISyntaxException{139 FileNotFoundException, ParseException { 142 140 String[] lines = FileTools.getLinesFromFile(filename); 143 141 … … 151 149 sequences = new ArrayList<List<WebEvent>>(); 152 150 151 int lineCounter = 0; 153 152 for (String line : lines) { 153 lineCounter++; 154 154 String[] values = line.substring(1, line.length() - 1).split( 155 155 "\" \""); … … 176 176 } 177 177 if (!isRobot(agent)) { 178 URI uri = new URI(uriString); 179 180 String path = uri.getPath(); 181 List<String> getVars = extractGetVarsFromUri(uri); 182 183 WebEvent event = new WebEvent(path, timestamp, postedVars, 184 getVars); 185 186 // find session and add event 187 List<Integer> sessionIds = cookieSessionMap.get(cookie); 188 if (sessionIds == null) { 189 sessionIds = new ArrayList<Integer>(); 190 // start new session 191 sessionIds.add(++lastId); 192 cookieSessionMap.put(cookie, sessionIds); 193 sequences.add(new LinkedList<WebEvent>()); 194 } 195 Integer lastSessionIndex = sessionIds 196 .get(sessionIds.size() - 1); 197 List<WebEvent> lastSession = sequences.get(lastSessionIndex); 198 long lastEventTime = timestamp; 199 if (!lastSession.isEmpty()) { 200 lastEventTime = lastSession.get(lastSession.size() - 1) 201 .getTimestamp(); 202 } 203 if (timestamp - lastEventTime > timeout) { 204 sessionIds.add(++lastId); 205 List<WebEvent> newSession = new LinkedList<WebEvent>(); 206 newSession.add(event); 207 sequences.add(newSession); 208 } else { 209 lastSession.add(event); 178 try { 179 URI uri = new URI(uriString); 180 String path = uri.getPath(); 181 List<String> getVars = extractGetVarsFromUri(uri); 182 183 WebEvent event = new WebEvent(path, timestamp, postedVars, 184 getVars); 185 186 // find session and add event 187 List<Integer> sessionIds = cookieSessionMap.get(cookie); 188 if (sessionIds == null) { 189 sessionIds = new ArrayList<Integer>(); 190 // start new session 191 sessionIds.add(++lastId); 192 cookieSessionMap.put(cookie, sessionIds); 193 sequences.add(new LinkedList<WebEvent>()); 194 } 195 Integer lastSessionIndex = sessionIds 196 .get(sessionIds.size() - 1); 197 List<WebEvent> lastSession = sequences.get(lastSessionIndex); 198 long lastEventTime = timestamp; 199 if (!lastSession.isEmpty()) { 200 lastEventTime = lastSession.get(lastSession.size() - 1) 201 .getTimestamp(); 202 } 203 if (timestamp - lastEventTime > timeout) { 204 sessionIds.add(++lastId); 205 List<WebEvent> newSession = new LinkedList<WebEvent>(); 206 newSession.add(event); 207 sequences.add(newSession); 208 } else { 209 lastSession.add(event); 210 } 211 } catch (URISyntaxException e) { 212 Console.traceln("Ignored line " + lineCounter + ": " + e.getMessage()); 210 213 } 211 214 } -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/commands/CMDloadSessionsFromClickstream.java
r176 r177 3 3 import java.io.FileNotFoundException; 4 4 import java.io.IOException; 5 import java.net.URISyntaxException;6 5 import java.security.InvalidParameterException; 7 6 import java.text.ParseException; … … 52 51 Console.println("Invalid format of date stamps."); 53 52 Console.println(e.getMessage()); 54 } catch (URISyntaxException e) { 55 Console.println("Invalid URI!"); 56 Console.println(e.getMessage()); 57 } 53 } 58 54 59 55 if( GlobalDataContainer.getInstance().addData("sequences", parser.getSequences()) ) {
Note: See TracChangeset
for help on using the changeset viewer.