|
@@ -40,6 +40,7 @@ import java.util.stream.Collectors;
|
|
import org.apache.kafka.clients.admin.ConfigEntry;
|
|
import org.apache.kafka.clients.admin.ConfigEntry;
|
|
import org.mapstruct.Mapper;
|
|
import org.mapstruct.Mapper;
|
|
import org.mapstruct.Mapping;
|
|
import org.mapstruct.Mapping;
|
|
|
|
+import org.mapstruct.Named;
|
|
|
|
|
|
@Mapper(componentModel = "spring")
|
|
@Mapper(componentModel = "spring")
|
|
public interface ClusterMapper {
|
|
public interface ClusterMapper {
|
|
@@ -90,6 +91,7 @@ public interface ClusterMapper {
|
|
|
|
|
|
Partition toPartition(InternalPartition topic);
|
|
Partition toPartition(InternalPartition topic);
|
|
|
|
|
|
|
|
+ @Named("setSchemaRegistry")
|
|
default InternalSchemaRegistry setSchemaRegistry(ClustersProperties.Cluster clusterProperties) {
|
|
default InternalSchemaRegistry setSchemaRegistry(ClustersProperties.Cluster clusterProperties) {
|
|
if (clusterProperties == null
|
|
if (clusterProperties == null
|
|
|| clusterProperties.getSchemaRegistry() == null) {
|
|
|| clusterProperties.getSchemaRegistry() == null) {
|
|
@@ -150,11 +152,13 @@ public interface ClusterMapper {
|
|
return brokerDiskUsage;
|
|
return brokerDiskUsage;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Named("mapDiskUsage")
|
|
default List<BrokerDiskUsage> mapDiskUsage(Map<Integer, InternalBrokerDiskUsage> brokers) {
|
|
default List<BrokerDiskUsage> mapDiskUsage(Map<Integer, InternalBrokerDiskUsage> brokers) {
|
|
return brokers.entrySet().stream().map(e -> this.map(e.getKey(), e.getValue()))
|
|
return brokers.entrySet().stream().map(e -> this.map(e.getKey(), e.getValue()))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Named("sumMetrics")
|
|
default BigDecimal sumMetrics(Map<String, BigDecimal> metrics) {
|
|
default BigDecimal sumMetrics(Map<String, BigDecimal> metrics) {
|
|
if (metrics != null) {
|
|
if (metrics != null) {
|
|
return metrics.values().stream().reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
return metrics.values().stream().reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
@@ -163,6 +167,7 @@ public interface ClusterMapper {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Named("resolvePath")
|
|
default Path resolvePath(String path) {
|
|
default Path resolvePath(String path) {
|
|
if (path != null) {
|
|
if (path != null) {
|
|
return Path.of(path);
|
|
return Path.of(path);
|
|
@@ -171,6 +176,7 @@ public interface ClusterMapper {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Named("setProperties")
|
|
default Properties setProperties(Properties properties) {
|
|
default Properties setProperties(Properties properties) {
|
|
Properties copy = new Properties();
|
|
Properties copy = new Properties();
|
|
if (properties != null) {
|
|
if (properties != null) {
|