source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/windows/commands/CMDconvertDirToXml.java

Last change on this file 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
RevLine 
[52]1package de.ugoe.cs.eventbench.windows.commands;
[1]2
3import java.io.FileNotFoundException;
4import java.io.IOException;
5import java.security.InvalidParameterException;
6import java.util.List;
7
[52]8import de.ugoe.cs.eventbench.windows.LogPreprocessor;
[1]9import de.ugoe.cs.util.console.Command;
10import de.ugoe.cs.util.console.Console;
11
[171]12/**
13 * <p>
14 * Command to pre-process all files in a folder.
15 * </p>
16 *
17 * @author Steffen Herbold
18 * @version 1.0
19 */
[1]20public class CMDconvertDirToXml implements Command {
21
[171]22        /*
23         * (non-Javadoc)
24         *
25         * @see de.ugoe.cs.util.console.Command#help()
26         */
[1]27        @Override
28        public void help() {
29                Console.println("Usage: convertToXml <sourceFolder> <targetFile> {<base64>}");
30        }
31
[171]32        /*
33         * (non-Javadoc)
34         *
35         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
36         */
[1]37        @Override
38        public void run(List<Object> parameters) {
[171]39                if (parameters.size() < 2) {
[1]40                        throw new InvalidParameterException();
41                }
42                String path = (String) parameters.get(0);
43                String target = (String) parameters.get(1);
44                boolean base64 = false;
[171]45                if (parameters.size() == 3) {
[1]46                        base64 = Boolean.parseBoolean((String) parameters.get(2));
47                }
[171]48
[1]49                try {
50                        new LogPreprocessor(base64).convertDirToXml(path, target);
51                } catch (FileNotFoundException e) {
[244]52                        Console.printerrln(e.getMessage());
[1]53                } catch (IOException e) {
[244]54                        Console.printerrln(e.getMessage());
[1]55                }
[171]56
[1]57        }
58
59}
Note: See TracBrowser for help on using the repository browser.