<commit_before>package com.headwire.aemdc.runner;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.headwire.aemdc.companion.Config;
import com.headwire.aemdc.companion.Constants;
import com.headwire.aemdc.companion.Reflection;
import com.headwire.aemdc.companion.Resource;
import com.headwire.aemdc.replacer.Replacer;


/**
 * Compound Runner for set of different template types.
 *
 */
public class CompoundRunner extends BasisRunner {

  private static final Logger LOG = LoggerFactory.getLogger(CompoundRunner.class);
  private static final String HELP_FOLDER = "help";

  /**
   * Invoker
   */
  private final List<BasisRunner> runners = new ArrayList<BasisRunner>();
  private final Config config;

  /**
   * Constructor
   *
   * @param pResource
   *          - resource object
   * @throws IOException
   */
  public CompoundRunner(final Resource pResource, final Config pConfig) {
    LOG.debug("Compound runner starting...");
    resource = pResource;
    config = pConfig;

    final Properties dynProps = config.getDynamicProperties(resource.getType(), resource.getSourceName());
    if (dynProps == null) {
      LOG.error("Unknown <type>=[{}] and [name]=[{}] argument.", resource.getType(), resource.getSourceName());
      return;
    }

    resource.setSourceFolderPath(dynProps.getProperty(Constants.DYN_CONFIGPROP_SOURCE_TYPE_FOLDER));

    // get compound template list
    final Map<String, String> compoundList = config.getCompoundList(resource.getSourceName());
    if (compoundList.size() == 0) {
      LOG.error("Can't get compound list for template name [{}].", resource.getSourceName());
      return;
    }

    for (final Map.Entry<String, String> entry : compoundList.entrySet()) {
      final String templateType = entry.getKey();
      final String templateName = entry.getValue();

      // Creates Invoker object, command object and configure them
      final Resource templateResource = resource.clone();
      templateResource.setType(templateType);
      templateResource.setSourceName(templateName);

      // Get Runner
      final Reflection reflection = new Reflection(config);
      final BasisRunner runner = reflection.getRunner(templateResource);
      if (runner != null) {
        runners.add(runner);
      } else {
        LOG.error("Unknown configurated compound <type>:<name>={}:{}.", templateType, templateName);
      }
    }<commit_msg>Fix, to avoid compound error message<commit_after>package com.headwire.aemdc.runner;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.headwire.aemdc.companion.Config;
import com.headwire.aemdc.companion.Constants;
import com.headwire.aemdc.companion.Reflection;
import com.headwire.aemdc.companion.Resource;
import com.headwire.aemdc.replacer.Replacer;


/**
 * Compound Runner for set of different template types.
 *
 */
public class CompoundRunner extends BasisRunner {

  private static final Logger LOG = LoggerFactory.getLogger(CompoundRunner.class);
  private static final String HELP_FOLDER = "help";

  /**
   * Invoker
   */
  private final List<BasisRunner> runners = new ArrayList<BasisRunner>();
  private final Config config;

  /**
   * Constructor
   *
   * @param pResource
   *          - resource object
   * @throws IOException
   */
  public CompoundRunner(final Resource pResource, final Config pConfig) {
    resource = pResource;
    config = pConfig;

    LOG.debug("Compound runner starting...");

    final Properties dynProps = config.getDynamicProperties(resource.getType(), resource.getSourceName());
    if (dynProps == null) {
      LOG.error("Unknown <type>=[{}] and [name]=[{}] argument.", resource.getType(), resource.getSourceName());
      return;
    }
    resource.setSourceFolderPath(dynProps.getProperty(Constants.DYN_CONFIGPROP_SOURCE_TYPE_FOLDER));

    if (StringUtils.isNotBlank(resource.getSourceName())) {
      // get compound template list
      final Map<String, String> compoundList = config.getCompoundList(resource.getSourceName());
      if (compoundList.size() == 0) {
        LOG.error("Can't get compound list for template name [{}].", resource.getSourceName());
      }

      for (final Map.Entry<String, String> entry : compoundList.entrySet()) {
        final String templateType = entry.getKey();
        final String templateName = entry.getValue();

        // Creates Invoker object, command object and configure them
        final Resource templateResource = resource.clone();
        templateResource.setType(templateType);
        templateResource.setSourceName(templateName);

        // Get Runner
        final Reflection reflection = new Reflection(config);
        final BasisRunner runner = reflection.getRunner(templateResource);
        if (runner != null) {
          runners.add(runner);
        } else {
          LOG.error("Unknown configurated compound <type>:<name>={}:{}.", templateType, templateName);
        }
      }
    }
{'fraction_non_alphanumeric': 0.11449083695446817, 'fraction_numerical': 0.0015114301908180617, 'mean_word_length': 3.7057777777777776, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '1460680', 'n_tokens_mistral': 1515, 'n_tokens_neox': 1473, 'n_words': 352}