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/04/17 09:41:39 UTC
[camel] 22/38: CAMEL-13421: Remove BeanInvocation from camel-bean
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch mock
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9379d72d0788898d9d1ec3a64629c235bab03636
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 16 15:02:21 2019 +0200
CAMEL-13421: Remove BeanInvocation from camel-bean
---
.../spring/remoting/CamelServiceExporter.java | 13 +++++++++-
.../remoting/spring-with-exporter-namespace.xml | 4 +--
.../spring/remoting/spring-with-exporter-proxy.xml | 4 +--
.../camel/spring/remoting/spring-with-exporter.xml | 3 ++-
.../remoting/spring-with-two-camelcontext.xml | 6 ++---
.../core/xml/CamelProxyFactoryDefinition.java | 30 ----------------------
.../core/xml/CamelServiceExporterDefinition.java | 13 ++++++++++
7 files changed, 33 insertions(+), 40 deletions(-)
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java b/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java
index 957215c..8e94c62 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java
@@ -45,6 +45,7 @@ public class CamelServiceExporter extends RemoteExporter implements Initializing
private String camelContextId;
private Consumer consumer;
private String serviceRef;
+ private String method;
private ApplicationContext applicationContext;
public String getUri() {
@@ -75,6 +76,14 @@ public class CamelServiceExporter extends RemoteExporter implements Initializing
this.serviceRef = serviceRef;
}
+ public String getMethod() {
+ return method;
+ }
+
+ public void setMethod(String method) {
+ this.method = method;
+ }
+
public ApplicationContext getApplicationContext() {
return applicationContext;
}
@@ -102,7 +111,9 @@ public class CamelServiceExporter extends RemoteExporter implements Initializing
try {
// need to start endpoint before we create consumer
ServiceHelper.startService(endpoint);
- consumer = endpoint.createConsumer(new BeanProcessor(proxy, camelContext));
+ BeanProcessor processor = new BeanProcessor(proxy, camelContext);
+ processor.setMethod(method);
+ consumer = endpoint.createConsumer(processor);
// add and start consumer
camelContext.addService(consumer, true, true);
} catch (Exception e) {
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter-namespace.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter-namespace.xml
index 1d15b26..9a328ca 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter-namespace.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter-namespace.xml
@@ -31,11 +31,11 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- START SNIPPET: proxy -->
<!-- Creates a proxy to the direct:say endpoint. -->
- <camel:proxy id="sayProxy" serviceUrl="direct:say" binding="false"
+ <camel:proxy id="sayProxy" serviceUrl="direct:say"
serviceInterface="org.apache.camel.spring.remoting.ISay"/>
<!-- END SNIPPET: proxy -->
<!-- START SNIPPET: export -->
- <camel:export id="say" uri="direct:sayImpl" serviceRef="sayService"
+ <camel:export id="say" uri="direct:sayImpl" serviceRef="sayService" method="say"
serviceInterface="org.apache.camel.spring.remoting.ISay"/>
<!--
The bean is defined out side of the camel
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter-proxy.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter-proxy.xml
index ff7f58a..b5d9537 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter-proxy.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter-proxy.xml
@@ -27,9 +27,9 @@
<bean id="sayService" class="org.apache.camel.spring.remoting.SayService"/>
- <camel:proxy id="sayProxy" serviceUrl="direct:say" binding="false"
+ <camel:proxy id="sayProxy" serviceUrl="direct:say"
serviceInterface="org.apache.camel.spring.remoting.ISay"/>
- <camel:export id="say" uri="direct:sayImpl" serviceRef="sayService"
+ <camel:export id="say" uri="direct:sayImpl" serviceRef="sayService" method="say"
serviceInterface="org.apache.camel.spring.remoting.ISay"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter.xml
index 41357ac..7c93450 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-exporter.xml
@@ -29,7 +29,7 @@
<bean id="sayProxy" class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
<property name="serviceUrl" value="direct:say"/>
<property name="serviceInterface" value="org.apache.camel.spring.remoting.ISay"/>
- <property name="binding" value="false"/>
+ <property name="binding" value="true"/>
</bean>
<!-- END SNIPPET: proxy -->
@@ -41,6 +41,7 @@
<property name="service">
<bean class="org.apache.camel.spring.remoting.SayService"/>
</property>
+ <property name="method" value="say"/>
<property name="serviceInterface" value="org.apache.camel.spring.remoting.ISay"/>
</bean>
<!-- END SNIPPET: export -->
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-two-camelcontext.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-two-camelcontext.xml
index d4e5bbfe..0136054 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-two-camelcontext.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring-with-two-camelcontext.xml
@@ -39,13 +39,11 @@
</camelContext>
<camel:proxy id="sayProxy1"
- binding="false"
serviceInterface="org.apache.camel.spring.remoting.ISay"
serviceUrl="direct:foo"
camelContextId="context-1"/>
<camel:proxy id="sayProxy2"
- binding="false"
serviceInterface="org.apache.camel.spring.remoting.ISay"
serviceUrl="direct:foo"
camelContextId="context-2"/>
@@ -58,11 +56,11 @@
<property name="message" value="context-2" />
</bean>
- <camel:export id="say1" uri="direct:sayImpl" serviceRef="sayService1"
+ <camel:export id="say1" uri="direct:sayImpl" serviceRef="sayService1" method="say"
serviceInterface="org.apache.camel.spring.remoting.ISay"
camelContextId="context-1"/>
- <camel:export id="say2" uri="direct:sayImpl" serviceRef="sayService2"
+ <camel:export id="say2" uri="direct:sayImpl" serviceRef="sayService2" method="say"
serviceInterface="org.apache.camel.spring.remoting.ISay"
camelContextId="context-2"/>
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
index 5437411..207dfc8 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
@@ -31,14 +31,10 @@ public class CamelProxyFactoryDefinition extends IdentifiedType {
@XmlAttribute
private String serviceUrl;
- @XmlAttribute @Deprecated
- private String serviceRef;
@XmlAttribute
private Class<?> serviceInterface;
@XmlAttribute
private String camelContextId;
- @XmlAttribute @Metadata(defaultValue = "true")
- private Boolean binding;
public String getServiceUrl() {
return serviceUrl;
@@ -51,20 +47,6 @@ public class CamelProxyFactoryDefinition extends IdentifiedType {
this.serviceUrl = serviceUrl;
}
- public String getServiceRef() {
- return serviceRef;
- }
-
- /**
- * The camel endpoint reference used to send the message to when calling the service from the interface.
- *
- * @deprecated use serviceUrl instead with the ref endpoint.
- */
- @Deprecated
- public void setServiceRef(String serviceRef) {
- this.serviceRef = serviceRef;
- }
-
public Class<?> getServiceInterface() {
return serviceInterface;
}
@@ -87,16 +69,4 @@ public class CamelProxyFactoryDefinition extends IdentifiedType {
this.camelContextId = camelContextId;
}
- public Boolean getBinding() {
- return binding;
- }
-
- /**
- * Camel parameter binding is enabled by default, which will use binding information from the method signature
- * parameters to bind to the Exchange/Message with the following annotations.
- * If disabled then a {@link org.apache.camel.component.bean.CamelInvocationHandler} is used.
- */
- public void setBinding(Boolean binding) {
- this.binding = binding;
- }
}
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
index 04fde86..70582ce 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
@@ -34,6 +34,8 @@ public class CamelServiceExporterDefinition extends IdentifiedType {
@XmlAttribute
private String serviceRef;
@XmlAttribute
+ private String method;
+ @XmlAttribute
private Class<?> serviceInterface;
@XmlAttribute
private String camelContextId;
@@ -60,6 +62,17 @@ public class CamelServiceExporterDefinition extends IdentifiedType {
this.serviceRef = serviceRef;
}
+ public String getMethod() {
+ return method;
+ }
+
+ /**
+ * Name of method to invoke on service
+ */
+ public void setMethod(String method) {
+ this.method = method;
+ }
+
public Class<?> getServiceInterface() {
return serviceInterface;
}