// Path: src/main/java/org/jboss/elasticsearch/tools/content/ValueUtils.java
// public static interface IValueEncoder {
//     public String encode(Object value);
// }


import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.http.Consts;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.config.ConnectionConfig;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
import org.elasticsearch.common.jackson.core.io.JsonStringEncoder;
import org.elasticsearch.common.settings.SettingsException;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.jboss.elasticsearch.tools.content.ValueUtils.IValueEncoder;
        if (logger.isDebugEnabled())
            logger.debug("Parsed ResponseData: {}", responseParsed);

        if (logger.isDebugEnabled())
            logger.debug("Data before processing: {}", data);

        for (Map<String, String> mappingRecord : responseMapping) {
            String restResponseField = mappingRecord.get(CFG_rest_response_field);
            Object v = null;
            if ("_source".equals(restResponseField)) {
                v = responseParsed;
            } else {
                if (restResponseField.contains(".")) {
                    v = XContentMapValues.extractValue(restResponseField, responseParsed);
                } else {
                    v = responseParsed.get(restResponseField);
                }
            }

            if (v == null && mappingRecord.get(CFG_value_default) != null) {
                v = ValueUtils.processStringValuePatternReplacement(mappingRecord.get(CFG_value_default), data, null);
            }
            StructureUtils.putValueIntoMapOfMaps(data, mappingRecord.get(CFG_target_field), v);
        }

        if (logger.isDebugEnabled())
            logger.debug("Data after processing: {}", data);

    }

// Path: src/main/java/org/jboss/elasticsearch/tools/content/ValueUtils.java
// public static interface IValueEncoder {
//     public String encode(Object value);
// }


// Path: src/main/java/org/jboss/elasticsearch/tools/content/RESTCallPreprocessor.java
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.http.Consts;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.config.ConnectionConfig;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
import org.elasticsearch.common.jackson.core.io.JsonStringEncoder;
import org.elasticsearch.common.settings.SettingsException;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.jboss.elasticsearch.tools.content.ValueUtils.IValueEncoder;

        if (logger.isDebugEnabled())
            logger.debug("Parsed ResponseData: {}", responseParsed);

        if (logger.isDebugEnabled())
            logger.debug("Data before processing: {}", data);

        for (Map<String, String> mappingRecord : responseMapping) {
            String restResponseField = mappingRecord.get(CFG_rest_response_field);
            Object v = null;
            if ("_source".equals(restResponseField)) {
                v = responseParsed;
            } else {
                if (restResponseField.contains(".")) {
                    v = XContentMapValues.extractValue(restResponseField, responseParsed);
                } else {
                    v = responseParsed.get(restResponseField);
                }
            }

            if (v == null && mappingRecord.get(CFG_value_default) != null) {
                v = ValueUtils.processStringValuePatternReplacement(mappingRecord.get(CFG_value_default), data, null);
            }
            StructureUtils.putValueIntoMapOfMaps(data, mappingRecord.get(CFG_target_field), v);
        }

        if (logger.isDebugEnabled())
            logger.debug("Data after processing: {}", data);

    }

    protected static final IValueEncoder jsonValueEncoder = new IValueEncoder() {