// 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/configuration/ArtifactException.java
// public class ArtifactException extends Exception {
// 
//     private static final long serialVersionUID = -3217334010123902842L;
// 
//     public ArtifactException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public ArtifactException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ArtifactException(String message) {
//         super(message);
//     }
// 
// }


import java.io.File;
import java.util.List;
import org.apache.maven.plugin.logging.Log;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.PluginArtifactResolver;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.ArtifactException;
/**
 * Copyright (C) 2010-2012 Joerg Bellmann <joerg.bellmann@googlemail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.alexcojocaru.mojo.elasticsearch.v2;




/**
 * Copied from the t7mp project.
 * Uses Maven-API to resolve the Artifacts.
 */
public class MyArtifactResolver
        implements PluginArtifactResolver
{
    private final RepositorySystem repositorySystem;
    private final RepositorySystemSession repositorySession;
    private final List<RemoteRepository> remoteRepositories;
    private final Log log;

    public MyArtifactResolver(RepositorySystem repositorySystem,
            RepositorySystemSession repositorySession,
            List<RemoteRepository> remoteRepositories,
            Log log)
    {
        this.repositorySystem = repositorySystem;
        this.repositorySession = repositorySession;
        this.remoteRepositories = remoteRepositories;
        this.log = log;
    }

    /**
     * Resolves an Artifact from the repositories.
     * 
     * @param coordinates The artifact coordinates
     * @return The local file resolved/downloaded for the given coordinates
     * @throws ArtifactException If the artifact cannot be resolved
     */
    @Override
// 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/configuration/ArtifactException.java
// public class ArtifactException extends Exception {
// 
//     private static final long serialVersionUID = -3217334010123902842L;
// 
//     public ArtifactException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public ArtifactException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ArtifactException(String message) {
//         super(message);
//     }
// 
// }


// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/MyArtifactResolver.java
import java.io.File;
import java.util.List;
import org.apache.maven.plugin.logging.Log;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.PluginArtifactResolver;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.ArtifactException;

/**
 * Copyright (C) 2010-2012 Joerg Bellmann <joerg.bellmann@googlemail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.alexcojocaru.mojo.elasticsearch.v2;




/**
 * Copied from the t7mp project.
 * Uses Maven-API to resolve the Artifacts.
 */
public class MyArtifactResolver
        implements PluginArtifactResolver
{
    private final RepositorySystem repositorySystem;
    private final RepositorySystemSession repositorySession;
    private final List<RemoteRepository> remoteRepositories;
    private final Log log;

    public MyArtifactResolver(RepositorySystem repositorySystem,
            RepositorySystemSession repositorySession,
            List<RemoteRepository> remoteRepositories,
            Log log)
    {
        this.repositorySystem = repositorySystem;
        this.repositorySession = repositorySession;
        this.remoteRepositories = remoteRepositories;
        this.log = log;
    }

    /**
     * Resolves an Artifact from the repositories.
     * 
     * @param coordinates The artifact coordinates
     * @return The local file resolved/downloaded for the given coordinates
     * @throws ArtifactException If the artifact cannot be resolved
     */
    @Override
    public File resolveArtifact(String coordinates) throws ArtifactException