@Override
protected Process createProcess() throws ExecutionException {
MongoConfiguration mongoConfiguration = MongoConfiguration.getInstance(getProject());
String shellPath = mongoConfiguration.getShellPath();
final GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(shellPath);
commandLine.addParameter(MongoUtils.buildMongoUrl(serverConfiguration, database));
String shellWorkingDir = serverConfiguration.getShellWorkingDir();
if (StringUtils.isNotBlank(shellWorkingDir)) {
commandLine.setWorkDirectory(shellWorkingDir);
}
String username = serverConfiguration.getUsername();
if (StringUtils.isNotBlank(username)) {
commandLine.addParameter("--username");
commandLine.addParameter(username);
}
String password = serverConfiguration.getPassword();
if (StringUtils.isNotBlank(password)) {
commandLine.addParameter("--password");
commandLine.addParameter(password);
}
String shellArgumentsLine = serverConfiguration.getShellArgumentsLine();
if (StringUtils.isNotBlank(shellArgumentsLine)) {
commandLine.addParameter(shellArgumentsLine);
}
return commandLine.createProcess();
}