Package org.apache.commons.jelly

Examples of org.apache.commons.jelly.Script.run()


        XMLParser parser = new XMLParser();
        Script script = parser.parse(in);
        script = script.compile();
        assertTrue("Parsed a Script", script instanceof Script);
        StringWriter buffer = new StringWriter();
        script.run(parser.getContext(), XMLOutput.createXMLOutput(buffer));

        String text = buffer.toString().trim();
        if (log.isDebugEnabled()) {
            log.debug("Evaluated script as...");
            log.debug(text);
View Full Code Here


        assertTrue("Parsed a Script", script instanceof Script);
        String[] args = { "one", "two", "three" };
        JellyContext context = new JellyContext();
        context.setVariable("args", args);
        StringWriter buffer = new StringWriter();
        script.run(context, XMLOutput.createXMLOutput(buffer));
        String text = buffer.toString().trim();
        if (log.isDebugEnabled()) {
            log.debug("Evaluated script as...");
            log.debug(text);
        }
View Full Code Here

        XMLOutput    output       = (XMLOutput) data.get( "jelly.output" );

        try
        {
            script.run( jellyContext,
                        output );
            output.flush();
        }
        catch (Exception e)
        {
View Full Code Here

            }
           
            Script script = compileScript();
            JellyContext context = getJellyContext();
            context.setVariable( "project", project );
            script.run( context, getXMLOutput() );
            getXMLOutput().close();
        }
        catch (Exception e) {
            throw new BuildException(e, location);
        }
View Full Code Here

    //-------------------------------------------------------------------------                   
    public void doTag(XMLOutput output) throws Exception {
        // Try find find the body from the reserved 'org.apache.commons.jelly.body' variable
        Script script = (Script) context.getVariable("org.apache.commons.jelly.body");
        if (script != null) {
            script.run(context, output);
        }
        else {
            // note this mechanism does not work properly for arbitrarily
            // nested dynamic tags. A better way is required.
            Tag tag = findAncestorWithClass(this, DynamicTag.class);
View Full Code Here

            script.run(context, output);
        }
*/   
        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            Script script = (Script) iter.next();
            script.run(context, output);
        }
    }
}
View Full Code Here

            script.run(context, output);
        }
*/
        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            Script script = (Script) iter.next();
            script.run(context, output);
        }
    }
}
View Full Code Here

        Script script = getJelly().compileScript();

        getJellyContext().setVariable( "test.Integer.MAX_VALUE",
                                       Boolean.TRUE );

        script.run( getJellyContext(), getXMLOutput() );

        assertEquals( new Integer(java.lang.Integer.MAX_VALUE),
                      getJellyContext().getVariable("value" ) );
    }
View Full Code Here

        Script script = getJelly().compileScript();

        getJellyContext().setVariable( "test.InvalidGet", Boolean.TRUE );

        try {
            script.run( getJellyContext(), getXMLOutput() );
        } catch(JellyTagException jte) {
            return;
        }

        fail("JellyTagException not thrown.");
View Full Code Here

     */
    public void testSimple() throws Exception{
        setUpScript("testUseBeanTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("test.simple",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        assertNotNull(getJellyContext().getVariable("foo"));
        assertTrue(getJellyContext().getVariable("foo") instanceof Customer);
        Customer customer = (Customer)(getJellyContext().getVariable("foo"));
        assertEquals("name not set", "testing", customer.getName());
        assertEquals("city not set", "sydney", customer.getCity());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.