|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder
public class DefaultTreeBuilder
Field Summary | |
---|---|
protected Map |
attributes
|
protected ComponentSelector |
builderSelector
Selector for ProcessingNodeBuilders |
protected Configuration |
configuration
|
protected Context |
context
|
protected String |
fileName
|
protected String |
languageName
|
protected LifecycleHelper |
lifecycle
|
protected ComponentManager |
manager
Component manager created by createComponentManager(Configuration) . |
protected String |
namespace
|
protected String |
parameterElement
|
protected ComponentManager |
parentManager
The parent component manager, set using compose() and recompose()
(implementation of Recomposable ). |
protected RoleManager |
parentRoleManager
The parent role manager, set using setRoleManager (implementation of
RoleManageable ). |
protected ConcreteTreeProcessor |
processor
The tree processor that we're building. |
protected RoleManager |
roleManager
Role manager result created by createRoleManager() . |
Constructor Summary | |
---|---|
DefaultTreeBuilder()
|
Method Summary | |
---|---|
ProcessingNode |
build(Configuration tree)
Build a processing tree from a Configuration . |
ProcessingNode |
build(Source source)
|
void |
compose(ComponentManager manager)
|
void |
configure(Configuration config)
Configurable |
void |
contextualize(Context context)
|
protected ComponentSelector |
createBuilderSelector()
Create a ComponentSelector for ProcessingNodeBuilder s. |
protected ComponentManager |
createComponentManager(Configuration tree)
Create a component manager that will be used for all Composable
ProcessingNodeBuilder s and ProcessingNode s. |
ProcessingNodeBuilder |
createNodeBuilder(Configuration config)
|
protected RoleManager |
createRoleManager()
Create a role manager that will be used by all RoleManageable
components. |
protected ProcessingNode |
createTree(Configuration tree)
Create the tree once component manager and node builders have been set up. |
void |
dispose()
|
Object |
getAttribute(String name)
Get the value of an attribute. |
List |
getDisposableNodes()
Return the list of ProcessingNodes part of this tree that are
Disposable . |
String |
getFileName()
|
String |
getLanguage()
Returns the language that is being built (e.g. |
protected LocationImpl |
getLocation(Configuration config)
|
String |
getNamespace()
Get the namespace URI that builders should use to find their nodes. |
String |
getParameterName()
Returns the name of the parameter element. |
protected Map |
getParameters(Configuration config,
Location location)
Get <xxx:parameter> elements as a Map of ListOfMapResolvers,
that can be turned into parameters using ListOfMapResolver.buildParameters() . |
ConcreteTreeProcessor |
getProcessor()
|
ProcessingNode |
getRegisteredNode(String name)
|
ComponentManager |
getSitemapComponentManager()
Return the sitemap component manager |
String |
getTypeForStatement(Configuration statement,
String role)
Get the type for a statement : it returns the 'type' attribute if present, and otherwhise the default hint of the ExtendedSelector designated by
role role . |
protected void |
linkNodes()
Resolve links : call linkNode() on all
LinkedProcessingNodeBuilder s. |
void |
recompose(ComponentManager manager)
|
void |
recycle()
|
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)
|
void |
setRoleManager(RoleManager rm)
|
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 . |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map attributes
protected ConcreteTreeProcessor processor
protected Context context
protected ComponentManager parentManager
compose()
and recompose()
(implementation of Recomposable
).
protected RoleManager parentRoleManager
setRoleManager
(implementation of
RoleManageable
).
protected Configuration configuration
protected ComponentManager manager
createComponentManager(Configuration)
.
protected RoleManager roleManager
createRoleManager()
.
protected ComponentSelector builderSelector
protected LifecycleHelper lifecycle
protected String namespace
protected String parameterElement
protected String languageName
protected String fileName
Constructor Detail |
---|
public DefaultTreeBuilder()
Method Detail |
---|
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void compose(ComponentManager manager) throws ComponentException
compose
in interface Composable
ComponentException
public void recompose(ComponentManager manager) throws ComponentException
recompose
in interface Recomposable
ComponentException
public void setRoleManager(RoleManager rm)
setRoleManager
in interface RoleManageable
public void configure(Configuration config) throws ConfigurationException
configure
in interface Configurable
ConfigurationException
public void setAttribute(String name, Object value)
TreeBuilder
setAttribute
in interface TreeBuilder
public Object getAttribute(String name)
TreeBuilder
getAttribute
in interface TreeBuilder
protected RoleManager createRoleManager() throws Exception
RoleManageable
components. The default here is to create a role manager with the contents of
the <roles> element of the configuration.
Subclasses can redefine this method to create roles from other sources than the one used here.
Exception
protected ComponentManager createComponentManager(Configuration tree) throws Exception
Composable
ProcessingNodeBuilder
s and ProcessingNode
s.
The default here is to simply return the manager set by compose()
,
i.e. the component manager set by the calling TreeProcessor
.
Subclasses can redefine this method to create a component manager local to a tree, such as for sitemap's <map:components>.
Exception
protected ComponentSelector createBuilderSelector() throws Exception
ComponentSelector
for ProcessingNodeBuilder
s.
It creates a selector with the contents of the "node" element of the configuration.
Exception
public void setProcessor(ConcreteTreeProcessor processor)
setProcessor
in interface TreeBuilder
public ConcreteTreeProcessor getProcessor()
getProcessor
in interface TreeBuilder
public String getLanguage()
getLanguage
in interface TreeBuilder
public String getParameterName()
getParameterName
in interface TreeBuilder
public boolean registerNode(String name, ProcessingNode node)
TreeBuilder
ProcessingNode
under a given name.
For example, ResourceNodeBuilder
stores here the ProcessingNode
s
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!
registerNode
in interface TreeBuilder
true
is returned; otherwise false.TreeBuilder.registerNode(java.lang.String, org.apache.cocoon.components.treeprocessor.ProcessingNode)
public ProcessingNode getRegisteredNode(String name)
getRegisteredNode
in interface TreeBuilder
public ProcessingNodeBuilder createNodeBuilder(Configuration config) throws Exception
createNodeBuilder
in interface TreeBuilder
Exception
protected ProcessingNode createTree(Configuration tree) throws Exception
Exception
protected void linkNodes() throws Exception
linkNode()
on all
LinkedProcessingNodeBuilder
s.
Can be overriden by subclasses to perform pre/post resolution operations.
Exception
public String getNamespace()
getNamespace
in interface TreeBuilder
public ProcessingNode build(Source source) throws Exception
build
in interface TreeBuilder
Exception
public String getFileName()
getFileName
in interface TreeBuilder
public ProcessingNode build(Configuration tree) throws Exception
Configuration
.
build
in interface TreeBuilder
Exception
public List getDisposableNodes()
ProcessingNodes
part of this tree that are
Disposable
. Care should be taken to properly dispose them before
trashing the processing tree.
getDisposableNodes
in interface TreeBuilder
public ComponentManager getSitemapComponentManager()
getSitemapComponentManager
in interface TreeBuilder
public ProcessingNode setupNode(ProcessingNode node, Configuration config) throws Exception
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)
.
setupNode
in interface TreeBuilder
Exception
protected LocationImpl getLocation(Configuration config)
protected Map getParameters(Configuration config, Location location) throws ConfigurationException
Map
of ListOfMapResolvers,
that can be turned into parameters using ListOfMapResolver.buildParameters()
.
null
if there are no parameters.
ConfigurationException
public String getTypeForStatement(Configuration statement, String role) throws ConfigurationException
ExtendedSelector
designated by
role role
.
getTypeForStatement
in interface TreeBuilder
ConfigurationException
- if the default type could not be found.public void recycle()
recycle
in interface Recyclable
public void dispose()
dispose
in interface Disposable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |