public abstract class AbstractDatabaseInitialization extends Object
AbstractDatabaseInitialization for initialize a database.| Modifier and Type | Field and Description |
|---|---|
protected static String |
CREATE_EMPTY_PROCESS
The Constant CREATE_PROCESS.
|
protected static String |
CREATE_PROCESS
The Constant CREATE_PROCESS.
|
protected String |
databaseName
The database name.
|
protected String |
databasePassword
The database password.
|
protected Properties |
databaseProperties
The database properties.
|
protected String |
databaseUser
The database user.
|
protected static String |
DELETE_PROCESS
The Constant DELETE_PROCESS.
|
protected static String |
DROP_PROCESS
The Constant DROP_PROCESS.
|
protected String |
fileEncoding
The file encoding.
|
protected String |
host
The host.
|
protected String |
initializationProcess
The initialization process.
|
static String |
JDBC_CREATE_DB_PROCESS_KEY
The Constant JDBC_CREATE_DB_PROCESS_KEY.
|
static String |
JDBC_DB_NAME_KEY
The Constant JDBC_DB_NAME_KEY.
|
static String |
JDBC_DB_VENDOR_KEY
The Constant JDBC_DB_VENDOR_KEY for the properties key.
|
static String |
JDBC_FILE_ENCODING_KEY
The Constant JDBC_FILE_ENCODING_KEY.
|
static String |
JDBC_HOST_KEY
The Constant JDBC_HOST_KEY.
|
static String |
JDBC_PASSWORD_KEY
The Constant JDBC_PASSWORD_KEY.
|
static String |
JDBC_SHOW_SQL_LOG_KEY
The Constant JDBC_SHOW_SQL_LOG_KEY.
|
static String |
JDBC_USER_KEY
The Constant JDBC_USER_KEY.
|
protected boolean |
log
The log.
|
protected static org.apache.log4j.Logger |
LOG
The logger constant.
|
protected boolean |
postgresDatabase
The postgres database.
|
| Constructor and Description |
|---|
AbstractDatabaseInitialization(Properties databaseProperties)
Instantiates a new
AbstractDatabaseInitialization. |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
createInitializationScript(String processtype)
Creates the initialization script.
|
protected void |
createSchema(Connection jdbcConnection,
String processtype)
Creates the schema.
|
protected void |
createSchemaFromScript(Connection jdbcConnection)
Creates the initialization script for the schema.
|
protected void |
deleteAndCreateEmptyDatabaseWithoutTables()
Deletes and creates an empty database without tables so without creating the database schema.
|
protected void |
dropTablesAndSequences(Connection jdbcConnection)
Drops all tables and sequences.
|
Properties |
getDatabaseProperties()
Gets the database properties.
|
protected File |
getInsertDir()
Gets the insert dir.
|
protected String |
getProcessType()
Gets the process type to execute.
|
protected abstract List<File> |
getScriptFiles()
Gets the script files.
|
protected File |
getSqlDir()
Gets the sql dir.
|
void |
initializeDatabase()
Initialize database.
|
protected void |
initializeDatabase(Connection jdbcConnection)
Initialize database.
|
protected void |
initializeScriptFiles()
Initialize the script files from the generated schema file from the hibernate3-maven-plugin.
|
protected void |
newEmptyDatabaseWithoutTables()
Creates an empty database without tables and no database schema.
|
protected String |
replaceMediumblobToBytea(File schema)
Replace mediumblob to bytea.
|
protected static final String CREATE_EMPTY_PROCESS
protected static final String CREATE_PROCESS
protected static final String DELETE_PROCESS
protected static final String DROP_PROCESS
public static final String JDBC_CREATE_DB_PROCESS_KEY
public static final String JDBC_DB_NAME_KEY
public static final String JDBC_DB_VENDOR_KEY
public static final String JDBC_FILE_ENCODING_KEY
public static final String JDBC_HOST_KEY
public static final String JDBC_PASSWORD_KEY
public static final String JDBC_SHOW_SQL_LOG_KEY
public static final String JDBC_USER_KEY
protected static final org.apache.log4j.Logger LOG
protected String databaseName
protected String databasePassword
protected final Properties databaseProperties
protected String databaseUser
protected String fileEncoding
protected String host
protected String initializationProcess
protected boolean log
protected boolean postgresDatabase
public AbstractDatabaseInitialization(Properties databaseProperties)
AbstractDatabaseInitialization.databaseProperties - the database propertiesprotected boolean createInitializationScript(String processtype) throws IOException
processtype - the processtypeIOException - Signals that an I/O exception has occurred.protected void createSchema(Connection jdbcConnection, String processtype) throws FileNotFoundException, IOException, SQLException
jdbcConnection - the jdbc connectionprocesstype - the processtypeFileNotFoundException - the file not found exceptionIOException - Signals that an I/O exception has occurred.SQLException - the SQL exceptionprotected void createSchemaFromScript(Connection jdbcConnection) throws IOException, SQLException
jdbcConnection - the jdbc connectionIOException - Signals that an I/O exception has occurred.SQLException - Signals that an sql error has occurred.protected void deleteAndCreateEmptyDatabaseWithoutTables()
throws ClassNotFoundException,
SQLException
ClassNotFoundException - occurs if a class has not been foundSQLException - Signals that an sql error has occurred.protected void dropTablesAndSequences(Connection jdbcConnection) throws IOException, SQLException
jdbcConnection - the jdbc connectionIOException - Signals that an I/O exception has occurred.SQLException - Signals that an sql error has occurred.public Properties getDatabaseProperties()
protected File getInsertDir()
protected String getProcessType()
protected abstract List<File> getScriptFiles()
protected File getSqlDir()
public void initializeDatabase()
throws ClassNotFoundException,
SQLException,
IOException
ClassNotFoundException - the class not found exceptionSQLException - the SQL exceptionIOException - Signals that an I/O exception has occurred.protected void initializeDatabase(Connection jdbcConnection) throws IOException, SQLException
jdbcConnection - the jdbc connectionIOException - Signals that an I/O exception has occurred.SQLException - Signals that an sql error has occurred.protected void initializeScriptFiles()
throws FileNotFoundException,
IOException
FileNotFoundException - occurs if a class has not been foundIOException - Signals that an I/O exception has occurred.protected void newEmptyDatabaseWithoutTables()
throws ClassNotFoundException,
SQLException
ClassNotFoundException - occurs if a class has not been foundSQLException - Signals that an sql error has occurred.protected String replaceMediumblobToBytea(File schema) throws IOException
schema - the schemaIOException - Signals that an I/O exception has occurred.Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.