use of com.github.alexcojocaru.mojo.elasticsearch.v2.ClusterConfiguration 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));
}
}
use of com.github.alexcojocaru.mojo.elasticsearch.v2.ClusterConfiguration in project elasticsearch-maven-plugin by alexcojocaru.
the class RunForkedMojo method execute.
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("Skipping plugin execution");
return;
}
ClusterConfiguration clusterConfig = buildClusterConfiguration();
new PreStartClusterSequence().execute(clusterConfig);
for (InstanceConfiguration config : clusterConfig.getInstanceConfigurationList()) {
getLog().info(String.format("Using Elasticsearch [%d] configuration: %s", config.getId(), config));
try {
ForkedInstance instance = new ForkedInstance(config);
instance.configureInstance();
Thread thread = new Thread(instance);
thread.start();
new PostStartInstanceSequence().execute(config);
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
new PostStartClusterSequence().execute(clusterConfig);
}
Aggregations