source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/windows/commands/CMDconvertToXml.java @ 335

Last change on this file since 335 was 244, checked in by sherbold, 13 years ago
  • changed some uses of Console.println, Console.traceln and Console.printerrln to one of the other streams for a more consistent use of the different output streams
File size: 1.4 KB
Line 
1package de.ugoe.cs.eventbench.windows.commands;
2
3import java.io.FileNotFoundException;
4import java.io.IOException;
5import java.security.InvalidParameterException;
6import java.util.List;
7
8import de.ugoe.cs.eventbench.windows.LogPreprocessor;
9import de.ugoe.cs.util.console.Command;
10import de.ugoe.cs.util.console.Console;
11
12/**
13 * <p>
14 * Command to pre-process a single file.
15 * </p>
16 *
17 * @author Steffen Herbold
18 * @version 1.0
19 */
20public class CMDconvertToXml implements Command {
21
22        /*
23         * (non-Javadoc)
24         *
25         * @see de.ugoe.cs.util.console.Command#help()
26         */
27        @Override
28        public void help() {
29                Console.println("Usage: convertToXml <sourceFile> <targetFile> {<base64>}");
30        }
31
32        /*
33         * (non-Javadoc)
34         *
35         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
36         */
37        @Override
38        public void run(List<Object> parameters) {
39                if (parameters.size() < 2) {
40                        throw new InvalidParameterException();
41                }
42                String source = (String) parameters.get(0);
43                String target = (String) parameters.get(1);
44                boolean base64 = false;
45                if (parameters.size() == 3) {
46                        base64 = Boolean.parseBoolean((String) parameters.get(2));
47                }
48
49                try {
50                        new LogPreprocessor(base64).convertToXml(source, target);
51                } catch (FileNotFoundException e) {
52                        Console.printerrln(e.getMessage());
53                } catch (IOException e) {
54                        Console.printerrln(e.getMessage());
55                }
56
57        }
58
59}
Note: See TracBrowser for help on using the repository browser.