org.apache.cocoon.transformation
Class CIncludeTransformer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.apache.cocoon.transformation.AbstractSAXTransformer
                      extended by org.apache.cocoon.transformation.CIncludeTransformer
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, Configurable, LogEnabled, Serviceable, CacheableProcessingComponent, SitemapModelComponent, Transformer, XMLPipe, XMLProducer, XMLConsumer, ContentHandler, LexicalHandler

public class CIncludeTransformer
extends AbstractSAXTransformer
implements CacheableProcessingComponent

Version:
$Id: CIncludeTransformer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Carsten Ziegeler, Andrew C. Oliver

Field Summary
protected  IncludeCacheManager cacheManager
           
protected  IncludeCacheManagerSession cachingSession
           
static String CINCLUDE_CACHED_INCLUDE_ELEMENT
           
protected static String CINCLUDE_CACHED_INCLUDE_PLACEHOLDER_ELEMENT
           
static String CINCLUDE_CONFIGURATION_ELEMENT
           
static String CINCLUDE_INCLUDE_ELEMENT
           
static String CINCLUDE_INCLUDE_ELEMENT_ELEMENT_ATTRIBUTE
           
static String CINCLUDE_INCLUDE_ELEMENT_NS_ATTRIBUTE
           
static String CINCLUDE_INCLUDE_ELEMENT_PREFIX_ATTRIBUTE
           
static String CINCLUDE_INCLUDE_ELEMENT_SELECT_ATTRIBUTE
           
static String CINCLUDE_INCLUDE_ELEMENT_SRC_ATTRIBUTE
           
static String CINCLUDE_INCLUDE_ELEMENT_STRIP_ROOT_ATTRIBUTE
           
static String CINCLUDE_INCLUDEXML_ELEMENT
           
static String CINCLUDE_INCLUDEXML_ELEMENT_IGNORE_ERRORS_ATTRIBUTE
           
static String CINCLUDE_NAME_ELEMENT
           
static String CINCLUDE_NAMESPACE_URI
           
static String CINCLUDE_PARAMETER_ELEMENT
           
static String CINCLUDE_PARAMETERS_ELEMENT
           
static String CINCLUDE_SRC_ELEMENT
           
static String CINCLUDE_VALUE_ELEMENT
           
protected  boolean compiling
           
protected  Parameters configurationParameters
          The configuration of includexml
protected  IncludeXMLConsumer filter
           
protected  XMLSerializer recorder
           
protected  SourceParameters resourceParameters
          The parameters for includexml
protected  AttributesImpl srcAttributes
           
protected  long startTime
          Remember the start time of the request for profiling
protected  int state
          The current state: STATE_
protected  boolean supportCaching
           
 
Fields inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
context, defaultNamespaceURI, EMPTY_ATTRIBUTES, emptyAttributes, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, ignoreWhitespaces, manager, namespaceURI, objectModel, parameters, recorderStack, request, resolver, response, source, stack
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
CIncludeTransformer()
          Constructor Set the namespace
 
Method Summary
 void dispose()
           
protected  Object endCompiledXMLRecording()
          Stop recording of compiled XML.
 void endDocument()
          Process the SAX event.
 void endTransformingElement(String uri, String name, String raw)
          Start processing elements of our namespace.
 Serializable getKey()
          Generate the unique key.
 SourceValidity getValidity()
          Generate the validity object.
protected  String processCIncludeElement(String src, String element, String select, String ns, String prefix, boolean stripRoot, boolean cache)
           
 void recycle()
          Recycle the component
 void service(ServiceManager manager)
           
 void setup(SourceResolver resolver, Map objectModel, String source, Parameters parameters)
          Setup the component.
protected  void startCompiledXMLRecording()
          Start recording of compiled xml.
 void startDocument()
          Process the SAX event.
 void startTransformingElement(String uri, String name, String raw, Attributes attr)
          Start processing elements of our namespace.
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
addRecorder, characters, comment, configure, endCDATA, endDTD, endElement, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, setDocumentLocator, setupTransforming, skippedEntity, startCDATA, startDTD, startElement, startEntity, startParametersRecording, startPrefixMapping, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
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
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

CINCLUDE_NAMESPACE_URI

public static final String CINCLUDE_NAMESPACE_URI
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT

public static final String CINCLUDE_INCLUDE_ELEMENT
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_SRC_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_SRC_ATTRIBUTE
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_ELEMENT_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_ELEMENT_ATTRIBUTE
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_SELECT_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_SELECT_ATTRIBUTE
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_NS_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_NS_ATTRIBUTE
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_PREFIX_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_PREFIX_ATTRIBUTE
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_STRIP_ROOT_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_STRIP_ROOT_ATTRIBUTE
See Also:
Constant Field Values

CINCLUDE_INCLUDEXML_ELEMENT

public static final String CINCLUDE_INCLUDEXML_ELEMENT
See Also:
Constant Field Values

CINCLUDE_INCLUDEXML_ELEMENT_IGNORE_ERRORS_ATTRIBUTE

public static final String CINCLUDE_INCLUDEXML_ELEMENT_IGNORE_ERRORS_ATTRIBUTE
See Also:
Constant Field Values

CINCLUDE_SRC_ELEMENT

public static final String CINCLUDE_SRC_ELEMENT
See Also:
Constant Field Values

CINCLUDE_CONFIGURATION_ELEMENT

public static final String CINCLUDE_CONFIGURATION_ELEMENT
See Also:
Constant Field Values

CINCLUDE_PARAMETERS_ELEMENT

public static final String CINCLUDE_PARAMETERS_ELEMENT
See Also:
Constant Field Values

CINCLUDE_PARAMETER_ELEMENT

public static final String CINCLUDE_PARAMETER_ELEMENT
See Also:
Constant Field Values

CINCLUDE_NAME_ELEMENT

public static final String CINCLUDE_NAME_ELEMENT
See Also:
Constant Field Values

CINCLUDE_VALUE_ELEMENT

public static final String CINCLUDE_VALUE_ELEMENT
See Also:
Constant Field Values

CINCLUDE_CACHED_INCLUDE_ELEMENT

public static final String CINCLUDE_CACHED_INCLUDE_ELEMENT
See Also:
Constant Field Values

CINCLUDE_CACHED_INCLUDE_PLACEHOLDER_ELEMENT

protected static final String CINCLUDE_CACHED_INCLUDE_PLACEHOLDER_ELEMENT
See Also:
Constant Field Values

configurationParameters

protected Parameters configurationParameters
The configuration of includexml


resourceParameters

protected SourceParameters resourceParameters
The parameters for includexml


state

protected int state
The current state: STATE_


cacheManager

protected IncludeCacheManager cacheManager

cachingSession

protected IncludeCacheManagerSession cachingSession

compiling

protected boolean compiling

filter

protected IncludeXMLConsumer filter

recorder

protected XMLSerializer recorder

srcAttributes

protected AttributesImpl srcAttributes

supportCaching

protected boolean supportCaching

startTime

protected long startTime
Remember the start time of the request for profiling

Constructor Detail

CIncludeTransformer

public CIncludeTransformer()
Constructor Set the namespace

Method Detail

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String source,
                  Parameters parameters)
           throws ProcessingException,
                  SAXException,
                  IOException
Setup the component.

Specified by:
setup in interface SitemapModelComponent
Overrides:
setup in class AbstractSAXTransformer
Throws:
ProcessingException
SAXException
IOException

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Overrides:
service in class AbstractSAXTransformer
Throws:
ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

dispose

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

recycle

public void recycle()
Recycle the component

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractSAXTransformer

startTransformingElement

public void startTransformingElement(String uri,
                                     String name,
                                     String raw,
                                     Attributes attr)
                              throws ProcessingException,
                                     IOException,
                                     SAXException
Description copied from class: AbstractSAXTransformer
Start processing elements of our namespace. This hook is invoked for each sax event with our namespace.

Overrides:
startTransformingElement in class AbstractSAXTransformer
Parameters:
uri - The namespace of the element.
name - The local name of the element.
raw - The qualified name of the element.
attr - The attributes of the element.
Throws:
ProcessingException
IOException
SAXException

endTransformingElement

public void endTransformingElement(String uri,
                                   String name,
                                   String raw)
                            throws ProcessingException,
                                   IOException,
                                   SAXException
Description copied from class: AbstractSAXTransformer
Start processing elements of our namespace. This hook is invoked for each sax event with our namespace.

Overrides:
endTransformingElement in class AbstractSAXTransformer
Parameters:
uri - The namespace of the element.
name - The local name of the element.
raw - The qualified name of the element.
Throws:
ProcessingException
IOException
SAXException

processCIncludeElement

protected String processCIncludeElement(String src,
                                        String element,
                                        String select,
                                        String ns,
                                        String prefix,
                                        boolean stripRoot,
                                        boolean cache)
                                 throws SAXException,
                                        IOException
Throws:
SAXException
IOException

startCompiledXMLRecording

protected void startCompiledXMLRecording()
                                  throws SAXException
Start recording of compiled xml. The incomming SAX events are recorded and a compiled representation is created. These events are not forwarded to the next component in the pipeline.

Throws:
SAXException

endCompiledXMLRecording

protected Object endCompiledXMLRecording()
                                  throws SAXException
Stop recording of compiled XML.

Returns:
The compiled XML.
Throws:
SAXException

startDocument

public void startDocument()
                   throws SAXException
Description copied from class: AbstractSAXTransformer
Process the SAX event. A new document is processed. The hook method AbstractSAXTransformer.setupTransforming() is invoked.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class AbstractSAXTransformer
Throws:
SAXException
See Also:
ContentHandler.startDocument()

endDocument

public void endDocument()
                 throws SAXException
Description copied from class: AbstractSAXTransformer
Process the SAX event. The processing of the document is finished.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class AbstractSAXTransformer
Throws:
SAXException
See Also:
ContentHandler.endDocument()

getKey

public Serializable getKey()
Description copied from interface: CacheableProcessingComponent
Generate the unique key. This key must be unique inside the space of this component. This method must be invoked before the getValidity() method.

Specified by:
getKey in interface CacheableProcessingComponent
Returns:
The generated key or null if the component is currently not cacheable.
See Also:
CacheableProcessingComponent.getKey()

getValidity

public SourceValidity getValidity()
Description copied from interface: CacheableProcessingComponent
Generate the validity object. Before this method can be invoked the getKey() method must be invoked.

Specified by:
getValidity in interface CacheableProcessingComponent
Returns:
The generated validity object or null if the component is currently not cacheable.
See Also:
CacheableProcessingComponent.getValidity()


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