001/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
002 *
003 * Copyright © 2017-2018 microBean.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
014 * implied.  See the License for the specific language governing
015 * permissions and limitations under the License.
016 */
017package org.microbean.helm.maven;
018
019import java.io.Serializable; // for javadoc only
020
021import java.util.EventObject; // for javadoc only
022import java.util.Objects;
023
024import hapi.services.tiller.Tiller.GetHistoryResponseOrBuilder;
025
026/**
027 * An {@link AbstractReleaseEvent} describing a retrieval of the
028 * history of a <a href="https://docs.helm.sh/glossary/#release">Helm
029 * release</a>.
030 *
031 * @author <a href="https://about.me/lairdnelson"
032 * target="_parent">Laird Nelson</a>
033 *
034 * @see ReleaseHistoryListener
035 *
036 * @see GetHistoryMojo
037 */
038public class ReleaseHistoryEvent extends AbstractReleaseEvent {
039
040  
041  /*
042   * Static fields.
043   */
044
045
046  /**
047   * The version of this class for {@linkplain Serializable
048   * serialization} purposes.
049   */
050  private static final long serialVersionUID = 1L;
051  
052
053  /*
054   * Instance fields.
055   */
056
057
058  /**
059   * The {@link
060   * hapi.services.tiller.Tiller.GetHistoryResponseOrBuilder}
061   * describing the history retrieval.
062   *
063   * <p>This field will never be {@code null}.</p>
064   *
065   * @see #ReleaseHistoryEvent(GetHistoryMojo,
066   * hapi.services.tiller.Tiller.GetHistoryResponseOrBuilder)
067   */
068  private final GetHistoryResponseOrBuilder getHistoryResponseOrBuilder;
069
070
071  /*
072   * Constructors.
073   */
074
075
076  /**
077   * Creates a new {@link ReleaseHistoryEvent}.
078   *
079   * @param source the {@link GetHistoryMojo} responsible for
080   * retrieving the history; must not be {@code null}
081   *
082   * @param getHistoryResponseOrBuilder the {@link
083   * hapi.services.tiller.Tiller.GetHistoryResponseOrBuilder}
084   * describing the history retrieval; must not be {@code null}
085   *
086   * @exception IllegalArgumentException if {@code source} is {@code
087   * null}; thrown by the {@link EventObject#EventObject(Object)}
088   * constructor
089   *
090   * @exception NullPointerException if {@code
091   * getReleaseHistoryResponseOrBuilder} is {@code null}
092   */
093  public ReleaseHistoryEvent(final GetHistoryMojo source, final GetHistoryResponseOrBuilder getHistoryResponseOrBuilder) {
094    super(source);
095    Objects.requireNonNull(getHistoryResponseOrBuilder);
096    this.getHistoryResponseOrBuilder = getHistoryResponseOrBuilder;
097  }
098
099  
100  /*
101   * Instance methods.
102   */
103
104
105  /**
106   * Returns the {@link
107   * hapi.services.tiller.Tiller.GetHistoryResponseOrBuilder}
108   * implementation representing the history retrieval.
109   *
110   * <p>This method never returns {@code null}.</p>
111   *
112   * @return the {@link
113   * hapi.services.tiller.Tiller.GetHistoryResponseOrBuilder}
114   * implementation representing the history retrieval; never {@code
115   * null}
116   */
117  public final GetHistoryResponseOrBuilder getHistoryResponseOrBuilder() {
118    return this.getHistoryResponseOrBuilder;
119  }
120
121  /**
122   * Returns the {@link GetHistoryMojo} responsible for firing
123   * this event.
124   *
125   * <p>This method never returns {@code null}.</p>
126   *
127   * @return the {@link GetHistoryMojo} responsible for firing this
128   * event; never {@code null}
129   */
130  @Override
131  public final GetHistoryMojo getSource() {
132    return (GetHistoryMojo)super.getSource();
133  }
134  
135}