public void init(Config config) { Connection connection = null; try { this.platform = PlatformFactory.createNewPlatformInstance("mysql"); connection = MetadataUtils.getJdbcConnection(config); String dbName = config.getString(MetadataUtils.JDBC_DATABASE_PATH); this.database = platform.readModelFromDatabase(connection, dbName); LOG.info("Loaded " + database); Database _database = identifyNewTables(); if (_database.getTableCount() > 0) { LOG.info("Creating {} new tables (totally {} tables)", _database.getTableCount(), database.getTableCount()); this.platform.createTables(connection, _database, false, true); LOG.info("Created {} new tables: ", _database.getTableCount(), _database.getTables()); } else { LOG.debug("All the {} tables have already been created, no new tables", database.getTableCount()); } } catch (Exception e) { LOG.error(e.getMessage(), e); throw new IllegalStateException(e); } finally { if (connection != null) { try { connection.close(); } catch (SQLException e) { LOG.warn(e.getMessage(), e); } } } }