org.apache.cocoon.components.treeprocessor
Class TreeProcessor

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.components.treeprocessor.TreeProcessor
All Implemented Interfaces:
Configurable, Contextualizable, Disposable, Initializable, LogEnabled, Processor, Serviceable, ThreadSafe

public class TreeProcessor
extends AbstractLogEnabled
implements ThreadSafe, Processor, Serviceable, Configurable, Contextualizable, Disposable, Initializable

Interpreted tree-traversal implementation of a pipeline assembly language.

Version:
CVS $Id: TreeProcessor.java 312930 2005-10-11 18:13:35Z cziegeler $
Author:
Sylvain Wallez

Nested Class Summary
 
Nested classes inherited from class org.apache.cocoon.Processor
Processor.InternalPipelineDescription
 
Field Summary
protected  boolean checkReload
          Check for reload?
protected  ConcreteTreeProcessor concreteProcessor
          The actual processor
protected  Context context
          The context
protected  Core core
          The core object.
protected  SitemapMonitor fam
           
protected  long lastModified
          Last modification time
protected  long lastModifiedDelay
          Delay for sourceLastModified.
protected  ServiceManager manager
          The component manager given by the upper level (root manager or parent concrete processor)
protected  TreeProcessor parent
          The parent TreeProcessor, if any
protected  SourceResolver resolver
          The source resolver
protected  DelayedRefreshSourceWrapper source
          The source of the tree definition
 
Fields inherited from interface org.apache.cocoon.Processor
ROLE
 
Constructor Summary
  TreeProcessor()
          Create a TreeProcessor.
protected TreeProcessor(TreeProcessor parent, DelayedRefreshSourceWrapper sitemapSource, boolean checkReload, String prefix)
          Create a child processor for a given language
 
Method Summary
 Processor.InternalPipelineDescription buildPipeline(Environment environment)
          Process the given Environment to assemble a ProcessingPipeline.
 void configure(Configuration config)
          Configure the tree processor: <processor file="{Location of the sitemap}" check-reload="{true|false}" config="{Location of sitemap tree processor config}> <reload delay="10"/> </processor> Only the file attribute is required; everything else is optional.
 void contextualize(Context context)
           
 TreeProcessor createChildProcessor(String src, boolean checkReload, String prefix)
          Create a new child of this processor (used for mounting submaps).
protected  ClassLoader createClassLoader(Configuration classpathConfig)
           
 void dispose()
           
 Object getAttribute(String name)
          Gets an attribute
 Configuration[] getComponentConfigurations()
          Get the sitemap component configurations
 String getContext()
          Get the context URI for this processor
 EnvironmentHelper getEnvironmentHelper()
          The current environment helper used by the MountNode
 Processor getRootProcessor()
          Get the root processor parent of this processor.
 SourceResolver getSourceResolver()
          Get the source resolver for this processor
 void initialize()
           
 boolean process(Environment environment)
          Process the given Environment producing the output.
 Object removeAttribute(String name)
          Remove an attribute.
 void service(ServiceManager manager)
           
 void setAttribute(String name, Object value)
          Sets an attribute
 
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

parent

protected TreeProcessor parent
The parent TreeProcessor, if any


context

protected Context context
The context


manager

protected ServiceManager manager
The component manager given by the upper level (root manager or parent concrete processor)


core

protected Core core
The core object.


lastModified

protected long lastModified
Last modification time


source

protected DelayedRefreshSourceWrapper source
The source of the tree definition


lastModifiedDelay

protected long lastModifiedDelay
Delay for sourceLastModified.


checkReload

protected boolean checkReload
Check for reload?


fam

protected SitemapMonitor fam

resolver

protected SourceResolver resolver
The source resolver


concreteProcessor

protected ConcreteTreeProcessor concreteProcessor
The actual processor

Constructor Detail

TreeProcessor

public TreeProcessor()
Create a TreeProcessor.


TreeProcessor

protected TreeProcessor(TreeProcessor parent,
                        DelayedRefreshSourceWrapper sitemapSource,
                        boolean checkReload,
                        String prefix)
                 throws Exception
Create a child processor for a given language

Method Detail

createChildProcessor

public TreeProcessor createChildProcessor(String src,
                                          boolean checkReload,
                                          String prefix)
                                   throws Exception
Create a new child of this processor (used for mounting submaps).

Returns:
a new child processor.
Throws:
Exception

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Throws:
Exception
See Also:
Initializable.initialize()

configure

public void configure(Configuration config)
               throws ConfigurationException
Configure the tree processor: <processor file="{Location of the sitemap}" check-reload="{true|false}" config="{Location of sitemap tree processor config}> <reload delay="10"/> </processor> Only the file attribute is required; everything else is optional.

Specified by:
configure in interface Configurable
Throws:
ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

process

public boolean process(Environment environment)
                throws Exception
Process the given Environment producing the output.

Specified by:
process in interface Processor
Returns:
If the processing is successfull true is returned. If not match is found in the sitemap false is returned.
Throws:
ResourceNotFoundException - If a sitemap component tries to access a resource which can not be found, e.g. the generator ConnectionResetException If the connection was reset
Exception

buildPipeline

public Processor.InternalPipelineDescription buildPipeline(Environment environment)
                                                    throws Exception
Process the given Environment to assemble a ProcessingPipeline.

Specified by:
buildPipeline in interface Processor
Throws:
Exception
Since:
2.1

getRootProcessor

public Processor getRootProcessor()
Description copied from interface: Processor
Get the root processor parent of this processor.

Specified by:
getRootProcessor in interface Processor

getComponentConfigurations

public Configuration[] getComponentConfigurations()
Description copied from interface: Processor
Get the sitemap component configurations

Specified by:
getComponentConfigurations in interface Processor

getContext

public String getContext()
Description copied from interface: Processor
Get the context URI for this processor

Specified by:
getContext in interface Processor

getSourceResolver

public SourceResolver getSourceResolver()
Description copied from interface: Processor
Get the source resolver for this processor

Specified by:
getSourceResolver in interface Processor

getEnvironmentHelper

public EnvironmentHelper getEnvironmentHelper()
The current environment helper used by the MountNode

Returns:
EnvironmentHelper

createClassLoader

protected ClassLoader createClassLoader(Configuration classpathConfig)
                                 throws Exception
Throws:
Exception

dispose

public void dispose()
Specified by:
dispose in interface Disposable

getAttribute

public Object getAttribute(String name)
Description copied from interface: Processor
Gets an attribute

Specified by:
getAttribute in interface Processor
See Also:
Processor.getAttribute(java.lang.String)

removeAttribute

public Object removeAttribute(String name)
Description copied from interface: Processor
Remove an attribute.

Specified by:
removeAttribute in interface Processor
See Also:
Processor.removeAttribute(java.lang.String)

setAttribute

public void setAttribute(String name,
                         Object value)
Description copied from interface: Processor
Sets an attribute

Specified by:
setAttribute in interface Processor
See Also:
Processor.setAttribute(java.lang.String, java.lang.Object)


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.