001/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
002 *
003 * Copyright (c) 2014 Edugility LLC.
004 *
005 * Permission is hereby granted, free of charge, to any person
006 * obtaining a copy of this software and associated documentation
007 * files (the "Software"), to deal in the Software without
008 * restriction, including without limitation the rights to use, copy,
009 * modify, merge, publish, distribute, sublicense and/or sell copies
010 * of the Software, and to permit persons to whom the Software is
011 * furnished to do so, subject to the following conditions:
012 *
013 * The above copyright notice and this permission notice shall be
014 * included in all copies or substantial portions of the Software.
015 *
016 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
017 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
018 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
019 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
020 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
021 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
022 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
023 * DEALINGS IN THE SOFTWARE.
024 *
025 * The original copy of this license is available at
026 * http://www.opensource.org/license/mit-license.html.
027 */
028package com.edugility.maven;
029
030import java.util.Collection;
031
032import org.apache.maven.artifact.Artifact;
033
034import org.apache.maven.plugin.logging.Log;
035
036import org.apache.maven.project.MavenProject;
037
038/**
039 * A processor of Maven {@link Artifact}s.
040 *
041 * @author <a href="http://about.me/lairdnelson"
042 * target="_parent">Laird Nelson</a>
043 *
044 * @see ArtifactMojo
045 */
046public interface ArtifactsProcessor {
047
048  /**
049   * Performs some operation on the supplied {@link Collection} of
050   * {@link Artifact}s in the context of the supplied {@link
051   * MavenProject} and returns a {@link Collection} of {@link
052   * Artifact}s representing the result.
053   *
054   * <p>Implementations of this method are permitted to return {@code
055   * null}.</p>
056   *
057   * <p>Implementations of this method are permitted to return the
058   * supplied {@link Collection} of {@link Artifact}s.</p>
059   *
060   * <p>Implementations of this method are permitted to mutate the
061   * supplied {@link Collection} and/or any of its elements.</p>
062   *
063   * <p>Implementations of this method must not mutate the supplied
064   * {@link MavenProject}.</p>
065   *
066   * @param project the {@link MavenProject} in the context of which
067   * processing will take place; must not be {@code null}
068   *
069   * @param artifacts the {@link Artifact}s to process; may be {@code
070   * null}
071   *
072   * @param log the {@link Log} to use when logging; may be {@code
073   * null}
074   *
075   * @return a {@link Collection} of {@link Artifact}s representing
076   * the result of processing, or {@code null}
077   *
078   * @exception ArtifactsProcessingException if an error occurs
079   *
080   * @see ArtifactMojo
081   *
082   * @see Artifact
083   * 
084   * @see MavenProject
085   */
086  public Collection<? extends Artifact> process(final MavenProject project, final Collection<? extends Artifact> artifacts, final Log log) throws ArtifactsProcessingException;
087
088}