// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/ChainedArtifactResolver.java
// public class ChainedArtifactResolver
//         implements PluginArtifactResolver
// {
// 
//     protected List<PluginArtifactResolver> resolverChain = new LinkedList<PluginArtifactResolver>();
// 
//     public ChainedArtifactResolver()
//     {
//         this.resolverChain.add(new SystemPathArtifactResolver());
//     }
// 
//     @Override
//     public File resolveArtifact(final String coordinates) throws ArtifactException
//     {
//         File result = null;
//         for (PluginArtifactResolver resolver : resolverChain)
//         {
//             try
//             {
//                 result = resolver.resolveArtifact(coordinates);
//                 if (result != null)
//                 {
//                     break;
//                 }
//                 // CHECKSTYLE:OFF: Empty catch block
//             }
//             catch (ArtifactException e)
//             {
//             }
//             // CHECKSTYLE:ON: Empty catch block
//         }
//         if (result == null)
//         {
//             throw new ArtifactException(
//                     "Could not resolve artifact with coordinates " + coordinates);
//         }
//         return result;
//     }
// 
//     public void addPluginArtifactResolver(PluginArtifactResolver pluginArtifactResolver)
//     {
//         Validate.notNull(pluginArtifactResolver, "PluginArtifactResolvers should not be null");
//         this.resolverChain.add(pluginArtifactResolver);
//     }
// 
// }
// 
// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/ElasticsearchBaseConfiguration.java
// public interface ElasticsearchBaseConfiguration
// {
//     int getInstanceCount();
//     
//     File getBaseDir();
//     
//     boolean isSkip();
//     
//     String getLogLevel();
//     
// 
//     ClusterConfiguration buildClusterConfiguration();
//     
//     PluginArtifactResolver buildArtifactResolver();
//     
//     Log getLog();
//     
// }
// 
// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/PluginArtifactResolver.java
// public interface PluginArtifactResolver
// {
//     File resolveArtifact(String coordinates) throws ArtifactException;
// }


import java.io.File;
import org.apache.maven.monitor.logging.DefaultLog;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Parameter;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.ChainedArtifactResolver;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.ElasticsearchBaseConfiguration;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.PluginArtifactResolver;
        if (log == null)
        {
            log = new DefaultLog(new ConsoleLogger(getMavenLogLevel(), "console"));
        }
        return log;
    }

    @Override
    public ClusterConfiguration buildClusterConfiguration()
    {
        ClusterConfiguration.Builder clusterConfigBuilder = new ClusterConfiguration.Builder()
                .withArtifactResolver(buildArtifactResolver())
                .withLog(getLog());

        for (int i = 0; i < instanceCount; i++)
        {
            clusterConfigBuilder.addInstanceConfiguration(new InstanceConfiguration.Builder()
                    .withId(i)
                    .withBaseDir(baseDir.getAbsolutePath() + i)
                    .build());
        }
        
        ClusterConfiguration clusterConfig = clusterConfigBuilder.build();
        
        return clusterConfig;
    }

    @Override
    public PluginArtifactResolver buildArtifactResolver()
    {
// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/ChainedArtifactResolver.java
// public class ChainedArtifactResolver
//         implements PluginArtifactResolver
// {
// 
//     protected List<PluginArtifactResolver> resolverChain = new LinkedList<PluginArtifactResolver>();
// 
//     public ChainedArtifactResolver()
//     {
//         this.resolverChain.add(new SystemPathArtifactResolver());
//     }
// 
//     @Override
//     public File resolveArtifact(final String coordinates) throws ArtifactException
//     {
//         File result = null;
//         for (PluginArtifactResolver resolver : resolverChain)
//         {
//             try
//             {
//                 result = resolver.resolveArtifact(coordinates);
//                 if (result != null)
//                 {
//                     break;
//                 }
//                 // CHECKSTYLE:OFF: Empty catch block
//             }
//             catch (ArtifactException e)
//             {
//             }
//             // CHECKSTYLE:ON: Empty catch block
//         }
//         if (result == null)
//         {
//             throw new ArtifactException(
//                     "Could not resolve artifact with coordinates " + coordinates);
//         }
//         return result;
//     }
// 
//     public void addPluginArtifactResolver(PluginArtifactResolver pluginArtifactResolver)
//     {
//         Validate.notNull(pluginArtifactResolver, "PluginArtifactResolvers should not be null");
//         this.resolverChain.add(pluginArtifactResolver);
//     }
// 
// }
// 
// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/ElasticsearchBaseConfiguration.java
// public interface ElasticsearchBaseConfiguration
// {
//     int getInstanceCount();
//     
//     File getBaseDir();
//     
//     boolean isSkip();
//     
//     String getLogLevel();
//     
// 
//     ClusterConfiguration buildClusterConfiguration();
//     
//     PluginArtifactResolver buildArtifactResolver();
//     
//     Log getLog();
//     
// }
// 
// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/PluginArtifactResolver.java
// public interface PluginArtifactResolver
// {
//     File resolveArtifact(String coordinates) throws ArtifactException;
// }


// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/AbstractElasticsearchBaseMojo.java
import java.io.File;
import org.apache.maven.monitor.logging.DefaultLog;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Parameter;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.ChainedArtifactResolver;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.ElasticsearchBaseConfiguration;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.PluginArtifactResolver;

        if (log == null)
        {
            log = new DefaultLog(new ConsoleLogger(getMavenLogLevel(), "console"));
        }
        return log;
    }

    @Override
    public ClusterConfiguration buildClusterConfiguration()
    {
        ClusterConfiguration.Builder clusterConfigBuilder = new ClusterConfiguration.Builder()
                .withArtifactResolver(buildArtifactResolver())
                .withLog(getLog());

        for (int i = 0; i < instanceCount; i++)
        {
            clusterConfigBuilder.addInstanceConfiguration(new InstanceConfiguration.Builder()
                    .withId(i)
                    .withBaseDir(baseDir.getAbsolutePath() + i)
                    .build());
        }
        
        ClusterConfiguration clusterConfig = clusterConfigBuilder.build();
        
        return clusterConfig;
    }

    @Override
    public PluginArtifactResolver buildArtifactResolver()
    {
        ChainedArtifactResolver artifactResolver = new ChainedArtifactResolver();