this.captureStackTrace = params.isCaptureStackTrace(); this.maxStackTraceSize = params.getMaxStackTraceSize(); this.databaseDriver = params.getDriver(); this.databaseUrl = params.getUrl(); this.pstmtCacheSize = params.getPstmtCacheSize();
this.captureStackTrace = params.isCaptureStackTrace(); this.maxStackTraceSize = params.getMaxStackTraceSize(); this.databaseDriver = params.getDriver(); this.databaseUrl = params.getUrl(); this.pstmtCacheSize = params.getPstmtCacheSize();
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); }
private DataSource getDataSourceFromConfig(ServerConfig config) { DataSource ds = null; if (config.getDataSourceJndiName() != null) { ds = jndiDataSourceFactory.lookup(config.getDataSourceJndiName()); if (ds == null) { String m = "JNDI lookup for DataSource " + config.getDataSourceJndiName() + " returned null."; throw new PersistenceException(m); } else { return ds; } } DataSourceConfig dsConfig = config.getDataSourceConfig(); if (dsConfig == null) { String m = "No DataSourceConfig definded for " + config.getName(); throw new PersistenceException(m); } if (dsConfig.isOffline()) { if (config.getDatabasePlatformName() == null) { String m = "You MUST specify a DatabasePlatformName on ServerConfig when offline"; throw new PersistenceException(m); } return null; } if (dsConfig.getHeartbeatSql() == null) { // use default heartbeatSql from the DatabasePlatform String heartbeatSql = getHeartbeatSql(dsConfig.getDriver()); dsConfig.setHeartbeatSql(heartbeatSql); } return DataSourceGlobalManager.getDataSource(config.getName(), dsConfig); }
private DataSource getDataSourceFromConfig(ServerConfig config) { DataSource ds = null; if (config.getDataSourceJndiName() != null) { ds = jndiDataSourceFactory.lookup(config.getDataSourceJndiName()); if (ds == null) { String m = "JNDI lookup for DataSource " + config.getDataSourceJndiName() + " returned null."; throw new PersistenceException(m); } else { return ds; } } DataSourceConfig dsConfig = config.getDataSourceConfig(); if (dsConfig == null) { String m = "No DataSourceConfig definded for " + config.getName(); throw new PersistenceException(m); } if (dsConfig.isOffline()) { if (config.getDatabasePlatformName() == null) { String m = "You MUST specify a DatabasePlatformName on ServerConfig when offline"; throw new PersistenceException(m); } return null; } if (dsConfig.getHeartbeatSql() == null) { // use default heartbeatSql from the DatabasePlatform String heartbeatSql = getHeartbeatSql(dsConfig.getDriver()); dsConfig.setHeartbeatSql(heartbeatSql); } return DataSourceGlobalManager.getDataSource(config.getName(), dsConfig); }