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

org.sirix.access.SubComponentResourceManagerFactory 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 org.sirix.access;

import org.sirix.api.NodeReadOnlyTrx;
import org.sirix.api.NodeTrx;
import org.sirix.api.ResourceManager;
import org.sirix.cache.BufferManager;

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

/**
 * A parameterizable resource manager factory that creates {@link ResourceManager} instances based on
 * {@link GenericResourceManagerComponent a resource manager subcomponent}.
 *
 * @author Joao Sousa
 */
public class SubComponentResourceManagerFactory,
        R extends ResourceManager>
        implements ResourceManagerFactory {

    private final Provider subComponentBuilder;

    public SubComponentResourceManagerFactory(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();
    }
}