Example usage for org.springframework.jdbc.datasource.embedded EmbeddedDatabaseFactory setDatabasePopulator

List of usage examples for org.springframework.jdbc.datasource.embedded EmbeddedDatabaseFactory setDatabasePopulator

Introduction

In this page you can find the example usage for org.springframework.jdbc.datasource.embedded EmbeddedDatabaseFactory setDatabasePopulator.

Prototype

public void setDatabasePopulator(DatabasePopulator populator) 

Source Link

Document

Set the strategy that will be used to initialize or populate the embedded database.

Usage

From source file:sf.wicklet.gwt.site.server.db.H2Configurator.java

/** @param dbpath Absolute path relative to web application context root. */
public static EmbeddedDatabase createDatabase(final String dbpath, final String... initscripts)
        throws ClassNotFoundException {
    final EmbeddedDatabaseFactory f = new EmbeddedDatabaseFactory();
    final ResourceDatabasePopulator p = new ResourceDatabasePopulator();
    final ResourceLoader l = new DefaultResourceLoader();
    final IWickletSupport support = Config.get().getSupport();
    final File dbfile = support.getContextFile(dbpath + ".h2.db");
    if (!dbfile.exists()) {
        for (final String s : initscripts) {
            p.addScript(l.getResource("file:" + support.getContextFile(s).getAbsolutePath()));
        }//from  w  w  w  .  ja v  a2s  .c  om
    }
    f.setDatabasePopulator(p);
    f.setDatabaseConfigurer(H2Configurator.getInstance(support.getContextFile(dbpath).getAbsolutePath()));
    // Database name is actually a don't care.
    f.setDatabaseName(TextUtil.fileName(dbpath));
    return f.getDatabase();
}

From source file:com.pramati.knowyou.config.MainConfig.java

@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("knowyou");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
}

From source file:de.uni_koeln.spinfo.maalr.login.config.H2Config.java

@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("maalr-social-connect");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
}

From source file:com.github.gabrielruiu.spring.yahoo.sample.config.InMemoryDatabaseConfig.java

@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("spring-social-yahoo-sample");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
}

From source file:com.vmware.entertainmentetc.config.MainConfig.java

@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("entertainmentetc");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
}

From source file:com.kdubb.social.config.MainConfig.java

@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("spring-social-quickstart");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
}

From source file:p2v.config.MainConfig.java

@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("p2v-spring-social");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
}

From source file:net.nobien.springsocial.examples.instagram.config.MainConfig.java

@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("spring-social-instagram");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
}

From source file:net.nobien.springsocial.examples.foursquare.config.MainConfig.java

@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("spring-social-foursquare");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
}

From source file:com.cloudfoundry.samples.spring.config.MainConfig.java

@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("spring-social-cloudfoundry");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
}