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

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

import dagger.Module;
import dagger.Provides;
import org.sirix.access.DatabaseConfiguration;
import org.sirix.access.LocalDatabase;
import org.sirix.access.LocalDatabaseModule;
import org.sirix.access.PathBasedPool;
import org.sirix.access.ResourceManagerFactory;
import org.sirix.access.ResourceStore;
import org.sirix.access.ResourceStoreImpl;
import org.sirix.access.SubComponentResourceManagerFactory;
import org.sirix.access.WriteLocksRegistry;
import org.sirix.api.Database;
import org.sirix.api.ResourceManager;
import org.sirix.api.TransactionManager;
import org.sirix.api.xml.XmlResourceManager;
import org.sirix.dagger.DatabaseScope;

import javax.inject.Provider;

/**
 * The module for {@link XmlLocalDatabaseComponent}.
 *
 * @author Joao Sousa
 */
@Module(includes = LocalDatabaseModule.class)
public interface XmlLocalDatabaseModule {

    @DatabaseScope
    @Provides
    static ResourceManagerFactory resourceManagerFactory(
            final Provider subComponentBuilder) {

        return new SubComponentResourceManagerFactory<>(subComponentBuilder);
    }

    @DatabaseScope
    @Provides
    static Database xmlDatabase(final TransactionManager transactionManager,
                                                    final DatabaseConfiguration dbConfig,
                                                    final PathBasedPool> sessions,
                                                    final ResourceStore resourceStore,
                                                    final WriteLocksRegistry writeLocks,
                                                    final PathBasedPool> resourceManagers) {

        return new LocalDatabase<>(
                transactionManager,
                dbConfig,
                sessions,
                resourceStore,
                writeLocks,
                resourceManagers
        );
    }

    @DatabaseScope
    @Provides
    static ResourceStore xmlResourceManager(
            final PathBasedPool> allResourceManagers,
            final ResourceManagerFactory resourceManagerFactory) {

        return new ResourceStoreImpl<>(allResourceManagers, resourceManagerFactory);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy