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

com.github.aidensuen.mongo.session.impl.DefaultMongoSessionFactory Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
package com.github.aidensuen.mongo.session.impl;

import com.github.aidensuen.mongo.session.Configuration;
import com.github.aidensuen.mongo.session.ExecutorType;
import com.github.aidensuen.mongo.session.MongoSession;
import com.github.aidensuen.mongo.session.MongoSessionFactory;
import org.springframework.data.mongodb.core.MongoOperations;

public class DefaultMongoSessionFactory implements MongoSessionFactory {

    private final Configuration configuration;

    private final MongoOperations mongoOperations;

    public DefaultMongoSessionFactory(Configuration configuration, MongoOperations mongoOperations) {
        this.configuration = configuration;
        this.mongoOperations = mongoOperations;
    }

    @Override
    public MongoSession getMongoSession() {
        return getMongoSession(this.configuration.getDefaultExecutorType());
    }

    @Override
    public MongoSession getMongoSession(ExecutorType executorType) {
        return new DefaultMongoSession(mongoOperations, configuration, this.configuration.newExecutor(mongoOperations, executorType));
    }

    @Override
    public Configuration getConfiguration() {
        return this.configuration;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy