Search in sources :

Example 1 with EntityStore

use of com.sleepycat.persist.EntityStore in project OpenRefine by OpenRefine.

the class RefineBrokerImpl method init.

@Override
public void init(ServletConfig config) throws Exception {
    logger.trace("> init");
    super.init(config);
    timer = new Timer();
    expirer = new Expirer();
    timer.schedule(expirer, 0, LOCK_EXPIRATION_CHECK_DELAY);
    String dataDir = config.getInitParameter("refine.data");
    if (dataDir == null)
        dataDir = "data";
    File dataPath = new File(dataDir);
    if (!dataPath.exists())
        dataPath.mkdirs();
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    env = new Environment(dataPath, envConfig);
    StoreConfig storeConfig = new StoreConfig();
    storeConfig.setAllowCreate(true);
    storeConfig.setTransactional(true);
    projectStore = new EntityStore(env, "ProjectsStore", storeConfig);
    lockStore = new EntityStore(env, "LockStore", storeConfig);
    projectById = projectStore.getPrimaryIndex(String.class, Project.class);
    lockById = lockStore.getPrimaryIndex(String.class, Lock.class);
    locksByProject = lockStore.getSecondaryIndex(lockById, String.class, "pid");
    logger.trace("< init");
}
Also used : Timer(java.util.Timer) EnvironmentConfig(com.sleepycat.je.EnvironmentConfig) Environment(com.sleepycat.je.Environment) StoreConfig(com.sleepycat.persist.StoreConfig) EntityStore(com.sleepycat.persist.EntityStore) File(java.io.File)

Aggregations

Environment (com.sleepycat.je.Environment)1 EnvironmentConfig (com.sleepycat.je.EnvironmentConfig)1 EntityStore (com.sleepycat.persist.EntityStore)1 StoreConfig (com.sleepycat.persist.StoreConfig)1 File (java.io.File)1 Timer (java.util.Timer)1