public void init(RuntimeServices rs,
InternalContextAdapter context,
Node node) throws TemplateInitException {
super.init( rs, context, node );
/*
* get the msg, and add the space so we don't have to
* do it each time
*/
outputMsgStart = rsvc.getString(RuntimeConstants.ERRORMSG_START);
outputMsgStart = outputMsgStart + " ";
outputMsgEnd = rsvc.getString(RuntimeConstants.ERRORMSG_END );
outputMsgEnd = " " + outputMsgEnd;
}
simple init - init the tree and get the elementKey from
the AST |
public boolean render(InternalContextAdapter context,
Writer writer,
Node node) throws MethodInvocationException, IOException, ResourceNotFoundException {
/*
* get our arguments and check them
*/
int argCount = node.jjtGetNumChildren();
for( int i = 0; i < argCount; i++)
{
/*
* we only handle StringLiterals and References right now
*/
Node n = node.jjtGetChild(i);
if ( n.getType() == ParserTreeConstants.JJTSTRINGLITERAL ||
n.getType() == ParserTreeConstants.JJTREFERENCE )
{
if (!renderOutput( n, context, writer ))
outputErrorToStream( writer, "error with arg " + i
+ " please see log.");
}
else
{
rsvc.getLog().error("#include() invalid argument type: "
+ n.toString());
outputErrorToStream( writer, "error with arg " + i
+ " please see log.");
}
}
return true;
}
iterates through the argument list and renders every
argument that is appropriate. Any non appropriate
arguments are logged, but render() continues. |