org.apache.torque.mojo
Class DataModelTaskMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.torque.mojo.BaseMojo
          extended by org.apache.torque.mojo.AntTaskMojo
              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, DataSqlMojo, SqlMojoBase

public abstract class DataModelTaskMojo
extends TexenTaskMojo

The base class for mojos that wrap DataModelTasks


Field Summary
private  String reportFile
          The file containing the generation report, relative to outputDir.
private  boolean runOnlyOnSchemaChange
          Determines if this task should run only if the schema has changed
private  String schemaDir
          The path to the directory where the schema XML files are located
private  String schemaExcludes
          The schema files from that directory which should be excluded (ant-style notation).
private  String schemaIncludes
          The schema files from that directory which should be included (ant-style notation).
private  String sqlDbMap
          The path to the properties file containing the mapping sql file -> target database.
(package private)  String suffix
          The suffix of the generated sql files.
static String TARGET_DATABASE_CONTEXT_PROPERTY
          The Velocity context property for the target database
private  String targetDatabase
          The type of database we are targeting (eg oracle, mysql).
private  String targetPackage
          The target package for the generated classes.
(package private)  String url
          Database URL.
 
Fields inherited from class org.apache.torque.mojo.BaseMojo
FS, SKIP_PACKAGING_TYPE
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
DataModelTaskMojo()
           
 
Method Summary
protected  void addTargetDatabaseToOutputDir()
           
protected  void addTargetDatabaseToReportFile()
           
protected  void configureTask()
          Configures the Texen task wrapped by this mojo
protected  org.apache.tools.ant.types.FileSet getAntFileSet(File baseDir, String includes, String excludes)
           
protected  File getCanonicalReportFile()
           
protected abstract  String getControlTemplate()
          Returns the path to the control template.
protected  String getInvalidTargetDatabaseMessage()
           
 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.
protected  List<File> getSchemaFiles()
           
 String getSchemaIncludes()
          Returns the schema files which are included in generation.
 String getSqlDbMap()
          Returns the path to the mapping SQL Files -> database.
 String getSuffix()
           
 String getTargetDatabase()
          Returns the target database (e.g.
 String getTargetPackage()
          Returns the target package for the generated classes.
 String getUrl()
           
 boolean isRunOnlyOnSchemaChange()
          Returns whether this mojo should be executed only if 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 setSuffix(String suffix)
           
 void setTargetDatabase(String targetDatabase)
          Sets the target database (e.g.
 void setTargetPackage(String targetPackage)
          Sets the target package for the generated classes.
 void setUrl(String url)
           
protected  void updateConfiguration()
          Validate that some essential configuration items are present
protected  void validateConfiguration()
          Validate that some essential configuration items are present
 
Methods inherited from class org.apache.torque.mojo.TexenTaskMojo
executeMojo, generateContextProperties, getContextPropertiesPath, getGeneratorTask, getMojoContextProperties, getOutputDir, getTemplatePath, getUseClasspath, getUserContextProperties, setContextPropertiesPath, setOutputDir, setTemplatePath, setUseClasspath, setUserContextProperties
 
Methods inherited from class org.apache.torque.mojo.AntTaskMojo
getAntProject, getAntTask, getIniatializedAntProject, setAntProject, setAntTask
 
Methods inherited from class org.apache.torque.mojo.BaseMojo
afterExecution, beforeExecution, execute, getEncoding, getMavenSession, getProject, getSettings, isForceMojoExecution, isSkip, isStartMavenLogger, setEncoding, setForceMojoExecution, setMavenSession, setProject, setSettings, setSkip, setStartMavenLogger, skipMojo
 
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 Velocity context property for the target database

See Also:
Constant Field Values

url

String url
Database URL.


suffix

String suffix
The suffix of the generated sql files.


schemaDir

private String schemaDir
The path to the directory where the schema XML files are located


schemaIncludes

private String schemaIncludes
The schema files from that directory which should be included (ant-style notation).


schemaExcludes

private String schemaExcludes
The schema files from that directory which should be excluded (ant-style notation).


targetDatabase

private String targetDatabase
The type of database we are targeting (eg oracle, mysql). This is optional if url is supplied as the database type will be automatically detected based on the url. If targetDatabase is explicitly supplied it will override the type selected by the automatic detection logic.


targetPackage

private String targetPackage
The target package for the generated classes.


reportFile

private String reportFile
The file containing the generation report, relative to outputDir.


runOnlyOnSchemaChange

private boolean runOnlyOnSchemaChange
Determines if this task should run only if the schema has changed


sqlDbMap

private String sqlDbMap
The path to the properties file containing the mapping sql file -> target database.

Constructor Detail

DataModelTaskMojo

public DataModelTaskMojo()
Method Detail

getCanonicalReportFile

protected File getCanonicalReportFile()
                               throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getAntFileSet

protected org.apache.tools.ant.types.FileSet getAntFileSet(File baseDir,
                                                           String includes,
                                                           String excludes)

updateConfiguration

protected void updateConfiguration()
                            throws org.apache.maven.plugin.MojoExecutionException
Validate that some essential configuration items are present

Throws:
org.apache.maven.plugin.MojoExecutionException

getInvalidTargetDatabaseMessage

protected String getInvalidTargetDatabaseMessage()

validateConfiguration

protected void validateConfiguration()
                              throws org.apache.maven.plugin.MojoExecutionException
Validate that some essential configuration items are present

Throws:
org.apache.maven.plugin.MojoExecutionException

getControlTemplate

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

Returns:
the path to the control template.

addTargetDatabaseToOutputDir

protected void addTargetDatabaseToOutputDir()

addTargetDatabaseToReportFile

protected void addTargetDatabaseToReportFile()

configureTask

protected void configureTask()
                      throws org.apache.maven.plugin.MojoExecutionException
Configures the Texen task wrapped by this mojo

Overrides:
configureTask in class TexenTaskMojo
Throws:
org.apache.maven.plugin.MojoExecutionException

getSchemaFiles

protected List<File> getSchemaFiles()

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.

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.

getUrl

public String getUrl()

setUrl

public void setUrl(String url)

getSuffix

public String getSuffix()

setSuffix

public void setSuffix(String suffix)


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.