made app.properties-object readonly, plus formatting fixes.

This commit is contained in:
stefanp 2002-07-29 12:46:36 +00:00
parent e6cf8647cc
commit 1012b31a6a

View file

@ -2,7 +2,9 @@ package helma.scripting.fesi;
import java.util.Map;
import helma.framework.core.ApplicationBean;
import helma.objectmodel.INode;
import helma.util.SystemProperties;
import FESI.Interpreter.Evaluator;
import FESI.Exceptions.EcmaScriptException;
@ -24,16 +26,20 @@ public class ESBeanWrapper extends ESWrapper {
}
/**
* Wrap getProperty, return ESNode if INode would be returned.
* Wrap getProperty, return ESNode if INode would be returned,
* ESMapWrapper if Map would be returned.
*/
public ESValue getProperty(String propertyName, int hash)
throws EcmaScriptException {
public ESValue getProperty(String propertyName, int hash) throws EcmaScriptException {
try {
ESValue val = super.getProperty (propertyName, hash);
if (val instanceof ESWrapper && ((ESWrapper)val).getJavaObject() instanceof INode) {
return eval.getNodeWrapper( (INode) ((ESWrapper)val).getJavaObject() );
} else if (val instanceof ESWrapper && ((ESWrapper)val).getJavaObject() instanceof Map) {
return new ESMapWrapper(eval, (Map) ((ESWrapper)val).getJavaObject() );
Object theObject = ((ESWrapper)val).getJavaObject ();
if (val instanceof ESWrapper && theObject instanceof INode) {
return eval.getNodeWrapper ((INode) theObject);
} else if (val instanceof ESWrapper && theObject instanceof Map) {
ESMapWrapper wrapper = new ESMapWrapper(eval, (Map) theObject);
if (theObject instanceof SystemProperties && super.getJavaObject () instanceof ApplicationBean)
wrapper.setReadonly(true);
return wrapper;
} else {
return val;
}
@ -42,8 +48,7 @@ public class ESBeanWrapper extends ESWrapper {
}
}
public void putProperty(String propertyName, ESValue propertyValue, int hash)
throws EcmaScriptException {
public void putProperty(String propertyName, ESValue propertyValue, int hash) throws EcmaScriptException {
try {
super.putProperty (propertyName, propertyValue, hash);
} catch (Exception rte) {