Tabnine Logo
DataSourceConfig
Code IndexAdd Tabnine to your IDE (free)

How to use
DataSourceConfig
in
com.avaje.ebean.config

Best Java code snippets using com.avaje.ebean.config.DataSourceConfig (Showing top 14 results out of 315)

origin: Bukkit/Bukkit

final void init(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) {
  this.loader = loader;
  this.server = server;
  this.file = file;
  this.description = description;
  this.dataFolder = dataFolder;
  this.classLoader = classLoader;
  this.configFile = new File(dataFolder, "config.yml");
  this.logger = new PluginLogger(this);
  if (description.isDatabaseEnabled()) {
    ServerConfig db = new ServerConfig();
    db.setDefaultServer(false);
    db.setRegister(false);
    db.setClasses(getDatabaseClasses());
    db.setName(description.getName());
    server.configureDbConfig(db);
    DataSourceConfig ds = db.getDataSourceConfig();
    ds.setUrl(replaceDatabaseString(ds.getUrl()));
    dataFolder.mkdirs();
    ClassLoader previous = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(classLoader);
    ebean = EbeanServerFactory.create(db);
    Thread.currentThread().setContextClassLoader(previous);
  }
}
origin: org.avaje/ebean

this.poolListener = createPoolListener(params.getPoolListener());
this.transactionIsolation = params.getIsolationLevel();
this.maxInactiveTimeSecs = params.getMaxInactiveTimeSecs();
this.leakTimeMinutes = params.getLeakTimeMinutes();
this.captureStackTrace = params.isCaptureStackTrace();
this.maxStackTraceSize = params.getMaxStackTraceSize();
this.databaseDriver = params.getDriver();
this.databaseUrl = params.getUrl();
this.pstmtCacheSize = params.getPstmtCacheSize();
this.minConnections = params.getMinConnections();
this.maxConnections = params.getMaxConnections();
this.waitTimeoutMillis = params.getWaitTimeoutMillis();
this.heartbeatsql = params.getHeartbeatSql();
String un = params.getUsername();
String pw = params.getPassword();
if (un == null) {
  throw new RuntimeException("DataSource user is null?");
this.connectionProps.setProperty("password", pw);
Map<String, String> customProperties = params.getCustomProperties();
if (customProperties != null){
 Set<Entry<String,String>> entrySet = customProperties.entrySet();
origin: MinecraftWars/Gringotts

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);
}
origin: org.avaje.ebeanorm/avaje-ebeanorm-server

public DataSourcePool getDataSource(String name, DataSourceConfig dsConfig){
  
  if (name == null){
    throw new IllegalArgumentException("name not defined");
  }
      
  synchronized(monitor){
    DataSourcePool pool = dsMap.get(name);
    if (pool == null){
      if (dsConfig == null){
        dsConfig = new DataSourceConfig();
        dsConfig.loadSettings(name);
      }
      pool = new DataSourcePool(this, name, dsConfig);
      dsMap.put(name, pool); 
    }
    return pool;
  }
}
 
origin: com.khubla.pragmatach/pragmatach-ebean

final DataSourceConfig dataSourceConfig = new DataSourceConfig();
dataSourceConfig.setDriver(Application.getConfiguration().getParameter("ebean.driver"));
dataSourceConfig.setUsername(Application.getConfiguration().getParameter("ebean.username"));
dataSourceConfig.setPassword(Application.getConfiguration().getParameter("ebean.password"));
final String url = Application.getConfiguration().getParameter("ebean.url");
if (null != url) {
  dataSourceConfig.setUrl(url);
} else {
  throw new Exception("ebean.url must be specified");
origin: org.avaje/ebean

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);
}
origin: org.avaje.ebeanorm/avaje-ebeanorm-server

this.poolListener = createPoolListener(params.getPoolListener());
this.transactionIsolation = params.getIsolationLevel();
this.maxInactiveTimeSecs = params.getMaxInactiveTimeSecs();
this.leakTimeMinutes = params.getLeakTimeMinutes();
this.captureStackTrace = params.isCaptureStackTrace();
this.maxStackTraceSize = params.getMaxStackTraceSize();
this.databaseDriver = params.getDriver();
this.databaseUrl = params.getUrl();
this.pstmtCacheSize = params.getPstmtCacheSize();
this.minConnections = params.getMinConnections();
this.maxConnections = params.getMaxConnections();
this.waitTimeoutMillis = params.getWaitTimeoutMillis();
this.heartbeatsql = params.getHeartbeatSql();
String un = params.getUsername();
String pw = params.getPassword();
if (un == null) {
  throw new RuntimeException("DataSource user is null?");
this.connectionProps.setProperty("password", pw);
Map<String, String> customProperties = params.getCustomProperties();
if (customProperties != null){
 Set<Entry<String,String>> entrySet = customProperties.entrySet();
origin: org.avaje/ebean

public DataSourcePool getDataSource(String name, DataSourceConfig dsConfig){
  
  if (name == null){
    throw new IllegalArgumentException("name not defined");
  }
      
  synchronized(monitor){
    DataSourcePool pool = dsMap.get(name);
    if (pool == null){
      if (dsConfig == null){
        dsConfig = new DataSourceConfig();
        dsConfig.loadSettings(name);
      }
      pool = new DataSourcePool(this, name, dsConfig);
      dsMap.put(name, pool); 
    }
    return pool;
  }
}
 
origin: org.avaje.ebeanorm/avaje-ebeanorm-server

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);
}
origin: MrNeuronix/IRISv2

config.setName("iris");
DataSourceConfig ds = new DataSourceConfig();
ds.loadSettings("iris");
origin: MinecraftWars/Gringotts

public Gringotts() {
  ServerConfig dbConfig = new ServerConfig();
  dbConfig.setDefaultServer(false);
  dbConfig.setRegister(false);
  dbConfig.setClasses(getDatabaseClasses());
  dbConfig.setName(getDescription().getName());
  configureDbConfig(dbConfig);
  DataSourceConfig dsConfig = dbConfig.getDataSourceConfig();
  dsConfig.setUrl(replaceDatabaseString(dsConfig.getUrl()));
  getDataFolder().mkdirs();
  ClassLoader previous = Thread.currentThread().getContextClassLoader();
  Thread.currentThread().setContextClassLoader(getClassLoader());
  ebean = EbeanServerFactory.create(dbConfig);
  Thread.currentThread().setContextClassLoader(previous);
}
origin: org.avaje/ebean

 dataSourceConfig = new DataSourceConfig();
dataSourceConfig.loadSettings(p.getServerName());
origin: SpigotMC/Spigot-API

final void init(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) {
  this.loader = loader;
  this.server = server;
  this.file = file;
  this.description = description;
  this.dataFolder = dataFolder;
  this.classLoader = classLoader;
  this.configFile = new File(dataFolder, "config.yml");
  this.logger = new PluginLogger(this);
  if (description.isDatabaseEnabled()) {
    ServerConfig db = new ServerConfig();
    db.setDefaultServer(false);
    db.setRegister(false);
    db.setClasses(getDatabaseClasses());
    db.setName(description.getName());
    server.configureDbConfig(db);
    DataSourceConfig ds = db.getDataSourceConfig();
    ds.setUrl(replaceDatabaseString(ds.getUrl()));
    dataFolder.mkdirs();
    ClassLoader previous = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(classLoader);
    ebean = EbeanServerFactory.create(db);
    Thread.currentThread().setContextClassLoader(previous);
  }
}
origin: org.avaje.ebeanorm/avaje-ebeanorm-api

 dataSourceConfig = new DataSourceConfig();
dataSourceConfig.loadSettings(p.getServerName());
com.avaje.ebean.configDataSourceConfig

Javadoc

Used to config a DataSource when using the internal Ebean DataSource implementation.

If a DataSource instance is already defined via ServerConfig#setDataSource(javax.sql.DataSource) or defined as JNDI dataSource via ServerConfig#setDataSourceJndiName(String) then those will used and not this DataSourceConfig.

Most used methods

  • <init>
  • getUrl
    Return the connection URL.
  • loadSettings
    Load the settings from ebean.properties.
  • setUrl
    Set the connection URL.
  • getDriver
    Return the database driver.
  • getCustomProperties
    Return a map of custom properties for the jdbc driver connection.
  • getHeartbeatSql
    Return a SQL statement used to test the database is accessible. Note that if this is not set then it
  • getIsolationLevel
    Return the transaction isolation level.
  • getLeakTimeMinutes
    Return the time in minutes after which a connection could be considered to have leaked.
  • getMaxConnections
    Return the maximum number of connections the pool can reach.
  • getMaxInactiveTimeSecs
    Return the time in seconds a connection can be idle after which it can be trimmed from the pool. Thi
  • getMaxStackTraceSize
    Return the max size for reporting stack traces on busy connections.
  • getMaxInactiveTimeSecs,
  • getMaxStackTraceSize,
  • getMinConnections,
  • getPassword,
  • getPoolListener,
  • getPstmtCacheSize,
  • getUsername,
  • getWaitTimeoutMillis,
  • isCaptureStackTrace,
  • isOffline

Popular in Java

  • Updating database using SQL prepared statement
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now