kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: MINOR: Make some constructors in admin package public
Date Wed, 17 May 2017 11:42:09 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 62d5aac5d -> c36b5b7f6


MINOR: Make some constructors in admin package public

Add a public create API that takes a Properties instance.

Make the constructors for TopicDescription, TopicListing
and TopicPartitionInfo public to enable AdminClient
users to write better tests.

Author: Colin P. Mccabe <cmccabe@confluent.io>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #3070 from cmccabe/publicapi


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/c36b5b7f
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/c36b5b7f
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/c36b5b7f

Branch: refs/heads/trunk
Commit: c36b5b7f6ef5767c9455cca093ce05bf2a54d5db
Parents: 62d5aac
Author: Colin P. Mccabe <cmccabe@confluent.io>
Authored: Wed May 17 12:41:21 2017 +0100
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Wed May 17 12:41:28 2017 +0100

----------------------------------------------------------------------
 .../org/apache/kafka/clients/admin/AdminClient.java    | 13 ++++++++++++-
 .../apache/kafka/clients/admin/KafkaAdminClient.java   |  2 +-
 .../apache/kafka/clients/admin/TopicDescription.java   |  2 +-
 .../org/apache/kafka/clients/admin/TopicListing.java   |  2 +-
 .../apache/kafka/clients/admin/TopicPartitionInfo.java |  2 +-
 5 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/c36b5b7f/clients/src/main/java/org/apache/kafka/clients/admin/AdminClient.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/AdminClient.java b/clients/src/main/java/org/apache/kafka/clients/admin/AdminClient.java
index 7db5e6e..a976ca4 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/AdminClient.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/AdminClient.java
@@ -22,6 +22,7 @@ import org.apache.kafka.common.annotation.InterfaceStability;
 
 import java.util.Collection;
 import java.util.Map;
+import java.util.Properties;
 
 /**
  * The public interface for the {@link KafkaAdminClient}, which supports managing and inspecting
topics,
@@ -34,11 +35,21 @@ public abstract class AdminClient implements AutoCloseable {
     /**
      * Create a new AdminClient with the given configuration.
      *
+     * @param props         The configuration.
+     * @return              The new KafkaAdminClient.
+     */
+    public static AdminClient create(Properties props) {
+        return KafkaAdminClient.createInternal(new AdminClientConfig(props));
+    }
+
+    /**
+     * Create a new AdminClient with the given configuration.
+     *
      * @param conf          The configuration.
      * @return              The new KafkaAdminClient.
      */
     public static AdminClient create(Map<String, Object> conf) {
-        return KafkaAdminClient.create(new AdminClientConfig(conf));
+        return KafkaAdminClient.createInternal(new AdminClientConfig(conf));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/kafka/blob/c36b5b7f/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java b/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
index ec10232..7dde027 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java
@@ -238,7 +238,7 @@ public class KafkaAdminClient extends AdminClient {
         return throwable.getClass().getSimpleName();
     }
 
-    static KafkaAdminClient create(AdminClientConfig config) {
+    static KafkaAdminClient createInternal(AdminClientConfig config) {
         Metadata metadata = null;
         Metrics metrics = null;
         NetworkClient networkClient = null;

http://git-wip-us.apache.org/repos/asf/kafka/blob/c36b5b7f/clients/src/main/java/org/apache/kafka/clients/admin/TopicDescription.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/TopicDescription.java b/clients/src/main/java/org/apache/kafka/clients/admin/TopicDescription.java
index 2fc4442..f13dfff 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/TopicDescription.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/TopicDescription.java
@@ -29,7 +29,7 @@ public class TopicDescription {
     private final boolean internal;
     private final NavigableMap<Integer, TopicPartitionInfo> partitions;
 
-    TopicDescription(String name, boolean internal,
+    public TopicDescription(String name, boolean internal,
                     NavigableMap<Integer, TopicPartitionInfo> partitions) {
         this.name = name;
         this.internal = internal;

http://git-wip-us.apache.org/repos/asf/kafka/blob/c36b5b7f/clients/src/main/java/org/apache/kafka/clients/admin/TopicListing.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/TopicListing.java b/clients/src/main/java/org/apache/kafka/clients/admin/TopicListing.java
index 4c25551..1b491a7 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/TopicListing.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/TopicListing.java
@@ -24,7 +24,7 @@ public class TopicListing {
     private final String name;
     private final boolean internal;
 
-    TopicListing(String name, boolean internal) {
+    public TopicListing(String name, boolean internal) {
         this.name = name;
         this.internal = internal;
     }

http://git-wip-us.apache.org/repos/asf/kafka/blob/c36b5b7f/clients/src/main/java/org/apache/kafka/clients/admin/TopicPartitionInfo.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/admin/TopicPartitionInfo.java
b/clients/src/main/java/org/apache/kafka/clients/admin/TopicPartitionInfo.java
index b304802..5241602 100644
--- a/clients/src/main/java/org/apache/kafka/clients/admin/TopicPartitionInfo.java
+++ b/clients/src/main/java/org/apache/kafka/clients/admin/TopicPartitionInfo.java
@@ -28,7 +28,7 @@ public class TopicPartitionInfo {
     private final List<Node> replicas;
     private final List<Node> isr;
 
-    TopicPartitionInfo(int partition, Node leader, List<Node> replicas, List<Node>
isr) {
+    public TopicPartitionInfo(int partition, Node leader, List<Node> replicas, List<Node>
isr) {
         this.partition = partition;
         this.leader = leader;
         this.replicas = replicas;


Mime
View raw message