From 10069e5d0e334b76b10918b7dec6faad36d37d4d Mon Sep 17 00:00:00 2001 From: brinn <brinn> Date: Fri, 1 Jun 2012 11:20:28 +0000 Subject: [PATCH] Run Clean-up to add @Override annotations for Java 1.6. SVN: 25443 --- .../cisd/dbmigration/AbstractDatabaseAdminDAO.java | 3 +++ .../cisd/dbmigration/BasicDataSourceFactory.java | 4 ++++ .../systemsx/cisd/dbmigration/DBScriptFormatter.java | 7 +++++++ .../cisd/dbmigration/DatabaseConfigurationContext.java | 1 + .../systemsx/cisd/dbmigration/DatabaseDefinition.java | 1 + .../cisd/dbmigration/DatabaseVersionLogDAO.java | 7 +++++++ .../SimpleDatabaseConfigurationContext.java | 1 + .../systemsx/cisd/dbmigration/SqlScriptExecutor.java | 1 + .../systemsx/cisd/dbmigration/SqlScriptProvider.java | 10 ++++++++++ .../cisd/dbmigration/TableColumnDefinition.java | 1 + .../ch/systemsx/cisd/dbmigration/TableDefinition.java | 2 ++ .../ch/systemsx/cisd/dbmigration/h2/H2AdminDAO.java | 6 ++++++ .../ch/systemsx/cisd/dbmigration/h2/H2DAOFactory.java | 6 ++++++ .../systemsx/cisd/dbmigration/h2/H2MassUploader.java | 5 +++++ .../cisd/dbmigration/java/MigrationStepAdapter.java | 2 ++ .../cisd/dbmigration/java/MigrationStepExecutor.java | 5 +++++ .../cisd/dbmigration/postgresql/DumpPreparator.java | 1 + .../dbmigration/postgresql/PostgreSQLAdminDAO.java | 6 ++++++ .../dbmigration/postgresql/PostgreSQLDAOFactory.java | 6 ++++++ .../dbmigration/postgresql/PostgreSQLMassUploader.java | 3 +++ .../java/MigrationStepAdminFrom001To002.java | 2 ++ .../dbmigration/java/MigrationStepFrom001To002.java | 2 ++ .../dbmigration/java/MigrationStepFrom002To003.java | 2 ++ .../dbmigration/migration/SqlMigrationDataSource.java | 9 +++++++++ .../migration/SqlMigrationDataSourceFactory.java | 4 ++++ 25 files changed, 97 insertions(+) diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/AbstractDatabaseAdminDAO.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/AbstractDatabaseAdminDAO.java index 35f17a4728f..5cede966bee 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/AbstractDatabaseAdminDAO.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/AbstractDatabaseAdminDAO.java @@ -77,16 +77,19 @@ public abstract class AbstractDatabaseAdminDAO extends SimpleJdbcDaoSupport impl setDataSource(dataSource); } + @Override public String getDatabaseName() { return databaseName; } + @Override public String getDatabaseURL() { return databaseURL; } + @Override public DatabaseDefinition getDatabaseDefinition() { DatabaseDefinition databaseDefinition = new DatabaseDefinition(); diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/BasicDataSourceFactory.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/BasicDataSourceFactory.java index a70b7c4e4fb..0e9135dd2b1 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/BasicDataSourceFactory.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/BasicDataSourceFactory.java @@ -43,6 +43,7 @@ public class BasicDataSourceFactory implements IDataSourceFactory // IDataSourceFactory // + @Override public final DataSource createDataSource(final String driver, final String url, final String owner, final String password) { @@ -57,16 +58,19 @@ public class BasicDataSourceFactory implements IDataSourceFactory return dataSource; } + @Override public void setMaxWait(long maxWait) { this.maxWait = maxWait; } + @Override public void setMaxIdle(int maxIdle) { this.maxIdle = maxIdle; } + @Override public void setMaxActive(int maxActive) { this.maxActive = maxActive; diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DBScriptFormatter.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DBScriptFormatter.java index ef58b8baf32..c1655ff559e 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DBScriptFormatter.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DBScriptFormatter.java @@ -55,6 +55,7 @@ public class DBScriptFormatter "CREATE TABLE "), CREATE_SEQUENCE("Creating sequences", "CREATE SEQUENCE ", new ILineProcessor() { + @Override public String process(String line) { return StringUtils.replace(line, " NO MAXVALUE NO MINVALUE NO CYCLE", @@ -63,12 +64,14 @@ public class DBScriptFormatter }), PRIMARY_KEY_CONSTRAINTS("Creating primary key constraints", new ILineMatcher() { + @Override public boolean match(String line) { return Pattern.matches("ALTER TABLE .+ PRIMARY KEY.+", line); } }, null), UNIQUE_CONSTRAINTS("Creating unique constraints", new ILineMatcher() { + @Override public boolean match(String line) { return Pattern.matches("ALTER TABLE .+ UNIQUE.+", line); @@ -76,12 +79,14 @@ public class DBScriptFormatter }, null), FOREIGN_KEY_CONSTRAINTS("Creating foreign key constraints", new ILineMatcher() { + @Override public boolean match(String line) { return Pattern.matches("ALTER TABLE .+ FOREIGN KEY.+", line); } }, null), CHECK_CONSTRAINTS("Creating check constraints", new ILineMatcher() { + @Override public boolean match(String line) { return Pattern.matches("ALTER TABLE .+ CHECK.+", line); @@ -89,6 +94,7 @@ public class DBScriptFormatter }, null), CREATE_INDEX("Creating indices", "CREATE INDEX "), MISC("Miscellaneous", new ILineMatcher() { + @Override public boolean match(String line) { return true; @@ -111,6 +117,7 @@ public class DBScriptFormatter { this(comment, new ILineMatcher() { + @Override public boolean match(String line) { return line.startsWith(prefix); diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseConfigurationContext.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseConfigurationContext.java index 7adecb4b78a..b7580dec624 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseConfigurationContext.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseConfigurationContext.java @@ -651,6 +651,7 @@ public class DatabaseConfigurationContext implements DisposableBean // DisposableBean // + @Override public final void destroy() throws Exception { closeConnections(); diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseDefinition.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseDefinition.java index 571ffeb68dc..367ccf8e866 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseDefinition.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseDefinition.java @@ -82,6 +82,7 @@ public final class DatabaseDefinition implements Iterable<TableDefinition> /** * Creates an iterator over all table definitions. */ + @Override public Iterator<TableDefinition> iterator() { return tableDefinitions.values().iterator(); diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseVersionLogDAO.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseVersionLogDAO.java index 12d27069eb7..d13500cd547 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseVersionLogDAO.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/DatabaseVersionLogDAO.java @@ -78,6 +78,7 @@ public class DatabaseVersionLogDAO extends SimpleJdbcDaoSupport implements IData this.lobHandler = lobHandler; } + @Override public LogEntry mapRow(ResultSet rs, int rowNum) throws SQLException { final LogEntry logEntry = new LogEntry(); @@ -119,6 +120,7 @@ public class DatabaseVersionLogDAO extends SimpleJdbcDaoSupport implements IData this.lobHandler = lobHandler; } + @Override public boolean canConnectToDatabase() { try @@ -134,12 +136,14 @@ public class DatabaseVersionLogDAO extends SimpleJdbcDaoSupport implements IData } } + @Override public void createTable(Script script) { JdbcTemplate template = getJdbcTemplate(); template.execute(script.getContent()); } + @Override public LogEntry getLastEntry() { SimpleJdbcTemplate template = getSimpleJdbcTemplate(); @@ -154,6 +158,7 @@ public class DatabaseVersionLogDAO extends SimpleJdbcDaoSupport implements IData * * @param moduleScript The script of the module to be logged. */ + @Override public void logStart(final Script moduleScript) { JdbcTemplate template = getJdbcTemplate(); @@ -182,6 +187,7 @@ public class DatabaseVersionLogDAO extends SimpleJdbcDaoSupport implements IData * * @param moduleScript The script of the successfully applied module. */ + @Override public void logSuccess(final Script moduleScript) { SimpleJdbcTemplate template = getSimpleJdbcTemplate(); @@ -197,6 +203,7 @@ public class DatabaseVersionLogDAO extends SimpleJdbcDaoSupport implements IData * @param moduleScript Script of the failed module. * @param runException Exception causing the failure. */ + @Override public void logFailure(final Script moduleScript, Throwable runException) { final StringWriter stringWriter = new StringWriter(); diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SimpleDatabaseConfigurationContext.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SimpleDatabaseConfigurationContext.java index 80888183d8f..2a1840fb236 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SimpleDatabaseConfigurationContext.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SimpleDatabaseConfigurationContext.java @@ -128,6 +128,7 @@ public class SimpleDatabaseConfigurationContext implements DisposableBean // DisposableBean // + @Override public final void destroy() throws Exception { closeConnections(); diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SqlScriptExecutor.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SqlScriptExecutor.java index 05a4dcbbaed..5785edea664 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SqlScriptExecutor.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SqlScriptExecutor.java @@ -53,6 +53,7 @@ public class SqlScriptExecutor extends JdbcDaoSupport implements ISqlScriptExecu this.singleStepMode = singleStepMode; } + @Override public void execute(final Script sqlScript, final boolean honorSingleStepMode, final ISqlScriptExecutionLogger loggerOrNull) { diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SqlScriptProvider.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SqlScriptProvider.java index d711e6ba084..7fe9f3a3c8b 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SqlScriptProvider.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/SqlScriptProvider.java @@ -73,11 +73,13 @@ public class SqlScriptProvider implements ISqlScriptProvider * Returns <code>true</code> if a <finish script> is found and <code>false</code> * otherwise. */ + @Override public boolean isDumpRestore(final String version) { return getDumprestoreFile(version).exists(); } + @Override public void markAsDumpRestorable(final String version) { try @@ -97,6 +99,7 @@ public class SqlScriptProvider implements ISqlScriptProvider /** * Returns the folder where all dump files for <var>version</var> reside. */ + @Override public File getDumpFolder(final String version) { return new File(getSpecificScriptFolder(schemaScriptRootFolders.get(schemaScriptRootFolders @@ -110,6 +113,7 @@ public class SqlScriptProvider implements ISqlScriptProvider * <schema script folder>/<version>/schema-<version>.sql * </pre> */ + @Override public Script tryGetSchemaScript(final String version) { return tryLoadScript("schema-" + version + SQL_FILE_TYPE, version); @@ -123,6 +127,7 @@ public class SqlScriptProvider implements ISqlScriptProvider * <data script folder>/<version>/function-<version>.sql * </pre> */ + @Override public Script tryGetFunctionScript(final String version) { return tryLoadScript("function-" + version + SQL_FILE_TYPE, version); @@ -136,6 +141,7 @@ public class SqlScriptProvider implements ISqlScriptProvider * <schema script folder>/<version>/domains-<version>.sql * </pre> */ + @Override public Script tryGetDomainsScript(final String version) { return tryLoadScript("domains-" + version + SQL_FILE_TYPE, version); @@ -149,6 +155,7 @@ public class SqlScriptProvider implements ISqlScriptProvider * <schema script folder>/<version>/grants-<version>.sql * </pre> */ + @Override public Script tryGetGrantsScript(final String version) { return tryLoadScript("grants-" + version + SQL_FILE_TYPE, version); @@ -161,6 +168,7 @@ public class SqlScriptProvider implements ISqlScriptProvider * <data script folder>/<version>/data-<version>.sql * </pre> */ + @Override public Script tryGetDataScript(final String version) { return tryLoadScript("data-" + version + SQL_FILE_TYPE, version); @@ -174,6 +182,7 @@ public class SqlScriptProvider implements ISqlScriptProvider * <schema script folder>/migration/migration-<fromVersion>-<toVersion>.sql * </pre> */ + @Override public Script tryGetMigrationScript(final String fromVersion, final String toVersion) { final String scriptName = "migration-" + fromVersion + "-" + toVersion + SQL_FILE_TYPE; @@ -190,6 +199,7 @@ public class SqlScriptProvider implements ISqlScriptProvider * * The function migration will always be called <i>after</i> the regular migration script. */ + @Override public Script tryGetFunctionMigrationScript(final String fromVersion, final String toVersion) { final String scriptName = diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/TableColumnDefinition.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/TableColumnDefinition.java index f3b9b307edf..f22153b6db6 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/TableColumnDefinition.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/TableColumnDefinition.java @@ -78,6 +78,7 @@ public final class TableColumnDefinition implements Iterable<TableColumnDefiniti connections.add(foreignKeyColumn); } + @Override public Iterator<TableColumnDefinition> iterator() { return connections.iterator(); diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/TableDefinition.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/TableDefinition.java index 0c431c8dd5b..f934f5f0a84 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/TableDefinition.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/TableDefinition.java @@ -73,11 +73,13 @@ public final class TableDefinition implements Iterable<TableColumnDefinition>, return columnDefinition; } + @Override public Iterator<TableColumnDefinition> iterator() { return columns.values().iterator(); } + @Override public int compareTo(TableDefinition tableDefinition) { return tableName.compareTo(tableDefinition.getTableName()); diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2AdminDAO.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2AdminDAO.java index a147da624f2..ab46b094d66 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2AdminDAO.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2AdminDAO.java @@ -89,16 +89,19 @@ public class H2AdminDAO extends AbstractDatabaseAdminDAO } } + @Override public void createOwner() { // Creation of the user happens "on the fly" with H2 } + @Override public void createGroups() { // Creation of the user happens "on the fly" with H2 } + @Override public void createDatabase() { // Creation of databases happens "on the fly" with H2, we only need to create the @@ -119,6 +122,7 @@ public class H2AdminDAO extends AbstractDatabaseAdminDAO } } + @Override public void dropDatabase() { scriptExecutor.execute(new Script("drop database", DROP_ALL_OBJECTS_SQL), true, null); @@ -131,6 +135,7 @@ public class H2AdminDAO extends AbstractDatabaseAdminDAO } } + @Override public void restoreDatabaseFromDump(File dumpFolder, String version) { createDatabaseVersionLogsTable(); @@ -169,6 +174,7 @@ public class H2AdminDAO extends AbstractDatabaseAdminDAO } String[] csvFiles = dumpFolder.list(new FilenameFilter() { + @Override public boolean accept(File dir, String name) { return MassUploadFileType.CSV.isOfType(name) diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2DAOFactory.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2DAOFactory.java index 5b8f95da3c5..7acaed45890 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2DAOFactory.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2DAOFactory.java @@ -73,31 +73,37 @@ public class H2DAOFactory implements IDAOFactory context.getDatabaseName(), context.getDatabaseURL()); } + @Override public IDatabaseAdminDAO getDatabaseDAO() { return databaseDAO; } + @Override public ISqlScriptExecutor getSqlScriptExecutor() { return sqlScriptExecutor; } + @Override public IDatabaseVersionLogDAO getDatabaseVersionLogDAO() { return databaseVersionLogDAO; } + @Override public IMassUploader getMassUploader() { return massUploader; } + @Override public IMigrationStepExecutor getMigrationStepExecutor() { return migrationStepExecutor; } + @Override public IMigrationStepExecutor getMigrationStepExecutorAdmin() { return migrationStepExecutorAdmin; diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2MassUploader.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2MassUploader.java index 02ec5898f6e..eaacad63b4f 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2MassUploader.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/h2/H2MassUploader.java @@ -111,6 +111,7 @@ public class H2MassUploader extends SimpleJdbcDaoSupport implements IMassUploade } } + @Override public void performMassUpload(String tableName, String data) { try @@ -132,6 +133,7 @@ public class H2MassUploader extends SimpleJdbcDaoSupport implements IMassUploade } } + @Override public void performMassUpload(String tableName, String[] columnNames, String data) { try @@ -153,6 +155,7 @@ public class H2MassUploader extends SimpleJdbcDaoSupport implements IMassUploade } } + @Override public final void performMassUpload(final File[] massUploadFiles) { String task = "Get database metadata"; @@ -244,11 +247,13 @@ public class H2MassUploader extends SimpleJdbcDaoSupport implements IMassUploade insertSql.append(')'); getJdbcTemplate().batchUpdate(insertSql.toString(), new BatchPreparedStatementSetter() { + @Override public int getBatchSize() { return numberOfRows; } + @Override public void setValues(final PreparedStatement ps, final int rowNo) throws SQLException { diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/java/MigrationStepAdapter.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/java/MigrationStepAdapter.java index 599dcbab6e8..4e5374c0c65 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/java/MigrationStepAdapter.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/java/MigrationStepAdapter.java @@ -36,11 +36,13 @@ public class MigrationStepAdapter implements IMigrationStep // IMigrationStep // + @Override public void performPostMigration(final SimpleJdbcTemplate simpleJdbcTemplate, DataSource dataSource) throws DataAccessException { } + @Override public void performPreMigration(final SimpleJdbcTemplate simpleJdbcTemplate, DataSource dataSource) throws DataAccessException { diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/java/MigrationStepExecutor.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/java/MigrationStepExecutor.java index 97445fe63d0..0b193215102 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/java/MigrationStepExecutor.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/java/MigrationStepExecutor.java @@ -79,6 +79,7 @@ public class MigrationStepExecutor extends SimpleJdbcDaoSupport implements IMigr final ParserUtilities.LineSplitter splitter = new ParserUtilities.LineSplitter(content, new ILineFilter() { + @Override public <T> boolean acceptLine(ILine<T> line) { String text = line.getText(); @@ -131,6 +132,7 @@ public class MigrationStepExecutor extends SimpleJdbcDaoSupport implements IMigr // IMigrationStepExecutor // + @Override public final void init(final Script migrationScript) { migrationStep = tryExtractMigrationStep(migrationScript); @@ -148,6 +150,7 @@ public class MigrationStepExecutor extends SimpleJdbcDaoSupport implements IMigr inited = true; } + @Override public final void performPreMigration() { assert inited : "Executor not initialized."; @@ -157,6 +160,7 @@ public class MigrationStepExecutor extends SimpleJdbcDaoSupport implements IMigr } } + @Override public final void performPostMigration() { assert inited : "Executor not initialized."; @@ -166,6 +170,7 @@ public class MigrationStepExecutor extends SimpleJdbcDaoSupport implements IMigr } } + @Override public final void finish() { inited = false; diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/DumpPreparator.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/DumpPreparator.java index bcb150134ee..d96194d1667 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/DumpPreparator.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/DumpPreparator.java @@ -403,6 +403,7 @@ public class DumpPreparator { File[] files = folder.listFiles(new FileFilter() { + @Override public boolean accept(File pathname) { if (pathname.isDirectory()) diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLAdminDAO.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLAdminDAO.java index 984763055f4..ef643487a2f 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLAdminDAO.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLAdminDAO.java @@ -84,6 +84,7 @@ public class PostgreSQLAdminDAO extends AbstractDatabaseAdminDAO databaseName, databaseURL); } + @Override public void createOwner() { try @@ -109,6 +110,7 @@ public class PostgreSQLAdminDAO extends AbstractDatabaseAdminDAO } } + @Override public void createGroups() { if (StringUtils.isNotBlank(readOnlyGroupOrNull)) @@ -146,6 +148,7 @@ public class PostgreSQLAdminDAO extends AbstractDatabaseAdminDAO } } + @Override public void createDatabase() { createEmptyDatabase(); @@ -209,6 +212,7 @@ public class PostgreSQLAdminDAO extends AbstractDatabaseAdminDAO } } + @Override public void dropDatabase() { try @@ -223,6 +227,7 @@ public class PostgreSQLAdminDAO extends AbstractDatabaseAdminDAO } } + @Override public void restoreDatabaseFromDump(File dumpFolder, String version) { createEmptyDatabase(); @@ -265,6 +270,7 @@ public class PostgreSQLAdminDAO extends AbstractDatabaseAdminDAO } String[] csvFiles = dumpFolder.list(new FilenameFilter() { + @Override public boolean accept(File dir, String name) { return MassUploadFileType.CSV.isOfType(name) diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLDAOFactory.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLDAOFactory.java index e648aa869e5..19e728ba3ed 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLDAOFactory.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLDAOFactory.java @@ -78,31 +78,37 @@ public class PostgreSQLDAOFactory implements IDAOFactory .getDatabaseURL()); } + @Override public IDatabaseAdminDAO getDatabaseDAO() { return databaseDAO; } + @Override public ISqlScriptExecutor getSqlScriptExecutor() { return sqlScriptExecutor; } + @Override public IDatabaseVersionLogDAO getDatabaseVersionLogDAO() { return databaseVersionLogDAO; } + @Override public IMassUploader getMassUploader() { return massUploader; } + @Override public IMigrationStepExecutor getMigrationStepExecutor() { return migrationStepExecutor; } + @Override public IMigrationStepExecutor getMigrationStepExecutorAdmin() { return migrationStepExecutorAdmin; diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLMassUploader.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLMassUploader.java index 4709c5b5206..89a9aeabe15 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLMassUploader.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/postgresql/PostgreSQLMassUploader.java @@ -104,11 +104,13 @@ public class PostgreSQLMassUploader extends SimpleJdbcDaoSupport implements IMas return copyManager; } + @Override public void performMassUpload(String tableName, String data) { performMassUpload(tableName, null, data); } + @Override public void performMassUpload(String tableName, String[] columnNamesOrNull, String data) { final StringBuilder copySql = new StringBuilder(); @@ -138,6 +140,7 @@ public class PostgreSQLMassUploader extends SimpleJdbcDaoSupport implements IMas } } + @Override public final void performMassUpload(final File[] massUploadFiles) { final Set<String> tables = new LinkedHashSet<String>(); diff --git a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepAdminFrom001To002.java b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepAdminFrom001To002.java index 729ca81eda8..3030e94e4f1 100644 --- a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepAdminFrom001To002.java +++ b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepAdminFrom001To002.java @@ -52,12 +52,14 @@ public final class MigrationStepAdminFrom001To002 implements IMigrationStep // IMigrationStep // + @Override public final void performPostMigration(final SimpleJdbcTemplate simpleJdbcTemplate, DataSource dataSource) throws DataAccessException { postMigrationPerformed = true; } + @Override public final void performPreMigration(final SimpleJdbcTemplate simpleJdbcTemplate, DataSource dataSource) throws DataAccessException { diff --git a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepFrom001To002.java b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepFrom001To002.java index 439c6a2a5a5..c645321497c 100644 --- a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepFrom001To002.java +++ b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepFrom001To002.java @@ -33,11 +33,13 @@ public final class MigrationStepFrom001To002 implements IMigrationStep // IMigrationStep // + @Override public final void performPostMigration(final SimpleJdbcTemplate simpleJdbcTemplate, DataSource dataSource) throws DataAccessException { } + @Override public final void performPreMigration(final SimpleJdbcTemplate simpleJdbcTemplate, DataSource dataSource) throws DataAccessException { diff --git a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepFrom002To003.java b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepFrom002To003.java index 9b0b8c47d80..cfa3e90741a 100644 --- a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepFrom002To003.java +++ b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/java/MigrationStepFrom002To003.java @@ -43,12 +43,14 @@ public final class MigrationStepFrom002To003 implements IMigrationStep // IMigrationStep // + @Override public final void performPostMigration(final SimpleJdbcTemplate simpleJdbcTemplate, DataSource dataSource) throws DataAccessException { throw new EmptyResultDataAccessException(1); } + @Override public final void performPreMigration(final SimpleJdbcTemplate simpleJdbcTemplate, DataSource dataSource) throws DataAccessException { diff --git a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/migration/SqlMigrationDataSource.java b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/migration/SqlMigrationDataSource.java index 13bf5bce22d..7dec396228c 100644 --- a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/migration/SqlMigrationDataSource.java +++ b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/migration/SqlMigrationDataSource.java @@ -30,6 +30,7 @@ public class SqlMigrationDataSource implements DataSource, DisposableBean this.password = password; } + @Override public Connection getConnection() throws SQLException { if (connection != null && connection.isClosed() || connection == null) @@ -47,6 +48,7 @@ public class SqlMigrationDataSource implements DataSource, DisposableBean return connection; } + @Override public Connection getConnection(final String username, final String pw) throws SQLException { if (owner.equals(username) && password.equals(pw)) @@ -56,26 +58,31 @@ public class SqlMigrationDataSource implements DataSource, DisposableBean throw new SQLException("Forbidden"); } + @Override public int getLoginTimeout() throws SQLException { return 0; } + @Override public void setLoginTimeout(final int timeout) throws SQLException { throw new UnsupportedOperationException("setLoginTimeout"); } + @Override public PrintWriter getLogWriter() { throw new UnsupportedOperationException("getLogWriter"); } + @Override public void setLogWriter(final PrintWriter pw) throws SQLException { throw new UnsupportedOperationException("setLogWriter"); } + @Override public void destroy() throws SQLException { if (connection != null) @@ -92,11 +99,13 @@ public class SqlMigrationDataSource implements DataSource, DisposableBean } // NOTE: the following methods are needed because we compile with JDK 6 on Hudson + @Override public boolean isWrapperFor(Class<?> arg0) throws SQLException { return false; } + @Override public <T> T unwrap(Class<T> arg0) throws SQLException { return null; diff --git a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/migration/SqlMigrationDataSourceFactory.java b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/migration/SqlMigrationDataSourceFactory.java index d69b0342c83..798540db176 100644 --- a/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/migration/SqlMigrationDataSourceFactory.java +++ b/dbmigration/sourceTest/java/ch/systemsx/cisd/dbmigration/migration/SqlMigrationDataSourceFactory.java @@ -7,19 +7,23 @@ import ch.systemsx.cisd.dbmigration.IDataSourceFactory; public class SqlMigrationDataSourceFactory implements IDataSourceFactory { + @Override public DataSource createDataSource(String driver, String url, String owner, String password) { return new SqlMigrationDataSource(driver, url, owner, password); } + @Override public void setMaxActive(int maxActive) { } + @Override public void setMaxIdle(int maxIdle) { } + @Override public void setMaxWait(long maxWait) { } -- GitLab