Top Inners Fields Constructors Methods
liquibase.integration.commandline

public Class LiquibaseCommandLine

extends Object
Class Inheritance
Imports
liquibase.GlobalConfiguration, .Scope, liquibase.command.CommandArgumentDefinition, .CommandDefinition, .CommandFactory, .CommandFailedException, liquibase.command.core.*, liquibase.configuration.ConfigurationDefinition, .ConfigurationValueProvider, .ConfiguredValue, .LiquibaseConfiguration, liquibase.configuration.core.DefaultsFileValueProvider, liquibase.exception.CommandLineParsingException, .CommandValidationException, .LiquibaseException, liquibase.integration.IntegrationDetails, liquibase.license.LicenseInfo, .LicenseService, .LicenseServiceFactory, liquibase.logging.LogService, liquibase.logging.core.JavaLogService, .LogServiceFactory, liquibase.logging.mdc.MdcKey, .MdcManager, .MdcObject, liquibase.logging.mdc.customobjects.ChangesetsUpdated, .Version, liquibase.resource.*, liquibase.ui.CompositeUIService, .ConsoleUIService, .LoggerUIService, .UIService, liquibase.util.*, picocli.CommandLine, java.io.*, java.lang.reflect.InvocationTargetException, java.net.MalformedURLException, .URL, .URLClassLoader, java.nio.file.Path, .Paths, java.security.AccessController, .PrivilegedAction, java.time.Duration, java.util.*, java.util.jar.JarFile, .Manifest, java.util.logging.*, java.util.stream.Collectors, .Stream, java.util.zip.ZipEntry

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
public static final String
private final CommandLine
private Level
private final ResourceBundle
private CommandLine.IFactory
defaultFactory

Pico's defaultFactory does a lot of reflection, checking for classes we know we don't have.

private Handler
private final Set<String>
legacyNoLongerCommandArguments

Arguments that used to be command arguments but are now global

private final Set<String>
legacyNoLongerGlobalArguments

Arguments that used to be global arguments but are now command-level

private final Map<String, String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private void
private Map<String, String>
private void
addSubcommand(CommandDefinition commandDefinition, CommandLine rootCommand)

private CommandLine.Model.CommandSpec
addSubcommandGroup(String[] groupName, CommandDefinition commandDefinition, CommandLine.Model.CommandSpec parent)

protected String[]
private CommandLine
protected String
private void
protected ClassLoader
private void
configureHelp(CommandLine.Model.CommandSpec commandSpec, boolean includeVersion)

protected Map<String, Object>
private void
configureLogging(Level logLevel, String logFile)

private void
configureLogging(Level logLevel, String logFile, boolean
indicate whether the user selected the default value for log-level, or whether they provided a value
wasDefaultLogLevelUsed
)

private Map<String, Object>
private Map<String, Object>

Returns:

values to set in the scope
configureScope
(String[] args)

Configures the system, and returns values to add to Scope.

private void
private void
private CommandLine.Model.OptionSpec.Builder
private Level
protected void
public int
execute(String[] args)

private List<String[]>
pack-priv static String[]
private SortedSet<CommandDefinition>
private static UIService
private CommandLine.Model.CommandSpec
getParentCommandSpec(CommandDefinition commandDefinition, CommandLine rootCommand)

private CommandLine
protected int
private static void
private void
logMdcData()

Log MDC data related to Liquibase system information.

public static void
main(String[] args)

private List<ConfigurationValueProvider>
protected static String[]
protected static String[]
private String
private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COMMAND_ARGUMENTSback to summary
public static final String COMMAND_ARGUMENTS
commandLineback to summary
private final CommandLine commandLine
configuredLogLevelback to summary
private Level configuredLogLevel
coreBundleback to summary
private final ResourceBundle coreBundle
defaultFactoryback to summary
private CommandLine.IFactory defaultFactory

Pico's defaultFactory does a lot of reflection, checking for classes we know we don't have. That is slow on older JVMs and impact initial startup time, so do our own factory for performance reasons. It is easy to configure pico to it's default factory, when profiling check for `CommandLine$DefaultFactory` usage

fileHandlerback to summary
private Handler fileHandler
legacyNoLongerCommandArgumentsback to summary
private final Set<String> legacyNoLongerCommandArguments

Arguments that used to be command arguments but are now global

legacyNoLongerGlobalArgumentsback to summary
private final Set<String> legacyNoLongerGlobalArguments

Arguments that used to be global arguments but are now command-level

legacyPositionalArgumentsback to summary
private final Map<String, String> legacyPositionalArguments

Constructor Detail

LiquibaseCommandLineback to summary
public LiquibaseCommandLine()

Method Detail

addEmptyMdcValuesback to summary
private void addEmptyMdcValues()
addGlobalArgumentsback to summary
private void addGlobalArguments(CommandLine commandLine)
addJavaPropertiesToChangelogParametersback to summary
private Map<String, String> addJavaPropertiesToChangelogParameters()
addSubcommandback to summary
private void addSubcommand(CommandDefinition commandDefinition, CommandLine rootCommand)
addSubcommandGroupback to summary
private CommandLine.Model.CommandSpec addSubcommandGroup(String[] groupName, CommandDefinition commandDefinition, CommandLine.Model.CommandSpec parent)
adjustLegacyArgsback to summary
protected String[] adjustLegacyArgs(String[] args)
buildPicoCommandLineback to summary
private CommandLine buildPicoCommandLine()
cleanExceptionMessageback to summary
protected String cleanExceptionMessage(String message)
cleanupback to summary
private void cleanup()
configureClassLoaderback to summary
protected ClassLoader configureClassLoader() throws IllegalArgumentException
configureHelpback to summary
private void configureHelp(CommandLine.Model.CommandSpec commandSpec, boolean includeVersion)
configureLoggingback to summary
protected Map<String, Object> configureLogging() throws IOException
configureLoggingback to summary
private void configureLogging(Level logLevel, String logFile) throws IOException
configureLoggingback to summary
private void configureLogging(Level logLevel, String logFile, boolean wasDefaultLogLevelUsed) throws IOException
Parameters
wasDefaultLogLevelUsed:boolean

indicate whether the user selected the default value for log-level, or whether they provided a value

configureResourceAccessorback to summary
private Map<String, Object> configureResourceAccessor(ClassLoader classLoader) throws IOException
configureScopeback to summary
private Map<String, Object> configureScope(String[] args) throws Exception

Configures the system, and returns values to add to Scope.

Returns:Map<String, Object>

values to set in the scope

configureSubcommandGroupback to summary
private void configureSubcommandGroup(CommandLine.Model.CommandSpec groupSpec, String[] groupName, CommandDefinition commandDefinition)
configureVersionInfoback to summary
private void configureVersionInfo()
createArgBuilderback to summary
private CommandLine.Model.OptionSpec.Builder createArgBuilder(CommandArgumentDefinition<?> def, String argName)
determineLogLevelback to summary
private Level determineLogLevel(Throwable throwable)
enableMonitoringback to summary
protected void enableMonitoring()
executeback to summary
public int execute(String[] args)
expandCommandNamesback to summary
private List<String[]> expandCommandNames(CommandDefinition commandDefinition)
getCommandNamesback to summary
pack-priv static String[] getCommandNames(CommandLine parseResult)
getCommandsback to summary
private SortedSet<CommandDefinition> getCommands()
getDefaultUiServiceback to summary
private static UIService getDefaultUiService() throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
getParentCommandSpecback to summary
private CommandLine.Model.CommandSpec getParentCommandSpec(CommandDefinition commandDefinition, CommandLine rootCommand)
getRootCommandback to summary
private CommandLine getRootCommand(CommandLine commandLine)
handleExceptionback to summary
protected int handleException(Throwable exception)
insertWithoutDuplicatesback to summary
private static void insertWithoutDuplicates(List<String> returnList, String key)
logMdcDataback to summary
private void logMdcData() throws IOException

Log MDC data related to Liquibase system information.

mainback to summary
public static void main(String[] args)
registerValueProvidersback to summary
private List<ConfigurationValueProvider> registerValueProviders(String[] args) throws IOException
toArgNamesback to summary
protected static String[] toArgNames(CommandArgumentDefinition<?> def)
toArgNamesback to summary
protected static String[] toArgNames(ConfigurationDefinition<?> def)
toEnvVariableback to summary
private String toEnvVariable(String property)
wasHelpOrVersionRequestedback to summary
private boolean wasHelpOrVersionRequested()
liquibase.integration.commandline back to summary

private Class LiquibaseCommandLine.CaseInsensitiveList

extends ArrayList<String>
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(Object
element whose presence in this list is to be tested
o
)

Overrides java.util.ArrayList.contains.

Implements java.util.List.contains, java.util.Collection.contains.

Returns true if this list contains the specified element.

Inherited from java.util.ArrayList:
addaddaddAlladdAlladdFirstaddLastclearcloneensureCapacityequalsforEachgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveremoveremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsetsizesortspliteratorsubListtoArraytoArraytrimToSize

Constructor Detail

CaseInsensitiveListback to summary
private CaseInsensitiveList()

Method Detail

containsback to summary
public boolean contains(Object o)

Overrides java.util.ArrayList.contains.

Implements java.util.List.contains, java.util.Collection.contains.

Doc from java.util.ArrayList.contains.

Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that Objects.equals(o, e).

Parameters
o:Object

element whose presence in this list is to be tested

Returns:boolean

true if this list contains the specified element

Annotations
@Override
liquibase.integration.commandline back to summary

private Class LiquibaseCommandLine.LiquibaseVersionProvider

extends Object
implements IVersionProvider
Class Inheritance
  • java.lang.Object
  • liquibase.integration.commandline.LiquibaseCommandLine.LiquibaseVersionProvider
All Implemented Interfaces
picocli.CommandLine.IVersionProvider

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
addMdc(Version mdcVersion, LicenseService licenseService, String liquibaseHome, String javaHome, String javaVersion)

private LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo
getLibraryInfo(File pathEntryFile)

private String
getValue(Manifest manifest, String... keys)

public String[]
getVersion()

Implements picocli.CommandLine.IVersionProvider.getVersion.

Returns version information for a command.

private void
handleCompilerJarEdgeCase(File pathEntryFile, JarFile jarFile, LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo libraryInfo)

The compiler.jar file was accidentally added to the liquibase tar.gz distribution, and the compiler.jar file does not contain a completed MANIFEST.MF file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LiquibaseVersionProviderback to summary
private LiquibaseVersionProvider()

Method Detail

addMdcback to summary
private void addMdc(Version mdcVersion, LicenseService licenseService, String liquibaseHome, String javaHome, String javaVersion)
getLibraryInfoback to summary
private LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo getLibraryInfo(File pathEntryFile) throws IOException
getValueback to summary
private String getValue(Manifest manifest, String... keys)
getVersionback to summary
public String[] getVersion() throws Exception

Implements picocli.CommandLine.IVersionProvider.getVersion.

Doc from picocli.CommandLine.IVersionProvider.getVersion.

Returns version information for a command.

Returns:String[]

version information (each string in the array is displayed on a separate line)

Annotations
@Override
Exceptions
Exception:
an exception detailing what went wrong when obtaining version information
handleCompilerJarEdgeCaseback to summary
private void handleCompilerJarEdgeCase(File pathEntryFile, JarFile jarFile, LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo libraryInfo)

The compiler.jar file was accidentally added to the liquibase tar.gz distribution, and the compiler.jar file does not contain a completed MANIFEST.MF file. This method loads the version out of the pom.xml instead of using the manifest, only for the compiler.jar file.

liquibase.integration.commandline back to summary

private Class LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo

extends Object
implements Comparable<LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo>
Class Inheritance
  • java.lang.Object
  • liquibase.integration.commandline.LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo
All Implemented Interfaces
java.lang.Comparable

Field Summary

Modifier and TypeField and Description
private File
private String
private String
private String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fileback to summary
private File file
nameback to summary
private String name
vendorback to summary
private String vendor
versionback to summary
private String version

Constructor Detail

LibraryInfoback to summary
private LibraryInfo()

Method Detail

compareToback to summary
public int compareTo(LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:LiquibaseCommandLine.LiquibaseVersionProvider.LibraryInfo

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override