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/08/22 06:15:26 UTC

[camel] branch CAMEL-13870 updated (55d0d41 -> 1a47f95)

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

davsclaus pushed a change to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 55d0d41  CAMEL-13870: Regen
     new 2505d0d  CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
     new 1e0148e  CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
     new 7d37b51  CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
     new 7f09a79  CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
     new 287502d  CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
     new c6531a0  CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
     new 1a47f95  CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/docs/milo-client-component.adoc       |  2 +-
 .../milo/client/MiloClientConfiguration.java       |  6 +--
 .../src/main/docs/rabbitmq-component.adoc          |  2 +-
 .../component/rabbitmq/RabbitMQComponent.java      | 16 +-------
 .../camel/component/rabbitmq/RabbitMQEndpoint.java | 26 +++++-------
 .../component/rabbitmq/RabbitMQEndpointTest.java   |  6 +--
 .../rest/swagger/RestSwaggerEndpoint.java          | 12 +++---
 .../sjms/SjmsEndpointConnectionSettingsTest.java   |  4 +-
 .../sjms/batch/SjmsBatchEndpointTest.java          |  2 +-
 .../component/zookeeper/ZooKeeperEndpointTest.java |  3 +-
 .../dsl/MiloClientEndpointBuilderFactory.java      | 40 ++----------------
 .../dsl/RabbitMQEndpointBuilderFactory.java        | 48 ++--------------------
 .../org/apache/camel/support/DefaultEndpoint.java  |  2 +-
 .../camel/support/ScheduledPollEndpoint.java       | 45 ++++++++++----------
 .../EndpointPropertyConfigurerSupport.java         |  8 +++-
 .../MiloClientComponentConfiguration.java          |  7 ++--
 16 files changed, 71 insertions(+), 158 deletions(-)


[camel] 06/07: CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c6531a04ebda73a905facdf6e2ddecb539b02276
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 22 07:07:58 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
 .../org/apache/camel/component/zookeeper/ZooKeeperEndpointTest.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperEndpointTest.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperEndpointTest.java
index 6a3dbfd..d6d35a2 100644
--- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperEndpointTest.java
+++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperEndpointTest.java
@@ -26,8 +26,7 @@ public class ZooKeeperEndpointTest extends CamelTestSupport {
         ZooKeeperEndpoint endpoint = context.getEndpoint("zookeeper:someserver1,someserver2:1234/zoo", ZooKeeperEndpoint.class);
         assertEquals("Get wrong number of servers", 2, endpoint.getConfiguration().getServers().size());
         assertEquals("The first server address is wrong", "someserver1", endpoint.getConfiguration().getServers().get(0));
-        assertEquals("The second server address is wrong", "someserver2:1234", endpoint.getConfiguration().getServers().get(0));
-        
+        assertEquals("The second server address is wrong", "someserver2:1234", endpoint.getConfiguration().getServers().get(1));
     }
 
 }


[camel] 01/07: CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2505d0d2c3ddcd6b2e85d1e35bd42d64e05c2487
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 22 06:18:03 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
 .../src/main/docs/milo-client-component.adoc       |  2 +-
 .../milo/client/MiloClientConfiguration.java       |  6 ++--
 .../dsl/MiloClientEndpointBuilderFactory.java      | 40 ++--------------------
 .../MiloClientComponentConfiguration.java          |  7 ++--
 4 files changed, 10 insertions(+), 45 deletions(-)

diff --git a/components/camel-milo/src/main/docs/milo-client-component.adoc b/components/camel-milo/src/main/docs/milo-client-component.adoc
index 354b964..f0ddf32 100644
--- a/components/camel-milo/src/main/docs/milo-client-component.adoc
+++ b/components/camel-milo/src/main/docs/milo-client-component.adoc
@@ -124,7 +124,7 @@ with the following path and query parameters:
 | *keyPassword* (client) | The key password |  | String
 | *keyStorePassword* (client) | The keystore password |  | String
 | *keyStoreType* (client) | The key store type |  | String
-| *keyStoreUrl* (client) | The URL where the key should be loaded from |  | URL
+| *keyStoreUrl* (client) | The URL where the key should be loaded from |  | String
 | *maxPendingPublishRequests* (client) | The maximum number of pending publish requests |  | Long
 | *maxResponseMessageSize* (client) | The maximum number of bytes a response message may have |  | Long
 | *overrideHost* (client) | Override the server reported endpoint host with the host from the endpoint URI. | false | boolean
diff --git a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConfiguration.java b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConfiguration.java
index 25720f5..871bca9 100644
--- a/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConfiguration.java
+++ b/components/camel-milo/src/main/java/org/apache/camel/component/milo/client/MiloClientConfiguration.java
@@ -86,7 +86,7 @@ public class MiloClientConfiguration implements Cloneable {
     private Long maxResponseMessageSize;
 
     @UriParam(label = "client")
-    private URL keyStoreUrl;
+    private String keyStoreUrl;
 
     @UriParam(label = "client")
     private String keyStoreType = KeyStoreLoader.DEFAULT_KEY_STORE_TYPE;
@@ -277,11 +277,11 @@ public class MiloClientConfiguration implements Cloneable {
     /**
      * The URL where the key should be loaded from
      */
-    public void setKeyStoreUrl(URL keyStoreUrl) {
+    public void setKeyStoreUrl(String keyStoreUrl) {
         this.keyStoreUrl = keyStoreUrl;
     }
 
-    public URL getKeyStoreUrl() {
+    public String getKeyStoreUrl() {
         return this.keyStoreUrl;
     }
 
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/MiloClientEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/MiloClientEndpointBuilderFactory.java
index cd7f1ee..5f5dd3b 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/MiloClientEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/MiloClientEndpointBuilderFactory.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.builder.endpoint.dsl;
 
-import java.net.URL;
 import java.util.Set;
 import javax.annotation.Generated;
 import org.apache.camel.ExchangePattern;
@@ -311,18 +310,7 @@ public interface MiloClientEndpointBuilderFactory {
         /**
          * The URL where the key should be loaded from.
          * 
-         * The option is a: <code>java.net.URL</code> type.
-         * 
-         * Group: client
-         */
-        default MiloClientEndpointConsumerBuilder keyStoreUrl(URL keyStoreUrl) {
-            setProperty("keyStoreUrl", keyStoreUrl);
-            return this;
-        }
-        /**
-         * The URL where the key should be loaded from.
-         * 
-         * The option will be converted to a <code>java.net.URL</code> type.
+         * The option is a: <code>java.lang.String</code> type.
          * 
          * Group: client
          */
@@ -876,18 +864,7 @@ public interface MiloClientEndpointBuilderFactory {
         /**
          * The URL where the key should be loaded from.
          * 
-         * The option is a: <code>java.net.URL</code> type.
-         * 
-         * Group: client
-         */
-        default MiloClientEndpointProducerBuilder keyStoreUrl(URL keyStoreUrl) {
-            setProperty("keyStoreUrl", keyStoreUrl);
-            return this;
-        }
-        /**
-         * The URL where the key should be loaded from.
-         * 
-         * The option will be converted to a <code>java.net.URL</code> type.
+         * The option is a: <code>java.lang.String</code> type.
          * 
          * Group: client
          */
@@ -1339,18 +1316,7 @@ public interface MiloClientEndpointBuilderFactory {
         /**
          * The URL where the key should be loaded from.
          * 
-         * The option is a: <code>java.net.URL</code> type.
-         * 
-         * Group: client
-         */
-        default MiloClientEndpointBuilder keyStoreUrl(URL keyStoreUrl) {
-            setProperty("keyStoreUrl", keyStoreUrl);
-            return this;
-        }
-        /**
-         * The URL where the key should be loaded from.
-         * 
-         * The option will be converted to a <code>java.net.URL</code> type.
+         * The option is a: <code>java.lang.String</code> type.
          * 
          * Group: client
          */
diff --git a/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/client/springboot/MiloClientComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/client/springboot/MiloClientComponentConfiguration.java
index 0c6eabb..d975bac 100644
--- a/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/client/springboot/MiloClientComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/client/springboot/MiloClientComponentConfiguration.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.milo.client.springboot;
 
-import java.net.URL;
 import java.util.Set;
 import javax.annotation.Generated;
 import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
@@ -168,7 +167,7 @@ public class MiloClientComponentConfiguration
         /**
          * The URL where the key should be loaded from
          */
-        private URL keyStoreUrl;
+        private String keyStoreUrl;
         /**
          * The key store type
          */
@@ -292,11 +291,11 @@ public class MiloClientComponentConfiguration
             this.maxResponseMessageSize = maxResponseMessageSize;
         }
 
-        public URL getKeyStoreUrl() {
+        public String getKeyStoreUrl() {
             return keyStoreUrl;
         }
 
-        public void setKeyStoreUrl(URL keyStoreUrl) {
+        public void setKeyStoreUrl(String keyStoreUrl) {
             this.keyStoreUrl = keyStoreUrl;
         }
 


[camel] 02/07: CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1e0148e6fabc4af07fb6674ef85d709880d19648
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 22 06:27:50 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
 .../camel/component/sjms/SjmsEndpointConnectionSettingsTest.java      | 4 ++--
 .../org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsEndpointConnectionSettingsTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsEndpointConnectionSettingsTest.java
index 9af5359..d47c163 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsEndpointConnectionSettingsTest.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsEndpointConnectionSettingsTest.java
@@ -34,7 +34,7 @@ public class SjmsEndpointConnectionSettingsTest extends CamelTestSupport {
 
     @Test
     public void testConnectionFactory() {
-        Endpoint endpoint = context.getEndpoint("sjms:queue:test?connectionFactory=activemq");
+        Endpoint endpoint = context.getEndpoint("sjms:queue:test?connectionFactory=#activemq");
         assertNotNull(endpoint);
         assertTrue(endpoint instanceof SjmsEndpoint);
         SjmsEndpoint qe = (SjmsEndpoint) endpoint;
@@ -43,7 +43,7 @@ public class SjmsEndpointConnectionSettingsTest extends CamelTestSupport {
 
     @Test
     public void testConnectionResource() {
-        Endpoint endpoint = context.getEndpoint("sjms:queue:test?connectionResource=connresource");
+        Endpoint endpoint = context.getEndpoint("sjms:queue:test?connectionResource=#connresource");
         assertNotNull(endpoint);
         assertTrue(endpoint instanceof SjmsEndpoint);
         SjmsEndpoint qe = (SjmsEndpoint) endpoint;
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
index a1fba4e..152f14d 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
@@ -78,7 +78,7 @@ public class SjmsBatchEndpointTest extends CamelTestSupport {
         return true;
     }
 
-    @Test(expected = FailedToCreateRouteException.class)
+    @Test(expected = FailedToStartRouteException.class)
     public void testProducerFailure() throws Exception {
         context.addRoutes(new RouteBuilder() {
             public void configure() throws Exception {


[camel] 05/07: CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 287502df3d57c47d1131b2b0ac2bc9d668274786
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 22 06:54:44 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
 .../camel/component/rest/swagger/RestSwaggerEndpoint.java    | 12 +++++-------
 .../main/java/org/apache/camel/support/DefaultEndpoint.java  |  2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/components/camel-rest-swagger/src/main/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpoint.java b/components/camel-rest-swagger/src/main/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpoint.java
index 6bcae93..7823e63 100644
--- a/components/camel-rest-swagger/src/main/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpoint.java
+++ b/components/camel-rest-swagger/src/main/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpoint.java
@@ -281,13 +281,11 @@ public final class RestSwaggerEndpoint extends DefaultEndpoint {
 
         Map<String, Object> params = determineEndpointParameters(swagger, operation);
         boolean hasHost = params.containsKey("host");
-        setProperties(endpoint, params);
-
-        // ensure rest configuration is available
-//        final String componentName = determineComponentName();
-//        if (componentName != null) {
-//            RestConfiguration config = camelContext.getRestConfiguration(componentName, true);
-//        }
+        if (endpoint instanceof DefaultEndpoint) {
+            // let the rest endpoint configure itself
+            DefaultEndpoint de = (DefaultEndpoint) endpoint;
+            de.setProperties(endpoint, params);
+        }
 
         // if there is a host then we should use this hardcoded host instead of any Header that may have an existing
         // Host header from some other HTTP input, and if so then lets remove it
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/DefaultEndpoint.java b/core/camel-support/src/main/java/org/apache/camel/support/DefaultEndpoint.java
index de7dd80..14c5900 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/DefaultEndpoint.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/DefaultEndpoint.java
@@ -409,7 +409,7 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint
      * @param bean        the bean
      * @param parameters  properties to set
      */
-    protected void setProperties(Object bean, Map<String, Object> parameters) throws Exception {
+    public void setProperties(Object bean, Map<String, Object> parameters) throws Exception {
         if (basicPropertyBinding) {
             // use basic binding
             PropertyBindingSupport.build()


[camel] 04/07: CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7f09a79b3f501d1eb95355f1d3f9d31320c6386f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 22 06:44:58 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
 .../src/main/docs/rabbitmq-component.adoc          |  2 +-
 .../component/rabbitmq/RabbitMQComponent.java      | 16 +-------
 .../camel/component/rabbitmq/RabbitMQEndpoint.java | 26 +++++-------
 .../component/rabbitmq/RabbitMQEndpointTest.java   |  6 +--
 .../dsl/RabbitMQEndpointBuilderFactory.java        | 48 ++--------------------
 5 files changed, 20 insertions(+), 78 deletions(-)

diff --git a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
index 36f18ff..d5a5310 100644
--- a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
+++ b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
@@ -133,7 +133,7 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *addresses* (common) | If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses. The addresses value is a string which looks like server1:12345, server2:12345 |  | Address[]
+| *addresses* (common) | If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses. The addresses value is a string which looks like server1:12345, server2:12345 |  | String
 | *autoDelete* (common) | If it is true, the exchange will be deleted when it is no longer in use | true | boolean
 | *automaticRecoveryEnabled* (common) | Enables connection automatic recovery (uses connection implementation that performs automatic recovery when existing connection has failures) | true | Boolean
 | *connectionFactory* (common) | To use a custom RabbitMQ connection factory. When this option is set, all connection options (connectionTimeout, requestedChannelMax...) set on URI are not used |  | ConnectionFactory
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java
index ea40551..e0da35a 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java
@@ -49,7 +49,7 @@ public class RabbitMQComponent extends DefaultComponent {
     @Metadata(label = "common", defaultValue = ConnectionFactory.DEFAULT_VHOST)
     private String vhost = ConnectionFactory.DEFAULT_VHOST;
     @Metadata(label = "common")
-    private Address[] addresses;
+    private String addresses;
     @Metadata(label = "common")
     private ConnectionFactory connectionFactory;
     @Metadata(label = "consumer", defaultValue = "true")
@@ -324,22 +324,10 @@ public class RabbitMQComponent extends DefaultComponent {
      * looks like "server1:12345, server2:12345"
      */
     public void setAddresses(String addresses) {
-        Address[] addressArray = Address.parseAddresses(addresses);
-        if (addressArray.length > 0) {
-            this.addresses = addressArray;
-        }
-    }
-
-    /**
-     * If this option is set, camel-rabbitmq will try to create connection based
-     * on the setting of option addresses. The addresses value is a string which
-     * looks like "server1:12345, server2:12345"
-     */
-    public void setAddresses(Address[] addresses) {
         this.addresses = addresses;
     }
 
-    public Address[] getAddresses() {
+    public String getAddresses() {
         return addresses;
     }
 
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
index 56c01f9..58db20a 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
@@ -101,7 +101,7 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
     @UriParam(label = "common")
     private boolean skipExchangeDeclare;
     @UriParam(label = "common")
-    private Address[] addresses;
+    private String addresses;
     @UriParam(label = "common", defaultValue = "true")
     private Boolean automaticRecoveryEnabled = Boolean.TRUE;
     @UriParam(label = "advanced", defaultValue = "" + ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT)
@@ -220,7 +220,7 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
         if (getAddresses() == null) {
             return getOrCreateConnectionFactory().newConnection(executor);
         } else {
-            return getOrCreateConnectionFactory().newConnection(executor, getAddresses());
+            return getOrCreateConnectionFactory().newConnection(executor, parseAddresses());
         }
     }
 
@@ -452,25 +452,21 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
      * looks like "server1:12345, server2:12345"
      */
     public void setAddresses(String addresses) {
-        Address[] addressArray = Address.parseAddresses(addresses);
-        if (addressArray.length > 0) {
-            this.addresses = addressArray;
-        }
-    }
-
-    /**
-     * If this option is set, camel-rabbitmq will try to create connection based
-     * on the setting of option addresses. The addresses value is a string which
-     * looks like "server1:12345, server2:12345"
-     */
-    public void setAddresses(Address[] addresses) {
         this.addresses = addresses;
     }
 
-    public Address[] getAddresses() {
+    public String getAddresses() {
         return addresses;
     }
 
+    public Address[] parseAddresses() {
+        if (addresses != null) {
+            return Address.parseAddresses(getAddresses());
+        } else {
+            return null;
+        }
+    }
+
     public int getConnectionTimeout() {
         return connectionTimeout;
     }
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
index ba20ac5..0b5dcee 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
@@ -178,9 +178,9 @@ public class RabbitMQEndpointTest extends CamelTestSupport {
     @Test
     public void brokerEndpointAddressesSettings() throws Exception {
         RabbitMQEndpoint endpoint = context.getEndpoint("rabbitmq:localhost/exchange?addresses=server1:12345,server2:12345", RabbitMQEndpoint.class);
-        assertEquals("Wrong size of endpoint addresses.", 2, endpoint.getAddresses().length);
-        assertEquals("Get a wrong endpoint address.", new Address("server1", 12345), endpoint.getAddresses()[0]);
-        assertEquals("Get a wrong endpoint address.", new Address("server2", 12345), endpoint.getAddresses()[1]);
+        assertEquals("Wrong size of endpoint addresses.", 2, endpoint.parseAddresses().length);
+        assertEquals("Get a wrong endpoint address.", new Address("server1", 12345), endpoint.parseAddresses()[0]);
+        assertEquals("Get a wrong endpoint address.", new Address("server2", 12345), endpoint.parseAddresses()[1]);
     }
 
     private ConnectionFactory createConnectionFactory(String uri) throws TimeoutException {
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java
index 2007b1f..f5cb6ae 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java
@@ -48,21 +48,7 @@ public interface RabbitMQEndpointBuilderFactory {
          * based on the setting of option addresses. The addresses value is a
          * string which looks like server1:12345, server2:12345.
          * 
-         * The option is a: <code>com.rabbitmq.client.Address[]</code> type.
-         * 
-         * Group: common
-         */
-        default RabbitMQEndpointConsumerBuilder addresses(Object[] addresses) {
-            setProperty("addresses", addresses);
-            return this;
-        }
-        /**
-         * If this option is set, camel-rabbitmq will try to create connection
-         * based on the setting of option addresses. The addresses value is a
-         * string which looks like server1:12345, server2:12345.
-         * 
-         * The option will be converted to a
-         * <code>com.rabbitmq.client.Address[]</code> type.
+         * The option is a: <code>java.lang.String</code> type.
          * 
          * Group: common
          */
@@ -1187,21 +1173,7 @@ public interface RabbitMQEndpointBuilderFactory {
          * based on the setting of option addresses. The addresses value is a
          * string which looks like server1:12345, server2:12345.
          * 
-         * The option is a: <code>com.rabbitmq.client.Address[]</code> type.
-         * 
-         * Group: common
-         */
-        default RabbitMQEndpointProducerBuilder addresses(Object[] addresses) {
-            setProperty("addresses", addresses);
-            return this;
-        }
-        /**
-         * If this option is set, camel-rabbitmq will try to create connection
-         * based on the setting of option addresses. The addresses value is a
-         * string which looks like server1:12345, server2:12345.
-         * 
-         * The option will be converted to a
-         * <code>com.rabbitmq.client.Address[]</code> type.
+         * The option is a: <code>java.lang.String</code> type.
          * 
          * Group: common
          */
@@ -2306,21 +2278,7 @@ public interface RabbitMQEndpointBuilderFactory {
          * based on the setting of option addresses. The addresses value is a
          * string which looks like server1:12345, server2:12345.
          * 
-         * The option is a: <code>com.rabbitmq.client.Address[]</code> type.
-         * 
-         * Group: common
-         */
-        default RabbitMQEndpointBuilder addresses(Object[] addresses) {
-            setProperty("addresses", addresses);
-            return this;
-        }
-        /**
-         * If this option is set, camel-rabbitmq will try to create connection
-         * based on the setting of option addresses. The addresses value is a
-         * string which looks like server1:12345, server2:12345.
-         * 
-         * The option will be converted to a
-         * <code>com.rabbitmq.client.Address[]</code> type.
+         * The option is a: <code>java.lang.String</code> type.
          * 
          * Group: common
          */


[camel] 07/07: CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1a47f95ae800c607a6c0eb787b34f6ad6b46f4d8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 22 08:15:11 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
 .../camel/support/ScheduledPollEndpoint.java       | 45 ++++++++++++----------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java
index d465eb1..f9a846c 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java
@@ -112,28 +112,31 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint {
             setSchedulerProperties(schedulerProperties);
         }
 
-        if ("spring".equals(scheduler)) {
-            // special for scheduler if its "spring" or "quartz"
-            try {
-                Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(SPRING_SCHEDULER, ScheduledPollConsumerScheduler.class);
-                consumerScheduler = getCamelContext().getInjector().newInstance(clazz);
-            } catch (ClassNotFoundException e) {
-                throw new IllegalArgumentException("Cannot load " + SPRING_SCHEDULER + " from classpath. Make sure camel-spring.jar is on the classpath.", e);
+        String schedulerName = (String) options.get("scheduler");
+        if (schedulerName != null) {
+            if ("spring".equals(schedulerName)) {
+                // special for scheduler if its "spring" or "quartz"
+                try {
+                    Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(SPRING_SCHEDULER, ScheduledPollConsumerScheduler.class);
+                    consumerScheduler = getCamelContext().getInjector().newInstance(clazz);
+                } catch (ClassNotFoundException e) {
+                    throw new IllegalArgumentException("Cannot load " + SPRING_SCHEDULER + " from classpath. Make sure camel-spring.jar is on the classpath.", e);
+                }
+            } else if ("quartz".equals(schedulerName)) {
+                // special for scheduler if its "spring" or "quartz"
+                try {
+                    Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(QUARTZ_SCHEDULER, ScheduledPollConsumerScheduler.class);
+                    consumerScheduler = getCamelContext().getInjector().newInstance(clazz);
+                } catch (ClassNotFoundException e) {
+                    throw new IllegalArgumentException("Cannot load " + QUARTZ_SCHEDULER + " from classpath. Make sure camel-quartz.jar is on the classpath.", e);
+                }
+            } else if (!"none".equals(schedulerName)) {
+                // must refer to a custom scheduler by the given name
+                if (EndpointHelper.isReferenceParameter(schedulerName)) {
+                    schedulerName = schedulerName.substring(1);
+                }
+                consumerScheduler = CamelContextHelper.mandatoryLookup(getCamelContext(), schedulerName, ScheduledPollConsumerScheduler.class);
             }
-        } else if ("quartz".equals(scheduler)) {
-            // special for scheduler if its "spring" or "quartz"
-            try {
-                Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(QUARTZ_SCHEDULER, ScheduledPollConsumerScheduler.class);
-                consumerScheduler = getCamelContext().getInjector().newInstance(clazz);
-            } catch (ClassNotFoundException e) {
-                throw new IllegalArgumentException("Cannot load " + QUARTZ_SCHEDULER + " from classpath. Make sure camel-quartz.jar is on the classpath.", e);
-            }
-        } else if (!"none".equals(scheduler)) {
-            // must refer to a custom scheduler by the given name
-            if (EndpointHelper.isReferenceParameter(scheduler)) {
-                scheduler = scheduler.substring(1);
-            }
-            consumerScheduler = CamelContextHelper.mandatoryLookup(getCamelContext(), scheduler, ScheduledPollConsumerScheduler.class);
         }
     }
 


[camel] 03/07: CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7d37b519cbe93624456c97714a5843f1786775d9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 22 06:35:37 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
 .../support/component/EndpointPropertyConfigurerSupport.java      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/camel-support/src/main/java/org/apache/camel/support/component/EndpointPropertyConfigurerSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/component/EndpointPropertyConfigurerSupport.java
index 55a47e1..406e5e1 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/component/EndpointPropertyConfigurerSupport.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/component/EndpointPropertyConfigurerSupport.java
@@ -17,6 +17,8 @@
 package org.apache.camel.support.component;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.NoTypeConversionAvailableException;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.spi.EndpointPropertyConfigurer;
 
 public abstract class EndpointPropertyConfigurerSupport implements EndpointPropertyConfigurer {
@@ -45,7 +47,11 @@ public abstract class EndpointPropertyConfigurerSupport implements EndpointPrope
             }
         }
 
-        return camelContext.getTypeConverter().convertTo(type, value);
+        try {
+            return camelContext.getTypeConverter().mandatoryConvertTo(type, value);
+        } catch (NoTypeConversionAvailableException e) {
+            throw RuntimeCamelException.wrapRuntimeException(e);
+        }
     }
 
 }