/**
 * 
 */
package com.lazerycode.jmeter.mojo;

import java.io.File;
import java.util.Collections;
import java.util.Map;

import com.lazerycode.jmeter.properties.ConfigurationFiles;
import com.lazerycode.jmeter.properties.PropertiesMapping;

/**
 * Holds configuration 
 */
public class JMeterConfigurationHolder {
    private static final JMeterConfigurationHolder INSTANCE = new JMeterConfigurationHolder();
    private String runtimeJarName;
    private File workingDirectory;
    private Map<ConfigurationFiles, PropertiesMapping> propertiesMap;
    
    private boolean configurationFreezed;

    /**
     * 
     */
    private JMeterConfigurationHolder() {
        super();
    }

    public static final JMeterConfigurationHolder getInstance() {
        return INSTANCE;
    }

    /**
     * @return the runtimeJarName
     */
    public String getRuntimeJarName() {
        return runtimeJarName;
    }

    /**
     * @param runtimeJarName the runtimeJarName to set
     */
    void setRuntimeJarName(String runtimeJarName) {
        if(configurationFreezed) {
            throw new IllegalStateException("setRuntimeJarName called while JMeter configuration already freezed");
        }
        this.runtimeJarName = runtimeJarName;
    }

    /**
     * @return the workingDirectory
     */
    public File getWorkingDirectory() {
        return workingDirectory;
    }

    /**
     * @param workingDirectory the workingDirectory to set
     */
    void setWorkingDirectory(File workingDirectory) {
        if(configurationFreezed) {
            throw new IllegalStateException("setWorkingDirectory called while JMeter configuration already freezed");
        }
        this.workingDirectory = workingDirectory;
    }

    /**
     * @return the propertiesMap
     */
    public Map<ConfigurationFiles, PropertiesMapping> getPropertiesMap() {
        return propertiesMap;
    }

    /**
     * @param propertiesMap the propertiesMap to set
     */
    void setPropertiesMap(Map<ConfigurationFiles, PropertiesMapping> propertiesMap) {
        if(configurationFreezed) {
            throw new IllegalStateException("setPropertiesMap called while JMeter configuration already freezed");
        }
        this.propertiesMap = Collections.unmodifiableMap(propertiesMap);
    }

    /**
     * Freeze configuration
     */
    void freezeConfiguration() {
        this.configurationFreezed = true;
    }
    
    /**
     * Allow to reset configuration
     */
    void resetConfiguration() {
        workingDirectory = null;
        runtimeJarName = null;
        propertiesMap = null;
        this.configurationFreezed = false;
    }
}

@@ -1,15 +1,14 @@
 /**%0A *
- 
 %0A */%0Apac
@@ -45,82 +45,8 @@
 o;%0A%0A
-import java.io.File;%0Aimport java.util.Collections;%0Aimport java.util.Map;%0A%0A
 impo
@@ -161,16 +161,90 @@
 pping;%0A%0A
+import java.io.File;%0Aimport java.util.Collections;%0Aimport java.util.Map;%0A%0A
 /**%0A * H
@@ -543,20 +543,16 @@
 iesMap;%0A
-    
 %0A    pri
@@ -579,21 +579,20 @@
 rationFr
-eezed
+ozen
 ;%0A%0A    /
@@ -600,17 +600,16 @@
 *%0A     *
- 
 %0A     */
@@ -1026,32 +1026,33 @@
 me) %7B%0A        if
+ 
 (configurationFr
@@ -1043,37 +1043,36 @@
 (configurationFr
-eezed
+ozen
 ) %7B%0A            
@@ -1501,32 +1501,33 @@
 ry) %7B%0A        if
+ 
 (configurationFr
@@ -1518,37 +1518,36 @@
 (configurationFr
-eezed
+ozen
 ) %7B%0A            
@@ -2045,16 +2045,17 @@
       if
+ 
 (configu
@@ -2062,21 +2062,20 @@
 rationFr
-eezed
+ozen
 ) %7B%0A    
@@ -2380,21 +2380,20 @@
 rationFr
-eezed
+ozen
  = true;
@@ -2399,20 +2399,16 @@
 ;%0A    %7D%0A
-    
 %0A    /**
@@ -2606,21 +2606,20 @@
 rationFr
-eezed
+ozen
  = false

Change variable name from configurationFreezed to configurationFrozen