@Override public DataSource createDataSource(DataSourceConfig conf) { ServerConfig ebeanConfig = new EbeanConfigAdaptor().adaptFrom(actConfig, conf, svc); DataSourceFactory factory = ebeanConfig.service(DataSourceFactory.class); if (factory == null) { throw new IllegalStateException("No DataSourceFactory service implementation found in class path." + " Probably missing dependency to avaje-datasource?"); } DataSourceAlertFactory alertFactory = ebeanConfig.service(DataSourceAlertFactory.class); org.avaje.datasource.DataSourceConfig dsConfig = ebeanConfig.getDataSourceConfig(); if (alertFactory != null) { dsConfig.setAlert(alertFactory.createAlert()); } if (conf.readOnly) { // setup to use AutoCommit such that we skip explicit commit dsConfig.setAutoCommit(true); } String poolName = ebeanConfig.getName() + (conf.readOnly ? "-ro" : ""); return new EbeanDataSourceWrapper(ebeanConfig, factory.createPool(poolName, dsConfig)); }
DataSourceFactory factory = config.service(DataSourceFactory.class); if (factory == null) { throw new IllegalStateException("No DataSourceFactory service implementation found in class path." DataSourceAlertFactory alertFactory = config.service(DataSourceAlertFactory.class); if (alertFactory != null) { dsConfig.setAlert(alertFactory.createAlert());
public InternalConfiguration(ClusterManager clusterManager, SpiCacheManager cacheManager, SpiBackgroundExecutor backgroundExecutor, ServerConfig serverConfig, BootupClasses bootupClasses) { this.docStoreFactory = initDocStoreFactory(serverConfig.service(DocStoreFactory.class)); this.jsonFactory = serverConfig.getJsonFactory(); this.clusterManager = clusterManager; this.backgroundExecutor = backgroundExecutor; this.cacheManager = cacheManager; this.serverConfig = serverConfig; this.bootupClasses = bootupClasses; DatabasePlatform databasePlatform = serverConfig.getDatabasePlatform(); this.expressionFactory = initExpressionFactory(serverConfig, databasePlatform); this.typeManager = new DefaultTypeManager(serverConfig, bootupClasses); this.deployInherit = new DeployInherit(bootupClasses); this.deployCreateProperties = new DeployCreateProperties(typeManager); this.deployUtil = new DeployUtil(typeManager, serverConfig); this.beanDescriptorManager = new BeanDescriptorManager(this); Map<String, String> asOfTableMapping = beanDescriptorManager.deploy(); Map<String, String> draftTableMap = beanDescriptorManager.getDraftTableMap(); this.dataTimeZone = initDataTimeZone(); this.binder = getBinder(typeManager, databasePlatform, dataTimeZone); this.cQueryEngine = new CQueryEngine(serverConfig, databasePlatform, binder, asOfTableMapping, draftTableMap); }