/**
   * Get a connection pool data source for use by Java DB storage engines
   *
   * @param dbPath The path where the db will be located
   * @param memory whether to actually use a memory database
   * @return the {@link ConnectionPoolDataSource}
   */
  public static ConnectionPoolDataSource getDataSource(String dbPath, boolean memory) {

    EmbeddedConnectionPoolDataSource40 ds = new EmbeddedConnectionPoolDataSource40();
    if (memory) {
      ds.setDatabaseName("memory:SyncDB");
    } else {
      String path = "SyncDB";
      if (dbPath != null) {
        File f = new File(dbPath, "SyncDB");
        path = f.getAbsolutePath();
      }

      ds.setDatabaseName(path);
    }
    ds.setCreateDatabase("create");
    ds.setUser("floodlight");
    ds.setPassword("floodlight");
    return ds;
  }