org.apache.torque.mojo
Class AbstractDBACommandMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.torque.mojo.BaseMojo
          extended by org.apache.torque.mojo.AbstractSQLExecutorMojo
              extended by org.apache.torque.mojo.AbstractDBACommandMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
ResetMojo, SingleDBACommandMojo

public abstract class AbstractDBACommandMojo
extends AbstractSQLExecutorMojo

Common logic for running SQL commands on a database


Field Summary
(package private)  String database
          The name of the database to DROP/CREATE.
static String DATABASE_PROPERTY
           
static String DATABASE_PW_PROPERTY
           
static String DATABASE_USERNAME_PROPERTY
           
(package private)  String databasePassword
          The password for the user that is DROPPED/CREATED.
(package private)  String databaseUser
          The user to DROP/CREATE when issuing DBA commands for creating/dropping a user.
(package private)  String dbaSettingsKey
          Lookup DBA credentials in settings.xml using this key.
(package private)  String serverUrl
          URL to connect directly to the database server itself (ie: no database specified).
 
Fields inherited from class org.apache.torque.mojo.AbstractSQLExecutorMojo
append, autocommit, conn, connectionHandler, credentials, delimiter, delimiterType, driver, DRIVER_INFO_PROPERTIES_PASSWORD, DRIVER_INFO_PROPERTIES_USER, driverProperties, enableAnonymousPassword, enableAnonymousUsername, escapeProcessing, FILE_SORTING_ASC, FILE_SORTING_DSC, fileFilter, jdbcUtils, keepFormat, onError, password, platform, settingsKey, showheaders, showPassword, skipOnConnectionError, sqlCommand, srcFiles, successfulStatements, targetDatabase, totalStatements, transactions, url, username, utils
 
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
AbstractDBACommandMojo()
           
 
Method Summary
protected  Properties getContextProperties()
           
 String getDatabase()
           
 String getDatabasePassword()
           
 String getDatabaseUser()
           
 String getDbaSettingsKey()
           
protected  org.apache.maven.settings.Server getServerFromSettingsKey()
           
 String getServerUrl()
           
protected  String getTransactionDescription(DatabaseCommand command)
           
protected  String getUpdatedPassword(org.apache.maven.settings.Server server, String password)
           
protected  String getUpdatedUsername(org.apache.maven.settings.Server server, String username)
           
 void setDatabase(String schema)
           
 void setDatabasePassword(String databasePassword)
           
 void setDatabaseUser(String databaseUsername)
           
 void setDbaSettingsKey(String dbaSettingsKey)
           
 void setServerUrl(String serverUrl)
           
protected  void updateConfiguration()
          Attempt to automatically detect the correct JDBC driver and database type (oracle, mysql, h2, derby, etc) given a JDBC url
protected  void validateConfiguration()
          Validate that some essential configuration items are present
 
Methods inherited from class org.apache.torque.mojo.AbstractSQLExecutorMojo
addText, configureTransactions, convertNullToEmpty, executeMojo, getConn, getConnection, getCredentials, getDelimiter, getDelimiterType, getDisplayPassword, getDriver, getDriverProperties, getFileFilter, getNewConnectionHandler, getNewCredentials, getOnError, getPassword, getSettingsKey, getSqlCommand, getSqlExecutor, getSrcFiles, getSuccessfulStatements, getTargetDatabase, getTotalStatements, getTransactions, getUrl, getUsername, isAppend, isAutocommit, isEnableAnonymousPassword, isEscapeProcessing, isKeepFormat, isNullOrEmpty, isShowheaders, isShowPassword, isSkipOnConnectionError, setAppend, setAutocommit, setConn, setCredentials, setDelimiter, setDelimiterType, setDriver, setDriverProperties, setEnableAnonymousPassword, setEscapeProcessing, setFileFilter, setKeepFormat, setOnError, setPassword, setSettingsKey, setShowheaders, setShowPassword, setSkipOnConnectionError, setSqlCommand, setSrcFiles, setSuccessfulStatements, setTargetDatabase, setTotalStatements, setTransactions, setUrl, setUsername, updateCredentials, validateCredentials, validateCredentials
 
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

DATABASE_PROPERTY

public static final String DATABASE_PROPERTY
See Also:
Constant Field Values

DATABASE_PW_PROPERTY

public static final String DATABASE_PW_PROPERTY
See Also:
Constant Field Values

DATABASE_USERNAME_PROPERTY

public static final String DATABASE_USERNAME_PROPERTY
See Also:
Constant Field Values

serverUrl

String serverUrl
URL to connect directly to the database server itself (ie: no database specified). This is optional as it is automatically detected in almost all cases from the url. If serverUrl is explicitly supplied it overrides the serverUrl chosen by the automatic detection logic.


database

String database
The name of the database to DROP/CREATE. If not specified, this defaults to a database name that is compatible with ${targetDatabase} based on platform specific logic that converts the artifact id.

For example:
ks-embedded-db is converted to KSEMBEDDED for Oracle, and ksembedded for MySQL)


databaseUser

String databaseUser
The user to DROP/CREATE when issuing DBA commands for creating/dropping a user. If not specified, this defaults to a user that is compatible with ${targetDatabase} based on platform specific logic that converts the artifact id.

For example:
ks-embedded-db is converted to KSEMBEDDED for Oracle, and ksembedded for MySQL


databasePassword

String databasePassword
The password for the user that is DROPPED/CREATED. If not specified, this defaults to a password that is compatible with ${targetDatabase} based on platform specific logic that converts the artifact id.

For example:
ks-embedded-db is converted to KSEMBEDDED for Oracle, and ksembedded for MySQL


dbaSettingsKey

String dbaSettingsKey
Lookup DBA credentials in settings.xml using this key. If nothing is found under impex.dba.${project.artifactId} a second attempt will be made to locate a set of credentials under impex.dba.${url}

Constructor Detail

AbstractDBACommandMojo

public AbstractDBACommandMojo()
Method Detail

getTransactionDescription

protected String getTransactionDescription(DatabaseCommand command)

updateConfiguration

protected void updateConfiguration()
                            throws org.apache.maven.plugin.MojoExecutionException
Description copied from class: AbstractSQLExecutorMojo
Attempt to automatically detect the correct JDBC driver and database type (oracle, mysql, h2, derby, etc) given a JDBC url

Overrides:
updateConfiguration in class AbstractSQLExecutorMojo
Throws:
org.apache.maven.plugin.MojoExecutionException

getUpdatedPassword

protected String getUpdatedPassword(org.apache.maven.settings.Server server,
                                    String password)
Overrides:
getUpdatedPassword in class AbstractSQLExecutorMojo

getUpdatedUsername

protected String getUpdatedUsername(org.apache.maven.settings.Server server,
                                    String username)
Overrides:
getUpdatedUsername in class AbstractSQLExecutorMojo

getContextProperties

protected Properties getContextProperties()
Overrides:
getContextProperties in class AbstractSQLExecutorMojo

getServerFromSettingsKey

protected org.apache.maven.settings.Server getServerFromSettingsKey()
Overrides:
getServerFromSettingsKey in class AbstractSQLExecutorMojo

validateConfiguration

protected void validateConfiguration()
                              throws org.apache.maven.plugin.MojoExecutionException
Description copied from class: AbstractSQLExecutorMojo
Validate that some essential configuration items are present

Overrides:
validateConfiguration in class AbstractSQLExecutorMojo
Throws:
org.apache.maven.plugin.MojoExecutionException

getDatabase

public String getDatabase()

setDatabase

public void setDatabase(String schema)

getDatabasePassword

public String getDatabasePassword()

setDatabasePassword

public void setDatabasePassword(String databasePassword)

getDatabaseUser

public String getDatabaseUser()

setDatabaseUser

public void setDatabaseUser(String databaseUsername)

getServerUrl

public String getServerUrl()

setServerUrl

public void setServerUrl(String serverUrl)

getDbaSettingsKey

public String getDbaSettingsKey()

setDbaSettingsKey

public void setDbaSettingsKey(String dbaSettingsKey)


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