diff --git a/.github/util/package-install4j.sh b/.github/util/package-install4j.sh index 9142ffb258a..5271a0cb13d 100755 --- a/.github/util/package-install4j.sh +++ b/.github/util/package-install4j.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash ################################################################### -## This script creates the installer files given an unziped directory +## This script creates the installer files given an unzipped directory ################################################################### set -e @@ -13,14 +13,14 @@ if [ -z ${1+x} ]; then fi version=$1 -if [ -z ${INSTALL4J_LICENSE+x} ]; then - echo "INSTALL4J_LICENSE must be set"; +if [ -z ${INSTALL4J_10_LICENSE+x} ]; then + echo "INSTALL4J_10_LICENSE must be set"; exit 1 fi -mkdir -p ~/.install4j8 -export INSTALL4J_CACHE=$HOME/.install4j8 +mkdir -p ~/.install4j10 +export INSTALL4J_CACHE=$HOME/.install4j10 # install4jc="/usr/local/bin/install4jc" install4jc="/Applications/install4j.app/Contents/Resources/app/bin/install4jc" @@ -31,13 +31,13 @@ else echo "$install4jc does not exist. Installing..." # installer automation for ubuntu-latest; replaced - # wget -nv --directory-prefix=$INSTALL4J_CACHE -nc https://download-gcdn.ej-technologies.com/install4j/install4j_linux_8_0_11.deb - # sudo apt install -y $INSTALL4J_CACHE/install4j_linux_8_0_11.deb + # wget -nv --directory-prefix=$INSTALL4J_CACHE -nc https://download.ej-technologies.com/install4j/install4j_linux-x64_10_0_4.deb + # sudo apt install -y $INSTALL4J_CACHE/install4j_linux-x64_10_0_4.deb # installer automation for macos-latest; macos needed for apple notarizing - wget -nv --directory-prefix=$INSTALL4J_CACHE -nc https://download-gcdn.ej-technologies.com/install4j/install4j_macos_8_0_11.dmg + wget -nv --directory-prefix=$INSTALL4J_CACHE -nc https://download.ej-technologies.com/install4j/install4j_macos_10_0_4.dmg sleep 5 - hdiutil attach /Users/runner/.install4j8/install4j_macos_8_0_11.dmg + hdiutil attach /Users/runner/.install4j10/install4j_macos_10_0_4.dmg sleep 5 cp -rf /Volumes/install4j/install4j.app /Applications sleep 5 @@ -54,6 +54,6 @@ else INSTALL4J_ARGS="$INSTALL4J_ARGS --win-keystore-password=$INSTALL4J_WINDOWS_KEY_PASSWORD --mac-keystore-password=$INSTALL4J_APPLE_KEY_PASSWORD --apple-id=$INSTALL4J_APPLE_ID --apple-id-password=$INSTALL4J_APPLE_ID_PASSWORD" fi -"$install4jc" --license=$INSTALL4J_LICENSE +"$install4jc" --license=$INSTALL4J_10_LICENSE "$install4jc" $INSTALL4J_ARGS src/main/install4j/liquibase.install4j diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 71c4b73751b..81014769072 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -8,7 +8,9 @@ on: branch: description: 'Branch to release (Defaults to master)' required: false - + runId: + description: 'RunId of liquibase/liquibase artifacts to attach' + required: true jobs: setup: name: Setup @@ -16,6 +18,7 @@ jobs: outputs: version: ${{ steps.collect-data.outputs.version }} branch: ${{ steps.collect-data.outputs.branch }} + runId: ${{ steps.collect-data.outputs.runId }} steps: - name: Collect Data id: collect-data @@ -24,9 +27,9 @@ jobs: script: | core.setOutput("version", context.payload.inputs.version); core.setOutput("branch", context.payload.inputs.branch || "master"); - + core.setOutput("runId", context.payload.inputs.runId); - run: | - echo "Creating version ${{ steps.collect-data.outputs.version }} from ${{ steps.collect-data.outputs.branch }}" + echo "Creating version ${{ steps.collect-data.outputs.version }} from ${{ steps.collect-data.outputs.branch }} with artifacts from build ${{ steps.collect-data.outputs.runId }} " reversion: needs: [ setup ] @@ -48,8 +51,7 @@ jobs: uses: liquibase/action-download-artifact@v2-liquibase with: workflow: build.yml - workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch }} + run_id: ${{ needs.setup.outputs.runId }} name: liquibase-artifacts path: download/liquibase-artifacts diff --git a/.github/workflows/installer-build-check.yml b/.github/workflows/installer-build-check.yml index bff2eb2486f..15a96a83384 100644 --- a/.github/workflows/installer-build-check.yml +++ b/.github/workflows/installer-build-check.yml @@ -29,7 +29,7 @@ jobs: - name: Set up JDK for GPG uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '17' distribution: 'temurin' gpg-private-key: ${{ secrets.GPG_SECRET }} gpg-passphrase: GPG_PASSPHRASE @@ -38,7 +38,7 @@ jobs: - name: Re-version Installers env: - INSTALL4J_LICENSE: ${{ secrets.INSTALL4J_LICENSE }} + INSTALL4J_10_LICENSE: ${{ secrets.INSTALL4J_10_LICENSE }} INSTALL4J_APPLE_KEY: ${{ secrets.INSTALL4J_APPLE_KEY }} INSTALL4J_APPLE_KEY_PASSWORD: ${{ secrets.INSTALL4J_APPLE_KEY_PASSWORD }} INSTALL4J_APPLE_ID: ${{ secrets.INSTALL4J_APPLE_ID }} diff --git a/.github/workflows/release-published.yml b/.github/workflows/release-published.yml index 5837a9b824e..df5b9171d4a 100644 --- a/.github/workflows/release-published.yml +++ b/.github/workflows/release-published.yml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Download release assets - uses: robinraju/release-downloader@v1.6 + uses: robinraju/release-downloader@v1.7 with: repository: "liquibase/liquibase" tag: "${{ needs.setup.outputs.tag }}" @@ -175,7 +175,7 @@ jobs: contents: read steps: - name: Download release javadocs - uses: robinraju/release-downloader@v1.6 + uses: robinraju/release-downloader@v1.7 with: repository: "liquibase/liquibase" tag: "${{ needs.setup.outputs.tag }}" diff --git a/liquibase-cdi/src/main/java/liquibase/integration/cdi/SchemesCDIConfigBuilder.java b/liquibase-cdi/src/main/java/liquibase/integration/cdi/SchemesCDIConfigBuilder.java index d1812c15ae2..57b36d2c29a 100644 --- a/liquibase-cdi/src/main/java/liquibase/integration/cdi/SchemesCDIConfigBuilder.java +++ b/liquibase-cdi/src/main/java/liquibase/integration/cdi/SchemesCDIConfigBuilder.java @@ -68,6 +68,7 @@ public CDILiquibaseConfig createCDILiquibaseConfig() { final InputStream is = SchemesCDIConfigBuilder.class.getResourceAsStream(SCHEMA_NAME); try { return jvmLocked(id, new Callable() { + @Override public CDILiquibaseConfig call() throws Exception { return createCDILiquibaseConfig(id, is); } @@ -190,7 +191,7 @@ CDILiquibaseConfig fileLocked(final String id, Callable acti FileLock lock = null; try ( FileOutputStream fileStream = new FileOutputStream(lockPath); - FileChannel fileChannel = fileStream.getChannel(); + FileChannel fileChannel = fileStream.getChannel() ) { while (null == lock) { diff --git a/liquibase-core/pom.xml b/liquibase-core/pom.xml index 617d20da735..d9be3e5a89e 100644 --- a/liquibase-core/pom.xml +++ b/liquibase-core/pom.xml @@ -115,7 +115,7 @@ org.junit.jupiter junit-jupiter-params - 5.8.1 + 5.9.1 test diff --git a/liquibase-core/src/main/java/liquibase/AbstractExtensibleObject.java b/liquibase-core/src/main/java/liquibase/AbstractExtensibleObject.java index ab835ca342b..b78607615ab 100644 --- a/liquibase-core/src/main/java/liquibase/AbstractExtensibleObject.java +++ b/liquibase-core/src/main/java/liquibase/AbstractExtensibleObject.java @@ -70,6 +70,7 @@ public ObjectMetaData getObjectMetaData() { /** * Return true if the given key is defined. */ + @Override public boolean has(String key) { return get(key, Object.class) != null; } @@ -119,6 +120,7 @@ protected T get(String attribute, T defaultValue, Class type) { } } + @Override public List getValuePath(String attributes, Class lastType) { List path = new ArrayList(); @@ -230,6 +232,7 @@ public ExtensibleObject set(String attribute, Object value) { return this; } + @Override public String describe() { String name = getClass().getSimpleName(); return name + "{" + StringUtil.join(this, ", ", new StringUtil.DefaultFormatter()) + "}"; diff --git a/liquibase-core/src/main/java/liquibase/Liquibase.java b/liquibase-core/src/main/java/liquibase/Liquibase.java index e1ff6fdd807..fe816fa8b8d 100644 --- a/liquibase-core/src/main/java/liquibase/Liquibase.java +++ b/liquibase-core/src/main/java/liquibase/Liquibase.java @@ -6,7 +6,9 @@ import liquibase.changelog.filter.*; import liquibase.changelog.visitor.*; import liquibase.command.CommandScope; +import liquibase.command.core.DbUrlConnectionCommandStep; import liquibase.command.core.InternalDropAllCommandStep; +import liquibase.command.core.TagCommandStep; import liquibase.database.Database; import liquibase.database.DatabaseConnection; import liquibase.database.DatabaseFactory; @@ -1887,30 +1889,14 @@ public final void dropAll(CatalogAndSchema... schemas) throws DatabaseException /** * 'Tags' the database for future rollback + * + * @deprecated Use {link {@link CommandScope(String)} to tag instead of this method. */ public void tag(String tagString) throws LiquibaseException { - runInScope(new Scope.ScopedRunner() { - @Override - public void run() throws Exception { - - LockService lockService = LockServiceFactory.getInstance().getLockService(database); - lockService.waitForLock(); - - try { - ChangeLogHistoryServiceFactory.getInstance().getChangeLogService(database).generateDeploymentId(); - - checkLiquibaseTables(false, null, new Contexts(), - new LabelExpression()); - getDatabase().tag(tagString); - } finally { - try { - lockService.releaseLock(); - } catch (LockException e) { - LOG.severe(MSG_COULD_NOT_RELEASE_LOCK, e); - } - } - } - }); + new CommandScope("tag") + .addArgumentValue(DbUrlConnectionCommandStep.DATABASE_ARG, database) + .addArgumentValue(TagCommandStep.TAG_ARG, tagString) + .execute(); } public boolean tagExists(String tagString) throws LiquibaseException { diff --git a/liquibase-core/src/main/java/liquibase/change/core/CreateProcedureChange.java b/liquibase-core/src/main/java/liquibase/change/core/CreateProcedureChange.java index 2aafe1d704a..9f715223819 100644 --- a/liquibase-core/src/main/java/liquibase/change/core/CreateProcedureChange.java +++ b/liquibase-core/src/main/java/liquibase/change/core/CreateProcedureChange.java @@ -141,6 +141,7 @@ public void setProcedureText(String procedureText) { this.procedureText = procedureText; } + @Override @DatabaseChangeProperty( exampleValue = "h2, oracle", since = "3.1" @@ -149,6 +150,7 @@ public String getDbms() { return dbms; } + @Override public void setDbms(final String dbms) { this.dbms = dbms; } diff --git a/liquibase-core/src/main/java/liquibase/change/core/DropColumnChange.java b/liquibase-core/src/main/java/liquibase/change/core/DropColumnChange.java index 2d0ed45f2e6..db60a6518df 100644 --- a/liquibase-core/src/main/java/liquibase/change/core/DropColumnChange.java +++ b/liquibase-core/src/main/java/liquibase/change/core/DropColumnChange.java @@ -211,6 +211,7 @@ public boolean createThisIndex(Index index) { for (Column column : index.getColumns()) { if (removedColumnNames.contains(column.getName())) { indexContainsColumn = true; + break; } } return !indexContainsColumn; diff --git a/liquibase-core/src/main/java/liquibase/change/core/LoadDataChange.java b/liquibase-core/src/main/java/liquibase/change/core/LoadDataChange.java index 319e7cea853..228ad715f42 100644 --- a/liquibase-core/src/main/java/liquibase/change/core/LoadDataChange.java +++ b/liquibase-core/src/main/java/liquibase/change/core/LoadDataChange.java @@ -121,6 +121,7 @@ public boolean generateRollbackStatementsVolatile(Database database) { return true; } + @Override @DatabaseChangeProperty(description = "Name of the table to insert data into", requiredForDatabase = ALL, mustEqualExisting = "table") public String getTableName() { diff --git a/liquibase-core/src/main/java/liquibase/changelog/AbstractChangeLogHistoryService.java b/liquibase-core/src/main/java/liquibase/changelog/AbstractChangeLogHistoryService.java index bdc0f0090c5..232166d8926 100644 --- a/liquibase-core/src/main/java/liquibase/changelog/AbstractChangeLogHistoryService.java +++ b/liquibase-core/src/main/java/liquibase/changelog/AbstractChangeLogHistoryService.java @@ -31,6 +31,7 @@ public void reset() { } + @Override public ChangeSet.RunStatus getRunStatus(final ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException { RanChangeSet foundRan = getRanChangeSet(changeSet); @@ -61,6 +62,7 @@ public ChangeSet.RunStatus getRunStatus(final ChangeSet changeSet) } } + @Override public void upgradeChecksums(final DatabaseChangeLog databaseChangeLog, final Contexts contexts, LabelExpression labels) throws DatabaseException { for (RanChangeSet ranChangeSet : this.getRanChangeSets()) { @@ -118,14 +120,17 @@ public String getLastDeploymentId() throws DatabaseException { protected abstract void replaceChecksum(ChangeSet changeSet) throws DatabaseException; + @Override public String getDeploymentId() { return this.deploymentId; } + @Override public void resetDeploymentId() { this.deploymentId = null; } + @Override public void generateDeploymentId() { if (this.deploymentId == null) { String dateString = String.valueOf(new Date().getTime()); diff --git a/liquibase-core/src/main/java/liquibase/changelog/ChangeLogHistoryServiceFactory.java b/liquibase-core/src/main/java/liquibase/changelog/ChangeLogHistoryServiceFactory.java index 424ad2a0abf..78b81920d30 100644 --- a/liquibase-core/src/main/java/liquibase/changelog/ChangeLogHistoryServiceFactory.java +++ b/liquibase-core/src/main/java/liquibase/changelog/ChangeLogHistoryServiceFactory.java @@ -56,7 +56,7 @@ public ChangeLogHistoryService getChangeLogService(Database database) { SortedSet foundServices = new TreeSet<>(new Comparator() { @Override public int compare(ChangeLogHistoryService o1, ChangeLogHistoryService o2) { - return -1 * Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority()); + return -1 * Integer.compare(o1.getPriority(), o2.getPriority()); } }); diff --git a/liquibase-core/src/main/java/liquibase/changelog/OfflineChangeLogHistoryService.java b/liquibase-core/src/main/java/liquibase/changelog/OfflineChangeLogHistoryService.java index 14afe04cc9c..7f436697990 100644 --- a/liquibase-core/src/main/java/liquibase/changelog/OfflineChangeLogHistoryService.java +++ b/liquibase-core/src/main/java/liquibase/changelog/OfflineChangeLogHistoryService.java @@ -151,7 +151,7 @@ public String[] execute(String[] line) { @Override public List getRanChangeSets() throws DatabaseException { try ( - Reader reader = new InputStreamReader(new FileInputStream(this.changeLogFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue()); + Reader reader = new InputStreamReader(new FileInputStream(this.changeLogFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue()) ) { CSVReader csvReader = new CSVReader(reader); @@ -210,7 +210,7 @@ protected void replaceChangeSet(ChangeSet changeSet, ReplaceChangeSetLogic repla Reader reader = new InputStreamReader(new FileInputStream(oldFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue()); Writer writer = new OutputStreamWriter(new FileOutputStream(newFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue()); CSVReader csvReader = new CSVReader(reader); - CSVWriter csvWriter = new CSVWriter(writer); + CSVWriter csvWriter = new CSVWriter(writer) ) { String[] line; @@ -238,7 +238,7 @@ protected void appendChangeSet(ChangeSet changeSet, ChangeSet.ExecType execType) Reader reader = new InputStreamReader(new FileInputStream(oldFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue()); Writer writer = new OutputStreamWriter(new FileOutputStream(newFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue()); CSVReader csvReader = new CSVReader(reader); - CSVWriter csvWriter = new CSVWriter(writer); + CSVWriter csvWriter = new CSVWriter(writer) ) { String[] line; @@ -327,7 +327,7 @@ public int getNextSequenceValue() throws LiquibaseException { lastChangeSetSequenceValue = 0; try ( - Reader reader = new InputStreamReader(new FileInputStream(this.changeLogFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue()); + Reader reader = new InputStreamReader(new FileInputStream(this.changeLogFile), GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue()) ) { diff --git a/liquibase-core/src/main/java/liquibase/changelog/StandardChangeLogHistoryService.java b/liquibase-core/src/main/java/liquibase/changelog/StandardChangeLogHistoryService.java index b4648d3a866..4326825fb88 100644 --- a/liquibase-core/src/main/java/liquibase/changelog/StandardChangeLogHistoryService.java +++ b/liquibase-core/src/main/java/liquibase/changelog/StandardChangeLogHistoryService.java @@ -98,6 +98,7 @@ protected String getCharTypeName() { return "varchar"; } + @Override public void init() throws DatabaseException { if (serviceInitialized) { return; @@ -304,6 +305,7 @@ public void upgradeChecksums(final DatabaseChangeLog databaseChangeLog, final Co /** * Returns the ChangeSets that have been run against the current getDatabase(). */ + @Override public List getRanChangeSets() throws DatabaseException { if (this.ranChangeSetList == null) { Database database = getDatabase(); diff --git a/liquibase-core/src/main/java/liquibase/changelog/filter/IgnoreChangeSetFilter.java b/liquibase-core/src/main/java/liquibase/changelog/filter/IgnoreChangeSetFilter.java index 8d5de72665a..b77e291be9c 100644 --- a/liquibase-core/src/main/java/liquibase/changelog/filter/IgnoreChangeSetFilter.java +++ b/liquibase-core/src/main/java/liquibase/changelog/filter/IgnoreChangeSetFilter.java @@ -3,6 +3,7 @@ import liquibase.changelog.ChangeSet; public class IgnoreChangeSetFilter implements ChangeSetFilter { + @Override public ChangeSetFilterResult accepts(ChangeSet changeSet) { if (changeSet.isIgnore()) { return new ChangeSetFilterResult(false, "Changeset is ignored", this.getClass()); diff --git a/liquibase-core/src/main/java/liquibase/command/CleanUpCommandStep.java b/liquibase-core/src/main/java/liquibase/command/CleanUpCommandStep.java new file mode 100644 index 00000000000..6f7424e9214 --- /dev/null +++ b/liquibase-core/src/main/java/liquibase/command/CleanUpCommandStep.java @@ -0,0 +1,14 @@ +package liquibase.command; + +/** + * Interface implemented by CommandSteps when they need to execute clean up tasks (such as closing database + * connections, flushing files, etc) after other steps in the pipeline are executed. + */ +public interface CleanUpCommandStep { + + /** + * Method invoked to execute the cleanup action. + * @param resultsBuilder builder used in this pipeline + */ + void cleanUp(CommandResultsBuilder resultsBuilder); +} diff --git a/liquibase-core/src/main/java/liquibase/command/CommandArgumentDefinition.java b/liquibase-core/src/main/java/liquibase/command/CommandArgumentDefinition.java index 1fb2c6b0c07..7b979811452 100644 --- a/liquibase-core/src/main/java/liquibase/command/CommandArgumentDefinition.java +++ b/liquibase-core/src/main/java/liquibase/command/CommandArgumentDefinition.java @@ -8,7 +8,10 @@ import liquibase.integration.commandline.LiquibaseCommandLineConfiguration; import liquibase.util.ObjectUtil; -import java.util.*; +import java.util.Collections; +import java.util.Objects; +import java.util.SortedSet; +import java.util.TreeSet; import java.util.regex.Pattern; /** @@ -26,7 +29,6 @@ public class CommandArgumentDefinition implements Comparable aliases = new TreeSet<>(); private final Class dataType; - private String description; private boolean required; private boolean hidden; @@ -34,6 +36,7 @@ public class CommandArgumentDefinition implements Comparable valueConverter; private ConfigurationValueObfuscator valueObfuscator; + private CommandArgumentDefinition supersededBy; protected CommandArgumentDefinition(String name, Class type) { this.name = name; @@ -77,6 +80,14 @@ public boolean isRequired() { return required; } + public CommandArgumentDefinition getSupersededBy() { + return this.supersededBy; + } + + public void setSupersededBy(CommandArgumentDefinition supersededBy) { + this.supersededBy = supersededBy; + } + /** * Hidden arguments are ones that can be called via integrations, but should not be normally shown in help to users. */ @@ -121,8 +132,9 @@ public ConfigurationValueObfuscator getValueObfuscator() { */ public void validate(CommandScope commandScope) throws CommandValidationException { final DataType currentValue = commandScope.getArgumentValue(this); - if (this.isRequired() && currentValue == null) { - throw new CommandValidationException(LiquibaseCommandLineConfiguration.ARGUMENT_CONVERTER.getCurrentValue().convert(this.getName()), "missing required argument", new MissingRequiredArgumentException(this.getName())); + if (this.isRequired() && currentValue == null && + (this.getSupersededBy() == null || commandScope.getArgumentValue(this.getSupersededBy()) == null)) { + throw new CommandValidationException(LiquibaseCommandLineConfiguration.ARGUMENT_CONVERTER.getCurrentValue().convert(this.getName()), "missing required argument", new MissingRequiredArgumentException(this.getName())); } } @@ -185,6 +197,16 @@ public Building required() { return this; } + /** + * Specifies a CommandArgument that can replace this one if it is not available. + * + */ + public Building supersededBy(CommandArgumentDefinition commandArgumentDefinition) { + this.newCommandArgument.supersededBy = commandArgumentDefinition; + + return this; + } + /** * Mark argument as optional. * @see #required() diff --git a/liquibase-core/src/main/java/liquibase/command/CommandBuilder.java b/liquibase-core/src/main/java/liquibase/command/CommandBuilder.java index ccb49fe6d99..b9f8465190b 100644 --- a/liquibase-core/src/main/java/liquibase/command/CommandBuilder.java +++ b/liquibase-core/src/main/java/liquibase/command/CommandBuilder.java @@ -1,5 +1,9 @@ package liquibase.command; +import liquibase.Beta; +import liquibase.command.core.DbUrlConnectionCommandStep; +import liquibase.database.Database; + /** * Builder for configuring {@link CommandStep} settings, such as {@link CommandArgumentDefinition}s and {@link CommandResultDefinition}s */ @@ -28,6 +32,19 @@ public CommandArgumentDefinition.Building argument(CommonAr return new CommandArgumentDefinition.Building<>(commandNames, new CommandArgumentDefinition<>(argument.getArgumentName(), type)); } + + /** + * Creates a database argument and registers the current Step as an applicable command + * to the InternalDatabaseCommandStep. + */ + @Beta + public CommandArgumentDefinition.Building databaseArgument() { + DbUrlConnectionCommandStep.addApplicableCommand(this.commandNames); + return new CommandArgumentDefinition.Building<>(commandNames, + new CommandArgumentDefinition<>("database", Database.class)) + .description("Database connection"); + } + /** * Starts the building of a new {@link CommandResultDefinition}. */ diff --git a/liquibase-core/src/main/java/liquibase/command/CommandFactory.java b/liquibase-core/src/main/java/liquibase/command/CommandFactory.java index ca083ba5f7d..a4a21cb1e11 100644 --- a/liquibase-core/src/main/java/liquibase/command/CommandFactory.java +++ b/liquibase-core/src/main/java/liquibase/command/CommandFactory.java @@ -5,6 +5,7 @@ import liquibase.servicelocator.ServiceLocator; import liquibase.util.StringUtil; +import java.lang.reflect.InvocationTargetException; import java.util.*; /** @@ -34,18 +35,30 @@ public CommandDefinition getCommandDefinition(String... commandName) throws Ille CommandDefinition commandDefinition = new CommandDefinition(commandName); for (CommandStep step : findAllInstances()) { if (step.getOrder(commandDefinition) > 0) { - commandDefinition.add(step); + try { + commandDefinition.add(step.getClass().getConstructor().newInstance()); + } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { + throw new IllegalArgumentException(e); + } } } final List pipeline = commandDefinition.getPipeline(); - if (pipeline.size() == 0) { + if (pipeline.isEmpty()) { throw new IllegalArgumentException("Unknown command '" + StringUtil.join(commandName, " ") + "'"); } - final Set> stepArguments = this.commandArgumentDefinitions.get(StringUtil.join(commandDefinition.getName(), " ")); + final Set> stepArguments = new HashSet<>(); + for (CommandStep step : pipeline) { + String[][] names = step.defineCommandNames(); + if (names != null) { + for (String[] name : names) { + stepArguments.addAll(this.commandArgumentDefinitions.getOrDefault(StringUtil.join(name, " "), new HashSet<>())); + } + } + } - if (stepArguments != null) { + if (!stepArguments.isEmpty()) { for (CommandArgumentDefinition commandArg : stepArguments) { commandDefinition.add(commandArg); } @@ -67,8 +80,11 @@ public CommandDefinition getCommandDefinition(String... commandName) throws Ille public SortedSet getCommands(boolean includeInternal) { Map commandNames = new HashMap<>(); for (CommandStep step : findAllInstances()) { - for (String[] name : step.defineCommandNames()) { - commandNames.put(StringUtil.join(name, " "), name); + String[][] names = step.defineCommandNames(); + if (names != null) { + for (String[] name : names) { + commandNames.put(StringUtil.join(name, " "), name); + } } } diff --git a/liquibase-core/src/main/java/liquibase/command/CommandScope.java b/liquibase-core/src/main/java/liquibase/command/CommandScope.java index 8f8e49c8feb..24573d03a99 100644 --- a/liquibase-core/src/main/java/liquibase/command/CommandScope.java +++ b/liquibase-core/src/main/java/liquibase/command/CommandScope.java @@ -171,6 +171,14 @@ public CommandResults execute() throws CommandExecutionException { for (CommandStep command : pipeline) { command.run(resultsBuilder); } + + // after executing our pipeline, runs cleanup in inverse order + for (int i = pipeline.size() -1; i >= 0; i--) { + CommandStep command = pipeline.get(i); + if (command instanceof CleanUpCommandStep) { + ((CleanUpCommandStep)command).cleanUp(resultsBuilder); + } + } } catch (Exception e) { if (e instanceof CommandExecutionException) { throw (CommandExecutionException) e; diff --git a/liquibase-core/src/main/java/liquibase/command/core/CalculateChecksumCommandStep.java b/liquibase-core/src/main/java/liquibase/command/core/CalculateChecksumCommandStep.java index b5198726cce..46944e234af 100644 --- a/liquibase-core/src/main/java/liquibase/command/core/CalculateChecksumCommandStep.java +++ b/liquibase-core/src/main/java/liquibase/command/core/CalculateChecksumCommandStep.java @@ -48,6 +48,7 @@ public String[][] defineCommandNames() { } + @Override protected String[] collectArguments(CommandScope commandScope) throws CommandExecutionException { return collectArguments(commandScope, null, CHANGESET_IDENTIFIER_ARG.getName()); } diff --git a/liquibase-core/src/main/java/liquibase/command/core/DbUrlConnectionCommandStep.java b/liquibase-core/src/main/java/liquibase/command/core/DbUrlConnectionCommandStep.java new file mode 100644 index 00000000000..9631859539e --- /dev/null +++ b/liquibase-core/src/main/java/liquibase/command/core/DbUrlConnectionCommandStep.java @@ -0,0 +1,219 @@ +package liquibase.command.core; + +import liquibase.Beta; +import liquibase.GlobalConfiguration; +import liquibase.Scope; +import liquibase.command.*; +import liquibase.configuration.ConfigurationValueObfuscator; +import liquibase.database.Database; +import liquibase.database.DatabaseFactory; +import liquibase.database.core.DatabaseUtils; +import liquibase.exception.CommandValidationException; +import liquibase.exception.DatabaseException; +import liquibase.integration.commandline.LiquibaseCommandLineConfiguration; +import liquibase.resource.ResourceAccessor; +import liquibase.util.StringUtil; + +import java.util.ArrayList; +import java.util.List; +import java.util.ResourceBundle; + +import static java.util.ResourceBundle.getBundle; + +/** + * Internal command step to be used on CommandStep pipeline to manage the database connection. + */ +public class DbUrlConnectionCommandStep extends AbstractCommandStep implements CleanUpCommandStep { + + public static final String[] COMMAND_NAME = {"dbUrlConnectionCommandStep"}; + + private static final List APPLICABLE_COMMANDS = new ArrayList<>(); + private static final ResourceBundle coreBundle = getBundle("liquibase/i18n/liquibase-core"); + + public static final CommandArgumentDefinition DATABASE_ARG; + public static final CommandArgumentDefinition URL_ARG; + public static final CommandArgumentDefinition DEFAULT_SCHEMA_NAME_ARG; + public static final CommandArgumentDefinition DEFAULT_CATALOG_NAME_ARG; + public static final CommandArgumentDefinition USERNAME_ARG; + public static final CommandArgumentDefinition PASSWORD_ARG; + public static final CommandArgumentDefinition DRIVER_ARG; + public static final CommandArgumentDefinition DRIVER_PROPERTIES_FILE_ARG; + + private Database database; + + static { + CommandBuilder builder = new CommandBuilder(COMMAND_NAME); + DEFAULT_SCHEMA_NAME_ARG = builder.argument("defaultSchemaName", String.class) + .description("The default schema name to use for the database connection").build(); + DEFAULT_CATALOG_NAME_ARG = builder.argument("defaultCatalogName", String.class) + .description("The default catalog name to use for the database connection").build(); + DRIVER_ARG = builder.argument("driver", String.class) + .description("The JDBC driver class").build(); + DRIVER_PROPERTIES_FILE_ARG = builder.argument("driverPropertiesFile", String.class) + .description("The JDBC driver properties file").build(); + USERNAME_ARG = builder.argument(CommonArgumentNames.USERNAME, String.class) + .description("Username to use to connect to the database").build(); + PASSWORD_ARG = builder.argument(CommonArgumentNames.PASSWORD, String.class) + .description("Password to use to connect to the database") + .setValueObfuscator(ConfigurationValueObfuscator.STANDARD) + .build(); + DATABASE_ARG = builder.argument("database", Database.class).hidden().build(); + URL_ARG = builder.argument(CommonArgumentNames.URL, String.class).required().supersededBy(DATABASE_ARG) + .description("The JDBC database connection URL").build(); + DATABASE_ARG.setSupersededBy(URL_ARG); + } + + /** + * Method that allows Commands to register themselves to be able to use this CommandStep. + */ + @Beta + public static void addApplicableCommand(String[]... commandName) { + APPLICABLE_COMMANDS.add(commandName); + } + + @Override + public void run(CommandResultsBuilder resultsBuilder) throws Exception { + CommandScope commandScope = resultsBuilder.getCommandScope(); + commandScope.addArgumentValue(DATABASE_ARG.getName(), this.obtainDatabase(commandScope)); + } + + /** + * Try to retrieve and set the database object from the command scope, otherwise creates a new one . + * + * @param commandScope current command scope + * @throws DatabaseException Thrown when there is a connection error + */ + private Database obtainDatabase(CommandScope commandScope) throws DatabaseException, CommandValidationException { + if (commandScope.getArgumentValue(DATABASE_ARG) == null) { + String url = commandScope.getArgumentValue(URL_ARG); + String username = commandScope.getArgumentValue(USERNAME_ARG); + String password = commandScope.getArgumentValue(PASSWORD_ARG); + String defaultSchemaName = commandScope.getArgumentValue(DEFAULT_SCHEMA_NAME_ARG); + String defaultCatalogName = commandScope.getArgumentValue(DEFAULT_CATALOG_NAME_ARG); + String driver = commandScope.getArgumentValue(DRIVER_ARG); + String driverPropertiesFile = commandScope.getArgumentValue(DRIVER_PROPERTIES_FILE_ARG); + this.database = createDatabaseObject(url, username, password, defaultSchemaName, defaultCatalogName, driver, driverPropertiesFile); + return this.database; + } else { + return commandScope.getArgumentValue(DATABASE_ARG); + } + } + + @SuppressWarnings("java:S2095") + /** + * + * Method to create a Database object given these parameters + * + * @param url URL to connect to + * @param username Username credential + * @param password Password credential + * @param defaultSchemaName Default schema for connection + * @param defaultCatalogName Default catalog for connection + * @param driver Driver class + * @param driverPropertiesFile Additional driver properties + * @throws DatabaseException Thrown when there is a connection error + * + */ + private Database createDatabaseObject(String url, + String username, + String password, + String defaultSchemaName, + String defaultCatalogName, + String driver, + String driverPropertiesFile) + throws DatabaseException { + ResourceAccessor resourceAccessor = Scope.getCurrentScope().getResourceAccessor(); + String databaseClassName = null; + Class databaseClass = LiquibaseCommandLineConfiguration.DATABASE_CLASS.getCurrentValue(); + if (databaseClass != null) { + databaseClassName = databaseClass.getCanonicalName(); + } + String propertyProviderClass = null; + Class clazz = LiquibaseCommandLineConfiguration.PROPERTY_PROVIDER_CLASS.getCurrentValue(); + if (clazz != null) { + propertyProviderClass = clazz.getName(); + } + String liquibaseCatalogName = StringUtil.trimToNull(GlobalConfiguration.LIQUIBASE_CATALOG_NAME.getCurrentValue()); + String liquibaseSchemaName = StringUtil.trimToNull(GlobalConfiguration.LIQUIBASE_SCHEMA_NAME.getCurrentValue()); + String databaseChangeLogTablespaceName = StringUtil.trimToNull(GlobalConfiguration.LIQUIBASE_TABLESPACE_NAME.getCurrentValue()); + String databaseChangeLogLockTableName = StringUtil.trimToNull(GlobalConfiguration.DATABASECHANGELOGLOCK_TABLE_NAME.getCurrentValue()); + String databaseChangeLogTableName = StringUtil.trimToNull(GlobalConfiguration.DATABASECHANGELOG_TABLE_NAME.getCurrentValue()); + + try { + defaultCatalogName = StringUtil.trimToNull(defaultCatalogName); + defaultSchemaName = StringUtil.trimToNull(defaultSchemaName); + + database = DatabaseFactory.getInstance().openDatabase(url, username, password, driver, + databaseClassName, driverPropertiesFile, propertyProviderClass, resourceAccessor); + + if (!database.supportsSchemas()) { + if ((defaultSchemaName != null) && (defaultCatalogName == null)) { + defaultCatalogName = defaultSchemaName; + } + if ((liquibaseSchemaName != null) && (liquibaseCatalogName == null)) { + liquibaseCatalogName = liquibaseSchemaName; + } + } + + defaultCatalogName = StringUtil.trimToNull(defaultCatalogName); + defaultSchemaName = StringUtil.trimToNull(defaultSchemaName); + + database.setDefaultCatalogName(defaultCatalogName); + database.setDefaultSchemaName(defaultSchemaName); + database.setOutputDefaultCatalog(true); + database.setOutputDefaultSchema(true); + database.setLiquibaseCatalogName(liquibaseCatalogName); + database.setLiquibaseTablespaceName(databaseChangeLogTablespaceName); + database.setLiquibaseSchemaName(liquibaseSchemaName); + if (databaseChangeLogTableName != null) { + database.setDatabaseChangeLogTableName(databaseChangeLogTableName); + if (databaseChangeLogLockTableName != null) { + database.setDatabaseChangeLogLockTableName(databaseChangeLogLockTableName); + } else { + database.setDatabaseChangeLogLockTableName(databaseChangeLogTableName + "LOCK"); + } + } + DatabaseUtils.initializeDatabase(defaultCatalogName, defaultSchemaName, database); + } catch (Exception e) { + throw new DatabaseException(e); + } + + return database; + } + + @Override + public String[][] defineCommandNames() { + return new String[][] { COMMAND_NAME }; + } + + @Override + public void adjustCommandDefinition(CommandDefinition commandDefinition) { + if (commandDefinition.getPipeline().size() == 1) { + commandDefinition.setInternal(true); + } + } + + @Override + public int getOrder(CommandDefinition commandDefinition) { + for (String[][] commandNames : APPLICABLE_COMMANDS) { + for (String[] commandName : commandNames) { + if (commandDefinition.is(commandName)) { + return 500; + } + } + } + return super.getOrder(commandDefinition); + } + + @Override + public void cleanUp(CommandResultsBuilder resultsBuilder) { + if (database != null) { + try { + database.close(); + database = null; + } catch (Exception e) { + Scope.getCurrentScope().getLog(getClass()).warning(coreBundle.getString("problem.closing.connection"), e); + } + } + } +} diff --git a/liquibase-core/src/main/java/liquibase/command/core/DiffToChangeLogCommand.java b/liquibase-core/src/main/java/liquibase/command/core/DiffToChangeLogCommand.java index 7557bfae1c1..8bf39523cc8 100644 --- a/liquibase-core/src/main/java/liquibase/command/core/DiffToChangeLogCommand.java +++ b/liquibase-core/src/main/java/liquibase/command/core/DiffToChangeLogCommand.java @@ -29,10 +29,12 @@ public DiffToChangeLogCommand setChangeLogFile(String changeLogFile) { return this; } + @Override public PrintStream getOutputStream() { return outputStream; } + @Override public DiffToChangeLogCommand setOutputStream(PrintStream outputStream) { this.outputStream = outputStream; return this; diff --git a/liquibase-core/src/main/java/liquibase/command/core/SnapshotCommandStep.java b/liquibase-core/src/main/java/liquibase/command/core/SnapshotCommandStep.java index eac670dd647..0bb214f9e3d 100644 --- a/liquibase-core/src/main/java/liquibase/command/core/SnapshotCommandStep.java +++ b/liquibase-core/src/main/java/liquibase/command/core/SnapshotCommandStep.java @@ -2,15 +2,9 @@ import liquibase.CatalogAndSchema; import liquibase.GlobalConfiguration; -import liquibase.Scope; import liquibase.command.*; -import liquibase.configuration.ConfigurationValueObfuscator; import liquibase.database.Database; import liquibase.database.ObjectQuotingStrategy; -import liquibase.exception.DatabaseException; -import liquibase.integration.commandline.CommandLineUtils; -import liquibase.integration.commandline.LiquibaseCommandLineConfiguration; -import liquibase.resource.ResourceAccessor; import liquibase.serializer.SnapshotSerializerFactory; import liquibase.snapshot.DatabaseSnapshot; import liquibase.snapshot.SnapshotControl; @@ -21,55 +15,29 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; -import java.util.*; - -import static java.util.ResourceBundle.getBundle; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Map; public class SnapshotCommandStep extends AbstractCommandStep { public static final String[] COMMAND_NAME = {"snapshot"}; - private static final ResourceBundle coreBundle = getBundle("liquibase/i18n/liquibase-core"); - public static final CommandArgumentDefinition USERNAME_ARG; - public static final CommandArgumentDefinition PASSWORD_ARG; - public static final CommandArgumentDefinition URL_ARG; public static final CommandArgumentDefinition SCHEMAS_ARG; - public static final CommandArgumentDefinition DEFAULT_SCHEMA_NAME_ARG; - public static final CommandArgumentDefinition DEFAULT_CATALOG_NAME_ARG; public static final CommandArgumentDefinition SNAPSHOT_FORMAT_ARG; - public static final CommandArgumentDefinition DRIVER_ARG; - public static final CommandArgumentDefinition DRIVER_PROPERTIES_FILE_ARG; public static final CommandArgumentDefinition DATABASE_ARG; public static final CommandArgumentDefinition SNAPSHOT_CONTROL_ARG; static { CommandBuilder builder = new CommandBuilder(COMMAND_NAME); - URL_ARG = builder.argument(CommonArgumentNames.URL, String.class).required() - .description("The JDBC database connection URL").build(); - SCHEMAS_ARG = builder.argument("schemas", String.class) - .description("The schemas to snapshot").build(); - DEFAULT_SCHEMA_NAME_ARG = builder.argument("defaultSchemaName", String.class) - .description("The default schema name to use for the database connection").build(); - DEFAULT_CATALOG_NAME_ARG = builder.argument("defaultCatalogName", String.class) - .description("The default catalog name to use for the database connection").build(); - DRIVER_ARG = builder.argument("driver", String.class) - .description("The JDBC driver class").build(); - DRIVER_PROPERTIES_FILE_ARG = builder.argument("driverPropertiesFile", String.class) - .description("The JDBC driver properties file").build(); - USERNAME_ARG = builder.argument(CommonArgumentNames.USERNAME, String.class) - .description("Username to use to connect to the database").build(); - PASSWORD_ARG = builder.argument(CommonArgumentNames.PASSWORD, String.class) - .description("Password to use to connect to the database") - .setValueObfuscator(ConfigurationValueObfuscator.STANDARD) - .build(); + SCHEMAS_ARG = builder.argument("schemas", String.class).description("The schemas to snapshot").build(); SNAPSHOT_FORMAT_ARG = builder.argument("snapshotFormat", String.class) .description("Output format to use (JSON, YAML, or TXT)").build(); - DATABASE_ARG = builder.argument("database", Database.class).hidden().build(); SNAPSHOT_CONTROL_ARG = builder.argument("snapshotControl", SnapshotControl.class).hidden().build(); + DATABASE_ARG = builder.databaseArgument().build(); } - private Database database; - private Map snapshotMetadata; @Override @@ -107,19 +75,7 @@ public void setSnapshotMetadata(Map snapshotMetadata) { @Override public void run(CommandResultsBuilder resultsBuilder) throws Exception { CommandScope commandScope = resultsBuilder.getCommandScope(); - - if (commandScope.getArgumentValue(DATABASE_ARG) == null) { - String url = commandScope.getArgumentValue(SnapshotCommandStep.URL_ARG); - String username = commandScope.getArgumentValue(SnapshotCommandStep.USERNAME_ARG); - String password = commandScope.getArgumentValue(SnapshotCommandStep.PASSWORD_ARG); - String defaultSchemaName = commandScope.getArgumentValue(SnapshotCommandStep.DEFAULT_SCHEMA_NAME_ARG); - String defaultCatalogName = commandScope.getArgumentValue(SnapshotCommandStep.DEFAULT_CATALOG_NAME_ARG); - String driver = commandScope.getArgumentValue(SnapshotCommandStep.DRIVER_ARG); - String driverPropertiesFile = commandScope.getArgumentValue(SnapshotCommandStep.DRIVER_PROPERTIES_FILE_ARG); - createDatabaseObject(url, username, password, defaultSchemaName, defaultCatalogName, driver, driverPropertiesFile); - } else { - database = commandScope.getArgumentValue(DATABASE_ARG); - } + Database database = commandScope.getArgumentValue(DATABASE_ARG); CatalogAndSchema[] schemas = parseSchemas(database, commandScope.getArgumentValue(SCHEMAS_ARG)); @@ -159,13 +115,6 @@ public void run(CommandResultsBuilder resultsBuilder) throws Exception { // Reset the quoting strategy // database.setObjectQuotingStrategy(originalQuotingStrategy); - - // - // Need to clean up here since we created the Database - // - if (commandScope.getArgumentValue(DATABASE_ARG) == null) { - closeDatabase(); - } } } @@ -175,75 +124,6 @@ private Writer getOutputWriter(final OutputStream outputStream) throws IOExcepti return new OutputStreamWriter(outputStream, charsetName); } - /** - * - * Method to create a Database object given these parameters - * - * @param url URL to connect to - * @param username Username credential - * @param password Password credential - * @param defaultSchemaName Default schema for connection - * @param defaultCatalogName Default catalog for connection - * @param driver Driver class - * @param driverPropertiesFile Additional driver properties - * @throws DatabaseException Thrown when there is a connection error - * - */ - private void createDatabaseObject(String url, - String username, - String password, - String defaultSchemaName, - String defaultCatalogName, - String driver, - String driverPropertiesFile) - throws DatabaseException { - ResourceAccessor resourceAccessor = Scope.getCurrentScope().getResourceAccessor(); - String databaseClassName = null; - Class databaseClass = LiquibaseCommandLineConfiguration.DATABASE_CLASS.getCurrentValue(); - if (databaseClass != null) { - databaseClassName = databaseClass.getCanonicalName(); - } - String propertyProviderClass = null; - Class clazz = LiquibaseCommandLineConfiguration.PROPERTY_PROVIDER_CLASS.getCurrentValue(); - if (clazz != null) { - propertyProviderClass = clazz.getName(); - } - String liquibaseCatalogName = GlobalConfiguration.LIQUIBASE_CATALOG_NAME.getCurrentValue(); - String liquibaseSchemaName = GlobalConfiguration.LIQUIBASE_SCHEMA_NAME.getCurrentValue(); - String databaseChangeLogTablespaceName = GlobalConfiguration.LIQUIBASE_TABLESPACE_NAME.getCurrentValue(); - String databaseChangeLogLockTableName = GlobalConfiguration.DATABASECHANGELOGLOCK_TABLE_NAME.getCurrentValue(); - String databaseChangeLogTableName = GlobalConfiguration.DATABASECHANGELOG_TABLE_NAME.getCurrentValue(); - database = - CommandLineUtils.createDatabaseObject(resourceAccessor, - url, - username, - password, - driver, - defaultCatalogName, - defaultSchemaName, - true, - true, - databaseClassName, - driverPropertiesFile, - propertyProviderClass, - liquibaseCatalogName, liquibaseSchemaName, - databaseChangeLogTableName, - databaseChangeLogLockTableName); - database.setLiquibaseTablespaceName(databaseChangeLogTablespaceName); - } - - private void closeDatabase() { - try { - if (database != null) { - database.rollback(); - database.close(); - } - } catch (Exception e) { - Scope.getCurrentScope().getLog(getClass()).warning( - coreBundle.getString("problem.closing.connection"), e); - } - } - private String printSnapshot(CommandScope commandScope, DatabaseSnapshot snapshot) { String format = commandScope.getArgumentValue(SNAPSHOT_FORMAT_ARG); if (format == null) { diff --git a/liquibase-core/src/main/java/liquibase/command/core/TagCommandStep.java b/liquibase-core/src/main/java/liquibase/command/core/TagCommandStep.java index 620bbd5252a..9666fc3c14c 100644 --- a/liquibase-core/src/main/java/liquibase/command/core/TagCommandStep.java +++ b/liquibase-core/src/main/java/liquibase/command/core/TagCommandStep.java @@ -1,52 +1,53 @@ package liquibase.command.core; +import liquibase.Liquibase; +import liquibase.Scope; +import liquibase.changelog.ChangeLogHistoryService; +import liquibase.changelog.ChangeLogHistoryServiceFactory; import liquibase.command.*; -import liquibase.configuration.ConfigurationValueObfuscator; -import liquibase.exception.CommandExecutionException; +import liquibase.database.Database; +import liquibase.exception.LockException; +import liquibase.lockservice.LockService; +import liquibase.lockservice.LockServiceFactory; -public class TagCommandStep extends AbstractCliWrapperCommandStep { +public class TagCommandStep extends AbstractCommandStep { public static final String[] COMMAND_NAME = {"tag"}; - public static final CommandArgumentDefinition URL_ARG; - public static final CommandArgumentDefinition DEFAULT_SCHEMA_NAME_ARG; - public static final CommandArgumentDefinition DEFAULT_CATALOG_NAME_ARG; - public static final CommandArgumentDefinition USERNAME_ARG; - public static final CommandArgumentDefinition PASSWORD_ARG; public static final CommandArgumentDefinition TAG_ARG; - public static final CommandArgumentDefinition DRIVER_ARG; - public static final CommandArgumentDefinition DRIVER_PROPERTIES_FILE_ARG; + public static final CommandArgumentDefinition DATABASE_ARG; static { CommandBuilder builder = new CommandBuilder(COMMAND_NAME); - URL_ARG = builder.argument(CommonArgumentNames.URL, String.class).required() - .description("The JDBC database connection URL").build(); - DEFAULT_SCHEMA_NAME_ARG = builder.argument("defaultSchemaName", String.class) - .description("The default schema name to use for the database connection").build(); - DEFAULT_CATALOG_NAME_ARG = builder.argument("defaultCatalogName", String.class) - .description("The default catalog name to use for the database connection").build(); - DRIVER_ARG = builder.argument("driver", String.class) - .description("The JDBC driver class").build(); - DRIVER_PROPERTIES_FILE_ARG = builder.argument("driverPropertiesFile", String.class) - .description("The JDBC driver properties file").build(); - USERNAME_ARG = builder.argument(CommonArgumentNames.USERNAME, String.class) - .description("Username to use to connect to the database").build(); - PASSWORD_ARG = builder.argument(CommonArgumentNames.PASSWORD, String.class) - .description("Password to use to connect to the database") - .setValueObfuscator(ConfigurationValueObfuscator.STANDARD) - .build(); - TAG_ARG = builder.argument("tag", String.class).required() - .description("Tag to add to the database changelog table").build(); + TAG_ARG = builder.argument("tag", String.class).required().description("Tag to add to the database changelog table").build(); + DATABASE_ARG = builder.databaseArgument().build(); } @Override - public String[][] defineCommandNames() { - return new String[][] { COMMAND_NAME }; + public void run(CommandResultsBuilder resultsBuilder) throws Exception { + CommandScope commandScope = resultsBuilder.getCommandScope(); + Database database = commandScope.getArgumentValue(DATABASE_ARG); + LockService lockService = LockServiceFactory.getInstance().getLockService(database); + lockService.waitForLock(); + + try { + ChangeLogHistoryService changeLogService = ChangeLogHistoryServiceFactory.getInstance().getChangeLogService(database); + changeLogService.generateDeploymentId(); + changeLogService.init(); + LockServiceFactory.getInstance().getLockService(database).init(); + changeLogService.tag(commandScope.getArgumentValue(TagCommandStep.TAG_ARG)); + } finally { + try { + lockService.releaseLock(); + } catch (LockException e) { + Scope.getCurrentScope().getLog(getClass()).severe(Liquibase.MSG_COULD_NOT_RELEASE_LOCK, e); + } + } } @Override - protected String[] collectArguments(CommandScope commandScope) throws CommandExecutionException { - return collectArguments(commandScope, null, "tag"); + public String[][] defineCommandNames() { + return new String[][] { COMMAND_NAME }; } @Override diff --git a/liquibase-core/src/main/java/liquibase/configuration/LiquibaseConfiguration.java b/liquibase-core/src/main/java/liquibase/configuration/LiquibaseConfiguration.java index e058931c9da..309d0dbf37e 100644 --- a/liquibase-core/src/main/java/liquibase/configuration/LiquibaseConfiguration.java +++ b/liquibase-core/src/main/java/liquibase/configuration/LiquibaseConfiguration.java @@ -158,7 +158,19 @@ public ConfiguredValue getCurrentConfiguredValue(Configurat if (foundFirstValue) { logMessage.append("Overrides "); } - logMessage.append(StringUtil.lowerCaseFirst(providedValue.describe())); + + // + // Only lower case the first character is + // the first two characters are NOT uppercase. This allows provider + // strings like 'AWS' to be displayed correctly, i.e. as 'AWS', not 'aWS' + // + String describe = providedValue.describe(); + char[] chars = describe.toCharArray(); + if (chars.length >= 2 && Character.isUpperCase(chars[0]) && Character.isUpperCase(chars[1])) { + logMessage.append(describe); + } else { + logMessage.append(StringUtil.lowerCaseFirst(describe)); + } Object value = providedValue.getValue(); if (value != null) { String finalValue = String.valueOf(value); diff --git a/liquibase-core/src/main/java/liquibase/database/AbstractJdbcDatabase.java b/liquibase-core/src/main/java/liquibase/database/AbstractJdbcDatabase.java index ae8cdf12c59..ccba774bd74 100644 --- a/liquibase-core/src/main/java/liquibase/database/AbstractJdbcDatabase.java +++ b/liquibase-core/src/main/java/liquibase/database/AbstractJdbcDatabase.java @@ -1202,7 +1202,7 @@ public int hashCode() { @Override public void close() throws DatabaseException { Scope.getCurrentScope().getSingleton(ExecutorService.class).clearExecutor("jdbc", this); - try (final DatabaseConnection connection = getConnection();) { + try (final DatabaseConnection connection = getConnection()) { if (connection != null && previousAutoCommit != null) { connection.setAutoCommit(previousAutoCommit); } diff --git a/liquibase-core/src/main/java/liquibase/database/Database.java b/liquibase-core/src/main/java/liquibase/database/Database.java index 1411b306919..21fc23b438c 100644 --- a/liquibase-core/src/main/java/liquibase/database/Database.java +++ b/liquibase-core/src/main/java/liquibase/database/Database.java @@ -176,9 +176,16 @@ public interface Database extends PrioritizedService, AutoCloseable { /** * Tags the database changelog with the given string. + * + * @deprecated Use {@link liquibase.changelog.ChangeLogHistoryService#tag(String)} instead */ + @Deprecated void tag(String tagString) throws DatabaseException; + /** + * @deprecated Use {@link liquibase.changelog.ChangeLogHistoryService#tagExists(String)} instead + */ + @Deprecated boolean doesTagExist(String tag) throws DatabaseException; boolean isSystemObject(DatabaseObject example); diff --git a/liquibase-core/src/main/java/liquibase/database/DatabaseFactory.java b/liquibase-core/src/main/java/liquibase/database/DatabaseFactory.java index f8f531237db..ec2c8b73f71 100644 --- a/liquibase-core/src/main/java/liquibase/database/DatabaseFactory.java +++ b/liquibase-core/src/main/java/liquibase/database/DatabaseFactory.java @@ -11,6 +11,7 @@ import liquibase.resource.ResourceAccessor; import liquibase.util.StringUtil; import liquibase.util.SystemUtil; +import liquibase.SingletonObject; import java.io.IOException; import java.io.InputStream; @@ -18,7 +19,7 @@ import java.sql.Driver; import java.util.*; -public class DatabaseFactory { +public class DatabaseFactory implements SingletonObject { private static final Logger LOG = Scope.getCurrentScope().getLog(DatabaseFactory.class); private static DatabaseFactory instance; private Map> implementedDatabases = new HashMap<>(); @@ -330,7 +331,7 @@ private Properties buildDriverProperties(String username, String password, Strin private static class DatabaseComparator implements Comparator { @Override public int compare(Database o1, Database o2) { - return -1 * Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority()); + return -1 * Integer.compare(o1.getPriority(), o2.getPriority()); } } } diff --git a/liquibase-core/src/main/java/liquibase/database/core/AbstractDb2Database.java b/liquibase-core/src/main/java/liquibase/database/core/AbstractDb2Database.java index 5004854cb6f..21f00b4611f 100644 --- a/liquibase-core/src/main/java/liquibase/database/core/AbstractDb2Database.java +++ b/liquibase-core/src/main/java/liquibase/database/core/AbstractDb2Database.java @@ -223,6 +223,7 @@ public boolean isSystemObject(DatabaseObject example) { return super.isSystemObject(example); } + @Override protected boolean mustQuoteObjectName(String objectName, Class objectType) { if (objectType.isAssignableFrom(Schema.class) || objectType.isAssignableFrom(Catalog.class)) { return true; diff --git a/liquibase-core/src/main/java/liquibase/structure/DatabaseObjectComparator.java b/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectCollectionComparator.java similarity index 83% rename from liquibase-core/src/main/java/liquibase/structure/DatabaseObjectComparator.java rename to liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectCollectionComparator.java index d5624c4324b..4df96019a2b 100644 --- a/liquibase-core/src/main/java/liquibase/structure/DatabaseObjectComparator.java +++ b/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectCollectionComparator.java @@ -1,11 +1,12 @@ -package liquibase.structure; +package liquibase.diff.compare; +import liquibase.structure.DatabaseObject; import liquibase.structure.core.Schema; import liquibase.util.StringUtil; import java.util.Comparator; -public class DatabaseObjectComparator implements Comparator { +public class DatabaseObjectCollectionComparator implements Comparator { @Override public int compare(DatabaseObject o1, DatabaseObject o2) { @@ -17,7 +18,6 @@ public int compare(DatabaseObject o1, DatabaseObject o2) { if (i != 0) { return i; } - } String name1 = StringUtil.trimToEmpty(o1.getName()); diff --git a/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectComparatorComparator.java b/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectComparatorComparator.java index 4ae972529f1..33c32ff8586 100644 --- a/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectComparatorComparator.java +++ b/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectComparatorComparator.java @@ -17,7 +17,7 @@ public DatabaseObjectComparatorComparator(Class object @Override public int compare(DatabaseObjectComparator o1, DatabaseObjectComparator o2) { - int result = -1 * Integer.valueOf(o1.getPriority(objectType, database)).compareTo(o2.getPriority(objectType, database)); + int result = -1 * Integer.compare(o1.getPriority(objectType, database), o2.getPriority(objectType, database)); if (result == 0) { return o1.getClass().getName().compareTo(o2.getClass().getName()); } diff --git a/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectComparatorFactory.java b/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectComparatorFactory.java index a5a870ece11..a0f06ea5255 100644 --- a/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectComparatorFactory.java +++ b/liquibase-core/src/main/java/liquibase/diff/compare/DatabaseObjectComparatorFactory.java @@ -69,6 +69,14 @@ public void unregister(Class generatorClass) { unregister(toRemove); } + public DatabaseObjectComparator getComparator(Class comparatorClass, Database database) { + List comparatorsForType = getComparators(comparatorClass, database); + if (! comparatorsForType.isEmpty()) { + return comparatorsForType.get(0); + } + return null; + } + protected List getComparators(Class comparatorClass, Database database) { String key = comparatorClass.getName()+":"+database.getShortName(); if (validComparatorsByClassAndDatabase.containsKey(key)) { diff --git a/liquibase-core/src/main/java/liquibase/diff/output/changelog/ChangeGeneratorComparator.java b/liquibase-core/src/main/java/liquibase/diff/output/changelog/ChangeGeneratorComparator.java index 5c5d2e488a4..65acd3789eb 100644 --- a/liquibase-core/src/main/java/liquibase/diff/output/changelog/ChangeGeneratorComparator.java +++ b/liquibase-core/src/main/java/liquibase/diff/output/changelog/ChangeGeneratorComparator.java @@ -17,7 +17,7 @@ public ChangeGeneratorComparator(Class objectType, Dat @Override public int compare(ChangeGenerator o1, ChangeGenerator o2) { - int result = -1 * Integer.valueOf(o1.getPriority(objectType, database)).compareTo(o2.getPriority(objectType, database)); + int result = -1 * Integer.compare(o1.getPriority(objectType, database), o2.getPriority(objectType, database)); if (result == 0) { return o1.getClass().getName().compareTo(o2.getClass().getName()); } diff --git a/liquibase-core/src/main/java/liquibase/diff/output/changelog/DiffToChangeLog.java b/liquibase-core/src/main/java/liquibase/diff/output/changelog/DiffToChangeLog.java index a0e8643ccd7..896ab27e087 100644 --- a/liquibase-core/src/main/java/liquibase/diff/output/changelog/DiffToChangeLog.java +++ b/liquibase-core/src/main/java/liquibase/diff/output/changelog/DiffToChangeLog.java @@ -11,6 +11,7 @@ import liquibase.diff.DiffResult; import liquibase.diff.ObjectDifferences; import liquibase.diff.compare.CompareControl; +import liquibase.diff.compare.DatabaseObjectCollectionComparator; import liquibase.diff.output.DiffOutputControl; import liquibase.exception.DatabaseException; import liquibase.exception.UnexpectedLiquibaseException; @@ -25,13 +26,17 @@ import liquibase.snapshot.EmptyDatabaseSnapshot; import liquibase.statement.core.RawSqlStatement; import liquibase.structure.DatabaseObject; -import liquibase.structure.DatabaseObjectComparator; import liquibase.structure.core.Column; import liquibase.structure.core.StoredDatabaseLogic; -import liquibase.util.*; +import liquibase.util.DependencyUtil; +import liquibase.util.StreamUtil; +import liquibase.util.StringUtil; import javax.xml.parsers.ParserConfigurationException; -import java.io.*; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; import java.text.SimpleDateFormat; import java.util.*; @@ -251,7 +256,7 @@ public void print(final PrintStream out, final ChangeLogSerializer changeLogSeri public List generateChangeSets() { final ChangeGeneratorFactory changeGeneratorFactory = ChangeGeneratorFactory.getInstance(); - DatabaseObjectComparator comparator = new DatabaseObjectComparator(); + DatabaseObjectCollectionComparator comparator = new DatabaseObjectCollectionComparator(); String created = null; if (GlobalConfiguration.GENERATE_CHANGESET_CREATED_VALUES.getCurrentValue()) { @@ -265,9 +270,9 @@ public List generateChangeSets() { // This is to avoid changing the MissingObjectChangeGenerator API and still be able to pass the // initial DiffResult Object which can be used to check for the objects available in the database // without doing any expensive db calls. Example usage is in MissingUniqueConstraintChangeGenerator#alreadyExists() - Database comparisionDatabase = diffResult.getComparisonSnapshot().getDatabase(); - if (comparisionDatabase instanceof AbstractJdbcDatabase) { - ((AbstractJdbcDatabase) comparisionDatabase).set("diffResult", diffResult); + Database comparisonDatabase = diffResult.getComparisonSnapshot().getDatabase(); + if (comparisonDatabase instanceof AbstractJdbcDatabase) { + ((AbstractJdbcDatabase) comparisonDatabase).set("diffResult", diffResult); } for (Class type : types) { @@ -283,7 +288,7 @@ public List generateChangeSets() { types = getOrderedOutputTypes(MissingObjectChangeGenerator.class); List missingObjects = new ArrayList(); for (Class type : types) { - for (DatabaseObject object : diffResult.getMissingObjects(type, getDbObjectComparator())) { + for (DatabaseObject object : diffResult.getMissingObjects(type, getDatabaseObjectCollectionComparator())) { if (object == null) { continue; } @@ -315,8 +320,8 @@ public List generateChangeSets() { } } // remove the diffResult from the database object - if (comparisionDatabase instanceof AbstractJdbcDatabase) { - ((AbstractJdbcDatabase) comparisionDatabase).set("diffResult", null); + if (comparisonDatabase instanceof AbstractJdbcDatabase) { + ((AbstractJdbcDatabase) comparisonDatabase).set("diffResult", null); } @@ -327,8 +332,8 @@ public List generateChangeSets() { return changeSets; } - private DatabaseObjectComparator getDbObjectComparator() { - return new DatabaseObjectComparator() { + private DatabaseObjectCollectionComparator getDatabaseObjectCollectionComparator() { + return new DatabaseObjectCollectionComparator() { @Override public int compare(DatabaseObject o1, DatabaseObject o2) { if (o1 instanceof Column && o1.getAttribute(ORDER_ATTRIBUTE, Integer.class) != null && o2.getAttribute(ORDER_ATTRIBUTE, Integer.class) != null) { @@ -336,15 +341,15 @@ public int compare(DatabaseObject o1, DatabaseObject o2) { if (i != 0) { return i; } - } else if (o1 instanceof StoredDatabaseLogic && o1.getAttribute(ORDER_ATTRIBUTE, Integer.class) != null - && o2.getAttribute(ORDER_ATTRIBUTE, Integer.class) != null) { - int order = o1.getAttribute(ORDER_ATTRIBUTE, Long.class).compareTo(o2.getAttribute(ORDER_ATTRIBUTE, Long.class)); - if (order != 0) { - return order; + } else if (o1 instanceof StoredDatabaseLogic) { + if (o1.getAttribute(ORDER_ATTRIBUTE, Integer.class) != null && o2.getAttribute(ORDER_ATTRIBUTE, Integer.class) != null) { + int order = o1.getAttribute(ORDER_ATTRIBUTE, Long.class).compareTo(o2.getAttribute(ORDER_ATTRIBUTE, Long.class)); + if (order != 0) { + return order; + } } } return super.compare(o1, o2); - } }; } diff --git a/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/MissingDataExternalFileChangeGenerator.java b/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/MissingDataExternalFileChangeGenerator.java index 48583416b90..fc812b31566 100644 --- a/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/MissingDataExternalFileChangeGenerator.java +++ b/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/MissingDataExternalFileChangeGenerator.java @@ -53,7 +53,7 @@ public Change[] fixMissing(DatabaseObject missingObject, DiffOutputControl outpu ResultSet rs = null; try ( Statement stmt = ((JdbcConnection) referenceDatabase.getConnection()).createStatement( - ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); + ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY) ) { Data data = (Data) missingObject; @@ -88,7 +88,7 @@ public Change[] fixMissing(DatabaseObject missingObject, DiffOutputControl outpu OutputStream fileOutputStream = externalFileResource.openOutputStream(new OpenOptions()); OutputStreamWriter outputStreamWriter = new OutputStreamWriter( fileOutputStream, GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue()); - CSVWriter outputFile = new CSVWriter(new BufferedWriter(outputStreamWriter)); + CSVWriter outputFile = new CSVWriter(new BufferedWriter(outputStreamWriter)) ) { dataTypes = new String[columnNames.size()]; diff --git a/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/UnexpectedTableChangeGenerator.java b/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/UnexpectedTableChangeGenerator.java index a1d459c2e80..4cc5913c876 100644 --- a/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/UnexpectedTableChangeGenerator.java +++ b/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/UnexpectedTableChangeGenerator.java @@ -47,7 +47,7 @@ public Change[] fixUnexpected(DatabaseObject unexpectedObject, DiffOutputControl for (Column column : unexpectedTable.getColumns()) { control.setAlreadyHandledUnexpected(column); - }; + } control.setAlreadyHandledUnexpected(unexpectedTable.getPrimaryKey()); for (Index index : unexpectedTable.getIndexes()) { diff --git a/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/UnexpectedViewChangeGenerator.java b/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/UnexpectedViewChangeGenerator.java index 008f738ef0e..3d0ddf23db1 100644 --- a/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/UnexpectedViewChangeGenerator.java +++ b/liquibase-core/src/main/java/liquibase/diff/output/changelog/core/UnexpectedViewChangeGenerator.java @@ -49,7 +49,7 @@ public Change[] fixUnexpected(DatabaseObject unexpectedObject, DiffOutputControl for (Column column : view.getColumns()) { control.setAlreadyHandledUnexpected(column); - }; + } return new Change[]{change}; diff --git a/liquibase-core/src/main/java/liquibase/diff/output/report/DiffToReport.java b/liquibase-core/src/main/java/liquibase/diff/output/report/DiffToReport.java index b1cbe0473a8..ba9ea26391e 100644 --- a/liquibase-core/src/main/java/liquibase/diff/output/report/DiffToReport.java +++ b/liquibase-core/src/main/java/liquibase/diff/output/report/DiffToReport.java @@ -6,9 +6,9 @@ import liquibase.diff.ObjectDifferences; import liquibase.diff.StringDiff; import liquibase.diff.compare.CompareControl; +import liquibase.diff.compare.DatabaseObjectCollectionComparator; import liquibase.exception.DatabaseException; import liquibase.structure.DatabaseObject; -import liquibase.structure.DatabaseObjectComparator; import liquibase.structure.core.Schema; import liquibase.util.StringUtil; @@ -28,7 +28,7 @@ public DiffToReport(DiffResult diffResult, PrintStream out) { } public void print() throws DatabaseException { - final DatabaseObjectComparator comparator = new DatabaseObjectComparator(); + final DatabaseObjectCollectionComparator comparator = new DatabaseObjectCollectionComparator(); out.println("Reference Database: " + diffResult.getReferenceSnapshot().getDatabase()); out.println("Comparison Database: " + diffResult.getComparisonSnapshot().getDatabase()); diff --git a/liquibase-core/src/main/java/liquibase/executor/AbstractExecutor.java b/liquibase-core/src/main/java/liquibase/executor/AbstractExecutor.java index b798df38e72..cfac65995f4 100644 --- a/liquibase-core/src/main/java/liquibase/executor/AbstractExecutor.java +++ b/liquibase-core/src/main/java/liquibase/executor/AbstractExecutor.java @@ -97,6 +97,7 @@ public void setResourceAccessor(ResourceAccessor resourceAccessor) { this.resourceAccessor = resourceAccessor; } + @Override public void setDatabase(Database database) { this.database = database; } diff --git a/liquibase-core/src/main/java/liquibase/executor/ExecutorService.java b/liquibase-core/src/main/java/liquibase/executor/ExecutorService.java index 117143aa178..7c5da66d1f9 100644 --- a/liquibase-core/src/main/java/liquibase/executor/ExecutorService.java +++ b/liquibase-core/src/main/java/liquibase/executor/ExecutorService.java @@ -10,7 +10,7 @@ public class ExecutorService extends AbstractPluginFactory { - private final Map executors = new ConcurrentHashMap<>(); + private final Map executors = new ConcurrentHashMap<>(); private ExecutorService() { } @@ -32,8 +32,8 @@ protected int getPriority(Executor executor, Object... args) { } - private String createKey(String executorName, Database database) { - return executorName.toLowerCase() + "#" + System.identityHashCode(database); + private Key createKey(String executorName, Database database) { + return new Key(executorName, database); } private Executor getExecutorValue(String executorName, Database database) throws UnexpectedLiquibaseException { @@ -117,4 +117,44 @@ public void clearExecutor(String name, Database database) { public void reset() { executors.clear(); } + + private static class Key { + private final String executorName; + private final Database database; + + Key(String executorName, Database database) { + this.executorName = normalizeExecutorName(executorName); + this.database = database; + } + + private String normalizeExecutorName(String executorName) { + return executorName.toLowerCase(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Key key = (Key) o; + return Objects.equals(executorName, key.executorName) + && database == key.database; // equality by reference to be consistent with hashCode + } + + @Override + public int hashCode() { + return Objects.hash( + executorName, + // this class already relied on identity hash code. It bypasses e.g. AbstractJdbcDatabase's hashCode + System.identityHashCode(database) + ); + } + + @Override + public String toString() { + return "Key{" + + "executorName='" + executorName + '\'' + + ", database=" + database + + '}'; + } + } } diff --git a/liquibase-core/src/main/java/liquibase/executor/jvm/JdbcExecutor.java b/liquibase-core/src/main/java/liquibase/executor/jvm/JdbcExecutor.java index cf17fc9d81c..08b9638f32a 100644 --- a/liquibase-core/src/main/java/liquibase/executor/jvm/JdbcExecutor.java +++ b/liquibase-core/src/main/java/liquibase/executor/jvm/JdbcExecutor.java @@ -185,7 +185,7 @@ public Object query(final SqlStatement sql, final ResultSetExtractor rse, final String finalSql = applyVisitors((RawParameterizedSqlStatement) sql, sqlVisitors); - try (PreparedStatement pstmt = factory.create(finalSql);) { + try (PreparedStatement pstmt = factory.create(finalSql)) { final List parameters = ((RawParameterizedSqlStatement) sql).getParameters(); for (int i = 0; i < parameters.size(); i++) { pstmt.setObject(i, parameters.get(0)); diff --git a/liquibase-core/src/main/java/liquibase/hub/core/MockHubService.java b/liquibase-core/src/main/java/liquibase/hub/core/MockHubService.java index b4b3def74e1..bda0ab81a5a 100644 --- a/liquibase-core/src/main/java/liquibase/hub/core/MockHubService.java +++ b/liquibase-core/src/main/java/liquibase/hub/core/MockHubService.java @@ -58,6 +58,7 @@ public Project createProject(Project project) { return new Project().setName("Project 1"); } + @Override public HubChangeLog createChangeLog(HubChangeLog hubChangeLog) throws LiquibaseException { if (randomUUID == null) { randomUUID = UUID.randomUUID(); diff --git a/liquibase-core/src/main/java/liquibase/hub/model/Connection.java b/liquibase-core/src/main/java/liquibase/hub/model/Connection.java index 71d7665c4df..c9568e716a5 100644 --- a/liquibase-core/src/main/java/liquibase/hub/model/Connection.java +++ b/liquibase-core/src/main/java/liquibase/hub/model/Connection.java @@ -15,6 +15,7 @@ public class Connection implements HubModel { private Project project; + @Override public UUID getId() { return id; } diff --git a/liquibase-core/src/main/java/liquibase/integration/commandline/CommandLineUtils.java b/liquibase-core/src/main/java/liquibase/integration/commandline/CommandLineUtils.java index 0b9f4e3a71d..aa96d2f668f 100644 --- a/liquibase-core/src/main/java/liquibase/integration/commandline/CommandLineUtils.java +++ b/liquibase-core/src/main/java/liquibase/integration/commandline/CommandLineUtils.java @@ -66,6 +66,7 @@ public static Database createDatabaseObject(ClassLoader classLoader, } @SuppressWarnings("java:S2095") + @Deprecated public static Database createDatabaseObject(ResourceAccessor resourceAccessor, String url, String username, diff --git a/liquibase-core/src/main/java/liquibase/integration/servlet/GenericServletListener.java b/liquibase-core/src/main/java/liquibase/integration/servlet/GenericServletListener.java index 3c24ab8ee06..b5e96451ccf 100644 --- a/liquibase-core/src/main/java/liquibase/integration/servlet/GenericServletListener.java +++ b/liquibase-core/src/main/java/liquibase/integration/servlet/GenericServletListener.java @@ -178,6 +178,7 @@ private boolean checkPreconditions(GenericServletWrapper.ServletContext servletC machine = machine.trim(); if (hostName.equalsIgnoreCase(machine)) { shouldRun = true; + break; } } } else if (machineExcludes != null) { @@ -186,6 +187,7 @@ private boolean checkPreconditions(GenericServletWrapper.ServletContext servletC machine = machine.trim(); if (hostName.equalsIgnoreCase(machine)) { shouldRun = false; + break; } } } diff --git a/liquibase-core/src/main/java/liquibase/io/EmptyLineAndCommentSkippingInputStream.java b/liquibase-core/src/main/java/liquibase/io/EmptyLineAndCommentSkippingInputStream.java index 0b2c1c36fd2..f174252e0ff 100644 --- a/liquibase-core/src/main/java/liquibase/io/EmptyLineAndCommentSkippingInputStream.java +++ b/liquibase-core/src/main/java/liquibase/io/EmptyLineAndCommentSkippingInputStream.java @@ -42,7 +42,7 @@ private int read(final int lastRead, final boolean lookAhead) throws IOException if (commentSkipEnabled && (read == this.commentLineStartsWith.toCharArray()[0]) && (lastRead == '\n' || lastRead < 0)) { while ((((read = super.read())) != '\n') && (read != '\r') && (read > 0)) { - ;//keep looking + //keep looking } } diff --git a/liquibase-core/src/main/java/liquibase/lockservice/LockServiceFactory.java b/liquibase-core/src/main/java/liquibase/lockservice/LockServiceFactory.java index e00bc514e9a..1c4490d9447 100644 --- a/liquibase-core/src/main/java/liquibase/lockservice/LockServiceFactory.java +++ b/liquibase-core/src/main/java/liquibase/lockservice/LockServiceFactory.java @@ -55,7 +55,7 @@ public LockService getLockService(Database database) { SortedSet foundServices = new TreeSet<>(new Comparator() { @Override public int compare(LockService o1, LockService o2) { - return -1 * Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority()); + return -1 * Integer.compare(o1.getPriority(), o2.getPriority()); } }); diff --git a/liquibase-core/src/main/java/liquibase/lockservice/StandardLockService.java b/liquibase-core/src/main/java/liquibase/lockservice/StandardLockService.java index 290324870da..42d2718b12a 100644 --- a/liquibase-core/src/main/java/liquibase/lockservice/StandardLockService.java +++ b/liquibase-core/src/main/java/liquibase/lockservice/StandardLockService.java @@ -133,33 +133,8 @@ public void init() throws DatabaseException { database.commit(); } - if (executor.updatesDatabase() && (database instanceof DerbyDatabase) && ((DerbyDatabase) database) - .supportsBooleanDataType() || database.getClass().isAssignableFrom(DB2Database.class) && ((DB2Database) database) - .supportsBooleanDataType()) { - //check if the changelog table is of an old smallint vs. boolean format - String lockTable = database.escapeTableName( - database.getLiquibaseCatalogName(), - database.getLiquibaseSchemaName(), - database.getDatabaseChangeLogLockTableName() - ); - Object obj = executor.queryForObject( - new RawSqlStatement( - "SELECT MIN(locked) AS test FROM " + lockTable + " FETCH FIRST ROW ONLY" - ), Object.class - ); - if (!(obj instanceof Boolean)) { //wrong type, need to recreate table - executor.execute( - new DropTableStatement( - database.getLiquibaseCatalogName(), - database.getLiquibaseSchemaName(), - database.getDatabaseChangeLogLockTableName(), - false - ) - ); - executor.execute(new CreateDatabaseChangeLogLockTableStatement()); - executor.execute(new InitializeDatabaseChangeLogLockTableStatement()); - } - } + handleOldChangelogTableFormat(executor); + break; } catch (Exception e) { if (i == maxIterations - 1) { throw e; @@ -179,6 +154,36 @@ public void init() throws DatabaseException { } } + private void handleOldChangelogTableFormat(Executor executor) throws DatabaseException { + if (executor.updatesDatabase() && (database instanceof DerbyDatabase) && ((DerbyDatabase) database) + .supportsBooleanDataType() || database.getClass().isAssignableFrom(DB2Database.class) && ((DB2Database) database) + .supportsBooleanDataType()) { + //check if the changelog table is of an old smallint vs. boolean format + String lockTable = database.escapeTableName( + database.getLiquibaseCatalogName(), + database.getLiquibaseSchemaName(), + database.getDatabaseChangeLogLockTableName() + ); + Object obj = executor.queryForObject( + new RawSqlStatement( + "SELECT MIN(locked) AS test FROM " + lockTable + " FETCH FIRST ROW ONLY" + ), Object.class + ); + if (!(obj instanceof Boolean)) { //wrong type, need to recreate table + executor.execute( + new DropTableStatement( + database.getLiquibaseCatalogName(), + database.getLiquibaseSchemaName(), + database.getDatabaseChangeLogLockTableName(), + false + ) + ); + executor.execute(new CreateDatabaseChangeLogLockTableStatement()); + executor.execute(new InitializeDatabaseChangeLogLockTableStatement()); + } + } + } + public boolean isDatabaseChangeLogLockTableInitialized(final boolean tableJustCreated) { return isDatabaseChangeLogLockTableInitialized(tableJustCreated, false); } diff --git a/liquibase-core/src/main/java/liquibase/parser/NamespaceDetailsFactory.java b/liquibase-core/src/main/java/liquibase/parser/NamespaceDetailsFactory.java index 8c8d69dfe91..75e49459bf0 100644 --- a/liquibase-core/src/main/java/liquibase/parser/NamespaceDetailsFactory.java +++ b/liquibase-core/src/main/java/liquibase/parser/NamespaceDetailsFactory.java @@ -82,7 +82,7 @@ public void unregister(NamespaceDetails namespaceDetails) { private class SerializerNamespaceDetailsComparator implements Comparator { @Override public int compare(NamespaceDetails o1, NamespaceDetails o2) { - return Integer.valueOf(o2.getPriority()).compareTo(o1.getPriority()); + return Integer.compare(o2.getPriority(), o1.getPriority()); } } } diff --git a/liquibase-core/src/main/java/liquibase/parser/SnapshotParserFactory.java b/liquibase-core/src/main/java/liquibase/parser/SnapshotParserFactory.java index 019171783d3..c70dbc8c8ed 100644 --- a/liquibase-core/src/main/java/liquibase/parser/SnapshotParserFactory.java +++ b/liquibase-core/src/main/java/liquibase/parser/SnapshotParserFactory.java @@ -41,7 +41,7 @@ private SnapshotParserFactory() { snapshotParserComparator = new Comparator() { @Override public int compare(SnapshotParser o1, SnapshotParser o2) { - return Integer.valueOf(o2.getPriority()).compareTo(o1.getPriority()); + return Integer.compare(o2.getPriority(), o1.getPriority()); } }; diff --git a/liquibase-core/src/main/java/liquibase/resource/DirectoryPathHandler.java b/liquibase-core/src/main/java/liquibase/resource/DirectoryPathHandler.java index 711564aa579..32c7822d2fe 100644 --- a/liquibase-core/src/main/java/liquibase/resource/DirectoryPathHandler.java +++ b/liquibase-core/src/main/java/liquibase/resource/DirectoryPathHandler.java @@ -11,6 +11,7 @@ public class DirectoryPathHandler extends AbstractPathHandler { /** * Returns {@link #PRIORITY_DEFAULT} for all paths except for ones that are for a non-"file:" protocol. */ + @Override public int getPriority(String root) { if (root == null) { return PRIORITY_NOT_APPLICABLE; @@ -27,6 +28,7 @@ public int getPriority(String root) { } } + @Override public ResourceAccessor getResourceAccessor(String root) throws FileNotFoundException { root = root .replace("file:", "") diff --git a/liquibase-core/src/main/java/liquibase/resource/ZipPathHandler.java b/liquibase-core/src/main/java/liquibase/resource/ZipPathHandler.java index f93c133fe3f..0f10edea1ec 100644 --- a/liquibase-core/src/main/java/liquibase/resource/ZipPathHandler.java +++ b/liquibase-core/src/main/java/liquibase/resource/ZipPathHandler.java @@ -17,6 +17,7 @@ public class ZipPathHandler extends AbstractPathHandler { /** * Returns {@link #PRIORITY_SPECIALIZED} for all "jar:file:" or files that end in ".jar" or ".zip" */ + @Override public int getPriority(String root) { if (root == null) { return PRIORITY_NOT_APPLICABLE; @@ -33,6 +34,7 @@ public int getPriority(String root) { return PRIORITY_NOT_APPLICABLE; } + @Override public ResourceAccessor getResourceAccessor(String root) throws FileNotFoundException { root = root.replace("jar:", "").replace("!/", ""); diff --git a/liquibase-core/src/main/java/liquibase/sdk/resource/MockResource.java b/liquibase-core/src/main/java/liquibase/sdk/resource/MockResource.java index b5b5f6e989a..2fcf966c58a 100644 --- a/liquibase-core/src/main/java/liquibase/sdk/resource/MockResource.java +++ b/liquibase-core/src/main/java/liquibase/sdk/resource/MockResource.java @@ -27,6 +27,7 @@ public Resource resolve(String other) { return new MockResource(resolvePath(other), "Resource relative to " + getPath()); } + @Override public Resource resolveSibling(String other) { return new MockResource(resolveSiblingPath(other), "Sibling resource to " + getPath()); } diff --git a/liquibase-core/src/main/java/liquibase/serializer/AbstractLiquibaseSerializable.java b/liquibase-core/src/main/java/liquibase/serializer/AbstractLiquibaseSerializable.java index 8d4fbb8f204..1c9d13ad420 100644 --- a/liquibase-core/src/main/java/liquibase/serializer/AbstractLiquibaseSerializable.java +++ b/liquibase-core/src/main/java/liquibase/serializer/AbstractLiquibaseSerializable.java @@ -18,6 +18,7 @@ public abstract class AbstractLiquibaseSerializable implements LiquibaseSerializ private Set serializableFields; + @Override public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException { for (ParsedNode childNode : parsedNode.getChildren()) { if (!shouldAutoLoad(childNode)) { diff --git a/liquibase-core/src/main/java/liquibase/serializer/ChangeLogSerializerFactory.java b/liquibase-core/src/main/java/liquibase/serializer/ChangeLogSerializerFactory.java index 0da76d05069..0784409a4c6 100644 --- a/liquibase-core/src/main/java/liquibase/serializer/ChangeLogSerializerFactory.java +++ b/liquibase-core/src/main/java/liquibase/serializer/ChangeLogSerializerFactory.java @@ -56,11 +56,7 @@ public ChangeLogSerializer getSerializer(String fileNameOrExtension) { public void register(ChangeLogSerializer changeLogSerializer) { for (String extension : changeLogSerializer.getValidFileExtensions()) { - List changeLogSerializers = serializers.get(extension); - if (changeLogSerializers == null) { - changeLogSerializers = new ArrayList<>(); - serializers.put(extension, changeLogSerializers); - } + List changeLogSerializers = serializers.computeIfAbsent(extension, k -> new ArrayList<>()); changeLogSerializers.add(changeLogSerializer); Collections.sort(changeLogSerializers, PrioritizedService.COMPARATOR); } diff --git a/liquibase-core/src/main/java/liquibase/serializer/SnapshotSerializerFactory.java b/liquibase-core/src/main/java/liquibase/serializer/SnapshotSerializerFactory.java index 1c8b9c3db81..f2ef1b02937 100644 --- a/liquibase-core/src/main/java/liquibase/serializer/SnapshotSerializerFactory.java +++ b/liquibase-core/src/main/java/liquibase/serializer/SnapshotSerializerFactory.java @@ -56,11 +56,7 @@ public SnapshotSerializer getSerializer(String fileNameOrExtension) { public void register(SnapshotSerializer snapshotSerializer) { for (String extension : snapshotSerializer.getValidFileExtensions()) { - List snapshotSerializers = serializers.get(extension); - if (snapshotSerializers == null) { - snapshotSerializers = new ArrayList<>(); - serializers.put(extension, snapshotSerializers); - } + List snapshotSerializers = serializers.computeIfAbsent(extension, k -> new ArrayList<>()); snapshotSerializers.add(snapshotSerializer); Collections.sort(snapshotSerializers, PrioritizedService.COMPARATOR); } diff --git a/liquibase-core/src/main/java/liquibase/serializer/core/yaml/YamlChangeLogSerializer.java b/liquibase-core/src/main/java/liquibase/serializer/core/yaml/YamlChangeLogSerializer.java index 52d6b980510..9eade3550ec 100644 --- a/liquibase-core/src/main/java/liquibase/serializer/core/yaml/YamlChangeLogSerializer.java +++ b/liquibase-core/src/main/java/liquibase/serializer/core/yaml/YamlChangeLogSerializer.java @@ -11,6 +11,7 @@ public class YamlChangeLogSerializer extends YamlSerializer implements ChangeLogSerializer { + @Override protected Comparator getComparator(LiquibaseSerializable object) { if (object instanceof ChangeSet) { return new ChangeSetComparator(); diff --git a/liquibase-core/src/main/java/liquibase/serializer/core/yaml/YamlSnapshotSerializer.java b/liquibase-core/src/main/java/liquibase/serializer/core/yaml/YamlSnapshotSerializer.java index 2772da4137b..e13da1a9ba6 100644 --- a/liquibase-core/src/main/java/liquibase/serializer/core/yaml/YamlSnapshotSerializer.java +++ b/liquibase-core/src/main/java/liquibase/serializer/core/yaml/YamlSnapshotSerializer.java @@ -1,6 +1,7 @@ package liquibase.serializer.core.yaml; import liquibase.GlobalConfiguration; +import liquibase.diff.compare.DatabaseObjectCollectionComparator; import liquibase.exception.UnexpectedLiquibaseException; import liquibase.serializer.LiquibaseSerializable; import liquibase.serializer.SnapshotSerializer; @@ -10,7 +11,6 @@ import liquibase.statement.SequenceNextValueFunction; import liquibase.structure.DatabaseObject; import liquibase.structure.DatabaseObjectCollection; -import liquibase.structure.DatabaseObjectComparator; import liquibase.structure.core.Column; import liquibase.util.ISODateFormat; import liquibase.util.StringUtil; @@ -86,7 +86,7 @@ protected Object toMap(final LiquibaseSerializable object) { SortedMap returnMap = new TreeMap<>(); for (Map.Entry, Set> entry : ((DatabaseObjectCollection) object).toMap().entrySet()) { ArrayList value = new ArrayList(entry.getValue()); - Collections.sort(value, new DatabaseObjectComparator()); + Collections.sort(value, new DatabaseObjectCollectionComparator()); returnMap.put(entry.getKey().getName(), value); } return returnMap; @@ -94,6 +94,7 @@ protected Object toMap(final LiquibaseSerializable object) { return super.toMap(object); } + @Override protected LiquibaseRepresenter getLiquibaseRepresenter() { return new SnapshotLiquibaseRepresenter(); } @@ -105,6 +106,7 @@ public int getPriority() { public static class SnapshotLiquibaseRepresenter extends LiquibaseRepresenter { + @Override protected void init() { multiRepresenters.put(DatabaseFunction.class, new TypeStoringAsStringRepresenter()); multiRepresenters.put(SequenceNextValueFunction.class, new TypeStoringAsStringRepresenter()); diff --git a/liquibase-core/src/main/java/liquibase/snapshot/DatabaseSnapshot.java b/liquibase-core/src/main/java/liquibase/snapshot/DatabaseSnapshot.java index 864f893a06b..1ff02078d25 100644 --- a/liquibase-core/src/main/java/liquibase/snapshot/DatabaseSnapshot.java +++ b/liquibase-core/src/main/java/liquibase/snapshot/DatabaseSnapshot.java @@ -312,11 +312,7 @@ protected T include(T example) throws DatabaseExcepti T object = chain.snapshot(example, this); if (object == null) { - Set collection = knownNull.get(example.getClass()); - if (collection == null) { - collection = new HashSet<>(); - knownNull.put(example.getClass(), collection); - } + Set collection = knownNull.computeIfAbsent(example.getClass(), k -> new HashSet<>()); collection.add(example); if (example instanceof Schema) { diff --git a/liquibase-core/src/main/java/liquibase/snapshot/ResultSetCache.java b/liquibase-core/src/main/java/liquibase/snapshot/ResultSetCache.java index 4ff868b2e40..796f3b2a3fa 100644 --- a/liquibase-core/src/main/java/liquibase/snapshot/ResultSetCache.java +++ b/liquibase-core/src/main/java/liquibase/snapshot/ResultSetCache.java @@ -31,11 +31,7 @@ public List get(ResultSetExtractor resultSetExtractor) throws Databas String schemaKey = resultSetExtractor.wantedKeyParameters().createSchemaKey(resultSetExtractor.database); - Map> cache = cacheBySchema.get(schemaKey); - if (cache == null) { - cache = new HashMap<>(); - cacheBySchema.put(schemaKey, cache); - } + Map> cache = cacheBySchema.computeIfAbsent(schemaKey, k -> new HashMap<>()); if (cache.containsKey(wantedKey)) { return cache.get(wantedKey); @@ -78,11 +74,7 @@ public List get(ResultSetExtractor resultSetExtractor) throws Databas String rowSchema = CatalogAndSchema.CatalogAndSchemaCase.ORIGINAL_CASE. equals(resultSetExtractor.database.getSchemaAndCatalogCase())?resultSetExtractor.getSchemaKey(row): resultSetExtractor.getSchemaKey(row).toLowerCase(); - cache = cacheBySchema.get(rowSchema); - if (cache == null) { - cache = new HashMap>(); - cacheBySchema.put(rowSchema, cache); - } + cache = cacheBySchema.computeIfAbsent(rowSchema, k -> new HashMap>()); } if (!cache.containsKey(rowKey)) { cache.put(rowKey, new ArrayList()); diff --git a/liquibase-core/src/main/java/liquibase/snapshot/SnapshotGeneratorComparator.java b/liquibase-core/src/main/java/liquibase/snapshot/SnapshotGeneratorComparator.java index 8ab85d2886f..f93db624dc1 100644 --- a/liquibase-core/src/main/java/liquibase/snapshot/SnapshotGeneratorComparator.java +++ b/liquibase-core/src/main/java/liquibase/snapshot/SnapshotGeneratorComparator.java @@ -17,7 +17,7 @@ public SnapshotGeneratorComparator(Class objectType, D @Override public int compare(SnapshotGenerator o1, SnapshotGenerator o2) { - int result = -1 * Integer.valueOf(o1.getPriority(objectType, database)).compareTo(o2.getPriority(objectType, database)); + int result = -1 * Integer.compare(o1.getPriority(objectType, database), o2.getPriority(objectType, database)); if (result == 0) { return o1.getClass().getName().compareTo(o2.getClass().getName()); } diff --git a/liquibase-core/src/main/java/liquibase/snapshot/jvm/UniqueConstraintSnapshotGenerator.java b/liquibase-core/src/main/java/liquibase/snapshot/jvm/UniqueConstraintSnapshotGenerator.java index abfc2bbaa33..3b8036f15b0 100644 --- a/liquibase-core/src/main/java/liquibase/snapshot/jvm/UniqueConstraintSnapshotGenerator.java +++ b/liquibase-core/src/main/java/liquibase/snapshot/jvm/UniqueConstraintSnapshotGenerator.java @@ -406,11 +406,7 @@ protected List listConstraints(Table table, DatabaseSnapshot snapshot snapshot.setScratchData(cacheKey, columnCache); for (Map row : rows) { String key = getCacheKey(row, database); - List> constraintRows = columnCache.get(key); - if (constraintRows == null) { - constraintRows = new ArrayList<>(); - columnCache.put(key, constraintRows); - } + List> constraintRows = columnCache.computeIfAbsent(key, k -> new ArrayList<>()); constraintRows.add(row); } diff --git a/liquibase-core/src/main/java/liquibase/sql/visitor/AbstractSqlVisitor.java b/liquibase-core/src/main/java/liquibase/sql/visitor/AbstractSqlVisitor.java index 2ea3bcfda2e..eec78fd6ef2 100644 --- a/liquibase-core/src/main/java/liquibase/sql/visitor/AbstractSqlVisitor.java +++ b/liquibase-core/src/main/java/liquibase/sql/visitor/AbstractSqlVisitor.java @@ -66,10 +66,12 @@ public void setContextFilter(ContextExpression contextFilter) { this.contextFilter = contextFilter; } + @Override public Labels getLabels() { return labels; } + @Override public void setLabels(Labels labels) { this.labels = labels; } diff --git a/liquibase-core/src/main/java/liquibase/sqlgenerator/SqlGeneratorComparator.java b/liquibase-core/src/main/java/liquibase/sqlgenerator/SqlGeneratorComparator.java index 78404151796..470abbba3fa 100644 --- a/liquibase-core/src/main/java/liquibase/sqlgenerator/SqlGeneratorComparator.java +++ b/liquibase-core/src/main/java/liquibase/sqlgenerator/SqlGeneratorComparator.java @@ -5,6 +5,6 @@ class SqlGeneratorComparator implements Comparator { @Override public int compare(SqlGenerator o1, SqlGenerator o2) { - return -1 * Integer.valueOf(o1.getPriority()).compareTo(o2.getPriority()); + return -1 * Integer.compare(o1.getPriority(), o2.getPriority()); } } diff --git a/liquibase-core/src/main/java/liquibase/sqlgenerator/core/AddPrimaryKeyGenerator.java b/liquibase-core/src/main/java/liquibase/sqlgenerator/core/AddPrimaryKeyGenerator.java index ab946c9969c..1d319c325cc 100644 --- a/liquibase-core/src/main/java/liquibase/sqlgenerator/core/AddPrimaryKeyGenerator.java +++ b/liquibase-core/src/main/java/liquibase/sqlgenerator/core/AddPrimaryKeyGenerator.java @@ -66,7 +66,7 @@ public Sql[] generateSql(AddPrimaryKeyStatement statement, Database database, Sq if (database instanceof MSSQLDatabase) { sql += " ON "+statement.getTablespace(); } else if ((database instanceof AbstractDb2Database) || (database instanceof SybaseASADatabase)) { - ; //not supported + //not supported } else { sql += " USING INDEX TABLESPACE "+statement.getTablespace(); } diff --git a/liquibase-core/src/main/java/liquibase/sqlgenerator/core/AddUniqueConstraintGenerator.java b/liquibase-core/src/main/java/liquibase/sqlgenerator/core/AddUniqueConstraintGenerator.java index bb7d53a9958..9a0c179a1df 100644 --- a/liquibase-core/src/main/java/liquibase/sqlgenerator/core/AddUniqueConstraintGenerator.java +++ b/liquibase-core/src/main/java/liquibase/sqlgenerator/core/AddUniqueConstraintGenerator.java @@ -83,7 +83,7 @@ public Sql[] generateSql(AddUniqueConstraintStatement statement, Database databa sql += " ON " + statement.getTablespace(); } else if ((database instanceof AbstractDb2Database) || (database instanceof SybaseASADatabase) || (database instanceof InformixDatabase)) { - ; //not supported + //not supported } else if (database instanceof OracleDatabase) { /* * In Oracle, you can use only exactly one of these clauses: diff --git a/liquibase-core/src/main/java/liquibase/structure/DatabaseObjectCollection.java b/liquibase-core/src/main/java/liquibase/structure/DatabaseObjectCollection.java index dae92c362b9..364d9670495 100644 --- a/liquibase-core/src/main/java/liquibase/structure/DatabaseObjectCollection.java +++ b/liquibase-core/src/main/java/liquibase/structure/DatabaseObjectCollection.java @@ -2,6 +2,7 @@ import liquibase.database.Database; import liquibase.diff.compare.CompareControl; +import liquibase.diff.compare.DatabaseObjectCollectionComparator; import liquibase.diff.compare.DatabaseObjectComparatorFactory; import liquibase.exception.UnexpectedLiquibaseException; import liquibase.parser.core.ParsedNode; @@ -48,7 +49,7 @@ public Set getSerializableFields() { @Override public Object getSerializableFieldValue(String field) { - SortedSet objects = new TreeSet<>(new DatabaseObjectComparator()); + SortedSet objects = new TreeSet<>(new DatabaseObjectCollectionComparator()); try { Map> map = cache.get(Class.forName(field)); if (map == null) { @@ -72,20 +73,12 @@ public void add(DatabaseObject databaseObject) { if (databaseObject == null) { return; } - Map> collectionMap = cache.get(databaseObject.getClass()); - if (collectionMap == null) { - collectionMap = new HashMap<>(); - cache.put(databaseObject.getClass(), collectionMap); - } + Map> collectionMap = cache.computeIfAbsent(databaseObject.getClass(), k -> new HashMap<>()); String[] hashes = DatabaseObjectComparatorFactory.getInstance().hash(databaseObject, null, database); for (String hash : hashes) { - Set collection = collectionMap.get(hash); - if (collection == null) { - collection = new HashSet<>(); - collectionMap.put(hash, collection); - } + Set collection = collectionMap.computeIfAbsent(hash, k -> new HashSet<>()); collection.add(databaseObject); } } diff --git a/liquibase-core/src/main/java/liquibase/structure/core/Catalog.java b/liquibase-core/src/main/java/liquibase/structure/core/Catalog.java index ddd3ac84ec8..d95e93ae578 100644 --- a/liquibase-core/src/main/java/liquibase/structure/core/Catalog.java +++ b/liquibase-core/src/main/java/liquibase/structure/core/Catalog.java @@ -71,11 +71,7 @@ public void addDatabaseObject(DatabaseObject databaseObject) { if (databaseObject == null) { return; } - Set objects = this.getObjects().get(databaseObject.getClass()); - if (objects == null) { - objects = new HashSet<>(); - this.getObjects().put(databaseObject.getClass(), objects); - } + Set objects = this.getObjects().computeIfAbsent(databaseObject.getClass(), k -> new HashSet<>()); objects.add(databaseObject); } diff --git a/liquibase-core/src/main/java/liquibase/structure/core/Relation.java b/liquibase-core/src/main/java/liquibase/structure/core/Relation.java index eb93416255b..de5819eeafb 100644 --- a/liquibase-core/src/main/java/liquibase/structure/core/Relation.java +++ b/liquibase-core/src/main/java/liquibase/structure/core/Relation.java @@ -101,6 +101,7 @@ public Relation setSchema(String catalog, String schema) { return setSchema(new Schema(catalog, schema)); } + @Override public int compareTo(Object o) { Relation that = (Relation) o; int returnValue = 0; diff --git a/liquibase-core/src/main/java/liquibase/structure/core/Schema.java b/liquibase-core/src/main/java/liquibase/structure/core/Schema.java index 0cf0b506706..4208bf340b4 100644 --- a/liquibase-core/src/main/java/liquibase/structure/core/Schema.java +++ b/liquibase-core/src/main/java/liquibase/structure/core/Schema.java @@ -138,11 +138,7 @@ public void addDatabaseObject(DatabaseObject databaseObject) { if (databaseObject == null) { return; } - Set objects = this.getObjects().get(databaseObject.getClass()); - if (objects == null) { - objects = new HashSet<>(); - this.getObjects().put(databaseObject.getClass(), objects); - } + Set objects = this.getObjects().computeIfAbsent(databaseObject.getClass(), k -> new HashSet<>()); objects.add(databaseObject); } diff --git a/liquibase-core/src/main/java/liquibase/structure/core/StoredDatabaseLogic.java b/liquibase-core/src/main/java/liquibase/structure/core/StoredDatabaseLogic.java index 136c1efdee0..965211ae731 100644 --- a/liquibase-core/src/main/java/liquibase/structure/core/StoredDatabaseLogic.java +++ b/liquibase-core/src/main/java/liquibase/structure/core/StoredDatabaseLogic.java @@ -1,5 +1,6 @@ package liquibase.structure.core; +import liquibase.diff.compare.DatabaseObjectCollectionComparator; import liquibase.license.LicenseServiceUtils; import liquibase.structure.AbstractDatabaseObject; import liquibase.structure.DatabaseObject; @@ -57,6 +58,10 @@ public T setBody(String body) { return (T) this; } + public DatabaseObjectCollectionComparator getDbObjectComparator() { + return null; + } + @Override public boolean equals(Object obj) { if (this == obj) return true; diff --git a/liquibase-core/src/main/java/liquibase/structure/core/Table.java b/liquibase-core/src/main/java/liquibase/structure/core/Table.java index 4309c577228..88dfd75dc5b 100644 --- a/liquibase-core/src/main/java/liquibase/structure/core/Table.java +++ b/liquibase-core/src/main/java/liquibase/structure/core/Table.java @@ -38,10 +38,12 @@ public List getOutgoingForeignKeys() { return ((fkList == null) ? new ArrayList(0) : fkList); } + @Override public List getIndexes() { return getAttribute("indexes", List.class); } + @Override public List getUniqueConstraints() { return getAttribute("uniqueConstraints", List.class); } diff --git a/liquibase-core/src/main/java/liquibase/util/FileUtil.java b/liquibase-core/src/main/java/liquibase/util/FileUtil.java index 3cd117443dc..c7419a05015 100644 --- a/liquibase-core/src/main/java/liquibase/util/FileUtil.java +++ b/liquibase-core/src/main/java/liquibase/util/FileUtil.java @@ -16,7 +16,7 @@ public static String getContents(File file) throws IOException { return null; } try ( - FileInputStream fileInputStream = new FileInputStream(file); + FileInputStream fileInputStream = new FileInputStream(file) ) { return StreamUtil.readStreamAsString(fileInputStream); diff --git a/liquibase-core/src/main/java/liquibase/util/MD5Util.java b/liquibase-core/src/main/java/liquibase/util/MD5Util.java index 4d55aaccc47..548aacb8ebb 100644 --- a/liquibase-core/src/main/java/liquibase/util/MD5Util.java +++ b/liquibase-core/src/main/java/liquibase/util/MD5Util.java @@ -57,7 +57,7 @@ public static String computeMD5(InputStream stream) { DigestInputStream digestStream = new DigestInputStream(stream, digest); byte[] buf = new byte[20480]; while (digestStream.read(buf) != -1) { - ; //digest is updating + //digest is updating } } catch (Exception e) { throw new RuntimeException(e); diff --git a/liquibase-core/src/main/java/liquibase/util/ObjectUtil.java b/liquibase-core/src/main/java/liquibase/util/ObjectUtil.java index b0a7f561e1d..00baa0e34b2 100644 --- a/liquibase-core/src/main/java/liquibase/util/ObjectUtil.java +++ b/liquibase-core/src/main/java/liquibase/util/ObjectUtil.java @@ -242,13 +242,7 @@ private static Method getWriteMethod(Object object, String propertyName) { * @return a list of methods belonging to the class of the object */ private static Method[] getMethods(Object object) { - Method[] methods = methodCache.get(object.getClass()); - - if (methods == null) { - methods = object.getClass().getMethods(); - methodCache.put(object.getClass(), methods); - } - return methods; + return methodCache.computeIfAbsent(object.getClass(), k -> object.getClass().getMethods()); } /** diff --git a/liquibase-core/src/main/java/liquibase/util/csv/CSVWriter.java b/liquibase-core/src/main/java/liquibase/util/csv/CSVWriter.java index 5fa21d699c2..ac3df5637d3 100644 --- a/liquibase-core/src/main/java/liquibase/util/csv/CSVWriter.java +++ b/liquibase-core/src/main/java/liquibase/util/csv/CSVWriter.java @@ -23,6 +23,7 @@ public void writeNext(String[] nextLine) { delegate.writeNext(nextLine); } + @Override public void flush() throws IOException { delegate.flush(); } diff --git a/liquibase-core/src/main/java/liquibase/util/xml/DefaultXmlWriter.java b/liquibase-core/src/main/java/liquibase/util/xml/DefaultXmlWriter.java index d22ec135524..18ea509f7f8 100644 --- a/liquibase-core/src/main/java/liquibase/util/xml/DefaultXmlWriter.java +++ b/liquibase-core/src/main/java/liquibase/util/xml/DefaultXmlWriter.java @@ -23,7 +23,7 @@ public void write(Document doc, OutputStream outputStream) throws IOException { try { factory.setAttribute("indent-number", 4); } catch (Exception e) { - ; //guess we can't set it, that's ok + //guess we can't set it, that's ok } Transformer transformer = factory.newTransformer(); diff --git a/liquibase-core/src/main/resources/META-INF/services/liquibase.command.CommandStep b/liquibase-core/src/main/resources/META-INF/services/liquibase.command.CommandStep index bbe41212c38..6bbab0ad936 100644 --- a/liquibase-core/src/main/resources/META-INF/services/liquibase.command.CommandStep +++ b/liquibase-core/src/main/resources/META-INF/services/liquibase.command.CommandStep @@ -5,6 +5,7 @@ liquibase.command.core.ChangelogSyncToTagCommandStep liquibase.command.core.ChangelogSyncToTagSqlCommandStep liquibase.command.core.ClearChecksumsCommandStep liquibase.command.core.DbDocCommandStep +liquibase.command.core.DbUrlConnectionCommandStep liquibase.command.core.DeactivateChangelogCommandStep liquibase.command.core.DiffChangelogCommandStep liquibase.command.core.DiffCommandStep diff --git a/liquibase-core/src/test/java/liquibase/command/core/MockCommandStep.java b/liquibase-core/src/test/java/liquibase/command/core/MockCommandStep.java index 520933c7a8d..e31d94a071b 100644 --- a/liquibase-core/src/test/java/liquibase/command/core/MockCommandStep.java +++ b/liquibase-core/src/test/java/liquibase/command/core/MockCommandStep.java @@ -9,10 +9,12 @@ public class MockCommandStep extends AbstractCommandStep { public static MockCommandStep logic; + public static final String[] COMMAND_NAME = {"mock"}; + public static final CommandArgumentDefinition VALUE_1_ARG; static { - CommandBuilder builder = new CommandBuilder(new String[]{"mock"}); + CommandBuilder builder = new CommandBuilder(COMMAND_NAME); VALUE_1_ARG = builder.argument("value1", String.class) .description("Value 1").build(); @@ -27,7 +29,7 @@ public static void reset() { @Override public String[][] defineCommandNames() { - return new String[][]{new String[] {"mock"}}; + return new String[][]{COMMAND_NAME}; } @Override diff --git a/liquibase-core/src/test/java/liquibase/verify/change/VerifyChangeClassesTest.java b/liquibase-core/src/test/java/liquibase/verify/change/VerifyChangeClassesTest.java index 460b4c39b93..acda488299c 100644 --- a/liquibase-core/src/test/java/liquibase/verify/change/VerifyChangeClassesTest.java +++ b/liquibase-core/src/test/java/liquibase/verify/change/VerifyChangeClassesTest.java @@ -227,7 +227,7 @@ public void extraParamsIsValidSql() throws Exception { Collections.sort(paramLists, new Comparator>() { @Override public int compare(List o1, List o2) { - int comp = Integer.valueOf(o1.size()).compareTo(o2.size()); + int comp = Integer.compare(o1.size(), o2.size()); if (comp == 0) { comp = StringUtil.join(o1,",").compareTo(StringUtil.join(o2, ",")); } diff --git a/liquibase-dist/pom.xml b/liquibase-dist/pom.xml index a53aff2c7cf..19071669dcc 100644 --- a/liquibase-dist/pom.xml +++ b/liquibase-dist/pom.xml @@ -20,7 +20,7 @@ 11.2.1.jre8 8.0.21 3.1.0 - 21.7.0.0 + 21.8.0.0 3.40.0.0 11.5.8.0 4.0.8.java8 @@ -76,7 +76,7 @@ net.snowflake snowflake-jdbc - 3.13.25 + 3.13.26 diff --git a/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/Liquibase Pro EULA Software License Subscription and Support Agreement.txt b/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/Liquibase Pro EULA Software License Subscription and Support Agreement.txt new file mode 100644 index 00000000000..10adb95aea8 --- /dev/null +++ b/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/Liquibase Pro EULA Software License Subscription and Support Agreement.txt @@ -0,0 +1,182 @@ +SOFTWARE LICENSE SUBSCRIPTION AND SUPPORT AGREEMENT + +PLEASE READ THIS AGREEMENT CAREFULLY BEFORE USING THIS SERVICE. + +BY USING THE SOFTWARE OR CLICKING AGREE, CUSTOMER IS AGREEING TO BE BOUND BY +THIS AGREEMENT. IF YOU ARE AGREEING TO THIS AGREEMENT ON BEHALF OF OR FOR THE +BENEFIT OF YOUR EMPLOYER OR A THIRD PARTY, THEN YOU REPRESENT AND WARRANT THAT +YOU HAVE THE NECESSARY AUTHORITY TO AGREE TO THIS AGREEMENT ON YOUR EMPLOYER'S +OR THAT THIRD PARTY'S BEHALF. + +This agreement is between Liquibase, Inc. a Delaware corporation (Liquibase) and +you, the customer entering into this agreement (Customer). The LiquibasePro +software, updates, documentation and license keys provided to Customer +(Software) are licensed and are not sold. + +SCOPE. This agreement describes the licensing of the Software and support +provided to Customer under an order. Third party contractors and majority owned +affiliates of Customer can use and access the Software under the terms of this +agreement, and Customer is responsible for each of their compliance with such +terms. + +1. LICENSE. Subject to the other terms of this agreement, Liquibase grants +Customer, under an order, a term based non-exclusive, non-transferable license +up to the license capacity purchased to use the Software only in Customer’s +internal business operations. Third party licenses delivered with the Software +may be subject to additional license rights and restrictions a set forth at +https://www.liquibase.com/licenses/liquibase_pro_tpl.html. + +2. RESTRICTIONS. Customer may not: +a. Transfer, assign, sublicense, rent the Software, create derivative works of +the Software, or use it in any type of service provider environment; +b. Reverse engineer, decompile, disassemble, or translate the Software; or +c. Evaluate the Software for the purpose of competing with Liquibase Pro or +operate the Software other than in accordance with its technical documentation. + +3. PROPRIETARY RIGHTS AND MUTUAL CONFIDENTIALITY. +a. Proprietary Rights. The Software, workflow processes, user interface, +designs and other technologies provided by Liquibase as part of the Software are +the proprietary property of Liquibase and its licensors, and all right, title and +interest in and to such items, including all associated intellectual property +rights, remain only with Liquibase and its licensors. The Software is protected +by copyright and other intellectual property laws. Customer may not remove any +product identification, copyright, trademark or other notice from the Software. +Liquibase reserves all rights not expressly granted. +b. Mutual Confidentiality. Recipient may not disclose Confidential Information +of Discloser to any third party or use the Confidential Information in +violation of this agreement. +Confidential Information means all information that is disclosed to the +recipient (Recipient) by the discloser (Discloser), and includes, among other +things: + * any and all information relating to products or services provided by a +Discloser, software code, flow charts, techniques, specifications, development +and marketing plans, strategies, and forecasts; + * as to Liquibase, the Software and the terms of this agreement, including +without limitation, all pricing information. +Confidential Information excludes information that: + * was rightfully in Recipient's possession without any obligation of +confidentiality before receipt from the Discloser; + * is or becomes a matter of public knowledge through no fault of Recipient; + * is rightfully received by Recipient from a third party without violation of +a duty of confidentiality; or + * is independently developed by or for Recipient without use or access to the +Confidential Information. + +Recipient may disclose Confidential Information if required by law, but it will +attempt to provide notice to the Discloser in advance so it may seek a +protective order. Each party acknowledges that any misuse of the other party’s +Confidential Information may cause irreparable harm for which there is no +adequate remedy at law. Either party may seek immediate injunctive relief in +such event. + +4. WARRANTY, REMEDY and DISCLAIMER. For new license purchases, Liquibase warrants +that the Software will perform in substantial accordance with its accompanying +technical documentation for a period of 60 days from the date of the order. +This warranty will not apply to any problems caused by software not licensed to +Customer by Liquibase, use other than in accordance with the technical +documentation, or misuse of the Software. The warranty only covers problems +reported to Liquibase during the warranty period or 30 days after. Customer will +cooperate with Liquibase in resolving any warranty claim. +A. EXCLUSIVE REMEDY AND SOLE LIABILITY. Liquibase will use commercially +reasonable efforts to remedy covered warranty claims within a reasonable period +of time or replace the Software, or if Liquibase cannot do so it will refund to +Customer the license fee paid. THIS REMEDY IS CUSTOMER’S EXCLUSIVE REMEDY, AND +LIQUIBASE’S SOLE LIABILITY FOR THESE WARRANTY CLAIMS. +B. DISCLAIMER OF WARRANTIES. LIQUIBASE DISCLAIMS ALL OTHER EXPRESS AND IMPLIED +WARRANTIES, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTY OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. CUSTOMER UNDERSTANDS THAT +THE SOFTWARE MAY NOT BE ERROR FREE, AND USE MAY BE INTERRUPTED. + +5. TERMINATION. This agreement expires at the end of the license period +specified. Either party may terminate this agreement upon a material breach of +the other party after a 30 days’ notice/cure period, if the breach is not cured +during such time period. Upon terminationof this agreement or a license, +Customer must discontinue using the Software, de-install and destroy or return +the Software and all copies, within 5 days. Upon Liquibase's request, Customer +will provide written certification of such compliance. + +6. SUPPORT. Liquibase’s technical support and maintenance services (Support) is +included with the license fees. Customer will receive best efforts e-mail +response for support within two business days from receipt of issue. Liquibase +may change its Support terms, but Support will not materially degrade during +any Support term. + +7. LIMIT ON LIABILITY. There may be situations in which (as a result of +material breach or other liability) Customer is entitled to make a claim +against Liquibase. In each situation (regardless of the form of the legal action +(e.g. contract or tort claims)), Liquibase is not responsible for any damage and +does not have any liability beyond the greater of the amount paid or payable by +Customer to Liquibase within the 12 months prior to the event that gave rise to +the claim and in no event is Liquibase responsible for any: loss of data or +information; lost profits, revenue, or productivity; or other special, +consequential, incidental or indirect damages. + +8. INTELLECTUAL PROPERTY INDEMNITY +a. Defense of Third Party Claims. Liquibase will defend or settle any third party +claim against Customer to the extent that such claim alleges that the Software +violates a copyright, patent, trademark or other intellectual property right, +if Customer, promptly notifies Liquibase of the claim in writing, cooperates with +Liquibase in the defense, and allows Liquibase to solely control the defense or +settlement of the claim. Costs. Liquibase will pay infringement claim defense +costs incurred as part of its obligations above, and Liquibase negotiated +settlement amounts, and court awarded damages. Process. If such a claim appears +likely, then Liquibase may modify the Software, procure the necessary rights, or +replace it with the functional equivalent. If Liquibase determines that none of +these are reasonably available, then Liquibase may terminate the Software and +refund any prepaid and unused fees. Exclusions. Liquibase has no obligation for +any claim arising from: Liquibase’s compliance with Customer’s specifications; A +combination of the Software with other technology where the infringement would +not occur but for the combination; or Technology not provided by Liquibase. THIS +SECTION CONTAINS CUSTOMER’S EXCLUSIVE REMEDIES AND LIQUIBASE’S SOLE LIABILITY FOR +INTELLECTUAL PROPERTY INFRINGEMENT CLAIMS. + +9. GOVERNING LAW AND EXCLUSIVE FORUM. This agreement is governed by the laws of +the State of Delaware (without regard to conflicts of law principles) for any +dispute between the parties or relating in any way to the subject matter of +this agreement. Any suit or legal proceeding must be exclusively brought in the +federal or state courts for Travis County, Texas, and Customer submits to this +personal jurisdiction and venue. Nothing in this agreement prevents either +party from seeking injunctive relief in a court of competent jurisdiction. The +prevailing party in litigation is entitled to recover its attorneys’ fees and +costs from the other party. + +10. OTHER TERMS. +a. Entire Agreement. This agreement and the order constitute the entire +agreement between the parties and supersede any prior or contemporaneous +negotiations or agreements, whether oral or written, related to this subject +matter. Customer is not relying on any representation concerning this subject +matter, oral or written, not included in this agreement. No representation, +promise or inducement not included in this agreement is binding. +b. Non-Assignment. Neither party may assign or transfer this agreement to a +third party, nor delegate any duty, except that the agreement and all orders +may be assigned, without the consent of the other party, as part of a merger, +or sale of all or substantially all of the business or assets, of a party. +c. Independent Contractors. The parties are independent contractors with +respect to each other. +d. Enforceability. If any term of this agreement is invalid or unenforceable, +the other terms remain in effect. +e. Survival of Terms and Force Majeure. All terms that by their nature survive +termination of this agreement for each party to receive the benefits and +protections of this agreement, will survive. Neither party is liable for events +beyond its reasonable control, including, without limitation force majeure +events. +f. Modification Only in Writing. No modification or waiver of any term of this +agreement is effective unless signed by both parties. +g. Export Compliance. Customer must comply with all applicable export control +laws of the United States, foreign jurisdictions and other applicable laws and +regulations. +h. US GOVERNMENT RESTRICTED RIGHTS. If Customer is a United States government +agency or acquired the license to the Software hereunder pursuant to a +government contract or with government funds, then as defined in FAR §2.101, +DFAR §252.227-7014(a)(1) and DFAR §252.227-7014(a)(5) or otherwise, all +Software provided in connection with this agreement are “commercial items,” +“commercial computer software” or “commercial computer software documentation.” +Consistent with DFAR §227.7202 and FAR §12.212, any use, modification, +reproduction, release, performance, display, disclosure or distribution by or +for the United States government is governed solely by the terms of this +agreement and is prohibited except to the extent permitted by the terms of this +agreement. +i. No PO Terms. Liquibase rejects conflicting terms of a Customer’s +form-purchasing document. +j. Order of Precedence. If there is an inconsistency between this agreement and +an order, the order prevails. diff --git a/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/README.txt b/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/README.txt new file mode 100644 index 00000000000..76cff2883af --- /dev/null +++ b/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/README.txt @@ -0,0 +1,22 @@ +Liquibase License Information (Used by Liquibase AWS Secrets Manager Extension) +Version: ${project.version} + +Liquibase ships with 3rd party components using the following licenses: +- Apache 2.0 License - https://www.apache.org/licenses/LICENSE-2.0.txt +- MIT License - http://www.opensource.org/licenses/mit-license.php +- Liquibase Pro EULA Software License Subscription and Support Agreement + +Libraries and their licenses: + +Apache 2.0 License +- org.liquibase:liquibase-core +- software.amazon.awssdk:secretsmanager +- software.amazon.awssdk:ssm +- com.google.code.gson:gjson + +MIT License +- org.slf4j:slf4j-api +- org.slf4j:slf4j-jdk14 + +Liquibase Pro EULA Software License Subscription and Support Agreement +- org.liquibase:liquibase-commercial diff --git a/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/apache-2.0.txt b/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/apache-2.0.txt new file mode 100644 index 00000000000..8e77af12431 --- /dev/null +++ b/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/apache-2.0.txt @@ -0,0 +1,65 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and +You must cause any modified files to carry prominent notices stating that You changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. diff --git a/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/mit.txt b/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/mit.txt new file mode 100644 index 00000000000..fe45399e37a --- /dev/null +++ b/liquibase-dist/src/main/archive/licenses/extensions/aws-secrets-manager-extension/mit.txt @@ -0,0 +1,6 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/liquibase-dist/src/main/archive/licenses/extensions/hashicorp-vault-extension/Liquibase Pro EULA Software License Subscription and Support Agreement.txt b/liquibase-dist/src/main/archive/licenses/extensions/hashicorp-vault-extension/Liquibase Pro EULA Software License Subscription and Support Agreement.txt new file mode 100644 index 00000000000..10adb95aea8 --- /dev/null +++ b/liquibase-dist/src/main/archive/licenses/extensions/hashicorp-vault-extension/Liquibase Pro EULA Software License Subscription and Support Agreement.txt @@ -0,0 +1,182 @@ +SOFTWARE LICENSE SUBSCRIPTION AND SUPPORT AGREEMENT + +PLEASE READ THIS AGREEMENT CAREFULLY BEFORE USING THIS SERVICE. + +BY USING THE SOFTWARE OR CLICKING AGREE, CUSTOMER IS AGREEING TO BE BOUND BY +THIS AGREEMENT. IF YOU ARE AGREEING TO THIS AGREEMENT ON BEHALF OF OR FOR THE +BENEFIT OF YOUR EMPLOYER OR A THIRD PARTY, THEN YOU REPRESENT AND WARRANT THAT +YOU HAVE THE NECESSARY AUTHORITY TO AGREE TO THIS AGREEMENT ON YOUR EMPLOYER'S +OR THAT THIRD PARTY'S BEHALF. + +This agreement is between Liquibase, Inc. a Delaware corporation (Liquibase) and +you, the customer entering into this agreement (Customer). The LiquibasePro +software, updates, documentation and license keys provided to Customer +(Software) are licensed and are not sold. + +SCOPE. This agreement describes the licensing of the Software and support +provided to Customer under an order. Third party contractors and majority owned +affiliates of Customer can use and access the Software under the terms of this +agreement, and Customer is responsible for each of their compliance with such +terms. + +1. LICENSE. Subject to the other terms of this agreement, Liquibase grants +Customer, under an order, a term based non-exclusive, non-transferable license +up to the license capacity purchased to use the Software only in Customer’s +internal business operations. Third party licenses delivered with the Software +may be subject to additional license rights and restrictions a set forth at +https://www.liquibase.com/licenses/liquibase_pro_tpl.html. + +2. RESTRICTIONS. Customer may not: +a. Transfer, assign, sublicense, rent the Software, create derivative works of +the Software, or use it in any type of service provider environment; +b. Reverse engineer, decompile, disassemble, or translate the Software; or +c. Evaluate the Software for the purpose of competing with Liquibase Pro or +operate the Software other than in accordance with its technical documentation. + +3. PROPRIETARY RIGHTS AND MUTUAL CONFIDENTIALITY. +a. Proprietary Rights. The Software, workflow processes, user interface, +designs and other technologies provided by Liquibase as part of the Software are +the proprietary property of Liquibase and its licensors, and all right, title and +interest in and to such items, including all associated intellectual property +rights, remain only with Liquibase and its licensors. The Software is protected +by copyright and other intellectual property laws. Customer may not remove any +product identification, copyright, trademark or other notice from the Software. +Liquibase reserves all rights not expressly granted. +b. Mutual Confidentiality. Recipient may not disclose Confidential Information +of Discloser to any third party or use the Confidential Information in +violation of this agreement. +Confidential Information means all information that is disclosed to the +recipient (Recipient) by the discloser (Discloser), and includes, among other +things: + * any and all information relating to products or services provided by a +Discloser, software code, flow charts, techniques, specifications, development +and marketing plans, strategies, and forecasts; + * as to Liquibase, the Software and the terms of this agreement, including +without limitation, all pricing information. +Confidential Information excludes information that: + * was rightfully in Recipient's possession without any obligation of +confidentiality before receipt from the Discloser; + * is or becomes a matter of public knowledge through no fault of Recipient; + * is rightfully received by Recipient from a third party without violation of +a duty of confidentiality; or + * is independently developed by or for Recipient without use or access to the +Confidential Information. + +Recipient may disclose Confidential Information if required by law, but it will +attempt to provide notice to the Discloser in advance so it may seek a +protective order. Each party acknowledges that any misuse of the other party’s +Confidential Information may cause irreparable harm for which there is no +adequate remedy at law. Either party may seek immediate injunctive relief in +such event. + +4. WARRANTY, REMEDY and DISCLAIMER. For new license purchases, Liquibase warrants +that the Software will perform in substantial accordance with its accompanying +technical documentation for a period of 60 days from the date of the order. +This warranty will not apply to any problems caused by software not licensed to +Customer by Liquibase, use other than in accordance with the technical +documentation, or misuse of the Software. The warranty only covers problems +reported to Liquibase during the warranty period or 30 days after. Customer will +cooperate with Liquibase in resolving any warranty claim. +A. EXCLUSIVE REMEDY AND SOLE LIABILITY. Liquibase will use commercially +reasonable efforts to remedy covered warranty claims within a reasonable period +of time or replace the Software, or if Liquibase cannot do so it will refund to +Customer the license fee paid. THIS REMEDY IS CUSTOMER’S EXCLUSIVE REMEDY, AND +LIQUIBASE’S SOLE LIABILITY FOR THESE WARRANTY CLAIMS. +B. DISCLAIMER OF WARRANTIES. LIQUIBASE DISCLAIMS ALL OTHER EXPRESS AND IMPLIED +WARRANTIES, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTY OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. CUSTOMER UNDERSTANDS THAT +THE SOFTWARE MAY NOT BE ERROR FREE, AND USE MAY BE INTERRUPTED. + +5. TERMINATION. This agreement expires at the end of the license period +specified. Either party may terminate this agreement upon a material breach of +the other party after a 30 days’ notice/cure period, if the breach is not cured +during such time period. Upon terminationof this agreement or a license, +Customer must discontinue using the Software, de-install and destroy or return +the Software and all copies, within 5 days. Upon Liquibase's request, Customer +will provide written certification of such compliance. + +6. SUPPORT. Liquibase’s technical support and maintenance services (Support) is +included with the license fees. Customer will receive best efforts e-mail +response for support within two business days from receipt of issue. Liquibase +may change its Support terms, but Support will not materially degrade during +any Support term. + +7. LIMIT ON LIABILITY. There may be situations in which (as a result of +material breach or other liability) Customer is entitled to make a claim +against Liquibase. In each situation (regardless of the form of the legal action +(e.g. contract or tort claims)), Liquibase is not responsible for any damage and +does not have any liability beyond the greater of the amount paid or payable by +Customer to Liquibase within the 12 months prior to the event that gave rise to +the claim and in no event is Liquibase responsible for any: loss of data or +information; lost profits, revenue, or productivity; or other special, +consequential, incidental or indirect damages. + +8. INTELLECTUAL PROPERTY INDEMNITY +a. Defense of Third Party Claims. Liquibase will defend or settle any third party +claim against Customer to the extent that such claim alleges that the Software +violates a copyright, patent, trademark or other intellectual property right, +if Customer, promptly notifies Liquibase of the claim in writing, cooperates with +Liquibase in the defense, and allows Liquibase to solely control the defense or +settlement of the claim. Costs. Liquibase will pay infringement claim defense +costs incurred as part of its obligations above, and Liquibase negotiated +settlement amounts, and court awarded damages. Process. If such a claim appears +likely, then Liquibase may modify the Software, procure the necessary rights, or +replace it with the functional equivalent. If Liquibase determines that none of +these are reasonably available, then Liquibase may terminate the Software and +refund any prepaid and unused fees. Exclusions. Liquibase has no obligation for +any claim arising from: Liquibase’s compliance with Customer’s specifications; A +combination of the Software with other technology where the infringement would +not occur but for the combination; or Technology not provided by Liquibase. THIS +SECTION CONTAINS CUSTOMER’S EXCLUSIVE REMEDIES AND LIQUIBASE’S SOLE LIABILITY FOR +INTELLECTUAL PROPERTY INFRINGEMENT CLAIMS. + +9. GOVERNING LAW AND EXCLUSIVE FORUM. This agreement is governed by the laws of +the State of Delaware (without regard to conflicts of law principles) for any +dispute between the parties or relating in any way to the subject matter of +this agreement. Any suit or legal proceeding must be exclusively brought in the +federal or state courts for Travis County, Texas, and Customer submits to this +personal jurisdiction and venue. Nothing in this agreement prevents either +party from seeking injunctive relief in a court of competent jurisdiction. The +prevailing party in litigation is entitled to recover its attorneys’ fees and +costs from the other party. + +10. OTHER TERMS. +a. Entire Agreement. This agreement and the order constitute the entire +agreement between the parties and supersede any prior or contemporaneous +negotiations or agreements, whether oral or written, related to this subject +matter. Customer is not relying on any representation concerning this subject +matter, oral or written, not included in this agreement. No representation, +promise or inducement not included in this agreement is binding. +b. Non-Assignment. Neither party may assign or transfer this agreement to a +third party, nor delegate any duty, except that the agreement and all orders +may be assigned, without the consent of the other party, as part of a merger, +or sale of all or substantially all of the business or assets, of a party. +c. Independent Contractors. The parties are independent contractors with +respect to each other. +d. Enforceability. If any term of this agreement is invalid or unenforceable, +the other terms remain in effect. +e. Survival of Terms and Force Majeure. All terms that by their nature survive +termination of this agreement for each party to receive the benefits and +protections of this agreement, will survive. Neither party is liable for events +beyond its reasonable control, including, without limitation force majeure +events. +f. Modification Only in Writing. No modification or waiver of any term of this +agreement is effective unless signed by both parties. +g. Export Compliance. Customer must comply with all applicable export control +laws of the United States, foreign jurisdictions and other applicable laws and +regulations. +h. US GOVERNMENT RESTRICTED RIGHTS. If Customer is a United States government +agency or acquired the license to the Software hereunder pursuant to a +government contract or with government funds, then as defined in FAR §2.101, +DFAR §252.227-7014(a)(1) and DFAR §252.227-7014(a)(5) or otherwise, all +Software provided in connection with this agreement are “commercial items,” +“commercial computer software” or “commercial computer software documentation.” +Consistent with DFAR §227.7202 and FAR §12.212, any use, modification, +reproduction, release, performance, display, disclosure or distribution by or +for the United States government is governed solely by the terms of this +agreement and is prohibited except to the extent permitted by the terms of this +agreement. +i. No PO Terms. Liquibase rejects conflicting terms of a Customer’s +form-purchasing document. +j. Order of Precedence. If there is an inconsistency between this agreement and +an order, the order prevails. diff --git a/liquibase-dist/src/main/archive/licenses/extensions/hashicorp-vault-extension/README.txt b/liquibase-dist/src/main/archive/licenses/extensions/hashicorp-vault-extension/README.txt new file mode 100644 index 00000000000..255dcf61cff --- /dev/null +++ b/liquibase-dist/src/main/archive/licenses/extensions/hashicorp-vault-extension/README.txt @@ -0,0 +1,16 @@ +Liquibase License Information (Used by Liquibase Hashicorp Vault Extension) +Version: ${project.version} + +Liquibase ships with 3rd party components using the following licenses: +- Apache 2.0 License - https://www.apache.org/licenses/LICENSE-2.0.txt +- Liquibase Pro EULA Software License Subscription and Support Agreement + +Libraries and their licenses: + +Apache 2.0 License +- org.liquibase:liquibase-core +- org.apache.httpcomponents:httpclient +- com.google.code.gson:gjson + +Liquibase Pro EULA Software License Subscription and Support Agreement +- org.liquibase:liquibase-commercial diff --git a/liquibase-dist/src/main/archive/licenses/extensions/hashicorp-vault-extension/apache-2.0.txt b/liquibase-dist/src/main/archive/licenses/extensions/hashicorp-vault-extension/apache-2.0.txt new file mode 100644 index 00000000000..8e77af12431 --- /dev/null +++ b/liquibase-dist/src/main/archive/licenses/extensions/hashicorp-vault-extension/apache-2.0.txt @@ -0,0 +1,65 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and +You must cause any modified files to carry prominent notices stating that You changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. diff --git a/liquibase-dist/src/main/install4j/liquibase.install4j b/liquibase-dist/src/main/install4j/liquibase.install4j index b7751d6c10e..2c75a356bf1 100644 --- a/liquibase-dist/src/main/install4j/liquibase.install4j +++ b/liquibase-dist/src/main/install4j/liquibase.install4j @@ -16,7 +16,7 @@ sqlite-* - + diff --git a/liquibase-extension-testing/pom.xml b/liquibase-extension-testing/pom.xml index 4967b860617..1069d1bee25 100644 --- a/liquibase-extension-testing/pom.xml +++ b/liquibase-extension-testing/pom.xml @@ -67,7 +67,7 @@ org.slf4j slf4j-jdk14 - 2.0.4 + 2.0.6 diff --git a/liquibase-extension-testing/src/main/groovy/liquibase/extension/testing/command/CommandTests.groovy b/liquibase-extension-testing/src/main/groovy/liquibase/extension/testing/command/CommandTests.groovy index d00ccfda2dc..f4c1b1d4f43 100644 --- a/liquibase-extension-testing/src/main/groovy/liquibase/extension/testing/command/CommandTests.groovy +++ b/liquibase-extension-testing/src/main/groovy/liquibase/extension/testing/command/CommandTests.groovy @@ -257,7 +257,6 @@ Long Description: ${commandDefinition.getLongDescription() ?: "NOT SET"} outputStream = new FileOutputStream(testDef.outputFile) } - commandScope.addArgumentValue("database", database) commandScope.setOutput(outputStream) if (testDef.setup != null) { diff --git a/liquibase-integration-tests/src/test/resources/liquibase/extension/testing/command/tag.test.groovy b/liquibase-integration-tests/src/test/resources/liquibase/extension/testing/command/tag.test.groovy index 8d518db1670..07836192e8c 100644 --- a/liquibase-integration-tests/src/test/resources/liquibase/extension/testing/command/tag.test.groovy +++ b/liquibase-integration-tests/src/test/resources/liquibase/extension/testing/command/tag.test.groovy @@ -34,10 +34,6 @@ Optional Args: password: { it.password }, tag: "version_2.0" ] - - expectedResults = [ - statusCode : 0 - ] } run "Run without a tag should throw an exception", { diff --git a/liquibase-maven-plugin/pom.xml b/liquibase-maven-plugin/pom.xml index df52feead2a..e7c817126cc 100644 --- a/liquibase-maven-plugin/pom.xml +++ b/liquibase-maven-plugin/pom.xml @@ -14,7 +14,7 @@ A Maven plugin wraps up some of the functionality of Liquibase - 3.8.5 + 3.8.7 diff --git a/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseChangeLogSyncToTagSQLMojo.java b/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseChangeLogSyncToTagSQLMojo.java index c55027db438..837cc473486 100644 --- a/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseChangeLogSyncToTagSQLMojo.java +++ b/liquibase-maven-plugin/src/main/java/org/liquibase/maven/plugins/LiquibaseChangeLogSyncToTagSQLMojo.java @@ -84,8 +84,8 @@ protected Liquibase createLiquibase(Database db) + migrationSqlOutputFile.getAbsolutePath()); } } - outputWriter = getOutputWriter(migrationSqlOutputFile);; - } catch (IOException e) { + outputWriter = getOutputWriter(migrationSqlOutputFile); + } catch (IOException e) { getLog().error(e); throw new MojoExecutionException( "Failed to create SQL output writer", e); diff --git a/pom.xml b/pom.xml index b8aaf95dca6..1060da385ad 100644 --- a/pom.xml +++ b/pom.xml @@ -126,7 +126,7 @@ org.mockito mockito-inline - 4.8.1 + 4.10.0 test @@ -215,7 +215,7 @@ com.oracle.database.jdbc ojdbc8 - 21.7.0.0 + 21.8.0.0 test @@ -229,13 +229,13 @@ net.snowflake snowflake-jdbc - 3.13.25 + 3.13.26 org.firebirdsql.jdbc jaybird - 4.0.6.java8 + 4.0.8.java8 test