package org.quattor.pan.template;

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

/**
 * A class that will throw an exception if SELF is accessed in any way. This is
 * the case for include statements where SELF is undefined.
 * 
 * @author loomis
 * 
 */
public class InvalidSelfHolder extends SelfHolder {

	public InvalidSelfHolder() {
		element = null;
		unmodifiable = true;
	}

	@Override
	public Element getElement() {
		throw new EvaluationException("SELF is undefined in this context");
	}

	@Override
	public void setElement(Element element) {
		throw new EvaluationException("SELF is undefined in this context");
	}

	@Override
	public boolean isUnmodifiable() {
		return true;
	}

}
@@ -28,16 +28,99 @@
 plate;%0A%0A
+import static org.quattor.pan.utils.MessageUtils.MSG_INVALID_SELF_REF_IN_INCLUDE;%0A%0A
 import o
@@ -588,43 +588,39 @@
 ion(
-%22SELF is undefined in this context%22
+MSG_INVALID_SELF_REF_IN_INCLUDE
 );%0A%09
@@ -712,43 +712,39 @@
 ion(
-%22SELF is undefined in this context%22
+MSG_INVALID_SELF_REF_IN_INCLUDE
 );%0A%09

use internationalized version of error message