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 2020/02/06 21:06:55 UTC

[camel] branch master updated (d8fcbbf -> 4d1e5f3)

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

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


    from d8fcbbf  Upgrade AWS SDK v2 to version 2.10.58
     new 2b79ed0  CAMEL-14510: Fixed NPE in camel-spring when usign Camel IoC via its bean post processor helper. Thaks to Remco Schoen for test case.
     new b405ad4  Reformat doc as CI server fails with this about some invalid utf-8 sequence
     new 4d1e5f3  Include camel-xml-jaxb for sprign and cdi as they use JAXB for xml parsing routes.

The 3 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:
 components/camel-cdi/pom.xml                       | 12 ++--
 components/camel-spring/pom.xml                    |  4 ++
 .../src/main/docs/yammer-component.adoc            | 83 ++++++++--------------
 .../impl/engine/CamelPostProcessorHelper.java      |  4 +-
 .../impl/engine/DefaultCamelBeanPostProcessor.java | 38 +++++-----
 5 files changed, 58 insertions(+), 83 deletions(-)


[camel] 03/03: Include camel-xml-jaxb for sprign and cdi as they use JAXB for xml parsing routes.

Posted by da...@apache.org.
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

commit 4d1e5f39ec937f620452c9bd71674df5bcb0475a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Feb 6 21:56:20 2020 +0100

    Include camel-xml-jaxb for sprign and cdi as they use JAXB for xml parsing routes.
---
 components/camel-cdi/pom.xml    | 12 +++++-------
 components/camel-spring/pom.xml |  4 ++++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/components/camel-cdi/pom.xml b/components/camel-cdi/pom.xml
index e825db7..175ad2c 100644
--- a/components/camel-cdi/pom.xml
+++ b/components/camel-cdi/pom.xml
@@ -105,14 +105,17 @@
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-core-xml</artifactId>
-            <version>${project.version}</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-xml-jaxb</artifactId>
             <optional>true</optional>
         </dependency>
 
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-core-osgi</artifactId>
-            <version>${project.version}</version>
             <scope>provided</scope>
             <optional>true</optional>
         </dependency>
@@ -160,11 +163,6 @@
             <artifactId>camel-ref</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-xml-jaxb</artifactId>
-            <scope>test</scope>
-        </dependency>
 
         <dependency>
             <groupId>junit</groupId>
diff --git a/components/camel-spring/pom.xml b/components/camel-spring/pom.xml
index 77cab95..a082025 100644
--- a/components/camel-spring/pom.xml
+++ b/components/camel-spring/pom.xml
@@ -39,6 +39,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
+            <artifactId>camel-xml-jaxb</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
             <artifactId>camel-xml-jaxp</artifactId>
         </dependency>
         <dependency>


[camel] 01/03: CAMEL-14510: Fixed NPE in camel-spring when usign Camel IoC via its bean post processor helper. Thaks to Remco Schoen for test case.

Posted by da...@apache.org.
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

commit 2b79ed0f09bd641c929c5131ba724849079270a2
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Feb 6 21:31:25 2020 +0100

    CAMEL-14510: Fixed NPE in camel-spring when usign Camel IoC via its bean post processor helper. Thaks to Remco Schoen for test case.
---
 .../impl/engine/CamelPostProcessorHelper.java      |  4 +--
 .../impl/engine/DefaultCamelBeanPostProcessor.java | 38 +++++++++++-----------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java
index 4483779..7bf8641 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java
@@ -288,8 +288,8 @@ public class CamelPostProcessorHelper implements CamelContextAware {
     public Object getInjectionBeanValue(Class<?> type, String name) {
         if (ObjectHelper.isEmpty(name)) {
             // is it camel context itself?
-            if (type.isAssignableFrom(camelContext.getClass())) {
-                return camelContext;
+            if (getCamelContext() != null && type.isAssignableFrom(getCamelContext().getClass())) {
+                return getCamelContext();
             }
             Set<?> found = getCamelContext().getRegistry().findByType(type);
             if (found == null || found.isEmpty()) {
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultCamelBeanPostProcessor.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultCamelBeanPostProcessor.java
index 1501550..d1882c9 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultCamelBeanPostProcessor.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultCamelBeanPostProcessor.java
@@ -378,17 +378,17 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor {
         }
         if (bean == null) {
             // no bean so then create an instance from its type
-            bean = camelContext.getInjector().newInstance(clazz);
+            bean = getOrLookupCamelContext().getInjector().newInstance(clazz);
         }
         if (beanPostProcess) {
             try {
-                camelContext.adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessBeforeInitialization(bean, beanName);
-                camelContext.adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessAfterInitialization(bean, beanName);
+                getOrLookupCamelContext().adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessBeforeInitialization(bean, beanName);
+                getOrLookupCamelContext().adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessAfterInitialization(bean, beanName);
             } catch (Exception e) {
                 throw RuntimeCamelException.wrapRuntimeException(e);
             }
         }
-        camelContext.getRegistry().bind(name, bean);
+        getOrLookupCamelContext().getRegistry().bind(name, bean);
     }
 
     private void bindToRegistry(Field field, String name, Object bean, String beanName, boolean beanPostProcess) {
@@ -399,13 +399,13 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor {
         if (value != null) {
             if (beanPostProcess) {
                 try {
-                    camelContext.adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessBeforeInitialization(value, beanName);
-                    camelContext.adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessAfterInitialization(value, beanName);
+                    getOrLookupCamelContext().adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessBeforeInitialization(value, beanName);
+                    getOrLookupCamelContext().adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessAfterInitialization(value, beanName);
                 } catch (Exception e) {
                     throw RuntimeCamelException.wrapRuntimeException(e);
                 }
             }
-            camelContext.getRegistry().bind(name, value);
+            getOrLookupCamelContext().getRegistry().bind(name, value);
         }
     }
 
@@ -429,13 +429,13 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor {
         if (value != null) {
             if (beanPostProcess) {
                 try {
-                    camelContext.adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessBeforeInitialization(value, beanName);
-                    camelContext.adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessAfterInitialization(value, beanName);
+                    getOrLookupCamelContext().adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessBeforeInitialization(value, beanName);
+                    getOrLookupCamelContext().adapt(ExtendedCamelContext.class).getBeanPostProcessor().postProcessAfterInitialization(value, beanName);
                 } catch (Exception e) {
                     throw RuntimeCamelException.wrapRuntimeException(e);
                 }
             }
-            camelContext.getRegistry().bind(name, value);
+            getOrLookupCamelContext().getRegistry().bind(name, value);
         }
     }
 
@@ -449,11 +449,11 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor {
         for (int i = 0; i < method.getParameterCount(); i++) {
             Class<?> type = method.getParameterTypes()[i];
             if (type.isAssignableFrom(CamelContext.class)) {
-                parameters[i] = camelContext;
+                parameters[i] = getOrLookupCamelContext();
             } else if (type.isAssignableFrom(Registry.class)) {
-                parameters[i] = camelContext.getRegistry();
+                parameters[i] = getOrLookupCamelContext().getRegistry();
             } else if (type.isAssignableFrom(TypeConverter.class)) {
-                parameters[i] = camelContext.getTypeConverter();
+                parameters[i] = getOrLookupCamelContext().getTypeConverter();
             } else {
                 // we also support @BeanInject and @PropertyInject annotations
                 Annotation[] anns = method.getParameterAnnotations()[i];
@@ -470,8 +470,8 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor {
                         // need to force property lookup by having key enclosed in tokens
                         key = PropertiesComponent.PREFIX_TOKEN + key + PropertiesComponent.SUFFIX_TOKEN;
                         try {
-                            Object value = camelContext.resolvePropertyPlaceholders(key);
-                            parameters[i] = camelContext.getTypeConverter().convertTo(type, value);
+                            Object value = getOrLookupCamelContext().resolvePropertyPlaceholders(key);
+                            parameters[i] = getOrLookupCamelContext().getTypeConverter().convertTo(type, value);
                         } catch (Exception e) {
                             throw RuntimeCamelException.wrapRuntimeCamelException(e);
                         }
@@ -481,7 +481,7 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor {
                         Object value;
                         if (isEmpty(key)) {
                             // empty key so lookup anonymously by type
-                            Set<?> instances = camelContext.getRegistry().findByType(type);
+                            Set<?> instances = getOrLookupCamelContext().getRegistry().findByType(type);
                             if (instances.size() == 0) {
                                 throw new NoSuchBeanException(null, key);
                             } else if (instances.size() == 1) {
@@ -492,16 +492,16 @@ public class DefaultCamelBeanPostProcessor implements CamelBeanPostProcessor {
                                     + " exists in the Camel registry. Specify the bean name on @BeanInject to bind to a single bean, at the method: " + method);
                             }
                         } else {
-                            value = camelContext.getRegistry().lookupByName(key);
+                            value = getOrLookupCamelContext().getRegistry().lookupByName(key);
                             if (value == null) {
                                 throw new NoSuchBeanException(key);
                             }
-                            parameters[i] = camelContext.getTypeConverter().convertTo(type, value);
+                            parameters[i] = getOrLookupCamelContext().getTypeConverter().convertTo(type, value);
                         }
                     }
                 } else {
                     // okay attempt to default to singleton instances from the registry
-                    Set<?> instances = camelContext.getRegistry().findByType(type);
+                    Set<?> instances = getOrLookupCamelContext().getRegistry().findByType(type);
                     if (instances.size() == 1) {
                         parameters[i] = instances.iterator().next();
                     } else if (instances.size() > 1) {


[camel] 02/03: Reformat doc as CI server fails with this about some invalid utf-8 sequence

Posted by da...@apache.org.
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

commit b405ad4edc9d944de754bab674a20062678722f4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Feb 6 21:40:31 2020 +0100

    Reformat doc as CI server fails with this about some invalid utf-8 sequence
---
 .../src/main/docs/yammer-component.adoc            | 83 ++++++++--------------
 1 file changed, 28 insertions(+), 55 deletions(-)

diff --git a/components/camel-yammer/src/main/docs/yammer-component.adoc b/components/camel-yammer/src/main/docs/yammer-component.adoc
index 6985f5e..e32656e 100644
--- a/components/camel-yammer/src/main/docs/yammer-component.adoc
+++ b/components/camel-yammer/src/main/docs/yammer-component.adoc
@@ -8,18 +8,16 @@
 // HEADER END
 
 The Yammer component allows you to interact with the
-https://www.yammer.com[Yammer] enterprise social network. Consuming
-messages and users is supported as well as creating
-new messages.
-
-Yammer uses OAuth 2 for all client application authentication. In order
-to use camel-yammer with your account, you'll need to create a new
-application within Yammer and grant the application access to your
-account. Finally, generate your access token. More details are at
+https://www.yammer.com[Yammer] enterprise social network.
+Consuming messages and users is supported as well as creating new messages.
+
+Yammer uses OAuth 2 for all client application authentication.
+In order to use camel-yammer with your account, you'll need to create a new application within Yammer and grant the application access to your account.
+Finally, generate your access token.
+More details are at
 https://developer.yammer.com/authentication/.
 
-Maven users will need to add the following dependency to their pom.xml
-for this component:
+Maven users will need to add the following dependency to their pom.xml for this component:
 
 [source,xml]
 ----
@@ -39,8 +37,7 @@ yammer:[function]?[options]
 
 == Component options
 
-The Yammer component can be configured with the Yammer account settings
-which are mandatory to configure before using.
+The Yammer component can be configured with the Yammer account settings which are mandatory to configure before using.
 
 
 
@@ -48,8 +45,6 @@ which are mandatory to configure before using.
 // component options: START
 The Yammer component supports 7 options, which are listed below.
 
-
-
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
@@ -83,17 +78,14 @@ with the following path and query parameters:
 
 === Path Parameters (1 parameters):
 
-
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *function* | *Required* The function to use. The value can be one of: MESSAGES, MY_FEED, ALGO, FOLLOWING, SENT, PRIVATE, RECEIVED, USERS, CURRENT |  | YammerFunctionType
 |===
 
-
 === Query Parameters (31 parameters):
 
-
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
@@ -145,11 +137,8 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 </dependency>
 ----
 
-
 The component supports 20 options, which are listed below.
 
-
-
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
@@ -180,8 +169,7 @@ The component supports 20 options, which are listed below.
 
 == Consuming messages
 
-The Yammer component provides several endpoints for consuming
-messages:
+The Yammer component provides several endpoints for consuming messages:
 
 [width="100%",cols="2l,3",options="header",]
 |=======================================================================
@@ -208,13 +196,12 @@ and topics that the user is following.
 |All messages received by the user
 |=======================================================================
 
-
 === Message format
 
 All messages by default are converted to a POJO model provided in the
-`org.apache.camel.component.yammer.model` package. The original message
-coming from yammer is in JSON. For all message consuming and producing
-endpoints, a `Messages` object is returned. Take for example a route like:
+`org.apache.camel.component.yammer.model` package.
+The original message coming from yammer is in JSON. For all message consuming and producing endpoints, a `Messages` object is returned.
+Take for example a route like:
 
 [source,java]
 ----
@@ -301,8 +288,8 @@ and lets say the yammer server returns:
 ----
 
 Camel will marshal that into a `Messages` object containing 2 `Message`
-objects. As shown below there is a rich object model that makes it easy
-to get any information you need:
+objects.
+As shown below there is a rich object model that makes it easy to get any information you need:
 
 [source,java]
 ----
@@ -314,23 +301,20 @@ assertEquals("Testing yammer API...", messages.getMessages().get(0).getBody().ge
 assertEquals("(Principal Software Engineer) has #joined the redhat.com network. Take a moment to welcome Jonathan.", messages.getMessages().get(1).getBody().getPlain());
 ----
 
-That said, marshaling this data into POJOs is not free so if you need
-you can switch back to using pure JSON by adding the `useJson=false`
+That said, marshaling this data into POJOs is not free so if you need you can switch back to using pure JSON by adding the `useJson=false`
 option to your URI.
 
 == Creating messages
 
-To create a new message in the account of the current user, you can use
-the following URI:
+To create a new message in the account of the current user, you can use the following URI:
 
 [source]
 ----
 yammer:messages?[options]
 ----
 
-The current Camel message body is what will be used to set the text of
-the Yammer message. The response body will include the new message
-formatted the same way as when you consume messages (i.e. as a `Messages`
+The current Camel message body is what will be used to set the text of the Yammer message.
+The response body will include the new message formatted the same way as when you consume messages (i.e. as a `Messages`
 object by default).
 
 Take this route for instance:
@@ -349,10 +333,8 @@ By sending to the `direct:start` endpoint a `"Hi from Camel!"` message body:
 template.sendBody("direct:start", "Hi from Camel!");
 ----
 
-a new message will be created in the current user's account on the
-server and also this new message will be returned to Camel and converted
-into a `Messages` object. Like when consuming messages you can interrogate
-the `Messages` object:
+a new message will be created in the current user's account on the server and also this new message will be returned to Camel and converted into a `Messages` object.
+Like when consuming messages you can interrogate the `Messages` object:
 
 [source,java]
 ----
@@ -363,11 +345,9 @@ assertEquals(1, messages.getMessages().size());
 assertEquals("Hi from Camel!", messages.getMessages().get(0).getBody().getPlain());
 ----
 
-
 == Retrieving users
 
-The Yammer component provides several endpoints for retrieving
-users:
+The Yammer component provides several endpoints for retrieving users:
 
 [width="100%",cols="2l,3",options="header",]
 |=====================================================
@@ -378,20 +358,14 @@ users:
 |View data about the current user.
 |=====================================================
 
-
 == Using an enricher
 
-It is helpful sometimes (or maybe always in the case of users
-to use an enricher pattern rather than a route
-initiated with one of the polling consumers in camel-yammer. This is
-because the consumers will fire repeatedly, however often you set the
-delay for. If you just want to look up a user's data, or grab a message
-at a point in time, it is better to call that consumer once and then get
-one with your route.
+It is helpful sometimes (or maybe always in the case of users to use an enricher pattern rather than a route initiated with one of the polling consumers in camel-yammer.
+This is because the consumers will fire repeatedly, however often you set the delay for.
+If you just want to look up a user's data, or grab a message at a point in time, it is better to call that consumer once and then get one with your route.
 
-Lets say you have a route that at some point needs to go out and fetch
-user data for the current user. Rather than polling for this user over
-and over again, use the `pollEnrich` DSL method:
+Lets say you have a route that at some point needs to go out and fetch user data for the current user.
+Rather than polling for this user over and over again, use the `pollEnrich` DSL method:
 
 [source,java]
 ----
@@ -400,6 +374,5 @@ from("direct:start")
     .to("mock:result");
 ----
 
-This will go out and fetch the current user's `User` object and set it as
-the Camel message body.
+This will go out and fetch the current user's `User` object and set it as the Camel message body.