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.regex.Matcher;
020
021import org.apache.maven.plugins.annotations.Parameter;
022
023import org.microbean.helm.ReleaseManager;
024
025/**
026 * An {@link AbstractMutatingReleaseMojo} that can be forced.
027 *
028 * @author <a href="https://about.me/lairdnelson"
029 * target="_parent">Laird Nelson</a>
030 */
031public abstract class AbstractForceableMutatingReleaseMojo extends AbstractMutatingReleaseMojo {
032
033
034  /*
035   * Instance fields.
036   */
037
038
039  /**
040   * Whether the operation should be forced.
041   */
042  @Parameter(defaultValue = "false", property = "helm.force")
043  private boolean force;
044
045  /**
046   * Whether Pods should be recreated as part of the operation.
047   */
048  @Parameter(defaultValue = "false", property = "helm.recreate")
049  private boolean recreate;
050
051
052  /*
053   * Constructors.
054   */
055
056
057  /**
058   * Creates a new {@link AbstractForceableMutatingReleaseMojo}.
059   */
060  protected AbstractForceableMutatingReleaseMojo() {
061    super();
062  }
063
064
065  /*
066   * Instance methods.
067   */
068
069
070  /**
071   * Returns whether the operation should be forced.
072   *
073   * @return whether the operation should be forced
074   *
075   * @see #setForce(boolean)
076   */
077  public boolean getForce() {
078    return this.force;
079  }
080
081  /**
082   * Sets whether the operation should be forced.
083   *
084   * @param force whether the operation should be forced
085   *
086   * @see #getForce()
087   */
088  public void setForce(final boolean force) {
089    this.force = force;
090  }
091
092  /**
093   * Returns whether Pods should be recreated as part of the
094   * operation.
095   *
096   * @return whether Pods should be recreated as part of the operation
097   *
098   * @see #setRecreate(boolean)
099   */
100  public boolean getRecreate() {
101    return this.recreate;
102  }
103
104  /**
105   * Sets whether Pods should be recreated as part of the operation.
106   *
107   * @param recreate whether Pods should be recreated as part of the
108   * operation
109   *
110   * @see #getRecreate()
111   */
112  public void setRecreate(final boolean recreate) {
113    this.recreate = recreate;
114  }
115
116}