source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/windows/commands/CMDparseXML.java @ 116

Last change on this file since 116 was 84, checked in by sherbold, 14 years ago

+ added command generateRandomSequences

  • changed command generateReplayfile such that it accepts an optional parameter with the name of the sequences that are to be written, to allow writing sequences generated with generateRandomSequences
  • minor output changes
File size: 1.2 KB
Line 
1package de.ugoe.cs.eventbench.windows.commands;
2
3import java.security.InvalidParameterException;
4import java.util.List;
5
6import de.ugoe.cs.eventbench.data.GlobalDataContainer;
7import de.ugoe.cs.eventbench.windows.LogParser;
8import de.ugoe.cs.eventbench.windows.WindowsEvent;
9import de.ugoe.cs.util.console.Command;
10import de.ugoe.cs.util.console.Console;
11
12public class CMDparseXML implements Command {
13
14        @Override
15        public void help() {
16                Console.println("Usage: parseXML <filename> {<countMessageOccurences}");
17        }
18
19        @Override
20        public void run(List<Object> parameters) {
21                String filename;
22                boolean countMessageOccurences = false;
23               
24                try {
25                        filename = (String) parameters.get(0);
26                        if( parameters.size()==2 ) {
27                                countMessageOccurences = Boolean.parseBoolean((String) parameters.get(1));
28                        }
29                } catch (Exception e) {
30                        throw new InvalidParameterException();
31                }
32               
33                LogParser parser = new LogParser(countMessageOccurences);
34                parser.parseFile(filename);
35               
36                List<List<WindowsEvent>> sequences = parser.getSequences();
37               
38                if( GlobalDataContainer.getInstance().addData("sequences", sequences ) ) {
39                        Console.traceln("Old data \"" + "sequences" + "\" overwritten");
40                }       
41        }
42
43}
Note: See TracBrowser for help on using the repository browser.