<commit_before>package org.jboss.windup.reporting.freemarker;

import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import org.jboss.forge.furnace.Furnace;
import org.jboss.windup.config.GraphRewrite;
import org.jboss.windup.config.Variables;
import org.jboss.windup.config.operation.GraphOperation;
import org.jboss.windup.reporting.service.ReportService;
import org.jboss.windup.util.exception.WindupException;
import org.ocpsoft.rewrite.context.EvaluationContext;

import freemarker.template.Template;
import freemarker.template.TemplateException;

/**
 * This class is used to produce a freemarker report (and the associated ReportModel) from outside of an Iteration context.
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a> <<EMAIL>)
 *
 */
public class FreeMarkerOperation extends GraphOperation
{
    private static final Logger LOG = Logger.getLogger(FreeMarkerOperation.class.getName());

    private final Furnace furnace;
    private final String templatePath;
    private final String outputFilename;
    private List<String> variableNames = new ArrayList<>();

    protected FreeMarkerOperation(Furnace furnace, String templatePath, String outputFilename, String... varNames)
    {
        this.furnace = furnace;
        this.templatePath = templatePath;
        this.outputFilename = outputFilename;
        this.variableNames = Arrays.asList(varNames);
    }

    /**<commit_msg>Update FreeMarkerOperation.java<commit_after>package org.jboss.windup.reporting.freemarker;

import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import org.jboss.forge.furnace.Furnace;
import org.jboss.windup.config.GraphRewrite;
import org.jboss.windup.config.Variables;
import org.jboss.windup.config.operation.GraphOperation;
import org.jboss.windup.reporting.service.ReportService;
import org.jboss.windup.util.exception.WindupException;
import org.ocpsoft.rewrite.context.EvaluationContext;

import freemarker.template.Template;
import freemarker.template.TemplateException;

/**
 * This class is used to produce a freemarker report (and the associated ReportModel) from outside of an Iteration context.
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a> <<EMAIL>)
 *
 */
public class FreeMarkerOperation extends GraphOperation
{
    private static final Logger LOG = Logger.getLogger(FreeMarkerOperation.class.getName());

    private final Furnace furnace;
    private final String templatePath;
    private final String outputFilename;
    private List<String> variableNames = new ArrayList<>();

    protected FreeMarkerOperation(Furnace furnace, String templatePath, String outputFilename, String... varNames)
    {
        this.furnace = furnace;
        this.templatePath = templatePath.replace('\\', '/');
        this.outputFilename = outputFilename;
        this.variableNames = Arrays.asList(varNames);
    }

    /**
{'fraction_non_alphanumeric': 0.10365282547611614, 'fraction_numerical': 0.0, 'mean_word_length': 4.7214285714285715, 'pattern_counts': {'":': 0, '<': 19, '<?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': '144786', 'n_tokens_mistral': 950, 'n_tokens_neox': 911, 'n_words': 213}