org.apache.torque.mojo
Class DataModelTaskMojo

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

public abstract class DataModelTaskMojo
extends TexenTaskMojo

The base class for all mojos wrapping DataModelTasks.

Author:
Raphael Pieroni (rafale_at_codehaus.org), Thomas Fischer

Field Summary
static String TARGET_DATABASE_CONTEXT_PROPERTY
          The context property for the database.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Method Summary
protected  void configureTask()
          Configures the Texen task which is wrapped by this mojo.
 void execute()
          Runs the generation for the database layout defined in the schema.xml files.
protected abstract  String getControlTemplate()
          Returns the path to the control template.
 String getReportFile()
          Gets the path to the report file.
 String getSchemaDir()
          Returns the directory where the schema files are located.
 String getSchemaExcludes()
          Returns the schema files which are excluded from generation.
 String getSchemaIncludes()
          Returns the schema files which are included in generation.
 String getSqlDbMap()
          Returns the path to the mapping SQL Files -> database.
 String getTargetDatabase()
          Returns the target database (e.g. mysql, oracle, ... ) for the generated files.
 String getTargetPackage()
          Returns the target package for the generated classes.
 boolean isRunOnlyOnSchemaChange()
          Returns whether this mojo should be executed only if the schema has changed.
protected  boolean schemaChanged()
          Returns whether the schema has changed.
 void setReportFile(String reportFile)
          Sets the path to the report file.
 void setRunOnlyOnSchemaChange(boolean runOnlyOnSchemaChange)
          Sets whether this mojo should be executed only if the schema has changed.
 void setSchemaDir(String schemaDir)
          Sets the the directory where the schema files are located.
 void setSchemaExcludes(String schemaExcludes)
          Sets the schema files which are excluded from generation.
 void setSchemaIncludes(String schemaIncludes)
          Sets the schema files which are included in generation.
 void setSqlDbMap(String sqlDbMap)
          Sets the path to the mapping SQL Files -> database.
 void setTargetDatabase(String targetDatabase)
          Sets the target database (e.g. mysql, oracle, ... ) for the generated files.
 void setTargetPackage(String targetPackage)
          Sets the target package for the generated classes.
 
Methods inherited from class org.apache.torque.mojo.TexenTaskMojo
generateContextProperties, getAntProject, getContextPropertiesPath, getGeneratorTask, getMojoContextProperties, getOutputDir, getProject, getTemplatePath, getUseClasspath, getUserContextProperties, setContextPropertiesPath, setGeneratorTask, setOutputDir, setProject, setTemplatePath, setUseClasspath, setUserContextProperties
 
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

TARGET_DATABASE_CONTEXT_PROPERTY

public static final String TARGET_DATABASE_CONTEXT_PROPERTY
The context property for the database.

See Also:
Constant Field Values
Method Detail

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, the output directory, the control template, the schema Fileset, the target package and the target database are set.

Overrides:
configureTask in class TexenTaskMojo
Throws:
org.apache.maven.plugin.MojoExecutionException - if an error occurs when setting the Tasks properties.
See Also:
TexenTaskMojo.configureTask()

schemaChanged

protected boolean schemaChanged()
Returns whether the schema has changed. This is done by comparing the modification date of all schema files to the modification date of the report file.

Returns:
whether the schema has changed.

getSchemaDir

public String getSchemaDir()
Returns the directory where the schema files are located.

Returns:
the the directory where the schema files are located.

setSchemaDir

public void setSchemaDir(String schemaDir)
Sets the the directory where the schema files are located.

Parameters:
schemaDir - the directory where the schema files are located.

getTargetDatabase

public String getTargetDatabase()
Returns the target database (e.g. mysql, oracle, ... ) for the generated files.

Returns:
the target database for the generated files.

setTargetDatabase

public void setTargetDatabase(String targetDatabase)
Sets the target database (e.g. mysql, oracle, ... ) for the generated files.

Parameters:
targetDatabase - the target database for the generated files.

getTargetPackage

public String getTargetPackage()
Returns the target package for the generated classes.

Returns:
the target package for the generated classes.

setTargetPackage

public void setTargetPackage(String targetPackage)
Sets the target package for the generated classes. param targetPackage the target package for the generated classes.


getReportFile

public String getReportFile()
Gets the path to the report file. The path is relative to outputDir.

Returns:
the path to the report file.

setReportFile

public void setReportFile(String reportFile)
Sets the path to the report file. The path is relative to outputDir.

Parameters:
reportFile - the path to the report file.

isRunOnlyOnSchemaChange

public boolean isRunOnlyOnSchemaChange()
Returns whether this mojo should be executed only if the schema has changed.

Returns:
true if the mojo only runs if the schema has changed, false otherwise.

setRunOnlyOnSchemaChange

public void setRunOnlyOnSchemaChange(boolean runOnlyOnSchemaChange)
Sets whether this mojo should be executed only if the schema has changed.

Parameters:
runOnlyOnSchemaChange - whether the mojo only should run if the schema has changed.

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Runs the generation for the database layout defined in the schema.xml files.

Specified by:
execute in interface org.apache.maven.plugin.Mojo
Overrides:
execute in class TexenTaskMojo
Throws:
org.apache.maven.plugin.MojoExecutionException - If an error occurs during generation.
See Also:
TexenTaskMojo.execute(), Mojo.execute()

getSchemaExcludes

public String getSchemaExcludes()
Returns the schema files which are excluded from generation.

Returns:
the pattern for the excluded files.

setSchemaExcludes

public void setSchemaExcludes(String schemaExcludes)
Sets the schema files which are excluded from generation.

Parameters:
schemaExcludes - the pattern for the excluded files.

getSchemaIncludes

public String getSchemaIncludes()
Returns the schema files which are included in generation.

Returns:
the pattern for the included files.

setSchemaIncludes

public void setSchemaIncludes(String schemaIncludes)
Sets the schema files which are included in generation.

Parameters:
schemaIncludes - the pattern for the included files.

getSqlDbMap

public String getSqlDbMap()
Returns the path to the mapping SQL Files -> database.

Returns:
the path to the mapping SQL Files -> database.

setSqlDbMap

public void setSqlDbMap(String sqlDbMap)
Sets the path to the mapping SQL Files -> database.

Parameters:
sqlDbMap - the absolute path to the mapping SQL Files -> database.

getControlTemplate

protected abstract String getControlTemplate()
Returns the path to the control template.

Returns:
the path to the control template.


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