source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/web/commands/CMDloadSessionsFromClickstream.java @ 72

Last change on this file since 72 was 68, checked in by sherbold, 14 years ago
  • changed weblog parser such that session without a minimum length are pruned to remove single page visits from the sessions (e.g., through robots)
  • changed loadSessionsFromClickstream such that the session timeout and the minimum session length are optional parameters
  • Property svn:mime-type set to text/plain
File size: 1.5 KB
Line 
1package de.ugoe.cs.eventbench.web.commands;
2
3import java.io.FileNotFoundException;
4import java.io.IOException;
5import java.security.InvalidParameterException;
6import java.text.ParseException;
7import java.util.List;
8
9import de.ugoe.cs.eventbench.data.GlobalDataContainer;
10import de.ugoe.cs.eventbench.web.WeblogParser;
11import de.ugoe.cs.util.console.Command;
12import de.ugoe.cs.util.console.Console;
13
14public class CMDloadSessionsFromClickstream implements Command {
15
16        @Override
17        public void run(List<Object> parameters) {
18                if( parameters.size() < 1 ) {
19                        throw new InvalidParameterException();
20                }
21                String source = (String) parameters.get(0);
22                int timeout = -1;
23                int minLength = -1;
24                if( parameters.size() ==3 ) {
25                        timeout = Integer.parseInt((String) parameters.get(1));
26                        minLength = Integer.parseInt((String) parameters.get(2));
27                }
28               
29                WeblogParser parser = new WeblogParser();;
30                if( timeout!=-1 ) {
31                        parser.setTimeout(timeout);
32                        parser.setMinLength(minLength);
33                }
34                try {
35                        parser.parseFile(source);
36                } catch (FileNotFoundException e) {
37                        Console.println(e.getMessage());
38                } catch (IOException e) {
39                        Console.println(e.getMessage());
40                } catch (ParseException e) {
41                        Console.println("Invalid format of date stamps.");
42                        Console.println(e.getMessage());
43                }
44               
45                GlobalDataContainer.getInstance().addData("sequences", parser.getSequences());
46        }
47       
48        @Override
49        public void help() {
50                Console.println("Usage: loadSessionsFromClickstream <filename> {<timeout> <minSessionLength>}");
51        }
52
53}
Note: See TracBrowser for help on using the repository browser.