Line | |
---|
1 | package de.ugoe.cs.eventbench.commands;
|
---|
2 |
|
---|
3 | import java.io.FileNotFoundException;
|
---|
4 | import java.io.IOException;
|
---|
5 | import java.security.InvalidParameterException;
|
---|
6 | import java.util.List;
|
---|
7 |
|
---|
8 | import de.ugoe.cs.eventbench.LogPreprocessor;
|
---|
9 | import de.ugoe.cs.util.console.Command;
|
---|
10 | import de.ugoe.cs.util.console.Console;
|
---|
11 |
|
---|
12 | public class CMDconvertToXml implements Command {
|
---|
13 |
|
---|
14 | @Override
|
---|
15 | public void help() {
|
---|
16 | Console.println("Usage: convertToXml <sourceFile> <targetFile> {<base64>}");
|
---|
17 | }
|
---|
18 |
|
---|
19 | @Override
|
---|
20 | public void run(List<Object> parameters) {
|
---|
21 | if( parameters.size() < 2 ) {
|
---|
22 | throw new InvalidParameterException();
|
---|
23 | }
|
---|
24 | String source = (String) parameters.get(0);
|
---|
25 | String target = (String) parameters.get(1);
|
---|
26 | boolean base64 = false;
|
---|
27 | if( parameters.size() == 3 ) {
|
---|
28 | base64 = Boolean.parseBoolean((String) parameters.get(2));
|
---|
29 | }
|
---|
30 |
|
---|
31 | try {
|
---|
32 | new LogPreprocessor(base64).convertToXml(source, target);
|
---|
33 | } catch (FileNotFoundException e) {
|
---|
34 | Console.println(e.getMessage());
|
---|
35 | } catch (IOException e) {
|
---|
36 | Console.println(e.getMessage());
|
---|
37 | }
|
---|
38 |
|
---|
39 | }
|
---|
40 |
|
---|
41 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.