org.apache.cocoon.components.treeprocessor.sitemap
Class SitemapLanguage

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder
          extended by org.apache.cocoon.components.treeprocessor.sitemap.SitemapLanguage
All Implemented Interfaces:
RoleManageable, Poolable, Recyclable, Disposable, Component, Composable, Recomposable, Configurable, Contextualizable, LogEnabled, TreeBuilder

public class SitemapLanguage
extends DefaultTreeBuilder

The tree builder for the sitemap language.

Version:
CVS $Id: SitemapLanguage.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Sylvain Wallez

Field Summary
static String FIRST_POS_LABEL
          Pseudo-label for views from-position="first" (i.e. generator).
static String LAST_POS_LABEL
          Pseudo-label for views from-position="last" (i.e. serializer).
 
Fields inherited from class org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder
attributes, builderSelector, configuration, context, fileName, languageName, lifecycle, manager, namespace, parameterElement, parentManager, parentRoleManager, processor, roleManager
 
Constructor Summary
SitemapLanguage()
           
 
Method Summary
 void addViewForLabel(String label, String view)
          Add a view for a label.
protected  ComponentManager createComponentManager(Configuration tree)
          Build a component manager with the contents of the <map:components> element of the tree.
 Map getHintsForStatement(String role, String hint, Configuration statement)
          Extract pipeline-hints from the given statement (if any exist)
 Map getViewNodes(Collection viewNames)
          Get the {view name, view node} map for a collection of view names.
 Collection getViewsForStatement(String role, String hint, Configuration statement)
          Get the names of views for a given statement.
 boolean isBuildingErrorHandler()
          Are we currently building an error handler ?
 boolean isBuildingView()
          Are we currently building a view ?
protected  void linkNodes()
          Before linking nodes, lookup the view category node used in getViewNodes(Collection).
 void recycle()
           
 void setBuildingErrorHandler(boolean building)
          Set to true while building the internals of a <map:handle-errors>
 void setBuildingView(boolean building)
          Set to true while building the internals of a <map:view>
 
Methods inherited from class org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder
build, build, compose, configure, contextualize, createBuilderSelector, createNodeBuilder, createRoleManager, createTree, dispose, getAttribute, getDisposableNodes, getFileName, getLanguage, getLocation, getNamespace, getParameterName, getParameters, getProcessor, getRegisteredNode, getSitemapComponentManager, getTypeForStatement, recompose, registerNode, setAttribute, setProcessor, setRoleManager, setupNode
 
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

FIRST_POS_LABEL

public static final String FIRST_POS_LABEL
Pseudo-label for views from-position="first" (i.e. generator).

See Also:
Constant Field Values

LAST_POS_LABEL

public static final String LAST_POS_LABEL
Pseudo-label for views from-position="last" (i.e. serializer).

See Also:
Constant Field Values
Constructor Detail

SitemapLanguage

public SitemapLanguage()
Method Detail

createComponentManager

protected ComponentManager createComponentManager(Configuration tree)
                                           throws Exception
Build a component manager with the contents of the <map:components> element of the tree.

Overrides:
createComponentManager in class DefaultTreeBuilder
Returns:
a component manager
Throws:
Exception

recycle

public void recycle()
Specified by:
recycle in interface Recyclable
Overrides:
recycle in class DefaultTreeBuilder

setBuildingView

public void setBuildingView(boolean building)
Set to true while building the internals of a <map:view>


isBuildingView

public boolean isBuildingView()
Are we currently building a view ?


setBuildingErrorHandler

public void setBuildingErrorHandler(boolean building)
Set to true while building the internals of a <map:handle-errors>


isBuildingErrorHandler

public boolean isBuildingErrorHandler()
Are we currently building an error handler ?


addViewForLabel

public void addViewForLabel(String label,
                            String view)
Add a view for a label. This is used to register all views that start from a given label.

Parameters:
label - the label (or pseudo-label) for the view
view - the view name

getViewsForStatement

public Collection getViewsForStatement(String role,
                                       String hint,
                                       Configuration statement)
                                throws Exception
Get the names of views for a given statement. If the cocoon view exists in the returned collection, the statement can directly branch to the view-handling node.

Parameters:
role - the component role (e.g. Generator.ROLE)
hint - the component hint, i.e. the 'type' attribute
statement - the sitemap statement
Returns:
the view names for this statement
Throws:
Exception

linkNodes

protected void linkNodes()
                  throws Exception
Before linking nodes, lookup the view category node used in getViewNodes(Collection).

Overrides:
linkNodes in class DefaultTreeBuilder
Throws:
Exception

getViewNodes

public Map getViewNodes(Collection viewNames)
                 throws Exception
Get the {view name, view node} map for a collection of view names. This allows to resolve view nodes at build time, thus avoiding runtime lookup.

Parameters:
viewNames - the view names
Returns:
association of names to views
Throws:
Exception

getHintsForStatement

public Map getHintsForStatement(String role,
                                String hint,
                                Configuration statement)
                         throws Exception
Extract pipeline-hints from the given statement (if any exist)

Parameters:
role - the component role (e.g. Generator.ROLE)
hint - the component hint, i.e. the 'type' attribute
statement - the sitemap statement
Returns:
the hint params Map for this statement, or null if none exist
Throws:
Exception


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