You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/12/11 09:07:08 UTC

[camel] branch master updated: CAMEL-14284: Configuring endpoint should set properties on endpoint and not configuration object - Etcd component

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 4416169  CAMEL-14284: Configuring endpoint should set properties on endpoint and not configuration object - Etcd component
4416169 is described below

commit 4416169b09f0969c41fd911133e02cedece3d643
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 11 10:06:48 2019 +0100

    CAMEL-14284: Configuring endpoint should set properties on endpoint and not configuration object - Etcd component
---
 .../apache/camel/component/etcd/EtcdComponent.java | 25 ++++++++++------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdComponent.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdComponent.java
index b4390f2..032e6c8 100644
--- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdComponent.java
+++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/EtcdComponent.java
@@ -56,7 +56,6 @@ public class EtcdComponent extends DefaultComponent implements SSLContextParamet
 
     /**
      * To set the URIs the client connects.
-     * @param uris
      */
     public void setUris(String uris) {
         configuration.setUris(uris);
@@ -68,7 +67,6 @@ public class EtcdComponent extends DefaultComponent implements SSLContextParamet
 
     /**
      * To configure security using SSLContextParameters.
-     * @param sslContextParameters
      */
     public void setSslContextParameters(SSLContextParameters sslContextParameters) {
         configuration.setSslContextParameters(sslContextParameters);
@@ -80,7 +78,6 @@ public class EtcdComponent extends DefaultComponent implements SSLContextParamet
 
     /**
      * The user name to use for basic authentication.
-     * @param userName
      */
     public void setUserName(String userName) {
         configuration.setUserName(userName);
@@ -92,7 +89,6 @@ public class EtcdComponent extends DefaultComponent implements SSLContextParamet
 
     /**
      * The password to use for basic authentication.
-     * @param password
      */
     public void setPassword(String password) {
         configuration.setPassword(password);
@@ -143,16 +139,19 @@ public class EtcdComponent extends DefaultComponent implements SSLContextParamet
                 path = "/" + path;
             }
 
-            switch (namespace) {
-            case stats:
-                return new EtcdStatsEndpoint(uri, this, configuration, namespace, path);
-            case watch:
-                return new EtcdWatchEndpoint(uri, this, configuration, namespace, path);
-            case keys:
-                return new EtcdKeysEndpoint(uri, this, configuration, namespace, path);
-            default:
+            Endpoint endpoint;
+            if (namespace == EtcdNamespace.stats) {
+                endpoint = new EtcdStatsEndpoint(uri, this, configuration, namespace, path);
+            } else if (namespace == EtcdNamespace.watch) {
+                endpoint = new EtcdWatchEndpoint(uri, this, configuration, namespace, path);
+            } else if (namespace == EtcdNamespace.keys) {
+                endpoint = new EtcdKeysEndpoint(uri, this, configuration, namespace, path);
+            } else {
                 throw new IllegalStateException("No endpoint for " + remaining);
             }
+
+            setProperties(endpoint, parameters);
+            return endpoint;
         }
 
         throw new IllegalStateException("No endpoint for " + remaining);
@@ -162,8 +161,6 @@ public class EtcdComponent extends DefaultComponent implements SSLContextParamet
         EtcdConfiguration configuration = Optional.ofNullable(this.configuration).orElseGet(EtcdConfiguration::new).copy();
         configuration.setCamelContext(getCamelContext());
 
-        setProperties(configuration, parameters);
-
         if (configuration.getSslContextParameters() == null) {
             configuration.setSslContextParameters(retrieveGlobalSslContextParameters());
         }