package org.quattor.pan.template;

import org.quattor.pan.dml.data.Element;
import org.quattor.pan.exceptions.EvaluationException;

/**
 * Essentially just a structure to hold values related to the processing of the
 * SELF variable. This is treated as a separate structure because we must save
 * (restore) these values when entering (exiting) a structure template.
 * 
 * @author loomis
 * 
 */
public class ReadOnlySelfHolder extends SelfHolder {

	public ReadOnlySelfHolder(Element element) {
		this.element = element;
		unmodifiable = true;
	}

	public void setElement(Element element) {
		if (this.element != element) {
			throw new EvaluationException(
					"cannot modify SELF from validation function");
		}
	}

}
@@ -28,16 +28,90 @@
 plate;%0A%0A
+import static org.quattor.pan.utils.MessageUtils.MSG_CANNOT_MODIFY_SELF;%0A%0A
 import o
@@ -730,59 +730,30 @@
 ion(
-%0A%09%09%09%09%09%22cannot modify SELF from validation function%22
+MSG_CANNOT_MODIFY_SELF
 );%0A%09

use internationalized version of error message