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

io.sirix.access.SubComponentResourceSessionFactory 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;

import io.sirix.cache.BufferManager;
import io.sirix.api.NodeReadOnlyTrx;
import io.sirix.api.NodeTrx;
import io.sirix.api.ResourceSession;

import javax.inject.Provider;
import java.nio.file.Path;

/**
 * A parameterizable resource session factory that creates {@link ResourceSession} instances based on
 * {@link GenericResourceSessionComponent a resource session subcomponent}.
 *
 * @author Joao Sousa
 */
public class SubComponentResourceSessionFactory, R extends ResourceSession>
    implements ResourceSessionFactory {

  private final Provider subComponentBuilder;

  public SubComponentResourceSessionFactory(final Provider subComponentBuilder) {
    this.subComponentBuilder = subComponentBuilder;
  }

  @Override
  public R create(final ResourceConfiguration resourceConfig, final BufferManager bufferManager,
      final Path resourceFile) {
    return this.subComponentBuilder.get()
                                   .resourceConfig(resourceConfig)
                                   .bufferManager(bufferManager)
                                   .resourceFile(resourceFile)
                                   .build()
                                   .resourceManager();
  }
}