Package com.guigarage.vagrant.configuration.builder

Source Code of com.guigarage.vagrant.configuration.builder.PuppetProvisionerConfigBuilder

package com.guigarage.vagrant.configuration.builder;

import com.guigarage.vagrant.configuration.PuppetProvisionerConfig;
import com.guigarage.vagrant.configuration.builder.util.VagrantBuilderException;

/**
* Builder for {@link PuppetProvisionerConfig}
* @author hendrikebbers
*
*/
public class PuppetProvisionerConfigBuilder {

  private String manifestPath;
 
  private String manifestFile;
 
  private boolean debug;
 
  private String modulesPath;
 
  public PuppetProvisionerConfigBuilder() {
  }
 
  /**
   * creates a new {@link PuppetProvisionerConfigBuilder}
   * @return a new {@link PuppetProvisionerConfigBuilder}
   */
  public static PuppetProvisionerConfigBuilder create() {
    return new PuppetProvisionerConfigBuilder();
  }
 
  public PuppetProvisionerConfigBuilder withManifestFile(String manifestFile) {
    this.manifestFile = manifestFile;
    return this;
  }
 
  public PuppetProvisionerConfigBuilder withManifestPath(String manifestPath) {
    this.manifestPath = manifestPath;
    return this;
  }
 
  public PuppetProvisionerConfigBuilder withModulesPath(String modulesPath) {
    this.modulesPath = modulesPath;
    return this;
  }
 
  public PuppetProvisionerConfigBuilder withDebug(boolean debug) {
    this.debug = debug;
    return this;
  }
 
  public PuppetProvisionerConfig build() {
    if(manifestPath == null) {
      throw new VagrantBuilderException("no manifestPath defined!");
    }
    if(manifestFile == null) {
      throw new VagrantBuilderException("no manifestFile defined!");
    }
    return new PuppetProvisionerConfig(debug, manifestPath, manifestFile, modulesPath);
  }
}
TOP

Related Classes of com.guigarage.vagrant.configuration.builder.PuppetProvisionerConfigBuilder

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.