|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.maven.plugin.AbstractMojo
com.agilejava.docbkx.maven.AbstractTransformerMojo
public abstract class AbstractTransformerMojo
The abstract Mojo base for concrete Mojos that generate some kind of output format from DocBook. This Mojo will
search documents in the directory returned by getTargetDirectory()
, and apply the stylesheets on these
documents. This Mojo will be subclassed by Mojo's that generate a particular type of output.
Field Summary | |
---|---|
protected String[] |
catalogs
|
Fields inherited from interface org.apache.maven.plugin.Mojo |
---|
ROLE |
Constructor Summary | |
---|---|
AbstractTransformerMojo()
|
Method Summary | |
---|---|
void |
adjustTransformer(Transformer transformer,
String sourceFilename,
File targetFile)
The operation to override when it is required to make some adjustments to the Transformer right before it is
applied to a certain source file. |
protected abstract void |
configure(Transformer transformer)
Configure the Transformer by passing in some parameters. |
protected Object |
convertBooleanToXsltParam(String value)
Converts a Boolean parameter to the type expected by the XSLT processor. |
protected Object |
convertStringToXsltParam(String value)
Converts a String parameter to the type expected by the XSLT processor. |
protected org.apache.xml.resolver.CatalogManager |
createCatalogManager()
Creates a CatalogManager , used to resolve DTDs and other entities. |
protected DocumentBuilder |
createDocumentBuilder()
Creates a DocumentBuilder to be used to parse DocBook XML documents. |
protected Source |
createSource(String inputFilename,
File sourceFile,
PreprocessingFilter filter)
Creates a SAXSource configured with the desired XInclude mode. |
protected org.jaxen.XPath |
createTitleXPath()
Creates an instance of an XPath expression for picking the title from a document. |
protected TransformerBuilder |
createTransformerBuilder(URIResolver resolver)
Constructs the default TransformerBuilder . |
protected File |
dumpResolvedXML(String initialFilename,
nu.xom.Document doc)
Saves the Docbook XML file with all XInclude resolved. |
void |
execute()
Builds the actual output document. |
protected void |
executeTasks(org.apache.tools.ant.Target antTasks,
org.apache.maven.project.MavenProject mavenProject)
|
protected abstract List |
getArtifacts()
Returns the plugin dependencies. |
protected abstract List |
getCustomizationParameters()
A list of additional XSL parameters to give to the XSLT engine. |
protected abstract String |
getDefaultStylesheetLocation()
Returns the default stylesheet location within the root of the stylesheet distribution. |
protected URL |
getDefaultStylesheetURL()
Returns the URL of the default stylesheet. |
protected abstract List |
getEntities()
Returns a list of Entities |
protected abstract File |
getGeneratedSourceDirectory()
Returns the directory to use to save the resolved docbook XML before it is given to the Transformer. |
protected abstract String[] |
getIncludes()
Returns the include patterns, as a comma-seperate collection of patterns. |
protected abstract org.apache.maven.project.MavenProject |
getMavenProject()
Returns a reference to the current project. |
protected String |
getNonDefaultStylesheetLocation()
The stylesheet location override by a class in the mojo hierarchy. |
protected URL |
getNonDefaultStylesheetURL()
Returns the URL of the default stylesheet. |
protected abstract org.apache.tools.ant.Target |
getPostProcess()
Returns the tasks that should be executed after the transformation. |
protected abstract org.apache.tools.ant.Target |
getPreProcess()
Returns the tasks that should be executed before the transformation. |
protected String |
getProperty(String propertyname)
Returns the value of a property of this object using introspection. |
protected abstract File |
getSourceDirectory()
Returns the source directory containing the source XML files. |
protected abstract String |
getStylesheetLocation()
Returns the actual stylesheet location. |
protected URL |
getStylesheetURL()
Returns the URL of the stylesheet. |
protected abstract Properties |
getSystemProperties()
Returns the additional System Properties. |
protected abstract File |
getTargetDirectory()
Returns the target directory in which all results should be placed. |
protected abstract String |
getTargetFileExtension()
Returns the extension of the target files, e.g. |
protected abstract String |
getType()
Returns the type of conversion. |
protected abstract boolean |
getXIncludeSupported()
Returns a boolean indicating if XInclude should be supported. |
protected abstract boolean |
isShowXslMessages()
Returns true if the xslt engine have to print xsl:messages to standard output. |
protected abstract boolean |
isUseStandardOutput()
Returns false if the stylesheet is responsible to create the output file(s) using its own naming scheme. |
void |
postProcess()
Allows classes to add their own specific post-processing logic. |
void |
postProcessResult(File result)
Post-processes the file. |
void |
preProcess()
Allows subclasses to add their own specific pre-processing logic. |
protected void |
setProperty(String propertyname,
String value)
Sets the value of a property of this object using introspection. |
protected abstract void |
setShowXslMessages(boolean showXslMessages)
|
protected abstract void |
setTargetFileExtension(String extension)
Sets the file extension, this can be usefull to override this value especially for multiple transformations plugins (like XML to FO to PDF). |
Methods inherited from class org.apache.maven.plugin.AbstractMojo |
---|
getLog, getPluginContext, setLog, setPluginContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String[] catalogs
Constructor Detail |
---|
public AbstractTransformerMojo()
Method Detail |
---|
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
protected Source createSource(String inputFilename, File sourceFile, PreprocessingFilter filter) throws org.apache.maven.plugin.MojoExecutionException
inputFilename
- Is used for temp file generation (XOM)sourceFile
- The docbook source file.filter
- The XML PI filter.
org.apache.maven.plugin.MojoExecutionException
protected File dumpResolvedXML(String initialFilename, nu.xom.Document doc) throws org.apache.maven.plugin.MojoExecutionException
initialFilename
- Filename of the root docbook source file.doc
- XOM Document resolved.
org.apache.maven.plugin.MojoExecutionException
protected abstract boolean getXIncludeSupported()
protected abstract File getGeneratedSourceDirectory()
protected String getNonDefaultStylesheetLocation()
null
.protected abstract boolean isUseStandardOutput()
protected abstract boolean isShowXslMessages()
protected abstract void setShowXslMessages(boolean showXslMessages)
public void adjustTransformer(Transformer transformer, String sourceFilename, File targetFile)
Transformer
right before it is
applied to a certain source file. The two parameters provide some context, allowing implementers to respond to
specific conditions for specific files.
transformer
- The Transformer
that must be adjusted.sourceFilename
- The name of the source file that is being transformed.targetFile
- The target File.public void preProcess() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
- If the Mojo fails to pre-process the results.public void postProcess() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
- If the Mojo fails to post-process the results.public void postProcessResult(File result) throws org.apache.maven.plugin.MojoExecutionException
result
- An individual result.
org.apache.maven.plugin.MojoExecutionException
protected org.apache.xml.resolver.CatalogManager createCatalogManager()
CatalogManager
, used to resolve DTDs and other entities.
CatalogManager
to be used for resolving DTDs and other entities.protected DocumentBuilder createDocumentBuilder() throws org.apache.maven.plugin.MojoExecutionException
DocumentBuilder
to be used to parse DocBook XML documents.
DocumentBuilder
instance.
org.apache.maven.plugin.MojoExecutionException
- If we cannot create an instance of the DocumentBuilder
.protected org.jaxen.XPath createTitleXPath() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
- If the XPath expression cannot be parsed.protected TransformerBuilder createTransformerBuilder(URIResolver resolver)
TransformerBuilder
.
protected void executeTasks(org.apache.tools.ant.Target antTasks, org.apache.maven.project.MavenProject mavenProject) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected abstract void configure(Transformer transformer)
transformer
- The Transformer that needs to be configured.protected abstract File getTargetDirectory()
protected abstract File getSourceDirectory()
protected abstract String[] getIncludes()
protected URL getStylesheetURL()
getStylesheetLocation()
.
protected URL getNonDefaultStylesheetURL()
protected URL getDefaultStylesheetURL()
protected abstract String getDefaultStylesheetLocation()
protected abstract String getStylesheetLocation()
protected abstract String getTargetFileExtension()
protected abstract void setTargetFileExtension(String extension)
extension
- The file extension to setprotected abstract List getEntities()
Entities
protected abstract List getCustomizationParameters()
customizationParameters
protected abstract Properties getSystemProperties()
protected abstract org.apache.tools.ant.Target getPreProcess()
protected abstract org.apache.tools.ant.Target getPostProcess()
protected abstract org.apache.maven.project.MavenProject getMavenProject()
protected abstract List getArtifacts()
protected abstract String getType()
protected Object convertStringToXsltParam(String value)
protected Object convertBooleanToXsltParam(String value)
protected void setProperty(String propertyname, String value)
propertyname
- The field namevalue
- The valueprotected String getProperty(String propertyname)
propertyname
- The filed name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |