@Override public void warning(final SAXParseException exception) throws SAXException { LogFactory.getLogger().warning(exception.getMessage()); throw exception; } });
/** * API method. */ public CDILiquibaseConfig createCDILiquibaseConfig() { final String id = UUID.randomUUID().toString(); log.debug(LogType.LOG, String.format("[id = %s] createConfig(). Date: '%s'", id, new Date())); final InputStream is = SchemesCDIConfigBuilder.class.getResourceAsStream(SCHEMA_NAME); try { return jvmLocked(id, new Callable<CDILiquibaseConfig>() { public CDILiquibaseConfig call() throws Exception { return createCDILiquibaseConfig(id, is); } }); } catch (Exception ex) { log.warning(LogType.LOG, String.format("[id = %s] Unable to initialize liquibase where '%s'.", id, ex.getMessage()), ex); return null; } finally { try { is.close(); } catch (IOException ioe) { log.warning(LogType.LOG, String.format("[id = %s] IOException during closing an input stream '%s'.", id, ioe.getMessage()), ioe); } } }
@Override public SqlStatement[] generateStatements(final Database database) { final SqlStatement[] superStatements = super.generateStatements(database); if (m_where == null) return superStatements; if (superStatements.length != 1) { LogFactory.getLogger().warning("expected 1 create index statement, but got " + superStatements.length); return superStatements; } return new SqlStatement[]{ new CreateIndexWithWhereStatement((CreateIndexStatement)superStatements[0], m_where) }; }
lock.release(); } catch (Exception e) { log.warning(LogType.LOG, e.getMessage(), e);
logger.info(message); } else { logger.warning(message);
log.warning(LogType.LOG, String.format("IOException during closing an input stream '%s'.", ioe.getMessage()), ioe);
@Override public SqlStatement[] generateStatements(final Database database) { final SqlStatement[] superStatements = super.generateStatements(database); if (m_where == null) return superStatements; if (superStatements.length != 1) { LogFactory.getLogger().warning("expected 1 create index statement, but got " + superStatements.length); return superStatements; } return new SqlStatement[]{ new CreateIndexWithWhereStatement((CreateIndexStatement)superStatements[0], m_where) }; }
public void afterPropertiesSet() throws Exception { if (this.dataSource == null && this.schemas == null) { this.log.info("DataSources based multitenancy enabled"); this.resolveDataSources(); this.runOnAllDataSources(); } else { if (this.dataSource == null && this.schemas != null) { throw new LiquibaseException("When schemas are defined you should also define a base dataSource"); } if (this.dataSource != null) { this.log.info("Schema based multitenancy enabled"); if (this.schemas == null || this.schemas.isEmpty()) { this.log.warning("Schemas not defined, using defaultSchema only"); this.schemas = new ArrayList(); this.schemas.add(this.defaultSchema); } this.runOnAllSchemas(); } } }
public void shutdown() { try { if (database != null) { database.rollback(); database.close(); } } catch (DatabaseException ex) { LogFactory.getInstance().getLog().warning("problem closing connection", ex); } finally { database = null; liquibase = null; } }
public String getDatabaseProductName() throws DatabaseException { Connection connection = null; Database database = null; String name = "unknown"; try { connection = this.getDataSource().getConnection(); database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection)); name = database.getDatabaseProductName(); } catch (SQLException var12) { throw new DatabaseException(var12); } finally { if (database != null) { database.close(); } else if (connection != null) { try { if (!connection.getAutoCommit()) { connection.rollback(); } connection.close(); } catch (Exception var11) { this.log.warning("problem closing connection", var11); } } } return name; }
@Override public Sql[] generateSql(final CreateIndexStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) { final Sql[] superSql = super.generateSql(statement, database, sqlGeneratorChain); if (statement instanceof CreateIndexWithWhereStatement) { if (superSql.length != 1) { LogFactory.getLogger().warning("expected 1 create index statement, but got " + superSql.length); return superSql; } return new Sql[] { new UnparsedSql(superSql[0].toSql() + " WHERE " + ((CreateIndexWithWhereStatement)statement).getWhere(), superSql[0].getEndDelimiter(), superSql[0].getAffectedDatabaseObjects().toArray(new DatabaseObject[0])) }; } else { return superSql; } }
@Override public ValidationErrors validate(final SetSequenceStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) { ValidationErrors validationErrors = new ValidationErrors(); validationErrors.checkRequiredField("sequenceName", statement.getSequenceName()); if (statement.getValue() == null) { validationErrors.checkRequiredField("tables", statement.getTables()); } else { if (statement.getTables().size() > 0) { LogFactory.getLogger().warning("You have set the sequence to a specific value, but have also provided tables to use for inferring the value. Using the specific value."); } } return validationErrors; }
@Override public ValidationErrors validate(final SetSequenceStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) { ValidationErrors validationErrors = new ValidationErrors(); validationErrors.checkRequiredField("sequenceName", statement.getSequenceName()); if (statement.getValue() == null) { validationErrors.checkRequiredField("tables", statement.getTables()); } else { if (statement.getTables().size() > 0) { LogFactory.getLogger().warning("You have set the sequence to a specific value, but have also provided tables to use for inferring the value. Using the specific value."); } } return validationErrors; }
@Override public Sql[] generateSql(final CreateIndexStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) { final Sql[] superSql = super.generateSql(statement, database, sqlGeneratorChain); if (statement instanceof CreateIndexWithWhereStatement) { if (superSql.length != 1) { LogFactory.getLogger().warning("expected 1 create index statement, but got " + superSql.length); return superSql; } return new Sql[] { new UnparsedSql(superSql[0].toSql() + " WHERE " + ((CreateIndexWithWhereStatement)statement).getWhere(), superSql[0].getEndDelimiter(), superSql[0].getAffectedDatabaseObjects().toArray(new DatabaseObject[0])) }; } else { return superSql; } }
if (!version.equals(OSGiXMLChangeLogSAXParser .getSchemaVersion())) { log.warning(databaseChangeLog.getPhysicalFilePath() + " is using schema version " + version + " rather than version "
protected Database createDatabase(Connection c, ResourceAccessor resourceAccessor) throws DatabaseException { Object liquibaseConnection; if (c == null) { this.log.warning("Null connection returned by liquibase datasource. Using offline unknown database"); liquibaseConnection = new OfflineConnection("offline:unknown", resourceAccessor); } else { liquibaseConnection = new JdbcConnection(c); } Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation((DatabaseConnection)liquibaseConnection); if (StringUtils.trimToNull(this.defaultSchema) != null) { database.setDefaultSchemaName(this.defaultSchema); } return database; }
@PostConstruct public void onStartup() { log.info(LogType.LOG, "Booting Liquibase " + LiquibaseUtil.getBuildVersion()); String hostName; try { hostName = NetUtil.getLocalHostName(); } catch (Exception e) { log.warning(LogType.LOG, "Cannot find hostname: " + e.getMessage()); log.debug(LogType.LOG, "", e); return; } LiquibaseConfiguration liquibaseConfiguration = LiquibaseConfiguration.getInstance(); if (!liquibaseConfiguration.getConfiguration(GlobalConfiguration.class).getShouldRun()) { log.info(LogType.LOG, String.format("Liquibase did not run on %s because %s was set to false.", hostName, liquibaseConfiguration.describeValueLookupLogic( GlobalConfiguration.class, GlobalConfiguration.SHOULD_RUN) )); return; } initialized = true; try { performUpdate(); } catch (LiquibaseException e) { throw new UnexpectedLiquibaseException(e); } }
database.close(); } catch (Exception e2) { LogFactory.getInstance().getLog().warning("problem closing connection", ex);