/** * Set the DatabasePlatform if it has not already been set. */ private void setDatabasePlatform(ServerConfig config) { DatabasePlatform dbPlatform = config.getDatabasePlatform(); if (dbPlatform == null) { DatabasePlatformFactory factory = new DatabasePlatformFactory(); DatabasePlatform db = factory.create(config); config.setDatabasePlatform(db); logger.info("DatabasePlatform name:" + config.getName() + " platform:" + db.getName()); } }
/** * Set the DatabasePlatform if it has not already been set. */ private void setDatabasePlatform(ServerConfig config) { DatabasePlatform dbPlatform = config.getDatabasePlatform(); if (dbPlatform == null) { DatabasePlatformFactory factory = new DatabasePlatformFactory(); DatabasePlatform db = factory.create(config); config.setDatabasePlatform(db); logger.info("DatabasePlatform name:" + config.getName() + " platform:" + db.getName()); } }
/** * Set the DatabasePlatform if it has not already been set. */ private void setDatabasePlatform(ServerConfig config) { DatabasePlatform dbPlatform = config.getDatabasePlatform(); if (dbPlatform == null) { if (config.getTenantMode().isDynamicDataSource()) { throw new IllegalStateException("DatabasePlatform must be explicitly set on ServerConfig for TenantMode "+config.getTenantMode()); } DatabasePlatformFactory factory = new DatabasePlatformFactory(); DatabasePlatform db = factory.create(config); db.configure(config.getDbTypeConfig()); config.setDatabasePlatform(db); logger.info("DatabasePlatform name:{} platform:{}", config.getName(), db.getName()); } }
public void configureDbConfig(ServerConfig config) { Validate.notNull(config, "Config cannot be null"); DataSourceConfig ds = new DataSourceConfig(); ds.setDriver("org.sqlite.JDBC"); ds.setUrl("jdbc:sqlite:{DIR}{NAME}.db"); ds.setUsername("bukkit"); ds.setPassword("walrus"); ds.setIsolationLevel(TransactionIsolation.getLevel("SERIALIZABLE")); if (ds.getDriver().contains("sqlite")) { config.setDatabasePlatform(new SQLitePlatform()); config.getDatabasePlatform().getDbDdlSyntax().setIdentity(""); } config.setDataSourceConfig(ds); }
serverConfig.setDatabasePlatform(new H2Platform()); } else { TenantMode tenantMode = serverConfig.getTenantMode();