mimaison commented on code in PR #21330:
URL: https://github.com/apache/kafka/pull/21330#discussion_r2846630360


##########
connect/api/src/main/java/org/apache/kafka/connect/components/ConnectPlugin.java:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kafka.connect.components;
+
+import org.apache.kafka.common.config.ConfigDef;
+
+/**
+ * Interface for components that provide version and configuration 
specifications.
+ * This interface establishes a common contract for all Kafka Connect 
components
+ * that define a version and expose configurable properties, enabling uniform 
discovery and introspection
+ * of component configurations.
+ *
+ * <p>Components implementing this interface declare their version and 
configuration requirements
+ * through a {@link ConfigDef} object, which describes the configuration 
properties
+ * including their names, types, default values, validators, and documentation.
+
+ *
+ */
+public interface ConnectPlugin {
+
+    /**
+     * Get the version of this component.
+     *
+     * @return the version, formatted as a String. The version may not be 
{@code null} or empty.
+     */
+    String version();

Review Comment:
   Should the interface extend `Versioned` instead of redefining the 
`version()` method?



##########
connect/api/src/main/java/org/apache/kafka/connect/transforms/predicates/Predicate.java:
##########
@@ -37,13 +38,14 @@
  *
  * @param <R> The type of record.
  */
-public interface Predicate<R extends ConnectRecord<R>> extends Configurable, 
AutoCloseable {
+public interface Predicate<R extends ConnectRecord<R>> extends Configurable, 
AutoCloseable, ConnectPlugin {

Review Comment:
   Don't we need a default `version()` implementation here? Existing 
`Predicate` implementations may not override `version()`



##########
connect/api/src/main/java/org/apache/kafka/connect/transforms/Transformation.java:
##########
@@ -36,7 +37,7 @@
  *
  * @param <R> The type of record (must be an implementation of {@link 
ConnectRecord})
  */
-public interface Transformation<R extends ConnectRecord<R>> extends 
Configurable, Closeable {
+public interface Transformation<R extends ConnectRecord<R>> extends 
Configurable, Closeable, ConnectPlugin {

Review Comment:
   Don't we need a default `version()` implementation here? 
Existing`Transformation` implementations may not override `version()`



##########
connect/api/src/main/java/org/apache/kafka/connect/storage/HeaderConverter.java:
##########
@@ -61,5 +62,16 @@ public interface HeaderConverter extends Configurable, 
Closeable {
      * Configuration specification for this set of header converters.
      * @return the configuration specification; may not be null
      */
+    @Override
     ConfigDef config();

Review Comment:
   Do we need to keep this here?



##########
connect/api/src/main/java/org/apache/kafka/connect/storage/StringConverter.java:
##########
@@ -42,7 +41,7 @@
  * <p>
  * This implementation currently does nothing with the topic names or header 
keys.
  */
-public class StringConverter implements Converter, HeaderConverter, Versioned {
+public class StringConverter implements Converter, HeaderConverter {

Review Comment:
   I think we can do the same on the other Converters too `BooleanConverter`, 
`ByteArrayConverter`, etc



##########
connect/api/src/main/java/org/apache/kafka/connect/transforms/predicates/Predicate.java:
##########
@@ -37,13 +38,14 @@
  *
  * @param <R> The type of record.
  */
-public interface Predicate<R extends ConnectRecord<R>> extends Configurable, 
AutoCloseable {
+public interface Predicate<R extends ConnectRecord<R>> extends Configurable, 
AutoCloseable, ConnectPlugin {

Review Comment:
   If so we can remove `implements Versioned` in all the built-in `Predicate` 
Kafka has



##########
connect/api/src/main/java/org/apache/kafka/connect/transforms/Transformation.java:
##########
@@ -36,7 +37,7 @@
  *
  * @param <R> The type of record (must be an implementation of {@link 
ConnectRecord})
  */
-public interface Transformation<R extends ConnectRecord<R>> extends 
Configurable, Closeable {
+public interface Transformation<R extends ConnectRecord<R>> extends 
Configurable, Closeable, ConnectPlugin {

Review Comment:
   If so we can remove `implements Versioned` in all the built-in 
`Transformation` Kafka has



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to