CreateConnectorRequest parseConnectorConfigurationFile(String filePath) throws IOException {
        ObjectMapper objectMapper = new ObjectMapper();

        File connectorConfigurationFile = Paths.get(filePath).toFile();
        try {
            Map<String, String> connectorConfigs = objectMapper.readValue(
                connectorConfigurationFile,
                new TypeReference<Map<String, String>>() { });

            if (!connectorConfigs.containsKey(NAME_CONFIG)) {
                throw new ConnectException("Connector configuration at '" + filePath + "' is missing the mandatory '" + NAME_CONFIG + "' "
                    + "configuration");
            }
            return new CreateConnectorRequest(connectorConfigs.get(NAME_CONFIG), connectorConfigs, null);
        } catch (StreamReadException | DatabindException e) {
            log.debug("Could not parse connector configuration file '{}' into a Map with String keys and values", filePath);
        }

        try {
            objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
            CreateConnectorRequest createConnectorRequest = objectMapper.readValue(connectorConfigurationFile,
                new TypeReference<CreateConnectorRequest>() { });
            if (createConnectorRequest.config().containsKey(NAME_CONFIG)) {
                if (!createConnectorRequest.config().get(NAME_CONFIG).equals(createConnectorRequest.name())) {
                    throw new ConnectException("Connector name configuration in 'config' doesn't match the one specified in 'name' at '" + filePath
                        + "'");
                }
            } else {
                createConnectorRequest.config().put(NAME_CONFIG, createConnectorRequest.name());
            }
            return createConnectorRequest;
        } catch (StreamReadException | DatabindException e) {
            log.debug("Could not parse connector configuration file '{}' into an object of type {}",
                filePath, CreateConnectorRequest.class.getSimpleName());
        }

        Map<String, String> connectorConfigs = Utils.propsToStringMap(Utils.loadProps(filePath));
        if (!connectorConfigs.containsKey(NAME_CONFIG)) {
            throw new ConnectException("Connector configuration at '" + filePath + "' is missing the mandatory '" + NAME_CONFIG + "' "
                + "configuration");
        }
        return new CreateConnectorRequest(connectorConfigs.get(NAME_CONFIG), connectorConfigs, null);
    }
Parse a connector configuration file into a {@link CreateConnectorRequest}. The file can have any one of the following formats (note that
we attempt to parse the file in this order):
<ol>
    <li>A JSON file containing an Object with only String keys and values that represent the connector configuration.</li>
    <li>A JSON file containing an Object that can be parsed directly into a {@link CreateConnectorRequest}</li>
    <li>A valid Java Properties file (i.e. containing String key/value pairs representing the connector configuration)</li>
</ol>
<p>
Visible for testing.

@param filePath the path of the connector configuration file
@return the parsed connector configuration in the form of a {@link CreateConnectorRequest}
connect/runtime/src/main/java/org/apache/kafka/connect/cli/ConnectStandalone.java