<commit_before>package io.mangoo.persistence;

import java.util.List;
import java.util.Objects;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bson.types.ObjectId;

import com.google.common.base.Preconditions;
import com.google.inject.Inject;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;

import dev.morphia.DeleteOptions;
import dev.morphia.Morphia;
import dev.morphia.query.experimental.filters.Filters;
import io.mangoo.core.Config;
import io.mangoo.enums.Required;

/**
 * 
 * @author svenkubiak
 *
 */
public class DatastoreImpl implements Datastore {
    private static final Logger LOG = LogManager.getLogger(DatastoreImpl.class);
    private dev.morphia.Datastore datastore; //NOSONAR
    private MongoClient mongoClient;
    private Config config;
    private String prefix = "persistence.";
    
    @Inject
    public DatastoreImpl(Config config) {
        this.config = Objects.requireNonNull(config, Required.CONFIG.toString());
        connect();
    }

    public DatastoreImpl(Config config, String prefix) {
        this.config = Objects.requireNonNull(config, Required.CONFIG.toString());
        this.prefix = Objects.requireNonNull(prefix, Required.PREFIX.toString());
        this.prefix = prefix + ".";
    }

    @Override
    public dev.morphia.Datastore getDatastore() {
        return this.datastore;
    }
    
    @Override
    public dev.morphia.Datastore query() {
        return this.datastore;
    }

    @Override<commit_msg>Fixed prefix handling in persistence<commit_after>package io.mangoo.persistence;

import java.util.List;
import java.util.Objects;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bson.types.ObjectId;

import com.google.common.base.Preconditions;
import com.google.inject.Inject;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;

import dev.morphia.DeleteOptions;
import dev.morphia.Morphia;
import dev.morphia.query.experimental.filters.Filters;
import io.mangoo.core.Config;
import io.mangoo.enums.Required;

/**
 * 
 * @author svenkubiak
 *
 */
public class DatastoreImpl implements Datastore {
    private static final Logger LOG = LogManager.getLogger(DatastoreImpl.class);
    private dev.morphia.Datastore datastore; //NOSONAR
    private MongoClient mongoClient;
    private Config config;
    private String prefix = "persistence.";
    
    @Inject
    public DatastoreImpl(Config config) {
        this.config = Objects.requireNonNull(config, Required.CONFIG.toString());
        connect();
    }

    public DatastoreImpl(Config config, String prefix) {
        this.config = Objects.requireNonNull(config, Required.CONFIG.toString());
        this.prefix = Objects.requireNonNull(prefix, Required.PREFIX.toString());
        this.prefix = "persistence." + prefix + ".";
    }

    @Override
    public dev.morphia.Datastore getDatastore() {
        return this.datastore;
    }
    
    @Override
    public dev.morphia.Datastore query() {
        return this.datastore;
    }

    @Override
{'fraction_non_alphanumeric': 0.1057014734144779, 'fraction_numerical': 0.0012812299807815502, 'mean_word_length': 3.6335311572700295, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2015722', 'n_tokens_mistral': 972, 'n_tokens_neox': 963, 'n_words': 186}