package org.apache.struts.config;

import java.io.Serializable;

public class ControllerConfig implements Serializable {
  protected boolean configured = false;
  
  protected int bufferSize = 4096;
  
  public int getBufferSize() {
    return this.bufferSize;
  }
  
  public void setBufferSize(int bufferSize) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.bufferSize = bufferSize;
  }
  
  protected String contentType = "text/html";
  
  public String getContentType() {
    return this.contentType;
  }
  
  public void setContentType(String contentType) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.contentType = contentType;
  }
  
  protected int debug = 0;
  
  public int getDebug() {
    return this.debug;
  }
  
  public void setDebug(int debug) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.debug = debug;
  }
  
  protected String forwardPattern = null;
  
  public String getForwardPattern() {
    return this.forwardPattern;
  }
  
  public void setForwardPattern(String forwardPattern) {
    this.forwardPattern = forwardPattern;
  }
  
  protected boolean inputForward = false;
  
  public boolean getInputForward() {
    return this.inputForward;
  }
  
  public void setInputForward(boolean inputForward) {
    this.inputForward = inputForward;
  }
  
  protected boolean locale = true;
  
  public boolean getLocale() {
    return this.locale;
  }
  
  public void setLocale(boolean locale) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.locale = locale;
  }
  
  protected String maxFileSize = "250M";
  
  public String getMaxFileSize() {
    return this.maxFileSize;
  }
  
  public void setMaxFileSize(String maxFileSize) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.maxFileSize = maxFileSize;
  }
  
  protected String memFileSize = "256K";
  
  public String getMemFileSize() {
    return this.memFileSize;
  }
  
  public void setMemFileSize(String memFileSize) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.memFileSize = memFileSize;
  }
  
  protected String multipartClass = "org.apache.struts.upload.CommonsMultipartRequestHandler";
  
  public String getMultipartClass() {
    return this.multipartClass;
  }
  
  public void setMultipartClass(String multipartClass) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.multipartClass = multipartClass;
  }
  
  protected boolean nocache = false;
  
  public boolean getNocache() {
    return this.nocache;
  }
  
  public void setNocache(boolean nocache) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.nocache = nocache;
  }
  
  protected String pagePattern = null;
  
  public String getPagePattern() {
    return this.pagePattern;
  }
  
  public void setPagePattern(String pagePattern) {
    this.pagePattern = pagePattern;
  }
  
  protected String processorClass = "org.apache.struts.action.RequestProcessor";
  
  public String getProcessorClass() {
    return this.processorClass;
  }
  
  public void setProcessorClass(String processorClass) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.processorClass = processorClass;
  }
  
  protected String tempDir = null;
  
  public String getTempDir() {
    return this.tempDir;
  }
  
  public void setTempDir(String tempDir) {
    if (this.configured)
      throw new IllegalStateException("Configuration is frozen"); 
    this.tempDir = tempDir;
  }
  
  public void freeze() {
    this.configured = true;
  }
  
  public String toString() {
    StringBuffer sb = new StringBuffer("ControllerConfig[");
    sb.append("bufferSize=");
    sb.append(this.bufferSize);
    if (this.contentType != null) {
      sb.append(",contentType=");
      sb.append(this.contentType);
    } 
    if (this.forwardPattern != null) {
      sb.append(",forwardPattern=");
      sb.append(this.forwardPattern);
    } 
    sb.append(",inputForward=");
    sb.append(this.inputForward);
    sb.append(",locale=");
    sb.append(this.locale);
    if (this.maxFileSize != null) {
      sb.append(",maxFileSize=");
      sb.append(this.maxFileSize);
    } 
    if (this.memFileSize != null) {
      sb.append(",memFileSize=");
      sb.append(this.memFileSize);
    } 
    sb.append(",multipartClass=");
    sb.append(this.multipartClass);
    sb.append(",nocache=");
    sb.append(this.nocache);
    if (this.pagePattern != null) {
      sb.append(",pagePattern=");
      sb.append(this.pagePattern);
    } 
    sb.append(",processorClass=");
    sb.append(this.processorClass);
    if (this.tempDir != null) {
      sb.append(",tempDir=");
      sb.append(this.tempDir);
    } 
    sb.append("]");
    return sb.toString();
  }
}
