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

io.sirix.access.json.LocalJsonDatabaseFactory Maven / Gradle / Ivy

Go to download

SirixDB is a hybrid on-disk and in-memory document oriented, versioned database system. It has a lightweight buffer manager, stores everything in a huge persistent and durable tree and allows efficient reconstruction of every revision. Furthermore, SirixDB implements change tracking, diffing and supports time travel queries.

There is a newer version: 0.11.0
Show newest version
package io.sirix.access.json;

import io.sirix.access.DatabaseConfiguration;
import io.sirix.access.LocalDatabaseFactory;
import io.sirix.access.User;
import io.sirix.access.json.JsonLocalDatabaseComponent.Builder;
import io.sirix.api.Database;
import io.sirix.api.json.JsonResourceSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;

/**
 * A database session factory for Json databases.
 *
 * @author Joao Sousa
 */
@Singleton
public class LocalJsonDatabaseFactory implements LocalDatabaseFactory {

  /**
   * Logger for {@link LocalJsonDatabaseFactory}.
   */
  private static final Logger logger = LoggerFactory.getLogger(LocalJsonDatabaseFactory.class);

  private final Provider subComponentBuilder;

  @Inject
  LocalJsonDatabaseFactory(final Provider subComponentBuilder) {
    this.subComponentBuilder = subComponentBuilder;
  }

  @Override
  public Database createDatabase(final DatabaseConfiguration configuration, final User user) {
    logger.trace("Creating new local JSON database instance (open)");
    return this.subComponentBuilder.get().databaseConfiguration(configuration).user(user).build().database();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy