org.apache.cocoon.components.language.markup
Class CocoonMarkupLanguage

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.language.markup.AbstractMarkupLanguage
          extended by org.apache.cocoon.components.language.markup.CocoonMarkupLanguage
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, Configurable, LogEnabled, Serviceable, MarkupLanguage
Direct Known Subclasses:
XSPMarkupLanguage

public abstract class CocoonMarkupLanguage
extends AbstractMarkupLanguage

Base implementation of MarkupLanguage. This class uses logicsheets as the only means of code generation. Code generation should be decoupled from this context!!!

Version:
$Id: CocoonMarkupLanguage.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Ricardo Rocha, Sebastien Sahuc, Davanum Srinivas, Ovidiu Predescu, Vadim Gritsenko

Nested Class Summary
 class CocoonMarkupLanguage.CocoonTransformerChainBuilderFilter
          This filter builds on the fly a chain of transformers.
 class CocoonMarkupLanguage.PreProcessFilter
          Preprocess filter for Cocoon Markup languages.
 
Nested classes/interfaces inherited from class org.apache.cocoon.components.language.markup.AbstractMarkupLanguage
AbstractMarkupLanguage.LanguageDescriptor, AbstractMarkupLanguage.TransformerChainBuilderFilter
 
Field Summary
 
Fields inherited from class org.apache.cocoon.components.language.markup.AbstractMarkupLanguage
ATTR_INTERPOLATION, languages, logicsheetCache, manager, name, TEXT_INTERPOLATION
 
Fields inherited from interface org.apache.cocoon.components.language.markup.MarkupLanguage
ROLE
 
Constructor Summary
CocoonMarkupLanguage()
          The default constructor.
 
Method Summary
protected  void addDependency(String location)
          Add a dependency on an external file to the document for inclusion in generated code.
protected  void addLogicsheetToList(AbstractMarkupLanguage.LanguageDescriptor language, String logicsheetLocation)
          Add a logicsheet to the code generator.
protected  AbstractXMLPipe getPreprocessFilter(String filename, AbstractXMLPipe filter, ProgrammingLanguage language)
          Prepare the input source for logicsheet processing and code generation with a preprocess filter.
abstract  String getRootElement()
          Returns the root element for this language.
protected  AbstractMarkupLanguage.TransformerChainBuilderFilter getTransformerChainBuilder(LogicsheetCodeGenerator logicsheetMarkupGenerator)
          Returns a filter that chain on the fly the requested transformers for source code generation.
 void recycle()
          Recycle this component: clear logic sheet list and dependencies.
 
Methods inherited from class org.apache.cocoon.components.language.markup.AbstractMarkupLanguage
addLogicsheetsToGenerator, configure, dispose, generateCode, getEncoding, getLogicsheetFilter, getName, getPrefix, getURI, hasAttrInterpolation, hasTextInterpolation, service
 
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
 

Constructor Detail

CocoonMarkupLanguage

public CocoonMarkupLanguage()
The default constructor.

Method Detail

recycle

public void recycle()
Recycle this component: clear logic sheet list and dependencies.

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

getPreprocessFilter

protected AbstractXMLPipe getPreprocessFilter(String filename,
                                              AbstractXMLPipe filter,
                                              ProgrammingLanguage language)
Prepare the input source for logicsheet processing and code generation with a preprocess filter. The return XMLFilter object is the first filter on the transformer chain. The markup language preprocess filter adds information on the root element such as creation-date, file-name and file-path, plus it use the the passed programming language to quote Strings on PCDATA node.

Overrides:
getPreprocessFilter in class AbstractMarkupLanguage
Parameters:
filename - The source filename
language - The target programming language
Returns:
The preprocess filter
See Also:
CocoonMarkupLanguage.PreProcessFilter

getTransformerChainBuilder

protected AbstractMarkupLanguage.TransformerChainBuilderFilter getTransformerChainBuilder(LogicsheetCodeGenerator logicsheetMarkupGenerator)
Returns a filter that chain on the fly the requested transformers for source code generation. This method scans the input SAX events for <?xml-logicsheet?> processing instructions and top-level <prefix:logicsheet> elements. Logicsheet declarations are removed from the input document.

Overrides:
getTransformerChainBuilder in class AbstractMarkupLanguage
Parameters:
logicsheetMarkupGenerator - the logicsheet markup generator
Returns:
XMLFilter the filter that build on the fly the transformer chain

addLogicsheetToList

protected void addLogicsheetToList(AbstractMarkupLanguage.LanguageDescriptor language,
                                   String logicsheetLocation)
                            throws IOException,
                                   SAXException,
                                   ProcessingException
Description copied from class: AbstractMarkupLanguage
Add a logicsheet to the code generator.

Overrides:
addLogicsheetToList in class AbstractMarkupLanguage
Parameters:
language - Target programming language of the logicsheet
logicsheetLocation - Location of the logicsheet to be added
Throws:
MalformedURLException - If location is invalid
IOException - IO Error
SAXException - Logicsheet parse error
ProcessingException

addDependency

protected void addDependency(String location)
Add a dependency on an external file to the document for inclusion in generated code. This is used to populate a list of File's tested for change on each invocation; this information is used to assert whether regeneration is necessary. XSP uses <xsp:dependency> elements for this purpose.

Specified by:
addDependency in class AbstractMarkupLanguage
Parameters:
location - The file path of the dependent file
See Also:
AbstractMarkupLanguage, ServerPagesGenerator, AbstractServerPage

getRootElement

public abstract String getRootElement()
Returns the root element for this language.



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