<commit_before>package nl.uva.cs.lobcder.webDav.resources;

import com.bradmcevoy.common.Path;
import com.bradmcevoy.http.Resource;
import com.bradmcevoy.http.ResourceFactory;
import nl.uva.cs.lobcder.catalogue.JDBCatalogue;
import nl.uva.cs.lobcder.resources.LogicalData;
import nl.uva.cs.lobcder.util.Constants;
import org.slf4j.LoggerFactory;

public class WebDataResourceFactory implements ResourceFactory {

    private JDBCatalogue catalogue;
    private static final boolean debug = true;
    private static final org.slf4j.Logger log = LoggerFactory.getLogger(WebDataResourceFactory.class);

    public WebDataResourceFactory(JDBCatalogue catalogue) throws Exception {
        this.catalogue = catalogue;
    }

    @Override
    public Resource getResource(String host, String strPath) {

        Path ldri = Path.path(strPath).getStripFirst().getStripFirst();
        try {
            //Gets the root path. If instead we called :'ldri = Path.path(strPath);' we get back '/lobcder-1.0-SNAPSHOT'
            debug("getResource:  strPath: " + strPath + " path: " + Path.path(strPath) + " ldri: " + ldri);
            debug("getResource:  host: " + host + " path: " + ldri);

            LogicalData entry = catalogue.getResourceEntryByLDRI(ldri, null);
            if (entry == null) {
                System.err.println("NULL!!!!!!!!!!!!!");
                return null;
            }

            if (entry.getType().equals(Constants.LOGICAL_FOLDER)) {
                return new WebDataDirResource(catalogue, entry);
            }
            if (entry.getType().equals(Constants.LOGICAL_FILE)) {
                return new WebDataFileResource(catalogue, entry);
            }
            return new WebDataResource(catalogue, entry);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }<commit_msg>Removed print <commit_after>package nl.uva.cs.lobcder.webDav.resources;

import com.bradmcevoy.common.Path;
import com.bradmcevoy.http.Resource;
import com.bradmcevoy.http.ResourceFactory;
import nl.uva.cs.lobcder.catalogue.JDBCatalogue;
import nl.uva.cs.lobcder.resources.LogicalData;
import nl.uva.cs.lobcder.util.Constants;
import org.slf4j.LoggerFactory;

public class WebDataResourceFactory implements ResourceFactory {

    private JDBCatalogue catalogue;
    private static final boolean debug = true;
    private static final org.slf4j.Logger log = LoggerFactory.getLogger(WebDataResourceFactory.class);

    public WebDataResourceFactory(JDBCatalogue catalogue) throws Exception {
        this.catalogue = catalogue;
    }

    @Override
    public Resource getResource(String host, String strPath) {

        Path ldri = Path.path(strPath).getStripFirst().getStripFirst();
        try {
            //Gets the root path. If instead we called :'ldri = Path.path(strPath);' we get back '/lobcder-1.0-SNAPSHOT'
            debug("getResource:  strPath: " + strPath + " path: " + Path.path(strPath) + " ldri: " + ldri);
            debug("getResource:  host: " + host + " path: " + ldri);

            LogicalData entry = catalogue.getResourceEntryByLDRI(ldri, null);
            if (entry == null) {
                return null;
            }

            if (entry.getType().equals(Constants.LOGICAL_FOLDER)) {
                return new WebDataDirResource(catalogue, entry);
            }
            if (entry.getType().equals(Constants.LOGICAL_FILE)) {
                return new WebDataFileResource(catalogue, entry);
            }
            return new WebDataResource(catalogue, entry);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
{'fraction_non_alphanumeric': 0.10682819383259912, 'fraction_numerical': 0.0022026431718061676, 'mean_word_length': 2.760869565217391, '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': '21181', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1075, 'n_words': 225}