001package io.ebean.datasource; 002 003/** 004 * Factory that creates DataSourcePool's. 005 * 006 * <pre>{@code 007 * 008 * DataSourceConfig config = new DataSourceConfig(); 009 * config.setDriver("org.h2.Driver"); 010 * config.setUrl("jdbc:h2:mem:tests2"); 011 * config.setUsername("sa"); 012 * config.setPassword(""); 013 * 014 * DataSourcePool pool = DataSourceFactory.create("test", config); 015 * 016 * Connection connection = pool.getConnection(); 017 * 018 * }</pre> 019 */ 020public interface DataSourceFactory { 021 022 /** 023 * Create the DataSourcePool given the name and configuration. 024 */ 025 static DataSourcePool create(String name, DataSourceConfig config) { 026 return DSManager.get().createPool(name, config); 027 } 028 029 DataSourcePool createPool(String name, DataSourceConfig config); 030}