Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ private static ConfigInfos mergeConfigInfos(String connType, ConfigInfos... conf
for (ConfigInfos configInfos : configInfosList) {
if (configInfos != null) {
errorCount += configInfos.errorCount();
configInfoList.addAll(configInfos.values());
configInfoList.addAll(configInfos.configs());
groups.addAll(configInfos.groups());
}
}
Expand Down Expand Up @@ -1073,7 +1073,7 @@ protected final boolean maybeAddConfigErrors(
StringBuilder messages = new StringBuilder();
messages.append("Connector configuration is invalid and contains the following ")
.append(errors).append(" error(s):");
for (ConfigInfo configInfo : configInfos.values()) {
for (ConfigInfo configInfo : configInfos.configs()) {
for (String msg : configInfo.configValue().errors()) {
messages.append('\n').append(msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,12 @@
*/
package org.apache.kafka.connect.runtime.rest.entities;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;

public class ConfigInfo {

private final ConfigKeyInfo configKey;
private final ConfigValueInfo configValue;

@JsonCreator
public ConfigInfo(
@JsonProperty("definition") ConfigKeyInfo configKey,
@JsonProperty("value") ConfigValueInfo configValue) {
this.configKey = configKey;
this.configValue = configValue;
}

@JsonProperty("definition")
public ConfigKeyInfo configKey() {
return configKey;
}

@JsonProperty("value")
public ConfigValueInfo configValue() {
return configValue;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ConfigInfo that = (ConfigInfo) o;
return Objects.equals(configKey, that.configKey) &&
Objects.equals(configValue, that.configValue);
}

@Override
public int hashCode() {
return Objects.hash(configKey, configValue);
}

public record ConfigInfo(
@JsonProperty("definition") ConfigKeyInfo configKey,
@JsonProperty("value") ConfigValueInfo configValue
) {
@Override
public String toString() {
return "[" + configKey + "," + configValue + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,84 +16,23 @@
*/
package org.apache.kafka.connect.runtime.rest.entities;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.Objects;

public class ConfigInfos {

@JsonProperty("name")
private final String name;

@JsonProperty("error_count")
private final int errorCount;

@JsonProperty("groups")
private final List<String> groups;

@JsonProperty("configs")
private final List<ConfigInfo> configs;

@JsonCreator
public ConfigInfos(@JsonProperty("name") String name,
@JsonProperty("error_count") int errorCount,
@JsonProperty("groups") List<String> groups,
@JsonProperty("configs") List<ConfigInfo> configs) {
this.name = name;
this.groups = groups;
this.errorCount = errorCount;
this.configs = configs;
}

@JsonProperty
public String name() {
return name;
}

@JsonProperty
public List<String> groups() {
return groups;
}

@JsonProperty("error_count")
public int errorCount() {
return errorCount;
}

@JsonProperty("configs")
public List<ConfigInfo> values() {
return configs;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ConfigInfos that = (ConfigInfos) o;
return Objects.equals(name, that.name) &&
Objects.equals(errorCount, that.errorCount) &&
Objects.equals(groups, that.groups) &&
Objects.equals(configs, that.configs);
}

@Override
public int hashCode() {
return Objects.hash(name, errorCount, groups, configs);
}

public record ConfigInfos(
@JsonProperty("name") String name,
@JsonProperty("error_count") int errorCount,
@JsonProperty("groups") List<String> groups,
@JsonProperty("configs") List<ConfigInfo> configs
) {
@Override
public String toString() {
return "[" +
name +
"," +
errorCount +
"," +
groups +
"," +
configs +
"]";
name + "," +
errorCount + "," +
groups + "," +
configs +
"]";
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,153 +16,39 @@
*/
package org.apache.kafka.connect.runtime.rest.entities;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.Objects;

public class ConfigKeyInfo {

private final String name;
private final String type;
private final boolean required;
private final String defaultValue;
private final String importance;
private final String documentation;
private final String group;
private final int orderInGroup;
private final String width;
private final String displayName;
private final List<String> dependents;

@JsonCreator
public ConfigKeyInfo(@JsonProperty("name") String name,
@JsonProperty("type") String type,
@JsonProperty("required") boolean required,
@JsonProperty("default_value") String defaultValue,
@JsonProperty("importance") String importance,
@JsonProperty("documentation") String documentation,
@JsonProperty("group") String group,
@JsonProperty("order_in_group") int orderInGroup,
@JsonProperty("width") String width,
@JsonProperty("display_name") String displayName,
@JsonProperty("dependents") List<String> dependents) {
this.name = name;
this.type = type;
this.required = required;
this.defaultValue = defaultValue;
this.importance = importance;
this.documentation = documentation;
this.group = group;
this.orderInGroup = orderInGroup;
this.width = width;
this.displayName = displayName;
this.dependents = dependents;
}

@JsonProperty
public String name() {
return name;
}

@JsonProperty
public String type() {
return type;
}

@JsonProperty
public boolean required() {
return required;
}

@JsonProperty("default_value")
public String defaultValue() {
return defaultValue;
}

@JsonProperty
public String documentation() {
return documentation;
}

@JsonProperty
public String group() {
return group;
}

@JsonProperty("order")
public int orderInGroup() {
return orderInGroup;
}

@JsonProperty
public String width() {
return width;
}

@JsonProperty
public String importance() {
return importance;
}

@JsonProperty("display_name")
public String displayName() {
return displayName;
}

@JsonProperty
public List<String> dependents() {
return dependents;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ConfigKeyInfo that = (ConfigKeyInfo) o;
return Objects.equals(name, that.name) &&
Objects.equals(type, that.type) &&
Objects.equals(required, that.required) &&
Objects.equals(defaultValue, that.defaultValue) &&
Objects.equals(importance, that.importance) &&
Objects.equals(documentation, that.documentation) &&
Objects.equals(group, that.group) &&
Objects.equals(orderInGroup, that.orderInGroup) &&
Objects.equals(width, that.width) &&
Objects.equals(displayName, that.displayName) &&
Objects.equals(dependents, that.dependents);
}

@Override
public int hashCode() {
return Objects.hash(name, type, required, defaultValue, importance, documentation, group, orderInGroup, width, displayName, dependents);
}

public record ConfigKeyInfo(
@JsonProperty("name") String name,
@JsonProperty("type") String type,
@JsonProperty("required") boolean required,
@JsonProperty("default_value") String defaultValue,
@JsonProperty("importance") String importance,
@JsonProperty("documentation") String documentation,
@JsonProperty("group") String group,
@JsonProperty("order_in_group") int orderInGroup,
@JsonProperty("width") String width,
@JsonProperty("display_name") String displayName,
@JsonProperty("dependents") List<String> dependents
) {
@Override
public String toString() {
return "[" +
name +
"," +
type +
"," +
required +
"," +
defaultValue +
"," +
importance +
"," +
documentation +
"," +
group +
"," +
orderInGroup +
"," +
width +
"," +
displayName +
"," +
dependents +
"]";
}
name + "," +
type + "," +
required + "," +
defaultValue + "," +
importance + "," +
documentation + "," +
group + "," +
orderInGroup + "," +
width + "," +
displayName + "," +
dependents +
"]";
}

// equals() and hashCode() are auto-generated by record
}
Loading