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.io.Serializable; // for javadoc only
031
032import java.util.Collection;
033
034import org.apache.maven.artifact.Artifact;
035
036/**
037 * An {@link Exception} indicating that something has gone wrong
038 * during {@linkplain ArtifactsProcessor#process(MavenProject,
039 * Collection, Log) <code>Artifact</code> processing}.
040 *
041 * @author <a href="http://about.me/lairdnelson"
042 * target="_parent">Laird Nelson</a>
043 *
044 * @see ArtifactsProcessor
045 *
046 * @see ArtifactMojo
047 */
048public class ArtifactsProcessingException extends Exception {
049
050  /**
051   * The version of this class for {@linkplain Serializable
052   * serialization} purposes.
053   */
054  private static final long serialVersionUID = 1L;
055
056  /**
057   * The {@link Collection} of {@link Artifact}s that caused this
058   * {@link ArtifactsProcessingException} to be thrown.
059   *
060   * <p>This field may be {@code null}.</p>
061   *
062   * @see #setArtifacts(Collection)
063   */
064  private Collection<? extends Artifact> artifacts;
065
066  /**
067   * Creates a new {@link ArtifactsProcessingException}.
068   */
069  public ArtifactsProcessingException() {
070    super();
071  }
072
073  /**
074   * Creates a new {@link ArtifactsProcessingException}.
075   *
076   * @param message a message describing the error; may be {@code
077   * null}
078   */
079  public ArtifactsProcessingException(final String message) {
080    super(message);
081  }
082
083  /**
084   * Creates a new {@link ArtifactsProcessingException}.
085   *
086   * @param cause the {@link Throwable} that caused this {@link
087   * ArtifactsProcessingException} to be thrown; may be {@code null}
088   */
089  public ArtifactsProcessingException(final Throwable cause) {
090    super(cause);
091  }
092
093  /**
094   * Returns the {@link Collection} of {@link Artifact}s that caused
095   * this {@link ArtifactsProcessingException} to be thrown.
096   *
097   * <p>This method may return {@code null}.</p>
098   *
099   * @return the {@link Collection} of {@link Artifact}s that caused
100   * this {@link ArtifactsProcessingException} to be thrown, or {@code
101   * null}
102   *
103   * @see #setArtifacts(Collection)
104   */
105  public Collection<? extends Artifact> getArtifacts() {
106    return this.artifacts;
107  }
108
109  /**
110   * Sets the {@link Collection} of {@link Artifact}s that caused this
111   * {@link ArtifactsProcessingException} to be thrown.
112   *
113   * @param artifacts the {@link Collection} of {@link Artifact}s that
114   * caused this {@link ArtifactsProcessingException} to be thrown;
115   * may be {@code null}
116   *
117   * @see #getArtifacts()
118   */
119  public void setArtifacts(final Collection<? extends Artifact> artifacts) {
120    this.artifacts = artifacts;
121  }
122
123}