org.apache.torque.mojo
Class TexenTaskMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.torque.mojo.TexenTaskMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
DataModelTaskMojo

public abstract class TexenTaskMojo
extends org.apache.maven.plugin.AbstractMojo

The base Class for all Mojos wrapping Texen Tasks.

Author:
Rapha�l Pi�roni (rafale_at_codehaus.org), Thomas Fischer

Field Summary
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
TexenTaskMojo(org.apache.texen.ant.TexenTask generatorTask)
          Creates a new instance of AbstractTorqueMojo.
 
Method Summary
protected  void configureTask()
          Configures the Texen task which is wrapped by this mojo.
 void execute()
          Executes the wrapped Texen task.
protected  void generateContextProperties()
          Generates the context properties file for Texen.
protected  org.apache.tools.ant.Project getAntProject()
          Returns the ant project.
 String getContextPropertiesPath()
          Returns the path to the generated property file used as Texen's context properties.
protected  org.apache.texen.ant.TexenTask getGeneratorTask()
          returns the generator Task for this mojo.
protected abstract  org.apache.commons.configuration.PropertiesConfiguration getMojoContextProperties()
          Returns the context properties for the Texen task which are defined in the configuration of the child mojo.
 String getOutputDir()
          Returns the path to Torque's output directory.
 org.apache.maven.project.MavenProject getProject()
          Returns the maven project.
 String getTemplatePath()
          Returns the path to Torque's templates, if the classpath is not used to load the templates.
 boolean getUseClasspath()
          Returns whether the classpath is used to locate the templates.
 Map getUserContextProperties()
          Returns the map which defines user-defined context properties.
 void setContextPropertiesPath(String contextPropertiesPath)
          Sets the path to the generated property file used as Texen's context properties.
protected  void setGeneratorTask(org.apache.texen.ant.TexenTask generatorTask)
          Sets the Texen task.
 void setOutputDir(String outputDir)
          Sets the path to Torque's output directory.
 void setProject(org.apache.maven.project.MavenProject project)
          Sets the maven project.
 void setTemplatePath(String templatePath)
          Sets the path to Torque's templates, if the classpath is not used to load the templates.
 void setUseClasspath(boolean useClasspath)
          Sets whether the classpath should be used to locate the templates.
 void setUserContextProperties(Map userContextProperties)
          Sets the map which defines user-defined context properties.
 
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
 

Constructor Detail

TexenTaskMojo

public TexenTaskMojo(org.apache.texen.ant.TexenTask generatorTask)
Creates a new instance of AbstractTorqueMojo.

Throws:
IllegalArgumentException - if generatorTask is null.
Method Detail

setGeneratorTask

protected void setGeneratorTask(org.apache.texen.ant.TexenTask generatorTask)
Sets the Texen task.

Parameters:
generatorTask - the Texen task to be used in this Mojo.

setProject

public void setProject(org.apache.maven.project.MavenProject project)
Sets the maven project.

Parameters:
project - the maven project where this plugin runs in.

getProject

public org.apache.maven.project.MavenProject getProject()
Returns the maven project.

Returns:
The maven project where this plugin runs in.

getAntProject

protected org.apache.tools.ant.Project getAntProject()
Returns the ant project.

Returns:
The ant project assigned to the generator task.

setOutputDir

public void setOutputDir(String outputDir)
Sets the path to Torque's output directory.

Parameters:
outputDir - the path to Torque's output directory.

getOutputDir

public String getOutputDir()
Returns the path to Torque's output directory.

Returns:
the path to Torque's output directory. Not null if initialized correctly.

setTemplatePath

public void setTemplatePath(String templatePath)
Sets the path to Torque's templates, if the classpath is not used to load the templates.

Parameters:
templatePath - the path to Torque's templates.

getTemplatePath

public String getTemplatePath()
Returns the path to Torque's templates, if the classpath is not used to load the templates.

Returns:
the path to Torque's templates.

setUseClasspath

public void setUseClasspath(boolean useClasspath)
Sets whether the classpath should be used to locate the templates.

Parameters:
templatePath - the path to Torque's templates.

getUseClasspath

public boolean getUseClasspath()
Returns whether the classpath is used to locate the templates.

Returns:
true if the classpath is used to locate the templates, false otherwise

setContextPropertiesPath

public void setContextPropertiesPath(String contextPropertiesPath)
Sets the path to the generated property file used as Texen's context properties.

Parameters:
generatedPropertyFilePath - the path to the generated context properties file.

getContextPropertiesPath

public String getContextPropertiesPath()
Returns the path to the generated property file used as Texen's context properties.

Returns:
the path to the generated context properties file.

setUserContextProperties

public void setUserContextProperties(Map userContextProperties)
Sets the map which defines user-defined context properties. The settings override all other mojo configuration settings which are mapped to context properties.

Parameters:
contextProperties - the user-defined context properties.

getUserContextProperties

public Map getUserContextProperties()
Returns the map which defines user-defined context properties.

Returns:
the map containing user-defined context properties, or null if not set.

getGeneratorTask

protected org.apache.texen.ant.TexenTask getGeneratorTask()
returns the generator Task for this mojo.

Returns:
the generator Task, not null.

generateContextProperties

protected void generateContextProperties()
                                  throws org.apache.maven.plugin.MojoExecutionException
Generates the context properties file for Texen. The file is written to the path contextPropertiesPath.

Throws:
org.apache.maven.plugin.MojoExecutionException - if an error occurs.

configureTask

protected void configureTask()
                      throws org.apache.maven.plugin.MojoExecutionException
Configures the Texen task which is wrapped by this mojo. In this implementation, the context properties, useClasspath and the output directory are set. If more parameters need to be set, this method shouldb be overwritten in subclasses.

Throws:
org.apache.maven.plugin.MojoExecutionException - if an error occurs when setting the Tasks properties.

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Executes the wrapped Texen task. Before this is done, the context properties file is generated and the Texen task is configured.

Throws:
org.apache.maven.plugin.MojoExecutionException - if an error occurs during execution.
See Also:
Mojo.execute()

getMojoContextProperties

protected abstract org.apache.commons.configuration.PropertiesConfiguration getMojoContextProperties()
Returns the context properties for the Texen task which are defined in the configuration of the child mojo. This method needs to be overwritten in subclasses.

Returns:
The PropertiesConfiguration containing all context properties, not null.


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.