CAMEL-10001: Add support for using any property placeholders on load balancers
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2aab2fb2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2aab2fb2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2aab2fb2 Branch: refs/heads/master Commit: 2aab2fb23570771c2019551029c65109373cb5df Parents: d3ad0f0 Author: Claus Ibsen <[email protected]> Authored: Tue May 31 08:14:00 2016 +0200 Committer: Claus Ibsen <[email protected]> Committed: Tue May 31 08:14:00 2016 +0200 ---------------------------------------------------------------------- .../camel/model/LoadBalancerDefinition.java | 18 +++++++++++++++- .../camel/model/config/ResequencerConfig.java | 22 +++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/2aab2fb2/camel-core/src/main/java/org/apache/camel/model/LoadBalancerDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/LoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/LoadBalancerDefinition.java index 4d4a37c..a219f9e 100644 --- a/camel-core/src/main/java/org/apache/camel/model/LoadBalancerDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/LoadBalancerDefinition.java @@ -16,10 +16,13 @@ */ package org.apache.camel.model; +import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; +import javax.xml.namespace.QName; import org.apache.camel.processor.loadbalancer.LoadBalancer; import org.apache.camel.spi.Metadata; @@ -33,11 +36,14 @@ import org.apache.camel.util.ObjectHelper; @Metadata(label = "eip,routing") @XmlType(name = "loadBalancer") @XmlAccessorType(XmlAccessType.FIELD) -public class LoadBalancerDefinition extends IdentifiedType { +public class LoadBalancerDefinition extends IdentifiedType implements OtherAttributesAware { @XmlTransient private LoadBalancer loadBalancer; @XmlTransient private String loadBalancerTypeName; + // use xs:any to support optional property placeholders + @XmlAnyAttribute + private Map<QName, Object> otherAttributes; public LoadBalancerDefinition() { } @@ -82,6 +88,16 @@ public class LoadBalancerDefinition extends IdentifiedType { this.loadBalancer = loadBalancer; } + @Override + public Map<QName, Object> getOtherAttributes() { + return otherAttributes; + } + + @Override + public void setOtherAttributes(Map<QName, Object> otherAttributes) { + this.otherAttributes = otherAttributes; + } + /** * Factory method to create the load balancer from the loadBalancerTypeName */ http://git-wip-us.apache.org/repos/asf/camel/blob/2aab2fb2/camel-core/src/main/java/org/apache/camel/model/config/ResequencerConfig.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/config/ResequencerConfig.java b/camel-core/src/main/java/org/apache/camel/model/config/ResequencerConfig.java index 5e55445..624eafa 100644 --- a/camel-core/src/main/java/org/apache/camel/model/config/ResequencerConfig.java +++ b/camel-core/src/main/java/org/apache/camel/model/config/ResequencerConfig.java @@ -16,11 +16,31 @@ */ package org.apache.camel.model.config; +import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlType; +import javax.xml.namespace.QName; + +import org.apache.camel.model.OtherAttributesAware; @XmlType(name = "resequencerConfig") @XmlAccessorType(XmlAccessType.FIELD) -public abstract class ResequencerConfig { +public abstract class ResequencerConfig implements OtherAttributesAware { + + // use xs:any to support optional property placeholders + @XmlAnyAttribute + private Map<QName, Object> otherAttributes; + + @Override + public Map<QName, Object> getOtherAttributes() { + return otherAttributes; + } + + @Override + public void setOtherAttributes(Map<QName, Object> otherAttributes) { + this.otherAttributes = otherAttributes; + } + }
