<commit_before>package com.altamiracorp.lumify.core.config;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.ConfigurationMap;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Responsible for parsing application configuration file and providing
 * configuration values to the application
 */
public final class Configuration {

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

    public static final String APP_CONFIG_LOCATION = "application.config.location";
    public static final String APP_CREDENTIALS_LOCATION = "application.config.credentials.location";

    public static final String HADOOP_URL = "hadoop.url";
    public static final String ZK_SERVERS = "zookeeper.serverNames";
    public static final String MODEL_PROVIDER = "model.provider";
    public static final String WORK_QUEUE_REPOSITORY = "work-queue-repository";
    public static final String CONTENT_TYPE_EXTRACTOR = "content-type-extractor";
    public static final String FILESYSTEM_PROVIDER = "fs.provider";
    public static final String MODEL_USER = "model.username";
    public static final String MODEL_PASSWORD = "<PASSWORD>";
    public static final String GRAPH_PROVIDER = "graph.provider";
    public static final String SEARCH_PROVIDER = "search.provider";
    public static final String AUTHENTICATION_PROVIDER = "authentication.provider";
    public static final String MAP_PROVIDER = "map.provider";
    public static final String MAP_ACCESS_KEY = "map.apiKey";
    public static final String MAP_TILE_SERVER_HOST = "map.tileServer.hostName";
    public static final String MAP_TILE_SERVER_PORT = "map.tileServer.port";
    public static final String OBJECT_DETECTOR = "object.detector";

    private org.apache.commons.configuration.Configuration config;


    /**
     * Default value for a {@link String} property that could not be parsed
     */
    private static final String UNKNOWN_STRING = "Unknown";

    /**
     * Default value for a {@link Integer} property that could not be parsed
     */
    private static final int UNKNOWN_INT = -999;

    public Configuration() {
        this.config = new PropertiesConfiguration();
    }

    private Configuration(org.apache.commons.configuration.Configuration config) {
        this.config = config;
    }

    public String get(String propertyKey) {
        return get(propertyKey, UNKNOWN_STRING);
    }

    public String get(String propertyKey, String defaultValue) {
        return config.getString(propertyKey, defaultValue);
    }

    public Integer getInt(String propertyKey) {
        return config.getInt(propertyKey, UNKNOWN_INT);
    }

    public Class getClass(String propertyKey, String defaultClassName) throws ClassNotFoundException {
        String className = config.getString(propertyKey, defaultClassName);<commit_msg>fix config and more logging in storm runner<commit_after>package com.altamiracorp.lumify.core.config;

import org.apache.commons.configuration.AbstractConfiguration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.ConfigurationMap;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
import java.util.Map;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Responsible for parsing application configuration file and providing
 * configuration values to the application
 */
public final class Configuration {

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

    public static final String APP_CONFIG_LOCATION = "application.config.location";
    public static final String APP_CREDENTIALS_LOCATION = "application.config.credentials.location";

    public static final String HADOOP_URL = "hadoop.url";
    public static final String ZK_SERVERS = "zookeeper.serverNames";
    public static final String MODEL_PROVIDER = "model.provider";
    public static final String WORK_QUEUE_REPOSITORY = "work-queue-repository";
    public static final String CONTENT_TYPE_EXTRACTOR = "content-type-extractor";
    public static final String FILESYSTEM_PROVIDER = "fs.provider";
    public static final String MODEL_USER = "model.username";
    public static final String MODEL_PASSWORD = "<PASSWORD>";
    public static final String GRAPH_PROVIDER = "graph.provider";
    public static final String SEARCH_PROVIDER = "search.provider";
    public static final String AUTHENTICATION_PROVIDER = "authentication.provider";
    public static final String MAP_PROVIDER = "map.provider";
    public static final String MAP_ACCESS_KEY = "map.apiKey";
    public static final String MAP_TILE_SERVER_HOST = "map.tileServer.hostName";
    public static final String MAP_TILE_SERVER_PORT = "map.tileServer.port";
    public static final String OBJECT_DETECTOR = "object.detector";

    private org.apache.commons.configuration.Configuration config;


    /**
     * Default value for a {@link String} property that could not be parsed
     */
    private static final String UNKNOWN_STRING = "Unknown";

    /**
     * Default value for a {@link Integer} property that could not be parsed
     */
    private static final int UNKNOWN_INT = -999;

    public Configuration() {
        this.config = new PropertiesConfiguration();
        ((PropertiesConfiguration) this.config).setDelimiterParsingDisabled(true);
    }

    private Configuration(org.apache.commons.configuration.Configuration config) {
        this.config = config;
        if (this.config instanceof AbstractConfiguration) {
            ((AbstractConfiguration) this.config).setDelimiterParsingDisabled(true);
        }
    }

    public String get(String propertyKey) {
        return get(propertyKey, UNKNOWN_STRING);
    }

    public String get(String propertyKey, String defaultValue) {
        return config.getString(propertyKey, defaultValue);
    }

    public Integer getInt(String propertyKey) {
        return config.getInt(propertyKey, UNKNOWN_INT);
    }

    public Class getClass(String propertyKey, String defaultClassName) throws ClassNotFoundException {
        String className = config.getString(propertyKey, defaultClassName);
{'fraction_non_alphanumeric': 0.07927536231884058, 'fraction_numerical': 0.0014492753623188406, 'mean_word_length': 4.387197501951601, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6349374', 'n_tokens_mistral': 1826, 'n_tokens_neox': 1767, 'n_words': 508}