Line | |
---|
1 | package de.ugoe.cs.eventbench.commands;
|
---|
2 |
|
---|
3 | import java.security.InvalidParameterException;
|
---|
4 | import java.util.List;
|
---|
5 |
|
---|
6 | import de.ugoe.cs.eventbench.LogParser;
|
---|
7 | import de.ugoe.cs.eventbench.data.Event;
|
---|
8 | import de.ugoe.cs.eventbench.data.GlobalDataContainer;
|
---|
9 | import de.ugoe.cs.eventbench.data.WindowsMessage;
|
---|
10 | import de.ugoe.cs.util.console.Command;
|
---|
11 | import de.ugoe.cs.util.console.Console;
|
---|
12 |
|
---|
13 | public class CMDparseXML implements Command {
|
---|
14 |
|
---|
15 | @Override
|
---|
16 | public void help() {
|
---|
17 | Console.println("Usage: parseXML <filename> {<countMessageOccurences}");
|
---|
18 | }
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public void run(List<Object> parameters) {
|
---|
22 | String filename;
|
---|
23 | boolean countMessageOccurences = false;
|
---|
24 |
|
---|
25 | try {
|
---|
26 | filename = (String) parameters.get(0);
|
---|
27 | if( parameters.size()==2 ) {
|
---|
28 | countMessageOccurences = Boolean.parseBoolean((String) parameters.get(1));
|
---|
29 | }
|
---|
30 | } catch (Exception e) {
|
---|
31 | throw new InvalidParameterException();
|
---|
32 | }
|
---|
33 |
|
---|
34 | LogParser parser = new LogParser(countMessageOccurences);
|
---|
35 | parser.parseFile(filename);
|
---|
36 |
|
---|
37 | List<List<Event<WindowsMessage>>> sequences = parser.getSequences();
|
---|
38 |
|
---|
39 | GlobalDataContainer.getInstance().addData("sequences", sequences);
|
---|
40 | }
|
---|
41 |
|
---|
42 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.