/*
* Copyright © Red Gate Software Ltd 2010-2020
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.flywaydb.core.api.callback;
import org.flywaydb.core.api.MigrationInfo;
import org.flywaydb.core.api.configuration.Configuration;
import org.flywaydb.core.api.output.OperationResult;
import java.sql.Connection;
The context relevant to an event.
/**
* The context relevant to an event.
*/
public interface Context {
Returns: The configuration currently in use.
/**
* @return The configuration currently in use.
*/
Configuration getConfiguration();
Returns: The JDBC connection being used. Transaction are managed by Flyway. When the context is passed to the Callback.handle(Event, Context)
method, a transaction will already have been started if required and will be automatically committed or rolled back afterwards.
/**
* @return The JDBC connection being used. Transaction are managed by Flyway.
* When the context is passed to the {@link Callback#handle(Event, Context)} method, a transaction will already have
* been started if required and will be automatically committed or rolled back afterwards.
*/
Connection getConnection();
Returns: The info about the migration being handled. Only relevant for the BEFORE_EACH_* and AFTER_EACH_* events. null
in all other cases.
/**
* @return The info about the migration being handled. Only relevant for the BEFORE_EACH_* and AFTER_EACH_* events.
* {@code null} in all other cases.
*/
MigrationInfo getMigrationInfo();
Returns: The info about the statement being handled. Only relevant for the statement-level events. null
in all other cases. Flyway Teams only
/**
* @return The info about the statement being handled. Only relevant for the statement-level events.
* {@code null} in all other cases.
* <p><i>Flyway Teams only</i></p>
*/
Statement getStatement();
Returns: The OperationResult object for the finished operation. Only relevant for the AFTER_*_OPERATION_FINISH events.
/**
* @return The OperationResult object for the finished operation. Only relevant for the AFTER_*_OPERATION_FINISH events.
*/
OperationResult getOperationResult();
}