Skip to content
Snippets Groups Projects
Commit 37e39f72 authored by Jürgen Walter's avatar Jürgen Walter
Browse files

allow for multiple kieker sources in command line tool

parent ed9b0fc5
No related branches found
No related tags found
No related merge requests found
...@@ -163,14 +163,14 @@ public class PMXCommandLine { ...@@ -163,14 +163,14 @@ public class PMXCommandLine {
private PMXController createPMX() { private PMXController createPMX() {
try { try {
String inputDir = getInputDir(); String[] inputDirs = getInputDirs();
Configuration pmxConfiguration = new Configuration(); Configuration pmxConfiguration = new Configuration();
AnalysisController analysisController = new AnalysisController(pmxConfiguration); AnalysisController analysisController = new AnalysisController(pmxConfiguration);
registerFSReader(analysisController, inputDir); registerFSReader(analysisController, inputDirs);
String outputDir = commandLine.getOptionValue(CMD_LONG_OPT_OUTPUT_DIR); String outputDir = commandLine.getOptionValue(CMD_LONG_OPT_OUTPUT_DIR);
if(outputDir == null){ if(outputDir == null){
outputDir = inputDir; outputDir = inputDirs[0];
log.info("No output directory specified. Logging to input directory."); log.info("No output directory specified. Logging to input directory.");
} }
...@@ -194,25 +194,26 @@ public class PMXCommandLine { ...@@ -194,25 +194,26 @@ public class PMXCommandLine {
} }
private String[] getInputDirs() {
private String getInputDir() { String inputDirCmd = commandLine.getOptionValue(CMD_LONG_OPT_INPUT_DIR);
String inputDir = commandLine.getOptionValue(CMD_LONG_OPT_INPUT_DIR); String[] inputDirs = inputDirCmd.split(";");
if (inputDir == null) { for (int idx = 0; idx < inputDirs.length; idx++) {
log.info("missing value for command line option '" + CMD_LONG_OPT_INPUT_DIR + "'"); final String inputDir = inputDirs[idx];
System.exit(1); if (inputDir == null) {
} else if (!new File(inputDir).exists()) { log.info("missing value for command line option '" + CMD_LONG_OPT_INPUT_DIR + "'");
log.info("File does not exist: " + CMD_LONG_OPT_INPUT_DIR); System.exit(1);
log.info("\tcurrent:" + System.getProperty("user.dir")); } else if (!new File(inputDir).exists()) {
log.info("\trequested:" +inputDir); log.info("File does not exist: " + CMD_LONG_OPT_INPUT_DIR);
System.exit(1); // or other exit code? log.info("\tcurrent:" + System.getProperty("user.dir"));
log.info("\trequested:" + inputDir);
System.exit(1); // or other exit code?
}
} }
return inputDir; return inputDirs;
} }
private static FSReader registerFSReader(IAnalysisController analysisInstance, final String kiekerTraceFile) { private static FSReader registerFSReader(IAnalysisController analysisInstance, final String[] kiekerTraceFile) {
String[] inputDirs; final String[] inputDirs = kiekerTraceFile;
inputDirs = new String[1];
inputDirs[0] = kiekerTraceFile;
// if (new File(kiekerTraceFile).getName().startsWith("kieker-")) { // if (new File(kiekerTraceFile).getName().startsWith("kieker-")) {
// inputDirs = new String[1]; // inputDirs = new String[1];
...@@ -322,7 +323,7 @@ public class PMXCommandLine { ...@@ -322,7 +323,7 @@ public class PMXCommandLine {
private String parseOutputDir() { private String parseOutputDir() {
String outputDir = commandLine.getOptionValue(CMD_LONG_OPT_OUTPUT_DIR); String outputDir = commandLine.getOptionValue(CMD_LONG_OPT_OUTPUT_DIR);
if (outputDir == null) { if (outputDir == null) {
outputDir = getInputDir(); outputDir = getInputDirs()[0];
log.info("No output directory specified. Logging to input directory."); log.info("No output directory specified. Logging to input directory.");
} }
return outputDir; return outputDir;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment