liquibase.command.LiquibaseCommandFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
The newest version!
package liquibase.command;
import liquibase.plugin.AbstractPluginFactory;
/**
* @deprecated Used for supporting old-style {@link LiquibaseCommand} implementations
*/
class LiquibaseCommandFactory extends AbstractPluginFactory {
protected LiquibaseCommandFactory() {
}
@Override
protected Class getPluginClass() {
return LiquibaseCommand.class;
}
@Override
protected int getPriority(LiquibaseCommand obj, Object... args) {
return obj.getPriority((String) args[0]);
}
public LiquibaseCommand getCommand(String commandName) {
return getPlugin(commandName);
}
public T execute(LiquibaseCommand command) throws CommandExecutionException {
command.validate();
try {
return command.run();
} catch (Exception e) {
if (e instanceof CommandExecutionException) {
throw (CommandExecutionException) e;
} else {
throw new CommandExecutionException(e);
}
}
}
}