|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.maven.plugin.AbstractMojo org.apache.torque.mojo.BaseMojo org.apache.torque.mojo.AbstractSQLExecutorMojo
public abstract class AbstractSQLExecutorMojo
Abstract mojo for making use of SQLExecutor
Field Summary | |
---|---|
static String |
DRIVER_INFO_PROPERTIES_PASSWORD
|
static String |
DRIVER_INFO_PROPERTIES_USER
|
static String |
FILE_SORTING_ASC
Call #setOrder(String) with this value to sort in ascendant order the sql files. |
static String |
FILE_SORTING_DSC
Call #setOrder(String) with this value to sort in descendant order the sql files. |
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 | |
---|---|
AbstractSQLExecutorMojo()
|
Method Summary | |
---|---|
void |
addText(String sql)
Set an inline SQL command to execute. |
protected void |
configureTransactions()
|
protected String |
convertNullToEmpty(String s)
|
void |
executeMojo()
Validate our configuration and execute SQL as appropriate |
Connection |
getConn()
|
protected Connection |
getConnection()
Creates a new Connection as using the driver, url, userid and password specified. |
protected Properties |
getContextProperties()
|
org.kuali.db.Credentials |
getCredentials()
|
String |
getDelimiter()
|
String |
getDelimiterType()
|
protected String |
getDisplayPassword(String password)
|
String |
getDriver()
|
protected Properties |
getDriverProperties()
parse driverProperties into Properties set |
org.apache.maven.shared.filtering.MavenFileFilter |
getFileFilter()
|
protected org.kuali.db.ConnectionHandler |
getNewConnectionHandler()
|
protected org.kuali.db.Credentials |
getNewCredentials()
|
String |
getOnError()
|
String |
getPassword()
|
protected org.apache.maven.settings.Server |
getServerFromSettingsKey()
|
String |
getSettingsKey()
|
String |
getSqlCommand()
|
protected org.kuali.db.SQLExecutor |
getSqlExecutor()
|
File[] |
getSrcFiles()
|
int |
getSuccessfulStatements()
Number of SQL statements executed so far that caused errors. |
String |
getTargetDatabase()
|
int |
getTotalStatements()
Number of SQL statements executed so far, including the ones that caused errors. |
Vector<org.kuali.db.Transaction> |
getTransactions()
|
protected String |
getUpdatedPassword(org.apache.maven.settings.Server server,
String password)
|
protected String |
getUpdatedUsername(org.apache.maven.settings.Server server,
String username)
|
String |
getUrl()
|
String |
getUsername()
|
boolean |
isAppend()
|
boolean |
isAutocommit()
|
boolean |
isEnableAnonymousPassword()
|
boolean |
isEscapeProcessing()
|
boolean |
isKeepFormat()
|
protected boolean |
isNullOrEmpty(Collection<?> c)
|
boolean |
isShowheaders()
|
boolean |
isShowPassword()
|
boolean |
isSkipOnConnectionError()
|
void |
setAppend(boolean append)
whether output should be appended to or overwrite an existing file. |
void |
setAutocommit(boolean autocommit)
|
void |
setConn(Connection conn)
|
void |
setCredentials(org.kuali.db.Credentials credentials)
|
void |
setDelimiter(String delimiter)
Set the delimiter that separates SQL statements. |
void |
setDelimiterType(String delimiterType)
Set the delimiter type: "normal" or "row" (default "normal"). |
void |
setDriver(String driver)
|
void |
setDriverProperties(String driverProperties)
|
void |
setEnableAnonymousPassword(boolean enableAnonymousPassword)
|
void |
setEscapeProcessing(boolean enable)
Set escape processing for statements. |
void |
setFileFilter(org.apache.maven.shared.filtering.MavenFileFilter filter)
|
void |
setKeepFormat(boolean keepformat)
whether or not format should be preserved. |
void |
setOnError(String action)
|
void |
setPassword(String password)
|
void |
setSettingsKey(String key)
|
void |
setShowheaders(boolean showheaders)
Print headers for result sets from the statements; optional, default true. |
void |
setShowPassword(boolean showPassword)
|
void |
setSkipOnConnectionError(boolean skipOnConnectionError)
|
void |
setSqlCommand(String sqlCommand)
|
void |
setSrcFiles(File[] files)
|
void |
setSuccessfulStatements(int successfulStatements)
|
void |
setTargetDatabase(String targetDatabase)
|
void |
setTotalStatements(int totalStatements)
|
void |
setTransactions(Vector<org.kuali.db.Transaction> transactions)
|
void |
setUrl(String url)
|
void |
setUsername(String username)
|
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 |
updateCredentials(org.kuali.db.Credentials credentials)
Load username/password from settings.xml if user has not set them in JVM properties |
protected void |
validateConfiguration()
Validate that some essential configuration items are present |
protected void |
validateCredentials(org.kuali.db.Credentials credentials)
|
protected void |
validateCredentials(org.kuali.db.Credentials credentials,
boolean anonymousAccessAllowed,
String validationFailureMessage)
|
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 |
---|
public static final String DRIVER_INFO_PROPERTIES_USER
public static final String DRIVER_INFO_PROPERTIES_PASSWORD
public static final String FILE_SORTING_ASC
#setOrder(String)
with this value to sort in ascendant order the sql files.
public static final String FILE_SORTING_DSC
#setOrder(String)
with this value to sort in descendant order the sql files.
Constructor Detail |
---|
public AbstractSQLExecutorMojo()
Method Detail |
---|
protected void configureTransactions() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected Properties getContextProperties()
protected org.kuali.db.Credentials getNewCredentials()
protected org.kuali.db.ConnectionHandler getNewConnectionHandler() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
public void executeMojo() throws org.apache.maven.plugin.MojoExecutionException
executeMojo
in class BaseMojo
org.apache.maven.plugin.MojoExecutionException
public void addText(String sql)
sql
- the sql statement to addpublic void setDelimiter(String delimiter)
delimiter
- the new delimiterpublic void setDelimiterType(String delimiterType)
delimiterType
- the new delimiterTypepublic void setShowheaders(boolean showheaders)
showheaders
- true
to show the headers, otherwise false
public void setAppend(boolean append)
append
- true
to append, otherwise false
to overwritepublic void setKeepFormat(boolean keepformat)
keepformat
- The keepformat to setpublic void setEscapeProcessing(boolean enable)
enable
- true
to escape, otherwiser false
protected org.kuali.db.SQLExecutor getSqlExecutor() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void updateConfiguration() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void validateConfiguration() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void validateCredentials(org.kuali.db.Credentials credentials, boolean anonymousAccessAllowed, String validationFailureMessage) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void validateCredentials(org.kuali.db.Credentials credentials) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected boolean isNullOrEmpty(Collection<?> c)
protected String convertNullToEmpty(String s)
protected void updateCredentials(org.kuali.db.Credentials credentials)
org.apache.maven.plugin.MojoExecutionException
protected org.apache.maven.settings.Server getServerFromSettingsKey()
protected String getUpdatedPassword(org.apache.maven.settings.Server server, String password)
protected String getDisplayPassword(String password)
protected String getUpdatedUsername(org.apache.maven.settings.Server server, String username)
protected Connection getConnection() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
- if the UserId/Password/Url is not set or there is no suitable driver or the driver fails to load.
SQLException
- if there is problem getting connection with valid urlprotected Properties getDriverProperties() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
public String getUsername()
public void setUsername(String username)
public String getPassword()
public void setPassword(String password)
public String getUrl()
public void setUrl(String url)
public String getDriver()
public void setDriver(String driver)
public void setAutocommit(boolean autocommit)
public File[] getSrcFiles()
public void setSrcFiles(File[] files)
public int getSuccessfulStatements()
public int getTotalStatements()
public String getOnError()
public void setOnError(String action)
public void setSettingsKey(String key)
public void setDriverProperties(String driverProperties)
public String getSqlCommand()
public void setSqlCommand(String sqlCommand)
public Vector<org.kuali.db.Transaction> getTransactions()
public void setTransactions(Vector<org.kuali.db.Transaction> transactions)
public void setFileFilter(org.apache.maven.shared.filtering.MavenFileFilter filter)
public String getTargetDatabase()
public void setTargetDatabase(String targetDatabase)
public Connection getConn()
public void setConn(Connection conn)
public String getDelimiter()
public String getDelimiterType()
public boolean isKeepFormat()
public boolean isShowheaders()
public boolean isAppend()
public boolean isEscapeProcessing()
public boolean isSkipOnConnectionError()
public void setSkipOnConnectionError(boolean skipOnConnectionError)
public org.apache.maven.shared.filtering.MavenFileFilter getFileFilter()
public boolean isShowPassword()
public void setShowPassword(boolean showPassword)
public boolean isEnableAnonymousPassword()
public void setEnableAnonymousPassword(boolean enableAnonymousPassword)
public String getSettingsKey()
public boolean isAutocommit()
public void setSuccessfulStatements(int successfulStatements)
public void setTotalStatements(int totalStatements)
public void setCredentials(org.kuali.db.Credentials credentials)
public org.kuali.db.Credentials getCredentials()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |