Package org.apache.velocity.runtime.parser.node

Examples of org.apache.velocity.runtime.parser.node.SimpleNode


                getLog().error("Could not auto-initialize Velocity", e);
                throw new IllegalStateException("Velocity could not be initialized!");
            }
        }

        SimpleNode ast = null;
        Parser parser = (Parser) parserPool.get();

        if (parser == null) {
            /*
             *  if we couldn't get a parser from the pool
View Full Code Here


     */
    public boolean evaluate(Context context, Writer writer,
                            String logTag, Reader reader)
        throws ParseErrorException, MethodInvocationException,
        ResourceNotFoundException, IOException {
        SimpleNode nodeTree = null;

        try {
            nodeTree = ri.parse(reader, logTag);
        }
        catch (ParseException pex) {
            throw new ParseErrorException(pex);
        }
        catch (TemplateInitException pex) {
            throw new ParseErrorException(pex);
        }

        /*
         * now we want to init and render
         */

        if (nodeTree != null) {
            InternalContextAdapterImpl ica =
                new InternalContextAdapterImpl(context);

            ica.pushCurrentTemplateName(logTag);

            try {
                try {
                    nodeTree.init(ica, ri);
                }
                catch (TemplateInitException pex) {
                    throw new ParseErrorException(pex);
                }
                /**
                 * pass through application level runtime exceptions
                 */
                catch (RuntimeException e) {
                    throw e;
                }
                catch (Exception e) {
                    getLog().error("Velocity.evaluate() : init exception for tag = "
                        + logTag, e);
                }

                /*
                 *  now render, and let any exceptions fly
                 */

                nodeTree.render(ica, writer);
            }
            finally {
                ica.popCurrentTemplateName();
            }

View Full Code Here

                getLog().error("Could not auto-initialize Velocity", e);
                throw new IllegalStateException("Velocity could not be initialized!");
            }
        }

        SimpleNode ast = null;
        Parser parser = (Parser) parserPool.get();

        if (parser == null) {
            /*
             *  if we couldn't get a parser from the pool
View Full Code Here

     * @param encoding The encoding of the template.
     * @param name A name associated with the template that will be used in log messages.
     * @return The created special template.
     */
    public SpecialTemplate getSpecialTemplate(Reader reader, String encoding, String name) {
        SimpleNode nodeTree = null;

        try {
            nodeTree = parse(reader, name);
        }
        catch (ParseException pex) {
View Full Code Here

     */
    public boolean evaluate(Context context, Writer writer,
                            String logTag, Reader reader)
        throws ParseErrorException, MethodInvocationException,
        ResourceNotFoundException, IOException {
        SimpleNode nodeTree = null;

        try {
            nodeTree = ri.parse(reader, logTag);
        }
        catch (ParseException pex) {
            throw new ParseErrorException(pex);
        }
        catch (TemplateInitException pex) {
            throw new ParseErrorException(pex);
        }

        /*
         * now we want to init and render
         */

        if (nodeTree != null) {
            InternalContextAdapterImpl ica =
                new InternalContextAdapterImpl(context);

            ica.pushCurrentTemplateName(logTag);

            try {
                try {
                    nodeTree.init(ica, ri);
                }
                catch (TemplateInitException pex) {
                    throw new ParseErrorException(pex);
                }
                /**
                 * pass through application level runtime exceptions
                 */
                catch (RuntimeException e) {
                    throw e;
                }
                catch (Exception e) {
                    getLog().error("Velocity.evaluate() : init exception for tag = "
                        + logTag, e);
                }

                /*
                 *  now render, and let any exceptions fly
                 */

                nodeTree.render(ica, writer);
            }
            finally {
                ica.popCurrentTemplateName();
            }

View Full Code Here

        /*
         *  this is really the only thing we can do here as everything
         *  else is context sensitive
         */

        SimpleNode sn = (SimpleNode) node.jjtGetChild(0);

        if (sn instanceof ASTReference)
        {
            elementKey = ((ASTReference) sn).getRootString();
        }
        else
        {
            /*
             * the default, error-prone way which we'll remove
             *  TODO : remove if all goes well
             */
            elementKey = sn.getFirstToken().image.substring(1);
        }

        /*
         * make an uberinfo - saves new's later on
         */
 
View Full Code Here

        if (logTag == null)
        {
            throw new NullPointerException("logTag (i.e. template name) cannot be null, you must provide an identifier for the content being evaluated");
        }

        SimpleNode nodeTree = null;
        try
        {
            nodeTree = parse(reader, logTag);
        }
        catch (ParseException pex)
View Full Code Here

        if (logTag == null)
        {
            throw new NullPointerException("logTag (i.e. template name) cannot be null, you must provide an identifier for the content being evaluated");
        }

        SimpleNode nodeTree = null;
        try
        {
            nodeTree = parse(reader, logTag);
        }
        catch (ParseException pex)
View Full Code Here

     */
    public SimpleNode parse( Reader reader, String templateName, boolean dumpNamespace )
        throws ParseException
    {

        SimpleNode ast = null;
        Parser parser = (Parser) parserPool.get();
        boolean madeNew = false;

        if (parser == null)
        {
View Full Code Here

     */
    public SimpleNode parse( Reader reader, String templateName, boolean dumpNamespace )
        throws ParseException
    {

        SimpleNode ast = null;
        Parser parser = (Parser) parserPool.get();
        boolean madeNew = false;

        if (parser == null)
        {
View Full Code Here

TOP

Related Classes of org.apache.velocity.runtime.parser.node.SimpleNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.