<commit_before>package com.github.lucene.store.database;

import java.io.IOException;
import java.util.Collection;

import javax.sql.DataSource;

import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.Lock;
import org.apache.lucene.store.LockFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.lucene.store.database.dialect.Dialect;

public class DatabaseDirectory extends Directory {

    private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseDirectory.class);

    /**
     *
     */
    private static final DatabaseDirectoryHandler handler = DatabaseDirectoryHandler.INSTANCE;

    private final String indexTableName;
    private final DataSource dataSource;
    private final Dialect dialect;
    private final LockFactory lockFactory;

    /**
     * @param dataSource
     * @param dialect
     * @param indexTableName
     * @throws DatabaseDirectoryException
     */
    public DatabaseDirectory(final DataSource dataSource, final Dialect dialect, final String indexTableName)
            throws DatabaseDirectoryException {
        this(dataSource, dialect, indexTableName, DatabaseLockFactory.INSTANCE);
    }

    /**
     * @param dataSource
     * @param dialect
     * @param indexTableName
     * @param lockFactory
     * @throws DatabaseDirectoryException
     */
    public DatabaseDirectory(final DataSource dataSource, final Dialect dialect, final String indexTableName,
            final LockFactory lockFactory) throws DatabaseDirectoryException {
        this.dataSource = dataSource;
        this.dialect = dialect;
        this.indexTableName = indexTableName;
        this.lockFactory = lockFactory;

        // create directory, if it doesn't exist
        if (dialect.supportsTableExists() && !handler.existsIndexTable(this)) {
            LOGGER.info("{}: creating lucene index table", this);
            handler.createIndexTable(this);
        }
    }

    public String getIndexTableName() {
        return indexTableName;
    }

    public DataSource getDataSource() {
        return dataSource;
    }

    public Dialect getDialect() {
        return dialect;
    }

    @Override
    public String[] listAll() throws IOException {
        LOGGER.debug("{}.listAll()", this);<commit_msg>review DatabaseDirectory to delete constructor with LockFactory parameter<commit_after>package com.github.lucene.store.database;

import java.io.IOException;
import java.util.Collection;

import javax.sql.DataSource;

import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.Lock;
import org.apache.lucene.store.LockFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.lucene.store.database.dialect.Dialect;

public class DatabaseDirectory extends Directory {

    private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseDirectory.class);

    /**
     *
     */
    private static final DatabaseDirectoryHandler handler = DatabaseDirectoryHandler.INSTANCE;

    private final String indexTableName;
    private final DataSource dataSource;
    private final Dialect dialect;
    private final LockFactory lockFactory;

    /**
     * @param dataSource
     * @param dialect
     * @param indexTableName
     * @throws DatabaseDirectoryException
     */
    public DatabaseDirectory(final DataSource dataSource, final Dialect dialect, final String indexTableName)
            throws DatabaseDirectoryException {
        this.dataSource = dataSource;
        this.dialect = dialect;
        this.indexTableName = indexTableName;
        lockFactory = dialect.getLockFactory();

        // create directory, if it doesn't exist
        if (dialect.supportsTableExists() && !handler.existsIndexTable(this)) {
            LOGGER.info("{}: creating lucene index table", this);
            handler.createIndexTable(this);
        }
    }

    public String getIndexTableName() {
        return indexTableName;
    }

    public DataSource getDataSource() {
        return dataSource;
    }

    public Dialect getDialect() {
        return dialect;
    }

    @Override
    public String[] listAll() throws IOException {
        LOGGER.debug("{}.listAll()", this);
{'fraction_non_alphanumeric': 0.08533034714445689, 'fraction_numerical': 0.0008958566629339306, 'mean_word_length': 3.310810810810811, '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': '4333883', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1170, 'n_words': 287}