source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/jfc/commands/CMDparseJFC.java @ 369

Last change on this file since 369 was 305, checked in by sherbold, 13 years ago
  • fixed typo in package names
  • Property svn:mime-type set to text/plain
File size: 1.5 KB
Line 
1package de.ugoe.cs.eventbench.jfc.commands;
2
3import java.security.InvalidParameterException;
4import java.util.Collection;
5import java.util.List;
6
7import de.ugoe.cs.eventbench.CommandHelpers;
8import de.ugoe.cs.eventbench.data.GlobalDataContainer;
9import de.ugoe.cs.eventbench.jfc.JFCLogParser;
10import de.ugoe.cs.eventbench.jfc.data.JFCEvent;
11import de.ugoe.cs.util.console.Command;
12import de.ugoe.cs.util.console.Console;
13
14/**
15 * <p>
16 * Command to parse an XML file with sessions monitored by EventBench's
17 * JFCMonitor.
18 * </p>
19 *
20 * @author Steffen Herbold
21 * @version 1.0
22 */
23public class CMDparseJFC implements Command {
24
25        /*
26         * (non-Javadoc)
27         *
28         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
29         */
30        @Override
31        public void run(List<Object> parameters) {
32                String filename;
33                String sequencesName = "sequences";
34
35                try {
36                        filename = (String) parameters.get(0);
37                        if (parameters.size() >= 2) {
38                                sequencesName = (String) parameters.get(1);
39                        }
40                } catch (Exception e) {
41                        throw new InvalidParameterException();
42                }
43
44                JFCLogParser parser = new JFCLogParser();
45
46                parser.parseFile(filename);
47
48                Collection<List<JFCEvent>> sequences = parser.getSequences();
49
50                if (GlobalDataContainer.getInstance().addData(sequencesName, sequences)) {
51                        CommandHelpers.dataOverwritten(sequencesName);
52                }
53        }
54
55        /*
56         * (non-Javadoc)
57         *
58         * @see de.ugoe.cs.util.console.Command#help()
59         */
60        @Override
61        public void help() {
62                Console.println("Usage: parseJFC <filename> {<sequencesName>}");
63        }
64
65}
Note: See TracBrowser for help on using the repository browser.