public abstract class AbstractDatabaseInitialization extends Object
AbstractDatabaseInitialization for initialize a database.| Modifier and Type | Field and Description |
|---|---|
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.
|
protected boolean |
log
The log.
|
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 DELETE_PROCESS
protected static final String CREATE_PROCESS
protected static final String DROP_PROCESS
protected final Properties databaseProperties
protected String host
protected String databaseName
protected String databaseUser
protected String databasePassword
protected String initializationProcess
protected String fileEncoding
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 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.