<commit_before>/*
 *   R Service Bus
 *   
 *   Copyright (c) Copyright of OpenAnalytics BVBA, 2010-2011
 *
 *   ===========================================================================
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Affero General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Affero General Public License for more details.
 *
 *   You should have received a copy of the GNU Affero General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package eu.openanalytics.rsb.config;

import java.io.File;
import java.net.URI;
import java.util.List;
import java.util.Map;

import eu.openanalytics.rsb.stats.JobStatisticsHandler;

/**
 * Defines the configuration of RSB, which is injected in all components in order to support runtime
 * changes.
 * 
 * @author "OpenAnalytics <<EMAIL>>"
 */
public interface Configuration {
    public static final String DEFAULT_JSON_CONFIGURATION_FILE = "rsb-configuration.json";

    public static final String R_SCRIPTS_CATALOG_SUBDIR = "r_scripts";
    public static final String SWEAVE_FILE_CATALOG_SUBDIR = "sweave_files";
    public static final String JOB_CONFIGURATION_CATALOG_SUBDIR = "job_configurations";
    public static final String EMAIL_REPLIES_CATALOG_SUBDIR = "email_replies";

    public static final String DEPOSIT_JOBS_SUBDIR = "inbox";
    public static final String DEPOSIT_ACCEPTED_SUBDIR = "accepted";
    public static final String DEPOSIT_RESULTS_SUBDIR = "outbox";

    /**
     * SMTP server configuration used for all RSB outbound email operations.
     */
    public interface SmtpConfiguration {
        String getHost();

        int getPort();

        String getUsername();

        String getPassword();
    }

    public interface DepositDirectoryConfiguration {
        /**
         * RSB must have full right on the root directory as it will need to create sub-directories
         * ({@value eu.openanalytics.rsb.config.Configuration.DEPOSIT_JOBS_SUBDIR} , {@value
         * eu.openanalytics.rsb.config.Configuration.DEPOSIT_ARCHIVE_SUBDIR} and {@value
         * eu.openanalytics.rsb.config.Configuration.DEPOSIT_RESULTS_SUBDIR}) and files below it.
         */
        File getRootDirectory();

        String getApplicationName();

        /**
         * Interval of time between to email account polling, in milliseconds.
         */
        long getPollingPeriod();
    }

    /**
     * POP/IMAP email account that must be polled for jobs.
     */
    public interface DepositEmailConfiguration {
        /**
         * An email account URI is of the form: pop3://usr:pwd@host/INBOX. Supported protocols are
         * pop3 and imap.
         */
        URI getAccountURI();

        String getApplicationName();

        /**
         * Interval of time between to email account polling, in milliseconds.
         */
        long getPollingPeriod();

        /**
         * Optional filename of a ready-made email response found in the catalog.
         * 
         * @see Configuration.getEmailRepliesCatalogDirectory()
         */
        String getResponseFileName();

        /**
         * Optional filename of a ready-made job configuration found in the catalog.
         * 
         * @see Configuration.getJobConfigurationCatalogDirectory()
         */
        String getJobConfigurationFileName();
    }

    /**
     * Job statistics handler configuration.
     */
    public interface JobStatisticsHandlerConfiguration {
        /**
         * The class must implement {@link JobStatisticsHandler}.
         */
        String getClassName();

        Map<String, Object> getParameters();
    }

    /**
     * Directory where a catalog of R scripts are stored.
     */
    File getRScriptsCatalogDirectory();

    /**
     * Directory where a catalog of Sweave files are stored.
     */
    File getSweaveFilesCatalogDirectory();

    /**
     * Directory where a catalog of job configuration files are stored.
     */
    File getJobConfigurationCatalogDirectory();

    /**
     * Directory where a catalog of Email replies are stored.
     */
    File getEmailRepliesCatalogDirectory();

    /**
     * Directory where result files are written.
     */
    File getResultsDirectory();

    /**
     * Directory where ActiveMQ stores its persisted data.
     */
    File getActiveMqWorkDirectory();

    /**
     * URI of the RServi RMI pool.
     */
    URI getDefaultRserviPoolUri();

    /**
     * Optional mapping of application names and RServi RMI pool URIs.
     */
    Map<String, URI> getApplicationSpecificRserviPoolUris();

    /**
     * Maximum time a job request can be pending its response (in milliseconds).
     */
    int getJobTimeOut();

    /**
     * Number of concurrent job workers per queue, which must be computed based on the number of
     * nodes in the RServi pool and the number of job queues (one global plus one per "boosted"
     * application).
     */
    int getNumberOfConcurrentJobWorkersPerQueue();

    /**
     * The SMTP server that will be used for all outbound email exchanges.
     */
    SmtpConfiguration getSmtpConfiguration();

    /**
     * Optional email address where RSB should send permanent error reports and other service
     * related messages.
     */
    String getAdministratorEmail();

    /**
     * Optional job statistics handler.
     */
    JobStatisticsHandlerConfiguration getJobStatisticsHandlerConfiguration();

    /**
     * Optional configuration of root directories where jobs and results will respectively be
     * dropped and retrieved. The map entry element has the root directory for key and the
     * application name for value. RSB must have full right on the root directory as it will need to
     * create sub-directories ({@value
     * eu.openanalytics.rsb.config.Configuration.DEPOSIT_JOBS_SUBDIR} , {@value
     * eu.openanalytics.rsb.config.Configuration.DEPOSIT_ARCHIVE_SUBDIR} and {@value
     * eu.openanalytics.rsb.config.Configuration.DEPOSIT_RESULTS_SUBDIR}) and files below it.
     */
    List<DepositDirectoryConfiguration> getDepositRootDirectories();

    /**
     * Optional configuration of email accounts that will be polled for jobs.
     */
    List<DepositEmailConfiguration> getDepositEmailAccounts();
}
<commit_msg>#101 fixed typo<commit_after>/*
 *   R Service Bus
 *   
 *   Copyright (c) Copyright of OpenAnalytics BVBA, 2010-2011
 *
 *   ===========================================================================
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Affero General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Affero General Public License for more details.
 *
 *   You should have received a copy of the GNU Affero General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package eu.openanalytics.rsb.config;

import java.io.File;
import java.net.URI;
import java.util.List;
import java.util.Map;

import eu.openanalytics.rsb.stats.JobStatisticsHandler;

/**
 * Defines the configuration of RSB, which is injected in all components in order to support runtime
 * changes.
 * 
 * @author "OpenAnalytics <<EMAIL>>"
 */
public interface Configuration {
    public static final String DEFAULT_JSON_CONFIGURATION_FILE = "rsb-configuration.json";

    public static final String R_SCRIPTS_CATALOG_SUBDIR = "r_scripts";
    public static final String SWEAVE_FILE_CATALOG_SUBDIR = "sweave_files";
    public static final String JOB_CONFIGURATION_CATALOG_SUBDIR = "job_configurations";
    public static final String EMAIL_REPLIES_CATALOG_SUBDIR = "email_replies";

    public static final String DEPOSIT_JOBS_SUBDIR = "inbox";
    public static final String DEPOSIT_ACCEPTED_SUBDIR = "accepted";
    public static final String DEPOSIT_RESULTS_SUBDIR = "outbox";

    /**
     * SMTP server configuration used for all RSB outbound email operations.
     */
    public interface SmtpConfiguration {
        String getHost();

        int getPort();

        String getUsername();

        String getPassword();
    }

    public interface DepositDirectoryConfiguration {
        /**
         * RSB must have full right on the root directory as it will need to create sub-directories
         * ({@value eu.openanalytics.rsb.config.Configuration.DEPOSIT_JOBS_SUBDIR} , {@value
         * eu.openanalytics.rsb.config.Configuration.DEPOSIT_ARCHIVE_SUBDIR} and {@value
         * eu.openanalytics.rsb.config.Configuration.DEPOSIT_RESULTS_SUBDIR}) and files below it.
         */
        File getRootDirectory();

        String getApplicationName();

        /**
         * Interval of time between to email account polling, in milliseconds.
         */
        long getPollingPeriod();
    }

    /**
     * POP/IMAP email account that must be polled for jobs.
     */
    public interface DepositEmailConfiguration {
        /**
         * An email account URI is of the form: pop3://usr:pwd@host/INBOX. Supported protocols are
         * pop3 and imap.
         */
        URI getAccountURI();

        String getApplicationName();

        /**
         * Interval of time between two email account polling, in milliseconds.
         */
        long getPollingPeriod();

        /**
         * Optional filename of a ready-made email response found in the catalog.
         * 
         * @see Configuration.getEmailRepliesCatalogDirectory()
         */
        String getResponseFileName();

        /**
         * Optional filename of a ready-made job configuration found in the catalog.
         * 
         * @see Configuration.getJobConfigurationCatalogDirectory()
         */
        String getJobConfigurationFileName();
    }

    /**
     * Job statistics handler configuration.
     */
    public interface JobStatisticsHandlerConfiguration {
        /**
         * The class must implement {@link JobStatisticsHandler}.
         */
        String getClassName();

        Map<String, Object> getParameters();
    }

    /**
     * Directory where a catalog of R scripts are stored.
     */
    File getRScriptsCatalogDirectory();

    /**
     * Directory where a catalog of Sweave files are stored.
     */
    File getSweaveFilesCatalogDirectory();

    /**
     * Directory where a catalog of job configuration files are stored.
     */
    File getJobConfigurationCatalogDirectory();

    /**
     * Directory where a catalog of Email replies are stored.
     */
    File getEmailRepliesCatalogDirectory();

    /**
     * Directory where result files are written.
     */
    File getResultsDirectory();

    /**
     * Directory where ActiveMQ stores its persisted data.
     */
    File getActiveMqWorkDirectory();

    /**
     * URI of the RServi RMI pool.
     */
    URI getDefaultRserviPoolUri();

    /**
     * Optional mapping of application names and RServi RMI pool URIs.
     */
    Map<String, URI> getApplicationSpecificRserviPoolUris();

    /**
     * Maximum time a job request can be pending its response (in milliseconds).
     */
    int getJobTimeOut();

    /**
     * Number of concurrent job workers per queue, which must be computed based on the number of
     * nodes in the RServi pool and the number of job queues (one global plus one per "boosted"
     * application).
     */
    int getNumberOfConcurrentJobWorkersPerQueue();

    /**
     * The SMTP server that will be used for all outbound email exchanges.
     */
    SmtpConfiguration getSmtpConfiguration();

    /**
     * Optional email address where RSB should send permanent error reports and other service
     * related messages.
     */
    String getAdministratorEmail();

    /**
     * Optional job statistics handler.
     */
    JobStatisticsHandlerConfiguration getJobStatisticsHandlerConfiguration();

    /**
     * Optional configuration of root directories where jobs and results will respectively be
     * dropped and retrieved. The map entry element has the root directory for key and the
     * application name for value. RSB must have full right on the root directory as it will need to
     * create sub-directories ({@value
     * eu.openanalytics.rsb.config.Configuration.DEPOSIT_JOBS_SUBDIR} , {@value
     * eu.openanalytics.rsb.config.Configuration.DEPOSIT_ARCHIVE_SUBDIR} and {@value
     * eu.openanalytics.rsb.config.Configuration.DEPOSIT_RESULTS_SUBDIR}) and files below it.
     */
    List<DepositDirectoryConfiguration> getDepositRootDirectories();

    /**
     * Optional configuration of email accounts that will be polled for jobs.
     */
    List<DepositEmailConfiguration> getDepositEmailAccounts();
}

{'fraction_non_alphanumeric': 0.08835672997522709, 'fraction_numerical': 0.0018767359807822235, 'mean_word_length': 2.766468758835171, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4262562', 'n_tokens_mistral': 3571, 'n_tokens_neox': 3426, 'n_words': 1196}