Search in sources :

Example 11 with CommandScope

use of liquibase.command.CommandScope in project liquibase by liquibase.

the class DiffToChangeLogCommand method run.

@Override
public CommandResult run() throws Exception {
    InternalSnapshotCommandStep.logUnsupportedDatabase(this.getReferenceDatabase(), this.getClass());
    final CommandScope commandScope = new CommandScope("diffToChangeLogInternal");
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.REFERENCE_DATABASE_ARG, getReferenceDatabase());
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.TARGET_DATABASE_ARG, getTargetDatabase());
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.SNAPSHOT_TYPES_ARG, getSnapshotTypes());
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.SNAPSHOT_LISTENER_ARG, getSnapshotListener());
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.REFERENCE_SNAPSHOT_CONTROL_ARG, getReferenceSnapshotControl());
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.TARGET_SNAPSHOT_CONTROL_ARG, getTargetSnapshotControl());
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.OBJECT_CHANGE_FILTER_ARG, getObjectChangeFilter());
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.COMPARE_CONTROL_ARG, getCompareControl());
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.CHANGELOG_FILE_ARG, getChangeLogFile());
    commandScope.addArgumentValue(InternalDiffChangelogCommandStep.DIFF_OUTPUT_CONTROL_ARG, getDiffOutputControl());
    commandScope.setOutput(getOutputStream());
    commandScope.execute();
    return new CommandResult("OK");
}
Also used : CommandScope(liquibase.command.CommandScope) CommandResult(liquibase.command.CommandResult)

Example 12 with CommandScope

use of liquibase.command.CommandScope in project liquibase by liquibase.

the class GenerateChangeLogCommand method run.

@Override
public CommandResult run() throws Exception {
    InternalSnapshotCommandStep.logUnsupportedDatabase(this.getReferenceDatabase(), this.getClass());
    final CommandScope commandScope = new CommandScope("generateChangeLogInternal");
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.REFERENCE_DATABASE_ARG, getReferenceDatabase());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.TARGET_DATABASE_ARG, getTargetDatabase());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.SNAPSHOT_TYPES_ARG, getSnapshotTypes());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.SNAPSHOT_LISTENER_ARG, getSnapshotListener());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.REFERENCE_SNAPSHOT_CONTROL_ARG, getReferenceSnapshotControl());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.TARGET_SNAPSHOT_CONTROL_ARG, getTargetSnapshotControl());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.OBJECT_CHANGE_FILTER_ARG, getObjectChangeFilter());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.COMPARE_CONTROL_ARG, getCompareControl());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.CHANGELOG_FILE_ARG, getChangeLogFile());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.DIFF_OUTPUT_CONTROL_ARG, getDiffOutputControl());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.AUTHOR_ARG, getAuthor());
    commandScope.addArgumentValue(InternalGenerateChangelogCommandStep.CONTEXT_ARG, getContext());
    commandScope.setOutput(getOutputStream());
    commandScope.execute();
    return new CommandResult("OK");
}
Also used : CommandScope(liquibase.command.CommandScope) CommandResult(liquibase.command.CommandResult)

Example 13 with CommandScope

use of liquibase.command.CommandScope in project liquibase by liquibase.

the class HistoryCommand method run.

@Override
public CommandResult run() throws Exception {
    final CommandScope commandScope = new CommandScope("internalHistory");
    commandScope.setOutput(getOutputStream());
    commandScope.addArgumentValue(InternalHistoryCommandStep.DATABASE_ARG, this.getDatabase());
    commandScope.addArgumentValue(InternalHistoryCommandStep.DATE_FORMAT_ARG, this.dateFormat);
    commandScope.execute();
    return new CommandResult("OK");
}
Also used : CommandScope(liquibase.command.CommandScope) CommandResult(liquibase.command.CommandResult)

Example 14 with CommandScope

use of liquibase.command.CommandScope in project liquibase by liquibase.

the class Main method executeSyncHub.

private void executeSyncHub(Database database, Liquibase liquibase) throws CommandLineParsingException, LiquibaseException, CommandExecutionException {
    Map<String, Object> argsMap = new HashMap<>();
    CommandScope liquibaseCommand = createLiquibaseCommand(database, liquibase, "internalSyncHub", argsMap);
    liquibaseCommand.addArgumentValue(InternalSyncHubCommandStep.HUB_CONNECTION_ID_ARG, hubConnectionId == null ? null : UUID.fromString(hubConnectionId)).addArgumentValue(InternalSyncHubCommandStep.URL_ARG, url).addArgumentValue(InternalSyncHubCommandStep.DATABASE_ARG, database).addArgumentValue(InternalSyncHubCommandStep.HUB_PROJECT_ID_ARG, hubProjectId == null ? null : UUID.fromString(hubProjectId));
    liquibaseCommand.execute();
}
Also used : CommandScope(liquibase.command.CommandScope)

Example 15 with CommandScope

use of liquibase.command.CommandScope in project liquibase by liquibase.

the class CommandLineUtils method createDiffCommand.

public static CommandScope createDiffCommand(Database referenceDatabase, Database targetDatabase, String snapshotTypes, CompareControl.SchemaComparison[] schemaComparisons, ObjectChangeFilter objectChangeFilter, PrintStream output) throws CommandExecutionException {
    CommandScope diffCommand = new CommandScope("internalDiff");
    diffCommand.addArgumentValue(InternalDiffCommandStep.REFERENCE_DATABASE_ARG, referenceDatabase).addArgumentValue(InternalDiffCommandStep.TARGET_DATABASE_ARG, targetDatabase).addArgumentValue(InternalDiffCommandStep.COMPARE_CONTROL_ARG, new CompareControl(schemaComparisons, snapshotTypes)).addArgumentValue(InternalDiffCommandStep.OBJECT_CHANGE_FILTER_ARG, objectChangeFilter).addArgumentValue(InternalDiffCommandStep.SNAPSHOT_TYPES_ARG, InternalDiffCommandStep.parseSnapshotTypes(snapshotTypes));
    diffCommand.setOutput(output);
    return diffCommand;
}
Also used : CompareControl(liquibase.diff.compare.CompareControl) CommandScope(liquibase.command.CommandScope)

Aggregations

CommandScope (liquibase.command.CommandScope)19 LiquibaseException (liquibase.exception.LiquibaseException)6 Database (liquibase.database.Database)5 CommandResult (liquibase.command.CommandResult)4 CompareControl (liquibase.diff.compare.CompareControl)4 CommandExecutionException (liquibase.exception.CommandExecutionException)4 ChangeLogParameters (liquibase.changelog.ChangeLogParameters)2 CommandResults (liquibase.command.CommandResults)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 SQLException (java.sql.SQLException)1 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 UUID (java.util.UUID)1 JarFile (java.util.jar.JarFile)1