|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--org.apache.avalon.framework.logger.AbstractLoggable
|
+--org.apache.cocoon.components.language.markup.AbstractMarkupLanguage
Base implementation of MarkupLanguage. This class uses
logicsheets as the only means of code generation. Code generation
should be decoupled from this context!!!
| Inner Class Summary | |
protected class |
AbstractMarkupLanguage.LanguageDescriptor
This class holds transient information about a target programming language. |
class |
AbstractMarkupLanguage.TransformerChainBuilderFilter
An XMLFilter that build the chain of transformers on the fly. |
| Field Summary | |
protected HashMap |
languages
The supported language table |
protected Store |
logicsheetCache
The code-generation logicsheet cache |
protected org.apache.avalon.framework.component.ComponentManager |
manager
The component manager |
protected java.lang.String |
name
This language name |
protected java.lang.String |
prefix
The markup language's namespace prefix |
protected java.lang.String |
uri
The markup language's namespace uri |
| Fields inherited from interface org.apache.cocoon.components.language.markup.MarkupLanguage |
ROLE |
| Constructor Summary | |
AbstractMarkupLanguage()
The default constructor. |
|
| Method Summary | |
protected abstract void |
addDependency(java.lang.String location)
Add a dependency on an external file to the document for inclusion in generated code. |
protected void |
addLogicsheetsToGenerator(LogicsheetCodeGenerator codeGenerator)
Add logicsheet list to the code generator. |
protected void |
addLogicsheetToList(AbstractMarkupLanguage.LanguageDescriptor language,
java.lang.String logicsheetLocation,
SourceResolver resolver)
Add a logicsheet to the code generator. |
void |
compose(org.apache.avalon.framework.component.ComponentManager manager)
Set the global component manager. |
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
Process additional configuration. |
void |
dispose()
Release all resources. |
java.lang.String |
generateCode(org.xml.sax.InputSource input,
java.lang.String filename,
ProgrammingLanguage programmingLanguage,
SourceResolver resolver)
Generate source code from the input document for the target ProgrammingLanguage. |
java.lang.String |
getEncoding()
Return the source document's encoding. |
java.lang.String |
getName()
Return the markup language name. |
protected org.xml.sax.XMLFilter |
getPreprocessFilter(java.lang.String filename,
ProgrammingLanguage language)
Prepare the input source for logicsheet processing and code generation with a preprocess filter. |
protected AbstractMarkupLanguage.TransformerChainBuilderFilter |
getTransformerChainBuilder(LogicsheetCodeGenerator logicsheetMarkupGenerator,
SourceResolver resolver)
Returns a filter that chains on the fly the requested transformers for source code generation. |
void |
parameterize(org.apache.avalon.framework.parameters.Parameters params)
Initialize the (required) markup language namespace definition. |
void |
recycle()
Recycle this component: clear logic sheet list and dependencies. |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String name
protected HashMap languages
protected Store logicsheetCache
protected java.lang.String uri
protected java.lang.String prefix
protected org.apache.avalon.framework.component.ComponentManager manager
| Constructor Detail |
public AbstractMarkupLanguage()
| Method Detail |
public void configure(org.apache.avalon.framework.configuration.Configuration conf)
throws org.apache.avalon.framework.configuration.ConfigurationException
configure in interface org.apache.avalon.framework.configuration.Configurableconf - The language configurationorg.apache.avalon.framework.configuration.ConfigurationException - If an error occurs loading logichseets
public void compose(org.apache.avalon.framework.component.ComponentManager manager)
throws org.apache.avalon.framework.component.ComponentException
compose in interface org.apache.avalon.framework.component.Composablemanager - The sitemap-specified component managerpublic void recycle()
recycle in interface org.apache.avalon.excalibur.pool.Recyclablepublic void dispose()
dispose in interface org.apache.avalon.framework.activity.Disposable
public void parameterize(org.apache.avalon.framework.parameters.Parameters params)
throws org.apache.avalon.framework.parameters.ParameterException
parameterize in interface org.apache.avalon.framework.parameters.Parameterizableparams - The supplied parameterspublic java.lang.String getName()
public java.lang.String getEncoding()
null for
the platform's default encoding. The default implementation returns
null, but derived classes may override it if encoding applies to
their concrete languages.
FIXME: There should be a way to get the
XML document's encoding as seen by the parser; unfortunately, this
information is not returned by current DOM or SAX parsers...getEncoding in interface MarkupLanguage
protected AbstractMarkupLanguage.TransformerChainBuilderFilter getTransformerChainBuilder(LogicsheetCodeGenerator logicsheetMarkupGenerator,
SourceResolver resolver)
logicsheetMarkupGenerator - the logicsheet markup generatorresolver - the entity resolver
protected org.xml.sax.XMLFilter getPreprocessFilter(java.lang.String filename,
ProgrammingLanguage language)
XMLFilter object is the first filter on the
transformer chain. The default implementation does nothing by
returning a identity filter, but derived classes should (at
least) use the passed programming language to quote
Stringsfilename - The source filenamelanguage - The target programming languageprotected abstract void addDependency(java.lang.String location)
File's
tested for change on each invocation; this information is used to assert whether regeneration is necessary.location - The file path of the dependent fileAbstractMarkupLanguage, ServerPagesGenerator and AbstractServerPage
public java.lang.String generateCode(org.xml.sax.InputSource input,
java.lang.String filename,
ProgrammingLanguage programmingLanguage,
SourceResolver resolver)
throws java.lang.Exception
ProgrammingLanguage. After preprocessing the input
document, this method applies logicsheets in the following
order:
generateCode in interface MarkupLanguageinput - The input sourcefilename - The input document's original filenameprogrammingLanguage - The target programming languagejava.lang.Exception - If an error occurs during code generation
protected void addLogicsheetsToGenerator(LogicsheetCodeGenerator codeGenerator)
throws java.net.MalformedURLException,
java.io.IOException,
org.xml.sax.SAXException,
ProcessingException
codeGenerator - The code generator
protected void addLogicsheetToList(AbstractMarkupLanguage.LanguageDescriptor language,
java.lang.String logicsheetLocation,
SourceResolver resolver)
throws java.io.IOException,
org.xml.sax.SAXException,
ProcessingException
logicsheetLocation - Location of the logicsheet to be addeddocument - The input documentjava.net.MalformedURLException - If location is invalidjava.io.IOException - IO Errororg.xml.sax.SAXException - Logicsheet parse error
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||