All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.command.LiquibaseCommandFactory Maven / Gradle / Ivy

There is a newer version: 4.30.0
Show 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);
            }
        }

    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy