use of com.github.alexcojocaru.mojo.elasticsearch.v2.ElasticsearchSetupException in project elasticsearch-maven-plugin by alexcojocaru.
the class BootstrapClusterStep method parseJson.
protected void parseJson(ElasticsearchClient client, Log log, Path path) {
try {
String json = new String(Files.readAllBytes(path));
List<Map<String, Object>> commands = new ObjectMapper().readValue(json, new TypeReference<List<Map<String, Object>>>() {
});
commands.forEach(command -> {
log.debug(String.format("Parsing command: %s", command));
ElasticsearchCommand esCommand = parseMapCommand(command);
executeInitCommand(client, log, esCommand);
});
} catch (IOException e) {
throw new ElasticsearchSetupException("Cannot read the init json file", e);
}
}
use of com.github.alexcojocaru.mojo.elasticsearch.v2.ElasticsearchSetupException in project elasticsearch-maven-plugin by alexcojocaru.
the class BootstrapClusterStep method parseScript.
protected void parseScript(ElasticsearchClient client, Log log, Path path) {
try (Stream<String> stream = Files.lines(path)) {
stream.forEach(command -> {
log.debug(String.format("Parsing command: %s", command));
ElasticsearchCommand esCommand = parseStringCommand(command);
if (esCommand.isSkip() == false) {
executeInitCommand(client, log, esCommand);
}
});
} catch (IOException e) {
throw new ElasticsearchSetupException("Cannot read the init script file", e);
}
}
use of com.github.alexcojocaru.mojo.elasticsearch.v2.ElasticsearchSetupException in project elasticsearch-maven-plugin by alexcojocaru.
the class ValidateBaseDirectoryStep method execute.
@Override
public void execute(ClusterConfiguration config) {
String baseDir = config.getInstanceConfigurationList().get(0).getBaseDir();
try {
Validate.notBlank(baseDir);
// this should catch erroneous paths
new File(baseDir).getCanonicalPath();
} catch (Exception e) {
throw new ElasticsearchSetupException(String.format("The value of the 'baseDir' parameter ('%1$s') is not a valid file path.", baseDir));
}
}
Aggregations