You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/06/14 08:29:09 UTC

[camel] branch main created (now f6ed24f)

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

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git.


      at f6ed24f  CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

This branch includes the following new commits:

     new b21d5de  Regen
     new f6ed24f  CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

The 2 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.


[camel] 01/02: Regen

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

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

commit b21d5de1145cc1066b518aca6917a27aa2424ebb
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 14 10:02:51 2021 +0200

    Regen
---
 .../resources/org/apache/camel/catalog/components/rabbitmq.json         | 2 ++
 docs/components/modules/ROOT/pages/rabbitmq-component.adoc              | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rabbitmq.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rabbitmq.json
index c6bb799..819fe5c 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rabbitmq.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rabbitmq.json
@@ -46,6 +46,7 @@
     "prefetchEnabled": { "kind": "property", "displayName": "Prefetch Enabled", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enables the quality of service on the RabbitMQConsumer side. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time" },
     "prefetchGlobal": { "kind": "property", "displayName": "Prefetch Global", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the settings should be applied to the entire channel rather than each consumer You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time" },
     "prefetchSize": { "kind": "property", "displayName": "Prefetch Size", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The maximum amount of content (measured in octets) that the server will deliver, 0 if unlimited. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time" },
+    "recoverFromDeclareException": { "kind": "property", "displayName": "Recover From Declare Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Decides whether an exception during declaration of exchanges or queues is recoverable or not. If the option is false, camel will throw an exception when starting the consumer, which will [...]
     "threadPoolSize": { "kind": "property", "displayName": "Thread Pool Size", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 10, "description": "The consumer uses a Thread Pool Executor with a fixed number of threads. This setting allows you to set that number of threads." },
     "additionalHeaders": { "kind": "property", "displayName": "Additional Headers", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Map of additional headers. These headers will be set only when the 'allowCustomHeaders' is set to true" },
     "additionalProperties": { "kind": "property", "displayName": "Additional Properties", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Map of additional properties. These are standard RabbitMQ properties as defined in com.rabbitmq.client.AMQP.BasicProperties The map keys should be from org.apache.camel.component.rabbi [...]
@@ -111,6 +112,7 @@
     "prefetchEnabled": { "kind": "parameter", "displayName": "Prefetch Enabled", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enables the quality of service on the RabbitMQConsumer side. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time" },
     "prefetchGlobal": { "kind": "parameter", "displayName": "Prefetch Global", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the settings should be applied to the entire channel rather than each consumer You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time" },
     "prefetchSize": { "kind": "parameter", "displayName": "Prefetch Size", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The maximum amount of content (measured in octets) that the server will deliver, 0 if unlimited. You need to specify the option of prefetchSize, prefetchCount, prefetchGlobal at the same time" },
+    "recoverFromDeclareException": { "kind": "parameter", "displayName": "Recover From Declare Exception", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Decides whether an exception during declaration of exchanges or queues is recoverable or not. If the option is false, camel will throw an exception when starting the consumer, which will [...]
     "reQueue": { "kind": "parameter", "displayName": "Re Queue", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "This is used by the consumer to control rejection of the message. When the consumer is complete processing the exchange, and if the exchange failed, then the consumer is going to reject the message from the RabbitMQ broker. If  [...]
     "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the con [...]
     "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
diff --git a/docs/components/modules/ROOT/pages/rabbitmq-component.adoc b/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
index 788313b..b6627cb 100644
--- a/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
+++ b/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
@@ -1,7 +1,7 @@
 [[rabbitmq-component]]
 = RabbitMQ Component
 //THIS FILE IS COPIED: EDIT THE SOURCE FILE:
-:page-source: componentscamel-rabbitmqsrcmaindocsrabbitmq-component.adoc
+:page-source: components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
 :docTitle: RabbitMQ
 :artifactId: camel-rabbitmq
 :description: Send and receive messages from RabbitMQ instances.

[camel] 02/02: CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

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

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

commit f6ed24fff7a00af56a136f603e309101e60ad35a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 14 10:22:21 2021 +0200

    CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
---
 .../bean/validator/BeanValidatorEndpoint.java      | 12 +-----
 .../HibernateValidationProviderResolver.java       |  4 --
 ...java => ValidationProviderResolverFactory.java} | 18 ++------
 .../bean/validator/ValidatorFactories.java         | 48 ++++++----------------
 4 files changed, 17 insertions(+), 65 deletions(-)

diff --git a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/BeanValidatorEndpoint.java b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/BeanValidatorEndpoint.java
index 68e4f13..4610955 100644
--- a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/BeanValidatorEndpoint.java
+++ b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/BeanValidatorEndpoint.java
@@ -32,7 +32,6 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
 import org.apache.camel.support.DefaultEndpoint;
-import org.apache.camel.support.PlatformHelper;
 
 import static org.apache.camel.component.bean.validator.ValidatorFactories.buildValidatorFactory;
 
@@ -76,7 +75,7 @@ public class BeanValidatorEndpoint extends DefaultEndpoint {
 
         ValidatorFactory validatorFactory = this.validatorFactory;
         if (validatorFactory == null) {
-            validatorFactory = buildValidatorFactory(isOsgiContext(), isIgnoreXmlConfiguration(),
+            validatorFactory = buildValidatorFactory(getCamelContext(), isIgnoreXmlConfiguration(),
                     validationProviderResolver, messageInterpolator, traversableResolver, constraintValidatorFactory);
         }
 
@@ -89,15 +88,6 @@ public class BeanValidatorEndpoint extends DefaultEndpoint {
         throw new UnsupportedOperationException("Consumer is not supported");
     }
 
-    /**
-     * Recognizes if component is executed in the OSGi environment.
-     *
-     * @return true if component is executed in the OSGi environment. False otherwise.
-     */
-    protected boolean isOsgiContext() {
-        return PlatformHelper.isOsgiContext(getCamelContext());
-    }
-
     public String getLabel() {
         return label;
     }
diff --git a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/HibernateValidationProviderResolver.java b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/HibernateValidationProviderResolver.java
index 81bbd89..df0a33b 100644
--- a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/HibernateValidationProviderResolver.java
+++ b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/HibernateValidationProviderResolver.java
@@ -24,10 +24,6 @@ import org.hibernate.validator.HibernateValidator;
 
 import static java.util.Collections.singletonList;
 
-/**
- * OSGi-friendly implementation of {@code javax.validation.ValidationProviderResolver} returning
- * {@code org.hibernate.validator.HibernateValidator} instance.
- */
 public class HibernateValidationProviderResolver implements ValidationProviderResolver {
 
     @Override
diff --git a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/HibernateValidationProviderResolver.java b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/ValidationProviderResolverFactory.java
similarity index 64%
copy from components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/HibernateValidationProviderResolver.java
copy to components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/ValidationProviderResolverFactory.java
index 81bbd89..ee4cea7 100644
--- a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/HibernateValidationProviderResolver.java
+++ b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/ValidationProviderResolverFactory.java
@@ -16,23 +16,11 @@
  */
 package org.apache.camel.component.bean.validator;
 
-import java.util.List;
-
 import javax.validation.ValidationProviderResolver;
 
-import org.hibernate.validator.HibernateValidator;
-
-import static java.util.Collections.singletonList;
-
-/**
- * OSGi-friendly implementation of {@code javax.validation.ValidationProviderResolver} returning
- * {@code org.hibernate.validator.HibernateValidator} instance.
- */
-public class HibernateValidationProviderResolver implements ValidationProviderResolver {
+import org.apache.camel.CamelContext;
 
-    @Override
-    public List getValidationProviders() {
-        return singletonList(new HibernateValidator());
-    }
+public interface ValidationProviderResolverFactory {
 
+    ValidationProviderResolver createValidationProviderResolver(CamelContext camelContext);
 }
diff --git a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/ValidatorFactories.java b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/ValidatorFactories.java
index 5701129..615fa5f 100644
--- a/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/ValidatorFactories.java
+++ b/components/camel-bean-validator/src/main/java/org/apache/camel/component/bean/validator/ValidatorFactories.java
@@ -25,6 +25,9 @@ import javax.validation.ValidationProviderResolver;
 import javax.validation.ValidatorFactory;
 import javax.validation.bootstrap.GenericBootstrap;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.support.CamelContextHelper;
+
 /**
  * Utility class dedicated to create new {@code javax.validation.ValidatorFactory} instances.
  */
@@ -34,33 +37,33 @@ public final class ValidatorFactories {
     }
 
     public static ValidatorFactory buildValidatorFactory(
-            boolean osgi, boolean ignoreXml,
+            CamelContext camelContext, boolean ignoreXml,
             ValidationProviderResolver validationProviderResolver,
             MessageInterpolator messageInterpolator,
             TraversableResolver traversableResolver,
             ConstraintValidatorFactory constraintValidatorFactory) {
 
-        ValidationProviderResolver resolvedValidationProviderResolver
-                = resolveValidationProviderResolver(osgi, validationProviderResolver);
-
+        if (validationProviderResolver == null) {
+            ValidationProviderResolverFactory factory
+                    = CamelContextHelper.findByType(camelContext, ValidationProviderResolverFactory.class);
+            if (factory != null) {
+                validationProviderResolver = factory.createValidationProviderResolver(camelContext);
+            }
+        }
         GenericBootstrap bootstrap = Validation.byDefaultProvider();
-        if (resolvedValidationProviderResolver != null) {
-            bootstrap.providerResolver(resolvedValidationProviderResolver);
+        if (validationProviderResolver != null) {
+            bootstrap.providerResolver(validationProviderResolver);
         }
         Configuration<?> configuration = bootstrap.configure();
-
         if (messageInterpolator != null) {
             configuration.messageInterpolator(messageInterpolator);
         }
-
         if (traversableResolver != null) {
             configuration.traversableResolver(traversableResolver);
         }
-
         if (constraintValidatorFactory != null) {
             configuration.constraintValidatorFactory(constraintValidatorFactory);
         }
-
         if (ignoreXml) {
             configuration.ignoreXmlConfiguration();
         }
@@ -68,29 +71,4 @@ public final class ValidatorFactories {
         return configuration.buildValidatorFactory();
     }
 
-    /**
-     * Resolves optional custom {@code javax.validation.ValidationProviderResolver} to be used by the component. By
-     * default component tries to use resolver instance bound to the Camel registry under name
-     * {@code validationProviderResolver} . If there is no such resolver instance in the registry and component is
-     * running in the OSGi environment, {@link HibernateValidationProviderResolver} will be used. In all the other cases
-     * this method will return null.
-     *
-     * @param  osgi                       specifies if validator factory should be OSGi-aware
-     * @param  validationProviderResolver predefined provider resolver. This parameter overrides the results of the
-     *                                    resolution.
-     * @return                            {@code javax.validation.ValidationProviderResolver} instance or null if no
-     *                                    custom resolver should be used by the component
-     */
-    private static ValidationProviderResolver resolveValidationProviderResolver(
-            boolean osgi,
-            ValidationProviderResolver validationProviderResolver) {
-        if (validationProviderResolver != null) {
-            return validationProviderResolver;
-        }
-        if (osgi) {
-            return new HibernateValidationProviderResolver();
-        }
-        return null;
-    }
-
 }