public class org.apache.nifi.registry.db.CustomFlywayConfiguration extends java.lang.Object implements org.springframework.boot.autoconfigure.flyway.FlywayConfigurationCustomizer
{
private static final org.slf4j.Logger LOGGER;
private static final java.lang.String LOCATION_COMMON;
private static final java.lang.String LOCATION_DEFAULT;
private static final java.lang.String[] LOCATIONS_DEFAULT;
private static final java.lang.String LOCATION_MYSQL;
private static final java.lang.String[] LOCATIONS_MYSQL;
private static final java.lang.String LOCATION_POSTGRES;
private static final java.lang.String[] LOCATIONS_POSTGRES;
private static final java.lang.String LEGACY_FLYWAY_SCHEMA_TABLE;
public void <init>()
{
org.apache.nifi.registry.db.CustomFlywayConfiguration v;
v := @this: org.apache.nifi.registry.db.CustomFlywayConfiguration;
specialinvoke v.<java.lang.Object: void <init>()>();
return;
}
public void customize(org.flywaydb.core.api.configuration.FluentConfiguration)
{
java.lang.String[] v, v, v, v, v, v;
org.flywaydb.core.api.configuration.FluentConfiguration v;
org.apache.nifi.registry.db.CustomFlywayConfiguration v;
javax.sql.DataSource v, v;
java.lang.String v;
boolean v, v, v, v;
org.flywaydb.core.internal.database.DatabaseType v;
org.slf4j.Logger v, v, v, v, v, v;
java.util.List v, v, v;
v := @this: org.apache.nifi.registry.db.CustomFlywayConfiguration;
v := @parameter: org.flywaydb.core.api.configuration.FluentConfiguration;
v = virtualinvoke v.<org.flywaydb.core.api.configuration.FluentConfiguration: javax.sql.DataSource getDataSource()>();
v = specialinvoke v.<org.apache.nifi.registry.db.CustomFlywayConfiguration: org.flywaydb.core.internal.database.DatabaseType getDatabaseType(javax.sql.DataSource)>(v);
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER>;
v = interfaceinvoke v.<org.flywaydb.core.internal.database.DatabaseType: java.lang.String getName()>();
interfaceinvoke v.<org.slf4j.Logger: void info(java.lang.String,java.lang.Object)>("Determined database type is {}", v);
v = v instanceof org.flywaydb.database.mysql.MySQLDatabaseType;
if v != 0 goto label;
v = v instanceof org.flywaydb.database.mysql.mariadb.MariaDBDatabaseType;
if v == 0 goto label;
label:
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER>;
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: java.lang.String[] LOCATIONS_MYSQL>;
v = staticinvoke <java.util.Arrays: java.util.List asList(java.lang.Object[])>(v);
interfaceinvoke v.<org.slf4j.Logger: void info(java.lang.String,java.lang.Object)>("Setting migration locations to {}", v);
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: java.lang.String[] LOCATIONS_MYSQL>;
virtualinvoke v.<org.flywaydb.core.api.configuration.FluentConfiguration: org.flywaydb.core.api.configuration.FluentConfiguration locations(java.lang.String[])>(v);
goto label;
label:
v = v instanceof org.flywaydb.core.internal.database.postgresql.PostgreSQLDatabaseType;
if v == 0 goto label;
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER>;
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: java.lang.String[] LOCATIONS_POSTGRES>;
v = staticinvoke <java.util.Arrays: java.util.List asList(java.lang.Object[])>(v);
interfaceinvoke v.<org.slf4j.Logger: void info(java.lang.String,java.lang.Object)>("Setting migration locations to {}", v);
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: java.lang.String[] LOCATIONS_POSTGRES>;
virtualinvoke v.<org.flywaydb.core.api.configuration.FluentConfiguration: org.flywaydb.core.api.configuration.FluentConfiguration locations(java.lang.String[])>(v);
goto label;
label:
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER>;
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: java.lang.String[] LOCATIONS_DEFAULT>;
v = staticinvoke <java.util.Arrays: java.util.List asList(java.lang.Object[])>(v);
interfaceinvoke v.<org.slf4j.Logger: void info(java.lang.String,java.lang.Object)>("Setting migration locations to {}", v);
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: java.lang.String[] LOCATIONS_DEFAULT>;
virtualinvoke v.<org.flywaydb.core.api.configuration.FluentConfiguration: org.flywaydb.core.api.configuration.FluentConfiguration locations(java.lang.String[])>(v);
label:
v = virtualinvoke v.<org.flywaydb.core.api.configuration.FluentConfiguration: javax.sql.DataSource getDataSource()>();
v = specialinvoke v.<org.apache.nifi.registry.db.CustomFlywayConfiguration: boolean isLegacyFlywaySchemaTable(javax.sql.DataSource)>(v);
if v == 0 goto label;
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER>;
interfaceinvoke v.<org.slf4j.Logger: void info(java.lang.String,java.lang.Object)>("Using legacy Flyway configuration table - {}", "schema_version");
virtualinvoke v.<org.flywaydb.core.api.configuration.FluentConfiguration: org.flywaydb.core.api.configuration.FluentConfiguration table(java.lang.String)>("schema_version");
goto label;
label:
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER>;
interfaceinvoke v.<org.slf4j.Logger: void info(java.lang.String)>("Using default Flyway configuration table");
label:
return;
}
private org.flywaydb.core.internal.database.DatabaseType getDatabaseType(javax.sql.DataSource)
{
java.lang.Throwable v;
org.flywaydb.core.internal.database.DatabaseType v;
java.sql.Connection v;
org.flywaydb.core.api.FlywayException v;
org.slf4j.Logger v;
java.sql.SQLException v;
org.apache.nifi.registry.db.CustomFlywayConfiguration v;
javax.sql.DataSource v;
java.lang.String v;
v := @this: org.apache.nifi.registry.db.CustomFlywayConfiguration;
v := @parameter: javax.sql.DataSource;
label:
v = interfaceinvoke v.<javax.sql.DataSource: java.sql.Connection getConnection()>();
label:
v = staticinvoke <org.flywaydb.core.internal.database.DatabaseTypeRegister: org.flywaydb.core.internal.database.DatabaseType getDatabaseTypeForConnection(java.sql.Connection)>(v);
label:
if v == null goto label;
interfaceinvoke v.<java.sql.Connection: void close()>();
label:
return v;
label:
v := @caughtexception;
throw v;
label:
v := @caughtexception;
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER>;
v = virtualinvoke v.<java.sql.SQLException: java.lang.String getMessage()>();
interfaceinvoke v.<org.slf4j.Logger: void error(java.lang.String,java.lang.Throwable)>(v, v);
v = new org.flywaydb.core.api.FlywayException;
specialinvoke v.<org.flywaydb.core.api.FlywayException: void <init>(java.lang.String,java.lang.Throwable)>("Unable to obtain connection from Flyway DataSource", v);
throw v;
catch java.lang.Throwable from label to label with label;
catch java.sql.SQLException from label to label with label;
}
private boolean isLegacyFlywaySchemaTable(javax.sql.DataSource)
{
java.lang.Throwable v, v;
java.sql.Connection v;
org.flywaydb.core.api.FlywayException v;
java.sql.DatabaseMetaData v;
java.sql.SQLException v;
org.apache.nifi.registry.db.CustomFlywayConfiguration v;
java.sql.ResultSet v;
javax.sql.DataSource v;
java.lang.String v, v, v;
boolean v, v;
org.slf4j.Logger v, v;
v := @this: org.apache.nifi.registry.db.CustomFlywayConfiguration;
v := @parameter: javax.sql.DataSource;
label:
v = interfaceinvoke v.<javax.sql.DataSource: java.sql.Connection getConnection()>();
label:
v = staticinvoke <org.flywaydb.core.internal.jdbc.JdbcUtils: java.sql.DatabaseMetaData getDatabaseMetaData(java.sql.Connection)>(v);
v = interfaceinvoke v.<java.sql.DatabaseMetaData: java.sql.ResultSet getTables(java.lang.String,java.lang.String,java.lang.String,java.lang.String[])>(null, null, null, null);
label:
v = interfaceinvoke v.<java.sql.ResultSet: boolean next()>();
if v == 0 goto label;
v = interfaceinvoke v.<java.sql.ResultSet: java.lang.String getString(int)>(3);
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER>;
interfaceinvoke v.<org.slf4j.Logger: void trace(java.lang.String,java.lang.Object)>("Found table {}", v);
v = "schema_version";
v = virtualinvoke v.<java.lang.String: boolean equals(java.lang.Object)>(v);
if v == 0 goto label;
label:
interfaceinvoke v.<java.sql.ResultSet: void close()>();
label:
if v == null goto label;
interfaceinvoke v.<java.sql.Connection: void close()>();
label:
return 1;
label:
interfaceinvoke v.<java.sql.ResultSet: void close()>();
goto label;
label:
v := @caughtexception;
throw v;
label:
if v == null goto label;
interfaceinvoke v.<java.sql.Connection: void close()>();
label:
return 0;
label:
v := @caughtexception;
throw v;
label:
v := @caughtexception;
v = <org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER>;
v = virtualinvoke v.<java.sql.SQLException: java.lang.String getMessage()>();
interfaceinvoke v.<org.slf4j.Logger: void error(java.lang.String,java.lang.Throwable)>(v, v);
v = new org.flywaydb.core.api.FlywayException;
specialinvoke v.<org.flywaydb.core.api.FlywayException: void <init>(java.lang.String,java.lang.Throwable)>("Unable to obtain connection from Flyway DataSource", v);
throw v;
catch java.lang.Throwable from label to label with label;
catch java.lang.Throwable from label to label with label;
catch java.lang.Throwable from label to label with label;
catch java.lang.Throwable from label to label with label;
catch java.sql.SQLException from label to label with label;
catch java.sql.SQLException from label to label with label;
}
static void <clinit>()
{
org.slf4j.Logger v;
java.lang.String[] v, v, v;
v = staticinvoke <org.slf4j.LoggerFactory: org.slf4j.Logger getLogger(java.lang.Class)>(class "Lorg/apache/nifi/registry/db/CustomFlywayConfiguration;");
<org.apache.nifi.registry.db.CustomFlywayConfiguration: org.slf4j.Logger LOGGER> = v;
v = newarray (java.lang.String)[2];
v[0] = "classpath:db/migration/common";
v[1] = "classpath:db/migration/default";
<org.apache.nifi.registry.db.CustomFlywayConfiguration: java.lang.String[] LOCATIONS_DEFAULT> = v;
v = newarray (java.lang.String)[2];
v[0] = "classpath:db/migration/common";
v[1] = "classpath:db/migration/mysql";
<org.apache.nifi.registry.db.CustomFlywayConfiguration: java.lang.String[] LOCATIONS_MYSQL> = v;
v = newarray (java.lang.String)[2];
v[0] = "classpath:db/migration/common";
v[1] = "classpath:db/migration/postgres";
<org.apache.nifi.registry.db.CustomFlywayConfiguration: java.lang.String[] LOCATIONS_POSTGRES> = v;
return;
}
}