From 37e39f7255b88fe5797d1f121e7b265f2df97813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Walter?= <juergen.walter@uni-wuerzburg.de> Date: Mon, 19 Dec 2016 15:29:55 +0100 Subject: [PATCH] allow for multiple kieker sources in command line tool --- .../descartes/pmx/console/PMXCommandLine.java | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java b/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java index 600a42ac..043ebe39 100644 --- a/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java +++ b/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java @@ -163,14 +163,14 @@ public class PMXCommandLine { private PMXController createPMX() { try { - String inputDir = getInputDir(); + String[] inputDirs = getInputDirs(); Configuration pmxConfiguration = new Configuration(); AnalysisController analysisController = new AnalysisController(pmxConfiguration); - registerFSReader(analysisController, inputDir); + registerFSReader(analysisController, inputDirs); String outputDir = commandLine.getOptionValue(CMD_LONG_OPT_OUTPUT_DIR); if(outputDir == null){ - outputDir = inputDir; + outputDir = inputDirs[0]; log.info("No output directory specified. Logging to input directory."); } @@ -194,25 +194,26 @@ public class PMXCommandLine { } - - private String getInputDir() { - String inputDir = commandLine.getOptionValue(CMD_LONG_OPT_INPUT_DIR); - if (inputDir == null) { - log.info("missing value for command line option '" + CMD_LONG_OPT_INPUT_DIR + "'"); - System.exit(1); - } else if (!new File(inputDir).exists()) { - log.info("File does not exist: " + CMD_LONG_OPT_INPUT_DIR); - log.info("\tcurrent:" + System.getProperty("user.dir")); - log.info("\trequested:" +inputDir); - System.exit(1); // or other exit code? + private String[] getInputDirs() { + String inputDirCmd = commandLine.getOptionValue(CMD_LONG_OPT_INPUT_DIR); + String[] inputDirs = inputDirCmd.split(";"); + for (int idx = 0; idx < inputDirs.length; idx++) { + final String inputDir = inputDirs[idx]; + if (inputDir == null) { + log.info("missing value for command line option '" + CMD_LONG_OPT_INPUT_DIR + "'"); + System.exit(1); + } else if (!new File(inputDir).exists()) { + log.info("File does not exist: " + CMD_LONG_OPT_INPUT_DIR); + 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) { - String[] inputDirs; - inputDirs = new String[1]; - inputDirs[0] = kiekerTraceFile; + private static FSReader registerFSReader(IAnalysisController analysisInstance, final String[] kiekerTraceFile) { + final String[] inputDirs = kiekerTraceFile; // if (new File(kiekerTraceFile).getName().startsWith("kieker-")) { // inputDirs = new String[1]; @@ -322,7 +323,7 @@ public class PMXCommandLine { private String parseOutputDir() { String outputDir = commandLine.getOptionValue(CMD_LONG_OPT_OUTPUT_DIR); if (outputDir == null) { - outputDir = getInputDir(); + outputDir = getInputDirs()[0]; log.info("No output directory specified. Logging to input directory."); } return outputDir; -- GitLab