Paul Libbrecht wrote:
> Why can't you use the catch tag which would catch the exception
> generated by sub-calls of getVariable ?
It's not in my point of view a very nice way of doing this purpose :0)
It however works with a JellyContext extension with override like
<code_extract>
/**
* @see
org.apache.commons.jelly.JellyContext#getVariable(java.lang.String)
*/
public Object getVariable(String name) {
Object object = super.getVariable(name);
if ( object == null ) {
object = fireRule(name,null);
}
return object;
}
</code_extract>
with
<code_extract>
public Object fireRule(String name, String scopeName) {
Object object = null;
if ( ruleMap != null && ! ruleMap.isEmpty() ) {
if ( ! firedRuleSet.contains(name) ) {
Rule rule = (Rule) ruleMap.get(name);
if ( rule != null ) {
rule.run(this);
firedRuleSet.add(name);
object =
super.getVariable(name,scopeName);
return object;
}
}
}
return object;
}
</code_extract>
And a new Rule interface
public interface Rule {
/**
* @param context
*/
public void run(JellyContext context) ;
}
You have just to pass a PhotonContext before running script body.
............................................
Marc DeXeT
Direction des Syst�mes d'Informations
Centre National de la Recherche Scientifique
~ * ~
Information System Direction
National Center for Scientific Research
http://www.cnrs.fr
............................................