Example usage for org.apache.commons.jelly XMLOutput createDummyXMLOutput

List of usage examples for org.apache.commons.jelly XMLOutput createDummyXMLOutput

Introduction

In this page you can find the example usage for org.apache.commons.jelly XMLOutput createDummyXMLOutput.

Prototype

public static XMLOutput createDummyXMLOutput() 

Source Link

Document

returns an XMLOutput object that will discard all tag-generated XML events.

Usage

From source file:com.cyclopsgroup.waterview.jelly.DeterminePageValve.java

private Page loadPage(Script script) throws JellyTagException {
    JellyContext jc = new JellyContext(jelly.getGlobalContext());
    script.run(jc, XMLOutput.createDummyXMLOutput());
    return (Page) jc.getVariable(Page.NAME);
}

From source file:com.cyclopsgroup.waterview.navigator.impl.DefaultNavigatorService.java

/**
 * Overwrite or implement method in DefaultNavigatorHome
 *
 * @see org.apache.avalon.framework.activity.Initializable#initialize()
 *///from   w  w w  . j av  a 2  s. com
public void initialize() throws Exception {
    pathIndex = new Hashtable();
    parentPathIndex = new MultiHashMap();
    pageIndex = new Hashtable();

    rootNode = new DefaultNavigatorNode(this, "/", null);
    rootNode.getAttributes().set(DefaultNavigatorNode.PAGE_NAME, "/Index.jelly");
    rootNode.getAttributes().set(DefaultNavigatorNode.TITLE_NAME, "%waterview.navigation.start");
    addNode(rootNode);

    JellyContext jc = new JellyContext();
    jc.setVariable(DefaultNavigatorService.class.getName(), this);
    jc.registerTagLibrary("http://waterview.cyclopsgroup.com/navigator", new NavigatorTagLibrary());
    for (Enumeration en = getClass().getClassLoader().getResources(path); en.hasMoreElements();) {
        URL resource = (URL) en.nextElement();
        getLogger().info("Reading navigation from " + resource);
        jc.runScript(resource, XMLOutput.createDummyXMLOutput());
    }
    populateNode(rootNode);
}

From source file:com.cyclopsgroup.waterview.jelly.JellyEngine.java

/**
 * Init global context/* w  ww . ja  va  2 s.  c o m*/
 *
 * @throws Exception Throw it out
 */
private void initGlobalContext() throws Exception {
    JellyContext jc = new JellyContext();
    jc.setVariable(SERVICE_MANAGER, serviceManager);
    jc.setVariable(ROLE, this);
    TagLibrary deftaglib = new TagLibrary();
    deftaglib.registerPackage((TagPackage) Class.forName(DEFINITION_TAG_PACKAGE).newInstance());
    jc.registerTagLibrary(DEFINITION_TAGLIB_URL, deftaglib);

    Enumeration e = getClass().getClassLoader().getResources("META-INF/cyclopsgroup/waterview.xml");
    while (e.hasMoreElements()) {
        URL resource = (URL) e.nextElement();
        getLogger().info("Load definition from " + resource);
        jc.runScript(resource, XMLOutput.createDummyXMLOutput());
    }

    globalContext = new JellyContext();
    globalContext.setVariables(initProperties);
    for (Iterator i = tagLibraries.keySet().iterator(); i.hasNext();) {
        String uri = (String) i.next();
        TagLibrary taglib = (TagLibrary) tagLibraries.get(uri);
        globalContext.registerTagLibrary(uri, taglib);
    }
    globalContext.setVariable(SERVICE_MANAGER, serviceManager);
    globalContext.setVariable(ROLE, this);
}