001/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
002 *
003 * Copyright © 2017 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.GetReleaseStatusResponseOrBuilder;
025
026/**
027 * An {@link AbstractReleaseEvent} describing a retrieval of the
028 * status 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 ReleaseStatusListener
035 *
036 * @see GetReleaseStatusMojo
037 */
038public class ReleaseStatusEvent 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.GetReleaseStatusResponseOrBuilder}
061   * describing the status retrieval.
062   *
063   * <p>This field will never be {@code null}.</p>
064   *
065   * @see #ReleaseStatusEvent(GetReleaseStatusMojo,
066   * hapi.services.tiller.Tiller.GetReleaseStatusResponseOrBuilder)
067   */
068  private final GetReleaseStatusResponseOrBuilder getReleaseStatusResponseOrBuilder;
069
070
071  /*
072   * Constructors.
073   */
074
075
076  /**
077   * Creates a new {@link ReleaseStatusEvent}.
078   *
079   * @param source the {@link GetReleaseStatusMojo} responsible for
080   * retrieving the status; must not be {@code null}
081   *
082   * @param getReleaseStatusResponseOrBuilder the {@link
083   * hapi.services.tiller.Tiller.GetReleaseStatusResponseOrBuilder}
084   * describing the status 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   * getReleaseStatusResponseOrBuilder} is {@code null}
092   */
093  public ReleaseStatusEvent(final GetReleaseStatusMojo source, final GetReleaseStatusResponseOrBuilder getReleaseStatusResponseOrBuilder) {
094    super(source);
095    Objects.requireNonNull(getReleaseStatusResponseOrBuilder);
096    this.getReleaseStatusResponseOrBuilder = getReleaseStatusResponseOrBuilder;
097  }
098
099
100  /*
101   * Instance methods.
102   */
103
104
105  /**
106   * Returns the {@link
107   * hapi.services.tiller.Tiller.GetReleaseStatusResponseOrBuilder}
108   * implementation representing the status retrieval.
109   *
110   * <p>This method never returns {@code null}.</p>
111   *
112   * @return the {@link
113   * hapi.services.tiller.Tiller.GetReleaseStatusResponseOrBuilder}
114   * implementation representing the status retrieval; never {@code
115   * null}
116   */
117  public final GetReleaseStatusResponseOrBuilder getReleaseStatusResponseOrBuilder() {
118    return this.getReleaseStatusResponseOrBuilder;
119  }
120
121  /**
122   * Returns the {@link GetReleaseStatusMojo} responsible for firing
123   * this event.
124   *
125   * <p>This method never returns {@code null}.</p>
126   *
127   * @return the {@link GetReleaseStatusMojo} responsible for firing
128   * this event; never {@code null}
129   */
130  @Override
131  public final GetReleaseStatusMojo getSource() {
132    return (GetReleaseStatusMojo)super.getSource();
133  }
134  
135}