Search in sources :

Example 1 with BackupHandler

use of com.axway.ats.environment.database.model.BackupHandler in project ats-framework by Axway.

the class DatabaseEnvironmentUnit method backup.

@Override
@PublicAtsApi
public void backup() throws EnvironmentCleanupException {
    BackupHandler dbBackup = null;
    try {
        log.info("Creating backup of environment unit " + getDescription() + "...");
        //create db backup handler instance
        dbBackup = environmentHandlerFactory.createDbBackupHandler(dbConnection);
        dbBackup.setLockTables(addLocks);
        dbBackup.setForeignKeyCheck(disableForeignKeys);
        dbBackup.setIncludeDeleteStatements(includeDeleteStatements);
        for (DbTable dbTable : dbTables) {
            dbBackup.addTable(dbTable);
        }
        String backupFile = getBackupFile();
        createDirIfNotExist(backupFile);
        dbBackup.createBackup(backupFile);
        log.info("Successfully created backup of environment unit " + getDescription());
    } finally {
        setTempBackupDir(null);
        if (dbBackup != null) {
            dbBackup.disconnect();
        }
    }
}
Also used : BackupHandler(com.axway.ats.environment.database.model.BackupHandler) DbTable(com.axway.ats.environment.database.model.DbTable) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

PublicAtsApi (com.axway.ats.common.PublicAtsApi)1 BackupHandler (com.axway.ats.environment.database.model.BackupHandler)1 DbTable (com.axway.ats.environment.database.model.DbTable)1