[ 
https://issues.apache.org/jira/browse/GOBBLIN-1927?focusedWorklogId=884939&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-884939
 ]

ASF GitHub Bot logged work on GOBBLIN-1927:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Oct/23 07:00
            Start Date: 13/Oct/23 07:00
    Worklog Time Spent: 10m 
      Work Description: wsarecv commented on code in PR #3793:
URL: https://github.com/apache/gobblin/pull/3793#discussion_r1357845239


##########
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/validator/TopicValidators.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.gobblin.source.extractor.extract.kafka.validator;
+
+import com.google.common.base.Strings;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.gobblin.configuration.SourceState;
+import org.apache.gobblin.source.extractor.extract.kafka.KafkaTopic;
+import org.apache.gobblin.util.reflection.GobblinConstructorUtils;
+
+/**
+ * The TopicValidators contains a list of {@link TopicValidatorBase} that 
validate topics.
+ * To enable it, add below settings in the config:
+ *   
gobblin.kafka.topicValidators=validator1_class_name,validator2_class_name...
+ */
+@Slf4j
+public class TopicValidators {
+  public static final String VALIDATOR_CLASSES_KEY = 
"gobblin.kafka.topicValidators";
+
+  public static final String VALIDATOR_CLASS_DELIMITER = ",";
+
+  private final List<TopicValidatorBase> validators = new ArrayList<>();
+
+  public TopicValidators(SourceState state) {
+    String validatorClasses = state.getProp(VALIDATOR_CLASSES_KEY);
+    if (Strings.isNullOrEmpty(validatorClasses)) {
+      return;
+    }
+
+    String[] validatorClassNames = 
validatorClasses.split(VALIDATOR_CLASS_DELIMITER);

Review Comment:
   Fixed





Issue Time Tracking
-------------------

    Worklog Id:     (was: 884939)
    Time Spent: 1h 10m  (was: 1h)

> Add topic validation support during work unit creation
> ------------------------------------------------------
>
>                 Key: GOBBLIN-1927
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1927
>             Project: Apache Gobblin
>          Issue Type: Bug
>            Reporter: Tao Qin
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to