All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.sitebricks.persist.sql.SqlModule Maven / Gradle / Ivy

There is a newer version: 0.8.11
Show newest version
package com.google.sitebricks.persist.sql;

import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.sitebricks.persist.AbstractPersistenceModule;
import com.google.sitebricks.persist.Persister;
import com.jolbox.bonecp.BoneCPConfig;

import java.lang.annotation.Annotation;

/**
 * A simple disk-based object store. Will use any file system directory
 * specified (must be currently mounted).
 *
 * @author [email protected] (Dhanji R. Prasanna)
 */
public class SqlModule extends AbstractPersistenceModule {
  private final BoneCPConfig config;

  public SqlModule(BoneCPConfig config) {
    this(null, config);
  }

  public SqlModule(Class selector, BoneCPConfig config) {
    super(selector);
    this.config = config;
  }

  @Override
  protected void internalConfigure() {
    exposeEntityStoreDelegate(Sql.class);
  }

  @Provides @Singleton
  Persister providePersister() {
    SqlPersister persister = new SqlPersister(config);
//    requestInjection(persister);
    return persister;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy