<commit_before>package com.bitdubai.fermat_dmp_plugin.layer.transaction.incoming_extra_user.developer.bitdubai.version_1.util;

import com.bitdubai.fermat_api.layer.all_definition.event.EventSource;
import com.bitdubai.fermat_api.layer.all_definition.transaction_transference_protocol.TransactionProtocolManager;
import com.bitdubai.fermat_api.layer.all_definition.transaction_transference_protocol.crypto_transactions.CryptoTransaction;

import com.bitdubai.fermat_cry_api.layer.crypto_router.incoming_crypto.DealsWithIncomingCrypto;
import com.bitdubai.fermat_cry_api.layer.crypto_router.incoming_crypto.IncomingCryptoManager;
import com.bitdubai.fermat_dmp_plugin.layer.transaction.incoming_extra_user.developer.bitdubai.version_1.exceptions.SourceNotRecognizedException;

/**
 * Created by eze on 11/06/15.
 */

/*
 * As the number of transaction senders will increase, this class will be in charge of
 * returning the MonitorAgent the TransactionSender that corresponds to the event source
 * that notifies new transactions
 */
public class SourceAdministrator implements DealsWithIncomingCrypto {

    private IncomingCryptoManager incomingCryptoManager;

    public TransactionProtocolManager<CryptoTransaction> getSourceAdministrator(final EventSource eventSource) throws SourceNotRecognizedException {
        // This method will select the correct sender according to the specified source,
        switch (eventSource) {
            case CRYPTO_ROUTER:
                return incomingCryptoManager.getTransactionManager();
            default:
                String exceptionMessage = "There is no administrator for this source";
                String context = "The event source was: "+ eventSource.name() + "with code " + eventSource.getCode();
                String possibleCause = "Value not considered in switch statement";
                throw new SourceNotRecognizedException(exceptionMessage,null,context,possibleCause);
        }
    }

    @Override
    public void setIncomingCryptoManager(final IncomingCryptoManager incomingCryptoManager) {
        this.incomingCryptoManager = incomingCryptoManager;<commit_msg>Exception Handling Inncoming Extra User SourceAdministrator class<commit_after>package com.bitdubai.fermat_dmp_plugin.layer.transaction.incoming_extra_user.developer.bitdubai.version_1.util;

import com.bitdubai.fermat_api.FermatException;
import com.bitdubai.fermat_api.layer.all_definition.event.EventSource;
import com.bitdubai.fermat_api.layer.all_definition.transaction_transference_protocol.TransactionProtocolManager;
import com.bitdubai.fermat_api.layer.all_definition.transaction_transference_protocol.crypto_transactions.CryptoTransaction;

import com.bitdubai.fermat_cry_api.layer.crypto_router.incoming_crypto.DealsWithIncomingCrypto;
import com.bitdubai.fermat_cry_api.layer.crypto_router.incoming_crypto.IncomingCryptoManager;
import com.bitdubai.fermat_dmp_plugin.layer.transaction.incoming_extra_user.developer.bitdubai.version_1.exceptions.SourceNotRecognizedException;

/**
 * Created by eze on 11/06/15.
 */

/*
 * As the number of transaction senders will increase, this class will be in charge of
 * returning the MonitorAgent the TransactionSender that corresponds to the event source
 * that notifies new transactions
 */
public class SourceAdministrator implements DealsWithIncomingCrypto {

    private IncomingCryptoManager incomingCryptoManager;

    public TransactionProtocolManager<CryptoTransaction> getSourceAdministrator(final EventSource eventSource) throws SourceNotRecognizedException {
        try {
            // This method will select the correct sender according to the specified source,
            switch (eventSource) {
                case CRYPTO_ROUTER:
                    return incomingCryptoManager.getTransactionManager();
                default:
                    String exceptionMessage = "There is no administrator for this source";
                    String context = "The event source was: " + eventSource.name() + "with code " + eventSource.getCode();
                    String possibleCause = "Value not considered in switch statement";
                    throw new SourceNotRecognizedException(exceptionMessage, null, context, possibleCause);
            }
        } catch (SourceNotRecognizedException e) {
            throw e;
        } catch (Exception e) {
            throw new SourceNotRecognizedException("Unexpected Exception", FermatException.wrapException(e),"","");
        }
    }

    @Override
    public void setIncomingCryptoManager(final IncomingCryptoManager incomingCryptoManager) {
        this.incomingCryptoManager = incomingCryptoManager;
{'fraction_non_alphanumeric': 0.06429489927132448, 'fraction_numerical': 0.0034290612944706386, 'mean_word_length': 4.285390713476784, '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': '4946820', 'n_tokens_mistral': 1256, 'n_tokens_neox': 1215, 'n_words': 266}