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

io.sirix.access.DatabaseModule Maven / Gradle / Ivy

package io.sirix.access;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import io.sirix.access.json.JsonLocalDatabaseComponent;
import io.sirix.access.json.LocalJsonDatabaseFactory;
import io.sirix.access.xml.LocalXmlDatabaseFactory;
import io.sirix.api.Database;
import io.sirix.api.ResourceSession;
import io.sirix.access.xml.XmlLocalDatabaseComponent;
import io.sirix.api.json.JsonResourceSession;
import io.sirix.api.xml.XmlResourceSession;

import javax.inject.Singleton;

/**
 * The DI module that bridges interfaces to implementations.
 *
 * @author Joao Sousa
 */
@Module(subcomponents = { JsonLocalDatabaseComponent.class, XmlLocalDatabaseComponent.class})
public interface DatabaseModule {

    @Binds
    @Singleton
    LocalDatabaseFactory bindJsonDatabaseFactory(LocalJsonDatabaseFactory jsonFactory);

    @Binds
    @Singleton
    LocalDatabaseFactory bindXmlDatabaseFactory(LocalXmlDatabaseFactory xmlFactory);

    @Provides
    @Singleton
    static PathBasedPool> databaseSessions() {
        return new PathBasedPool<>();
    }

    @Provides
    @Singleton
    static PathBasedPool> resourceManagers() {
        return new PathBasedPool<>();
    }



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy