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.util.EventListener;
020import java.util.Objects;
021
022import hapi.services.tiller.Tiller.GetReleaseContentResponseOrBuilder;
023
024import org.apache.maven.plugin.logging.Log;
025
026/**
027 * A {@link ReleaseContentListener} that {@linkplain
028 * Log#info(CharSequence) logs} the {@link
029 * hapi.services.tiller.Tiller.GetReleaseContentResponseOrBuilder}
030 * {@linkplain
031 * ReleaseContentEvent#getReleaseContentResponseOrBuilder() associated
032 * with a <code>ReleaseContentEvent</code>}.
033 *
034 * @author <a href="https://about.me/lairdnelson"
035 * target="_parent">Laird Nelson</a>
036 *
037 * @see ReleaseContentEvent
038 *
039 * @see ReleaseContentListener
040 */
041public class AbstractReleaseContentListener implements ReleaseContentListener {
042
043
044  /*
045   * Constructors.
046   */
047
048  
049  /**
050   * Creates a new {@link AbstractReleaseContentListener}.
051   */
052  public AbstractReleaseContentListener() {
053    super();
054  }
055
056
057  /*
058   * Instance methods.
059   */
060  
061
062  /**
063   * {@linkplain Log#info(CharSequence) Logs} the {@link
064   * hapi.services.tiller.Tiller.GetReleaseContentResponseOrBuilder}
065   * {@linkplain
066   * ReleaseContentEvent#getReleaseContentResponseOrBuilder()
067   * associated with a <code>ReleaseContentEvent</code>}.
068   *
069   * @param event the {@link ReleaseContentEvent} describing the
070   * release content; may be {@code null} in which case no action will
071   * be taken
072   *
073   * @see ReleaseContentEvent
074   *
075   * @see
076   * hapi.services.tiller.Tiller.GetReleaseContentResponse#toString()
077   */
078  @Override
079  public void releaseContentRetrieved(final ReleaseContentEvent event) {
080    if (event != null) {
081      final Log log = event.getLog();
082      if (log != null && log.isInfoEnabled()) {
083        log.info(String.valueOf(event.getReleaseContentResponseOrBuilder()));
084      }
085    }
086  }
087  
088}