org.apache.cocoon.components.treeprocessor
Class ConcreteTreeProcessor

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor
All Implemented Interfaces:
Disposable, ExecutionContext, Locatable, LogEnabled, org.apache.commons.jci.listeners.NotificationListener, Processor

public class ConcreteTreeProcessor
extends AbstractLogEnabled
implements Processor, Disposable, ExecutionContext, org.apache.commons.jci.listeners.NotificationListener

The concrete implementation of Processor, containing the evaluation tree and associated data such as component manager.

Version:
$Id: ConcreteTreeProcessor.java 292823 2005-09-30 18:01:51Z tcurdt $

Nested Class Summary
 
Nested classes inherited from class org.apache.cocoon.Processor
Processor.InternalPipelineDescription
 
Field Summary
protected  boolean needsReload
          Needs a reload?
protected  Map processorAttributes
          Processor attributes
 
Fields inherited from interface org.apache.cocoon.Processor
ROLE
 
Constructor Summary
ConcreteTreeProcessor(TreeProcessor wrappingProcessor, SitemapExecutor sitemapExecutor)
          Builds a concrete processig, given the wrapping processor
 
Method Summary
 Processor.InternalPipelineDescription buildPipeline(Environment environment)
          Process the given Environment to assemble a ProcessingPipeline.
 void dispose()
           
protected  void disposeListeners(List l)
           
 Object getAttribute(String name)
          Gets an attribute
 Map getClasspathListeners()
           
 Configuration[] getComponentConfigurations()
          Get the sitemap component configurations
 String getContext()
          Get the context URI for this processor
 Location getLocation()
          Return the location of the statement in the sitemap.
 Processor getRootProcessor()
          Get the root processor parent of this processor.
 ServiceManager getServiceManager()
           
 SitemapExecutor getSitemapExecutor()
          Return the sitemap executor
 SourceResolver getSourceResolver()
          Get the source resolver for this processor
 String getType()
          Return the component type
 TreeProcessor getWrappingProcessor()
           
protected  boolean handleCocoonRedirect(String uri, Environment environment, InvokeContext context)
           
 void handleNotification()
           
 void markForDisposal()
          Mark this processor as needing to be disposed.
 boolean process(Environment environment)
          Process the given Environment producing the output.
protected  boolean process(Environment environment, InvokeContext context)
          Do the actual processing, be it producing the response or just building the pipeline
 Object removeAttribute(String name)
          Remove an attribute.
 void setAttribute(String name, Object value)
          Sets an attribute
 void setClasspathListeners(Map classpathListeners)
           
 void setComponentConfigurations(Configuration componentConfigurations)
          Set the sitemap component configurations (called as part of the tree building process)
 void setProcessorData(ServiceManager manager, ClassLoader classloader, ProcessingNode rootNode, List disposableNodes, ComponentLocator componentLocator, List enterSitemapEventListeners, List leaveSitemapEventListeners)
          Set the processor data, result of the treebuilder job
 
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

needsReload

protected volatile boolean needsReload
Needs a reload?


processorAttributes

protected Map processorAttributes
Processor attributes

Constructor Detail

ConcreteTreeProcessor

public ConcreteTreeProcessor(TreeProcessor wrappingProcessor,
                             SitemapExecutor sitemapExecutor)
Builds a concrete processig, given the wrapping processor

Method Detail

handleNotification

public void handleNotification()
Specified by:
handleNotification in interface org.apache.commons.jci.listeners.NotificationListener

setClasspathListeners

public void setClasspathListeners(Map classpathListeners)

getClasspathListeners

public Map getClasspathListeners()

setProcessorData

public void setProcessorData(ServiceManager manager,
                             ClassLoader classloader,
                             ProcessingNode rootNode,
                             List disposableNodes,
                             ComponentLocator componentLocator,
                             List enterSitemapEventListeners,
                             List leaveSitemapEventListeners)
Set the processor data, result of the treebuilder job


setComponentConfigurations

public void setComponentConfigurations(Configuration componentConfigurations)
Set the sitemap component configurations (called as part of the tree building process)


getComponentConfigurations

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

Specified by:
getComponentConfigurations in interface Processor
See Also:
Processor.getComponentConfigurations()

markForDisposal

public void markForDisposal()
Mark this processor as needing to be disposed. Actual call to dispose() will occur when all request processings on this processor will be terminated.


getWrappingProcessor

public TreeProcessor getWrappingProcessor()

getRootProcessor

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

Specified by:
getRootProcessor in interface Processor
See Also:
Processor.getRootProcessor()

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

process

protected boolean process(Environment environment,
                          InvokeContext context)
                   throws Exception
Do the actual processing, be it producing the response or just building the pipeline

Parameters:
environment -
context -
Returns:
true if the pipeline was successfully built, false otherwise.
Throws:
Exception

handleCocoonRedirect

protected boolean handleCocoonRedirect(String uri,
                                       Environment environment,
                                       InvokeContext context)
                                throws Exception
Throws:
Exception

dispose

public void dispose()
Specified by:
dispose in interface Disposable
See Also:
Disposable.dispose()

disposeListeners

protected void disposeListeners(List l)

getSourceResolver

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

Specified by:
getSourceResolver 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

getSitemapExecutor

public SitemapExecutor getSitemapExecutor()
Return the sitemap executor


getServiceManager

public ServiceManager getServiceManager()

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)

getLocation

public Location getLocation()
Description copied from interface: ExecutionContext
Return the location of the statement in the sitemap.

Specified by:
getLocation in interface ExecutionContext
See Also:
ExecutionContext.getLocation()

getType

public String getType()
Description copied from interface: ExecutionContext
Return the component type

Specified by:
getType in interface ExecutionContext
See Also:
ExecutionContext.getType()


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