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

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


     */
    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


class MockupRuntimeServices extends RuntimeInstance {

    @Override
    public SimpleNode parse(Reader reader, String templateName, boolean dumpNamespace)
        throws ParseException {
        return new SimpleNode(1);
    }
View Full Code Here

        return new SimpleNode(1);
    }

    @Override
    public SimpleNode parse(Reader reader, String templateName) throws ParseException {
        return new SimpleNode(1);
    }
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.getMessage() );
        }               
    
        /*
         * 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( Exception e )
                {
                    ri.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

    public static boolean evaluate( Context context, Writer writer,
                                    String logTag, Reader reader )
        throws ParseErrorException, MethodInvocationException,  
          ResourceNotFoundException,IOException
    {
        SimpleNode nodeTree = null;
       
        try
        {
            nodeTree = RuntimeSingleton.parse( reader, logTag );       
        }
        catch ( ParseException pex )
        {
            throw  new ParseErrorException( pex.getMessage() );
        }               
    
        /*
         * now we want to init and render
         */

        if (nodeTree != null)
        {
            InternalContextAdapterImpl ica =
                new InternalContextAdapterImpl( context );
           
            ica.pushCurrentTemplateName( logTag );
           
            try
            {
                try
                {
                    nodeTree.init( ica, RuntimeSingleton.getRuntimeServices() );
                }
                catch( Exception e )
                {
                    RuntimeSingleton.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

     */
    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

     * @param String name of the template being parsed
     */
    public static SimpleNode parse(InputStream inputStream, String templateName )
        throws ParseException
    {
        SimpleNode ast = null;
        Parser parser = (Parser) parserPool.get();
        boolean madeNew = false;

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

     */
    public static boolean evaluate( Context context, Writer writer,
                                    String logTag, InputStream instream )
        throws ParseErrorException, MethodInvocationException, IOException
    {
        SimpleNode nodeTree = null;
       
        /*
         *  first, parse - convert ParseException if thrown
         */

        try
        {
            nodeTree = Runtime.parse( instream, logTag );       
        }
        catch ( ParseException pex )
        {
            throw  new ParseErrorException( pex.getMessage() );
        }               
    
        /*
         * now we want to init and render
         */

        if (nodeTree != null)
        {
            InternalContextAdapterImpl ica =
                new InternalContextAdapterImpl( context );
           
            ica.pushCurrentTemplateName( logTag );
           
            try
            {
                try
                {
                    nodeTree.init( ica, null );
                }
                catch( Exception e )
                {
                    Runtime.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

     * @param String name of the template being parsed
     */
    public static SimpleNode parse( Reader reader, String templateName )
        throws ParseException
    {
        SimpleNode ast = null;
        Parser parser = (Parser) parserPool.get();
        boolean madeNew = false;

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

     */
    public static boolean evaluate( Context context, Writer writer,
                                    String logTag, Reader reader )
        throws ParseErrorException, MethodInvocationException, IOException
    {
        SimpleNode nodeTree = null;
       
        try
        {
            nodeTree = Runtime.parse( reader, logTag );       
        }
        catch ( ParseException pex )
        {
            throw  new ParseErrorException( pex.getMessage() );
        }               
    
        /*
         * now we want to init and render
         */

        if (nodeTree != null)
        {
            InternalContextAdapterImpl ica =
                new InternalContextAdapterImpl( context );
           
            ica.pushCurrentTemplateName( logTag );
           
            try
            {
                try
                {
                    nodeTree.init( ica, null );
                }
                catch( Exception e )
                {
                    Runtime.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

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.