From 169386c08e7d54862624104172246aea7bbc48b6 Mon Sep 17 00:00:00 2001 From: ZhangJian He Date: Fri, 30 Aug 2024 11:46:30 +0800 Subject: [PATCH] feat: add reactor module (#23) Signed-off-by: ZhangJian He --- ci/spotbugs/exclude.xml | 8 +++ pom.xml | 63 +++++++++++++------ pulsar-admin-api/pom.xml | 14 +++++ .../protocol/pulsar/admin/api/TlsConfig.java | 29 +++++++++ .../pulsar/admin/api/package-info.java | 1 + pulsar-admin-jdk/pom.xml | 10 ++- .../pulsar/admin/jdk/Configuration.java | 2 +- .../pulsar/admin/jdk/InnerHttpClient.java | 2 +- .../admin/jdk/PulsarAdminBuilderImpl.java | 2 +- pulsar-admin-reactor/pom.xml | 27 ++++++++ .../admin/reactive/InnerReactorClient.java | 4 ++ .../pulsar/admin/reactive/package-info.java | 1 + 12 files changed, 140 insertions(+), 23 deletions(-) create mode 100644 pulsar-admin-api/pom.xml create mode 100644 pulsar-admin-api/src/main/java/io/github/protocol/pulsar/admin/api/TlsConfig.java create mode 100644 pulsar-admin-api/src/main/java/io/github/protocol/pulsar/admin/api/package-info.java create mode 100644 pulsar-admin-reactor/pom.xml create mode 100644 pulsar-admin-reactor/src/main/java/io/github/protocol/pulsar/admin/reactive/InnerReactorClient.java create mode 100644 pulsar-admin-reactor/src/main/java/io/github/protocol/pulsar/admin/reactive/package-info.java diff --git a/ci/spotbugs/exclude.xml b/ci/spotbugs/exclude.xml index 9d17990..cb8ec7e 100644 --- a/ci/spotbugs/exclude.xml +++ b/ci/spotbugs/exclude.xml @@ -15,4 +15,12 @@ + + + + + + + + diff --git a/pom.xml b/pom.xml index fed27fc..5b304bf 100644 --- a/pom.xml +++ b/pom.xml @@ -6,11 +6,13 @@ io.github.protocol-laboratory pulsar-admin-parent - 0.0.1 + 0.0.2 pom + pulsar-admin-api pulsar-admin-jdk + pulsar-admin-reactor @@ -25,19 +27,22 @@ 5.11.0 2.20.0 1.18.34 + 10.18.0 + 1.1.22 - 3.10.1 - 3.2.0 - 3.4.1 1.18.20.0 - 3.2.4 - 1.6.13 - 10.18.0 - 3.0.0-M6 - 2.1.0 - 3.2.1 - 4.7.2.0 - 3.0.0-M9 + 3.13.0 + 3.5.0 + 3.5.0 + 3.8.0 + 3.2.5 + 3.10.0 + 3.1.1 + 2.1.0 + 3.3.1 + 3.5.0 + 1.7.0 + 4.8.6.2 2.43.0 @@ -92,10 +97,30 @@ ${src.dir} + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-versions + + enforce + + + + + ${maven-enforce-plugin-maven.version} + + + + + + org.apache.maven.plugins maven-compiler-plugin - ${compiler-plugin.version} + ${maven-compiler-plugin.version} ${maven.compiler.source} ${maven.compiler.target} @@ -104,7 +129,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${checkstyle-plugin.version} + ${maven-checkstyle-plugin.version} com.puppycrawl.tools @@ -141,7 +166,7 @@ org.apache.maven.plugins maven-surefire-plugin - ${surefire-plugin.version} + ${maven-surefire-plugin.version} true false @@ -169,7 +194,7 @@ org.apache.maven.plugins maven-release-plugin - ${release-plugin.version} + ${maven-release-plugin.version} true false @@ -180,14 +205,14 @@ org.apache.maven.scm maven-scm-provider-gitexe - ${scm-provider-gitexe.version} + ${maven-scm-provider-gitexe.version} org.apache.maven.plugins maven-javadoc-plugin - ${javadoc-plugin.version} + ${maven-javadoc-plugin.version} ${src.dir} all,-missing @@ -204,7 +229,7 @@ org.apache.maven.plugins maven-source-plugin - ${source-plugin.version} + ${maven-source-plugin.version} attach-sources diff --git a/pulsar-admin-api/pom.xml b/pulsar-admin-api/pom.xml new file mode 100644 index 0000000..5deb56a --- /dev/null +++ b/pulsar-admin-api/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + io.github.protocol-laboratory + pulsar-admin-parent + 0.0.2 + + + pulsar-admin-api + + diff --git a/pulsar-admin-api/src/main/java/io/github/protocol/pulsar/admin/api/TlsConfig.java b/pulsar-admin-api/src/main/java/io/github/protocol/pulsar/admin/api/TlsConfig.java new file mode 100644 index 0000000..97d3230 --- /dev/null +++ b/pulsar-admin-api/src/main/java/io/github/protocol/pulsar/admin/api/TlsConfig.java @@ -0,0 +1,29 @@ +package io.github.protocol.pulsar.admin.api; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class TlsConfig { + public String keyStorePath; + + @ToString.Exclude + public char[] keyStorePassword; + + public String trustStorePath; + + @ToString.Exclude + public char[] trustStorePassword; + + public boolean verifyDisabled; + + public boolean hostnameVerifyDisabled; + + public String[] versions; + + public String[] cipherSuites; +} diff --git a/pulsar-admin-api/src/main/java/io/github/protocol/pulsar/admin/api/package-info.java b/pulsar-admin-api/src/main/java/io/github/protocol/pulsar/admin/api/package-info.java new file mode 100644 index 0000000..f2c20bc --- /dev/null +++ b/pulsar-admin-api/src/main/java/io/github/protocol/pulsar/admin/api/package-info.java @@ -0,0 +1 @@ +package io.github.protocol.pulsar.admin.api; diff --git a/pulsar-admin-jdk/pom.xml b/pulsar-admin-jdk/pom.xml index 351ccfa..0334324 100644 --- a/pulsar-admin-jdk/pom.xml +++ b/pulsar-admin-jdk/pom.xml @@ -6,11 +6,19 @@ io.github.protocol-laboratory pulsar-admin-parent - 0.0.1 + 0.0.2 pulsar-admin-jdk + + + io.github.protocol-laboratory + pulsar-admin-api + ${project.version} + + + diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/Configuration.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/Configuration.java index 78452b1..167954d 100644 --- a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/Configuration.java +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/Configuration.java @@ -29,7 +29,7 @@ public class Configuration { private int port; - public boolean useSsl = false; + public boolean tlsEnabled; public String keyStorePath; diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/InnerHttpClient.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/InnerHttpClient.java index c758523..d746a12 100644 --- a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/InnerHttpClient.java +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/InnerHttpClient.java @@ -39,7 +39,7 @@ public InnerHttpClient(Configuration conf) { this.conf = conf; HttpClient.Builder builder = HttpClient.newBuilder() .version(HttpClient.Version.HTTP_1_1); - if (conf.isUseSsl()) { + if (conf.isTlsEnabled()) { builder = builder .sslContext(SslContextUtil.buildFromJks(conf.keyStorePath, conf.keyStorePassword, conf.trustStorePath, conf.trustStorePassword, conf.disableSslVerify, diff --git a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PulsarAdminBuilderImpl.java b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PulsarAdminBuilderImpl.java index 90ba84c..13bfa2a 100644 --- a/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PulsarAdminBuilderImpl.java +++ b/pulsar-admin-jdk/src/main/java/io/github/protocol/pulsar/admin/jdk/PulsarAdminBuilderImpl.java @@ -44,7 +44,7 @@ public PulsarAdminBuilder port(int port) { @Override public PulsarAdminBuilder useSsl(boolean useSsl) { - this.conf.setUseSsl(useSsl); + this.conf.setTlsEnabled(useSsl); return this; } diff --git a/pulsar-admin-reactor/pom.xml b/pulsar-admin-reactor/pom.xml new file mode 100644 index 0000000..66fdff6 --- /dev/null +++ b/pulsar-admin-reactor/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + io.github.protocol-laboratory + pulsar-admin-parent + 0.0.2 + + + pulsar-admin-reactor + + + + io.github.protocol-laboratory + pulsar-admin-api + ${project.version} + + + io.projectreactor.netty + reactor-netty-http + ${reactor-netty.version} + + + + diff --git a/pulsar-admin-reactor/src/main/java/io/github/protocol/pulsar/admin/reactive/InnerReactorClient.java b/pulsar-admin-reactor/src/main/java/io/github/protocol/pulsar/admin/reactive/InnerReactorClient.java new file mode 100644 index 0000000..463d79c --- /dev/null +++ b/pulsar-admin-reactor/src/main/java/io/github/protocol/pulsar/admin/reactive/InnerReactorClient.java @@ -0,0 +1,4 @@ +package io.github.protocol.pulsar.admin.reactive; + +public class InnerReactorClient { +} diff --git a/pulsar-admin-reactor/src/main/java/io/github/protocol/pulsar/admin/reactive/package-info.java b/pulsar-admin-reactor/src/main/java/io/github/protocol/pulsar/admin/reactive/package-info.java new file mode 100644 index 0000000..e17acf4 --- /dev/null +++ b/pulsar-admin-reactor/src/main/java/io/github/protocol/pulsar/admin/reactive/package-info.java @@ -0,0 +1 @@ +package io.github.protocol.pulsar.admin.reactive;