org.apache.commons.exec.util.StringUtils Java Examples

The following examples show how to use org.apache.commons.exec.util.StringUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: __platform-name__Loader.java    From ldbc_graphalytics with Apache License 2.0 6 votes vote down vote up
public int unload(String loadedInputPath) throws Exception {
	String unloaderDir = platformConfig.getUnloaderPath();
	commandLine = new CommandLine(Paths.get(unloaderDir).toFile());

	commandLine.addArgument("--graph-name");
	commandLine.addArgument(formattedGraph.getName());

	commandLine.addArgument("--output-path");
	commandLine.addArgument(loadedInputPath);

	String commandString = StringUtils.toString(commandLine.toStrings(), " ");
	LOG.info(String.format("Execute graph unloader with command-line: [%s]", commandString));

	Executor executor = new DefaultExecutor();
	executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
	executor.setExitValue(0);

	return executor.execute(commandLine);
}
 
Example #2
Source File: __platform-name__Loader.java    From ldbc_graphalytics with Apache License 2.0 5 votes vote down vote up
public int load(String loadedInputPath) throws Exception {
	String loaderDir = platformConfig.getLoaderPath();
	commandLine = new CommandLine(Paths.get(loaderDir).toFile());

	commandLine.addArgument("--graph-name");
	commandLine.addArgument(formattedGraph.getName());
	commandLine.addArgument("--input-vertex-path");
	commandLine.addArgument(formattedGraph.getVertexFilePath());
	commandLine.addArgument("--input-edge-path");
	commandLine.addArgument(formattedGraph.getEdgeFilePath());
	commandLine.addArgument("--output-path");
	commandLine.addArgument(loadedInputPath);
	commandLine.addArgument("--directed");
	commandLine.addArgument(formattedGraph.isDirected() ? "true" : "false");
	commandLine.addArgument("--weighted");
	commandLine.addArgument(formattedGraph.hasEdgeProperties() ? "true" : "false");


	String commandString = StringUtils.toString(commandLine.toStrings(), " ");
	LOG.info(String.format("Execute graph loader with command-line: [%s]", commandString));

	Executor executor = new DefaultExecutor();
	executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
	executor.setExitValue(0);

	return executor.execute(commandLine);
}
 
Example #3
Source File: __platform-name__Job.java    From ldbc_graphalytics with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the platform job with the pre-defined parameters.
 *
 * @return the exit code
 * @throws IOException if the platform failed to run
 */
public int execute() throws Exception {
	String executableDir = platformConfig.getExecutablePath();
	commandLine = new CommandLine(Paths.get(executableDir).toFile());

	// List of benchmark parameters.
	String jobId = getJobId();
	String logDir = getLogPath();

	// List of dataset parameters.
	String inputPath = getInputPath();
	String outputPath = getOutputPath();

	// List of platform parameters.
	int numMachines = platformConfig.getNumMachines();
	int numThreads = platformConfig.getNumThreads();
	String homeDir = platformConfig.getHomePath();

	appendBenchmarkParameters(jobId, logDir);
	appendAlgorithmParameters();
	appendDatasetParameters(inputPath, outputPath);
	appendPlatformConfigurations(homeDir, numMachines, numThreads);

	String commandString = StringUtils.toString(commandLine.toStrings(), " ");
	LOG.info(String.format("Execute benchmark job with command-line: [%s]", commandString));

	Executor executor = new DefaultExecutor();
	executor.setStreamHandler(new PumpStreamHandler(System.out, System.err));
	executor.setExitValue(0);
	return executor.execute(commandLine);
}
 
Example #4
Source File: ReportGenerate.java    From allure1 with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the classpath for executable jar.
 */
protected String getClasspath() throws IOException {
    List<String> classpath = new ArrayList<>();
    classpath.add(getBundleJarPath());
    classpath.addAll(getPluginsPath());
    return StringUtils.toString(classpath.toArray(new String[classpath.size()]), " ");
}