pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] jiazhai closed pull request #3103: [conf] clean up proxy configuration to use lombok setter and getter
Date Sat, 01 Dec 2018 12:38:32 GMT
jiazhai closed pull request #3103: [conf] clean up proxy configuration to use lombok setter
and getter
URL: https://github.com/apache/pulsar/pull/3103
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConfiguration.java
b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConfiguration.java
index b84bf3c507..f694df1579 100644
--- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConfiguration.java
+++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConfiguration.java
@@ -18,6 +18,8 @@
  */
 package org.apache.pulsar.proxy.server;
 
+import com.google.common.collect.Sets;
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -27,15 +29,17 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import lombok.Getter;
+import lombok.Setter;
 import org.apache.pulsar.broker.authorization.PulsarAuthorizationProvider;
 import org.apache.pulsar.common.configuration.FieldContext;
 import org.apache.pulsar.common.configuration.PulsarConfiguration;
 
-import com.google.common.collect.Sets;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Getter
+@Setter
 public class ProxyConfiguration implements PulsarConfiguration {
     private final static Logger log = LoggerFactory.getLogger(ProxyConfiguration.class);
 
@@ -144,248 +148,6 @@
 
     private Properties properties = new Properties();
 
-    public boolean forwardAuthorizationCredentials() {
-        return forwardAuthorizationCredentials;
-    }
-
-    public void setForwardAuthorizationCredentials(boolean forwardAuthorizationCredentials)
{
-        this.forwardAuthorizationCredentials = forwardAuthorizationCredentials;
-    }
-
-    public String getBrokerServiceURLTLS() {
-        return brokerServiceURLTLS;
-    }
-
-    public void setBrokerServiceURLTLS(String discoveryServiceURLTLS) {
-        this.brokerServiceURLTLS = discoveryServiceURLTLS;
-    }
-
-    public String getBrokerServiceURL() {
-        return brokerServiceURL;
-    }
-
-    public void setBrokerServiceURL(String discoveryServiceURL) {
-        this.brokerServiceURL = discoveryServiceURL;
-    }
-
-    public String getBrokerWebServiceURL() {
-        return brokerWebServiceURL;
-    }
-
-    public void setBrokerWebServiceURL(String brokerWebServiceURL) {
-        this.brokerWebServiceURL = brokerWebServiceURL;
-    }
-
-    public String getBrokerWebServiceURLTLS() {
-        return brokerWebServiceURLTLS;
-    }
-
-    public void setBrokerWebServiceURLTLS(String brokerWebServiceURLTLS) {
-        this.brokerWebServiceURLTLS = brokerWebServiceURLTLS;
-    }
-
-    public String getFunctionWorkerWebServiceURL() {
-        return functionWorkerWebServiceURL;
-    }
-
-    public String getFunctionWorkerWebServiceURLTLS() {
-        return functionWorkerWebServiceURLTLS;
-    }
-
-    public String getZookeeperServers() {
-        return zookeeperServers;
-    }
-
-    public void setZookeeperServers(String zookeeperServers) {
-        this.zookeeperServers = zookeeperServers;
-    }
-
-    @Deprecated
-    public String getGlobalZookeeperServers() {
-        return globalZookeeperServers;
-    }
-
-    @Deprecated
-    public void setGlobalZookeeperServers(String globalZookeeperServers) {
-        this.globalZookeeperServers = globalZookeeperServers;
-    }
-
-    public String getConfigurationStoreServers() {
-        return null == configurationStoreServers ? getGlobalZookeeperServers() : configurationStoreServers;
-    }
-
-    public void setConfigurationStoreServers(String configurationStoreServers) {
-        this.configurationStoreServers = configurationStoreServers;
-    }
-
-    public int getZookeeperSessionTimeoutMs() {
-        return zookeeperSessionTimeoutMs;
-    }
-
-    public void setZookeeperSessionTimeoutMs(int zookeeperSessionTimeoutMs) {
-        this.zookeeperSessionTimeoutMs = zookeeperSessionTimeoutMs;
-    }
-
-    public int getServicePort() {
-        return servicePort;
-    }
-
-    public void setServicePort(int servicePort) {
-        this.servicePort = servicePort;
-    }
-
-    public int getServicePortTls() {
-        return servicePortTls;
-    }
-
-    public void setServicePortTls(int servicePortTls) {
-        this.servicePortTls = servicePortTls;
-    }
-
-    public int getWebServicePort() {
-        return webServicePort;
-    }
-
-    public void setWebServicePort(int webServicePort) {
-        this.webServicePort = webServicePort;
-    }
-
-    public int getWebServicePortTls() {
-        return webServicePortTls;
-    }
-
-    public void setWebServicePortTls(int webServicePortTls) {
-        this.webServicePortTls = webServicePortTls;
-    }
-
-    public String getStatusFilePath() {
-        return statusFilePath;
-    }
-
-    public void setStatusFilePath(String statusFilePath) {
-        this.statusFilePath = statusFilePath;
-    }
-
-    public boolean isTlsEnabledInProxy() {
-        return tlsEnabledInProxy;
-    }
-
-    public void setTlsEnabledInProxy(boolean tlsEnabledInProxy) {
-        this.tlsEnabledInProxy = tlsEnabledInProxy;
-    }
-
-    public boolean isTlsEnabledWithBroker() {
-        return tlsEnabledWithBroker;
-    }
-
-    public void setTlsEnabledWithBroker(boolean tlsEnabledWithBroker) {
-        this.tlsEnabledWithBroker = tlsEnabledWithBroker;
-    }
-
-    public String getTlsCertificateFilePath() {
-        return tlsCertificateFilePath;
-    }
-
-    public void setTlsCertificateFilePath(String tlsCertificateFilePath) {
-        this.tlsCertificateFilePath = tlsCertificateFilePath;
-    }
-
-    public String getTlsKeyFilePath() {
-        return tlsKeyFilePath;
-    }
-
-    public void setTlsKeyFilePath(String tlsKeyFilePath) {
-        this.tlsKeyFilePath = tlsKeyFilePath;
-    }
-
-    public String getTlsTrustCertsFilePath() {
-        return tlsTrustCertsFilePath;
-    }
-
-    public void setTlsTrustCertsFilePath(String tlsTrustCertsFilePath) {
-        this.tlsTrustCertsFilePath = tlsTrustCertsFilePath;
-    }
-
-    public boolean isTlsAllowInsecureConnection() {
-        return tlsAllowInsecureConnection;
-    }
-
-    public void setTlsAllowInsecureConnection(boolean tlsAllowInsecureConnection) {
-        this.tlsAllowInsecureConnection = tlsAllowInsecureConnection;
-    }
-
-    public boolean isTlsHostnameVerificationEnabled() {
-        return tlsHostnameVerificationEnabled;
-    }
-
-    public void setTlsHostnameVerificationEnabled(boolean tlsHostnameVerificationEnabled)
{
-        this.tlsHostnameVerificationEnabled = tlsHostnameVerificationEnabled;
-    }
-
-    public String getBrokerClientAuthenticationPlugin() {
-        return brokerClientAuthenticationPlugin;
-    }
-
-    public void setBrokerClientAuthenticationPlugin(String brokerClientAuthenticationPlugin)
{
-        this.brokerClientAuthenticationPlugin = brokerClientAuthenticationPlugin;
-    }
-
-    public String getBrokerClientAuthenticationParameters() {
-        return brokerClientAuthenticationParameters;
-    }
-
-    public void setBrokerClientAuthenticationParameters(String brokerClientAuthenticationParameters)
{
-        this.brokerClientAuthenticationParameters = brokerClientAuthenticationParameters;
-    }
-
-    public String getBrokerClientTrustCertsFilePath() {
-        return this.brokerClientTrustCertsFilePath;
-    }
-
-    public void setBrokerClientTrustCertsFilePath(String brokerClientTlsTrustCertsFilePath)
{
-        this.brokerClientTrustCertsFilePath = brokerClientTlsTrustCertsFilePath;
-    }
-
-    public boolean isAuthenticationEnabled() {
-        return authenticationEnabled;
-    }
-
-    public void setAuthenticationEnabled(boolean authenticationEnabled) {
-        this.authenticationEnabled = authenticationEnabled;
-    }
-
-    public Set<String> getAuthenticationProviders() {
-        return authenticationProviders;
-    }
-
-    public void setAuthenticationProviders(Set<String> authenticationProviders) {
-        this.authenticationProviders = authenticationProviders;
-    }
-
-    public boolean isAuthorizationEnabled() {
-        return authorizationEnabled;
-    }
-
-    public void setAuthorizationEnabled(boolean authorizationEnabled) {
-        this.authorizationEnabled = authorizationEnabled;
-    }
-
-    public String getAuthorizationProvider() {
-        return authorizationProvider;
-    }
-
-    public void setAuthorizationProvider(String authorizationProvider) {
-        this.authorizationProvider = authorizationProvider;
-    }
-
-    public Set<String> getSuperUserRoles() {
-        return superUserRoles;
-    }
-
-    public void setSuperUserRoles(Set<String> superUserRoles) {
-        this.superUserRoles = superUserRoles;
-    }
-
     public Properties getProperties() {
         return properties;
     }
@@ -417,62 +179,6 @@ public void setProperties(Properties properties) {
             });
     }
 
-    public Set<String> getTlsProtocols() {
-        return tlsProtocols;
-    }
-
-    public void setTlsProtocols(Set<String> tlsProtocols) {
-        this.tlsProtocols = tlsProtocols;
-    }
-
-    public Set<String> getTlsCiphers() {
-        return tlsCiphers;
-    }
-
-    public void setTlsCiphers(Set<String> tlsCiphers) {
-        this.tlsCiphers = tlsCiphers;
-    }
-
-    public int getMaxConcurrentInboundConnections() {
-        return maxConcurrentInboundConnections;
-    }
-
-    public void setMaxConcurrentInboundConnections(int maxConcurrentInboundConnections) {
-        this.maxConcurrentInboundConnections = maxConcurrentInboundConnections;
-    }
-
-    public int getMaxConcurrentLookupRequests() {
-        return maxConcurrentLookupRequests;
-    }
-
-    public void setMaxConcurrentLookupRequests(int maxConcurrentLookupRequests) {
-        this.maxConcurrentLookupRequests = maxConcurrentLookupRequests;
-    }
-
-    public boolean getTlsRequireTrustedClientCertOnConnect() {
-        return tlsRequireTrustedClientCertOnConnect;
-    }
-
-    public void setTlsRequireTrustedClientCertOnConnect(boolean tlsRequireTrustedClientCertOnConnect)
{
-        this.tlsRequireTrustedClientCertOnConnect = tlsRequireTrustedClientCertOnConnect;
-    }
-
-    public int getHttpOutputBufferSize() {
-        return httpOutputBufferSize;
-    }
-
-    public void setHttpOutputBufferSize(int httpOutputBufferSize) {
-        this.httpOutputBufferSize = httpOutputBufferSize;
-    }
-
-    public Set<HttpReverseProxyConfig> getHttpReverseProxyConfigs() {
-        return httpReverseProxyConfigs;
-    }
-
-    public void setHttpReverseProxyConfigs(Set<HttpReverseProxyConfig> reverseProxyConfigs)
{
-        this.httpReverseProxyConfigs = reverseProxyConfigs;
-    }
-
     public static class HttpReverseProxyConfig {
         private final String name;
         private final String path;
diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
index d1aa9dd0da..54a08ef0b4 100644
--- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
+++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
@@ -52,8 +52,6 @@
 import io.netty.handler.ssl.SslHandler;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.FutureListener;
-import io.prometheus.client.Counter;
-import io.prometheus.client.Gauge;
 
 /**
  * Handles incoming discovery request from client and sends appropriate response back to
client
@@ -313,7 +311,7 @@ private boolean authenticateAndCreateClient(CommandConnect connect) {
             clientAuthRole = service.getAuthenticationService().authenticate(authenticationData,
authMethod);
             LOG.info("[{}] Client successfully authenticated with {} role {}", remoteAddress,
authMethod,
                     clientAuthRole);
-            if (service.getConfiguration().forwardAuthorizationCredentials()) {
+            if (service.getConfiguration().isForwardAuthorizationCredentials()) {
                 this.clientAuthData = authData;
                 this.clientAuthMethod = authMethod;
             }
diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ServiceChannelInitializer.java
b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ServiceChannelInitializer.java
index b0055e1be0..30001c7480 100644
--- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ServiceChannelInitializer.java
+++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ServiceChannelInitializer.java
@@ -50,7 +50,7 @@ protected void initChannel(SocketChannel ch) throws Exception {
             SslContext sslCtx = SecurityUtility.createNettySslContextForServer(true /* to
allow InsecureConnection */,
                     serviceConfig.getTlsTrustCertsFilePath(), serviceConfig.getTlsCertificateFilePath(),
                     serviceConfig.getTlsKeyFilePath(), serviceConfig.getTlsCiphers(), serviceConfig.getTlsProtocols(),
-                    serviceConfig.getTlsRequireTrustedClientCertOnConnect());
+                    serviceConfig.isTlsRequireTrustedClientCertOnConnect());
             ch.pipeline().addLast(TLS_HANDLER, sslCtx.newHandler(ch.alloc()));
         }
 
diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java
index 76e3b4018e..07d75744b7 100644
--- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java
+++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java
@@ -18,7 +18,6 @@
  */
 package org.apache.pulsar.proxy.server;
 
-import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 import com.google.common.collect.Lists;
 
 import io.prometheus.client.jetty.JettyStatisticsCollector;
@@ -40,7 +39,6 @@
 import org.apache.pulsar.broker.authentication.AuthenticationService;
 import org.apache.pulsar.broker.web.AuthenticationFilter;
 import org.apache.pulsar.broker.web.JsonMapperProvider;
-import org.apache.pulsar.common.util.ObjectMapperFactory;
 import org.apache.pulsar.common.util.SecurityUtility;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Handler;
@@ -104,7 +102,7 @@ public WebServer(ProxyConfiguration config, AuthenticationService authentication
                         config.getTlsTrustCertsFilePath(),
                         config.getTlsCertificateFilePath(),
                         config.getTlsKeyFilePath(),
-                        config.getTlsRequireTrustedClientCertOnConnect());
+                        config.isTlsRequireTrustedClientCertOnConnect());
                 ServerConnector tlsConnector = new ServerConnector(server, 1, 1, sslCtxFactory);
                 tlsConnector.setPort(config.getWebServicePortTls());
                 connectors.add(tlsConnector);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message