|
||||||||
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
a XMLFilter that build the chain of transformers on the fly. |
Field Summary | |
protected java.util.Hashtable |
languages
The supported language table |
protected Store |
logicsheetCache
The in-memory code-generation logicsheet cache |
protected org.apache.avalon.framework.component.ComponentManager |
manager
The component manager |
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. |
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. |
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 |
getTranformerChainBuilder(LogicsheetCodeGenerator logicsheetMarkupGenerator,
SourceResolver resolver)
Returns a filter that chains on the fly the requested transformers for source code generation. |
protected void |
setParameters(org.apache.avalon.framework.parameters.Parameters params)
Initialize the (required) markup language namespace definition. |
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.util.Hashtable 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() throws org.xml.sax.SAXException, java.io.IOException
Method Detail |
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.Composable
manager
- The sitemap-specified component managerprotected void setParameters(org.apache.avalon.framework.parameters.Parameters params) throws java.lang.Exception
params
- The sitemap-supplied parametersjava.lang.Exception
- Not actually thrownpublic void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
conf
- The language configurationorg.apache.avalon.framework.configuration.ConfigurationException
- If an error occurs loading logichseetspublic 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...
- Specified by:
getEncoding
in interface MarkupLanguage
- Returns:
- The document-specified encoding
protected AbstractMarkupLanguage.TransformerChainBuilderFilter getTranformerChainBuilder(LogicsheetCodeGenerator logicsheetMarkupGenerator, SourceResolver resolver)
logicsheetMarkupGenerator
- the logicsheet markup generatorresolver
- the entity resolverprotected 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
Strings
filename
- 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 MarkupLanguage
input
- The input sourcefilename
- The input document's original filenameprogrammingLanguage
- The target programming languagejava.lang.Exception
- If an error occurs during code generationprotected void addLogicsheetsToGenerator(LogicsheetCodeGenerator codeGenerator) throws java.net.MalformedURLException, java.io.IOException, org.xml.sax.SAXException
codeGenerator
- The code generatorprotected void addLogicsheetToList(AbstractMarkupLanguage.LanguageDescriptor language, java.lang.String logicsheetLocation, SourceResolver resolver) throws java.net.MalformedURLException, 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 |