org.apache.cocoon.components.treeprocessor
Interface TreeBuilder

All Known Implementing Classes:
SitemapLanguage

public interface TreeBuilder

Version:
$Id: TreeBuilder.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
static String ROLE
           
 
Method Summary
 ProcessingNode build(Configuration config, String location)
          Build a processing tree from a Configuration object holding the sitemap program.
 ProcessingNodeBuilder createNodeBuilder(Configuration config)
           
 Object getAttribute(String name)
          Get the value of an attribute.
 List getDisposableNodes()
          Return the list of ProcessingNodes part of this tree that are Disposable.
 List getEnterSitemapEventListeners()
          Return all event listers that are registered for the EnterSitemapEvent.
 List getLeaveSitemapEventListeners()
          Return all event listers that are registered for the LeaveSitemapEvent.
 String getNamespace()
          Get the namespace URI that builders should use to find their nodes.
 ConcreteTreeProcessor getProcessor()
           
 ProcessingNode getRegisteredNode(String name)
           
 String getTypeForStatement(Configuration statement, String role)
          Get the type for a statement : it returns the 'type' attribute if present, and otherwhise the default hint for the ServiceSelector identified by the role role.
 WebApplicationContext getWebApplicationContext()
           
 boolean registerNode(String name, ProcessingNode node)
          Register a ProcessingNode under a given name.
 void setAttribute(String name, Object value)
          Add an attribute.
 void setProcessor(ConcreteTreeProcessor processor)
           
 ProcessingNode setupNode(ProcessingNode node, Configuration config)
          Setup a ProcessingNode by setting its location, calling all the lifecycle interfaces it implements and giving it the parameter map if it's a ParameterizableNode.
 

Field Detail

ROLE

public static final String ROLE
Method Detail

getWebApplicationContext

public WebApplicationContext getWebApplicationContext()

getProcessor

public ConcreteTreeProcessor getProcessor()

setProcessor

public void setProcessor(ConcreteTreeProcessor processor)

registerNode

public boolean registerNode(String name,
                            ProcessingNode node)
Register a ProcessingNode under a given name. For example, ResourceNodeBuilder stores here the ProcessingNodes it produces for use by sitemap pipelines. This allows to turn the tree into a graph. If a node with the name is already registed, the process fails!

Returns:
If the node could be registered, true is returned; otherwise false.

getRegisteredNode

public ProcessingNode getRegisteredNode(String name)
Throws:
IllegalStateException

createNodeBuilder

public ProcessingNodeBuilder createNodeBuilder(Configuration config)
                                        throws Exception
Throws:
Exception

getNamespace

public String getNamespace()
Get the namespace URI that builders should use to find their nodes.


build

public ProcessingNode build(Configuration config,
                            String location)
                     throws Exception
Build a processing tree from a Configuration object holding the sitemap program.

Throws:
Exception

getDisposableNodes

public List getDisposableNodes()
Return the list of ProcessingNodes part of this tree that are Disposable. Care should be taken to properly dispose them before trashing the processing tree.


setupNode

public ProcessingNode setupNode(ProcessingNode node,
                                Configuration config)
                         throws Exception
Setup a ProcessingNode by setting its location, calling all the lifecycle interfaces it implements and giving it the parameter map if it's a ParameterizableNode.

As a convenience, the node is returned by this method to allow constructs like return treeBuilder.setupNode(new MyNode(), config).

Throws:
Exception

getTypeForStatement

public String getTypeForStatement(Configuration statement,
                                  String role)
                           throws ConfigurationException
Get the type for a statement : it returns the 'type' attribute if present, and otherwhise the default hint for the ServiceSelector identified by the role role.

Parameters:
statement - the statement
role - the component's role (warn: not the selector's role)
Throws:
ConfigurationException - if the default type could not be found.

setAttribute

public void setAttribute(String name,
                         Object value)
Add an attribute. Useful to transmit information between distant (in the tree) node builders


getAttribute

public Object getAttribute(String name)
Get the value of an attribute.


getEnterSitemapEventListeners

public List getEnterSitemapEventListeners()
Return all event listers that are registered for the EnterSitemapEvent.

Returns:
A list of components.

getLeaveSitemapEventListeners

public List getLeaveSitemapEventListeners()
Return all event listers that are registered for the LeaveSitemapEvent.

Returns:
A list of components.


Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.