[52] | 1 | package de.ugoe.cs.eventbench.windows.commands;
|
---|
[1] | 2 |
|
---|
| 3 | import java.io.FileNotFoundException;
|
---|
| 4 | import java.io.IOException;
|
---|
| 5 | import java.security.InvalidParameterException;
|
---|
| 6 | import java.util.List;
|
---|
| 7 |
|
---|
[52] | 8 | import de.ugoe.cs.eventbench.windows.LogPreprocessor;
|
---|
[1] | 9 | import de.ugoe.cs.util.console.Command;
|
---|
| 10 | import 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] | 20 | public 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 | }
|
---|