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 2015/01/21 11:07:18 UTC
[2/2] camel git commit: CAMEL-8260: Camel EIP model - Ensure
consistent getter/setter style for Boolean types
CAMEL-8260: Camel EIP model - Ensure consistent getter/setter style for Boolean types
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/76e9aab4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/76e9aab4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/76e9aab4
Branch: refs/heads/master
Commit: 76e9aab4ff6a2e172afdf32911b751da7bff782f
Parents: 707ebea
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jan 21 10:01:29 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jan 21 10:51:42 2015 +0100
----------------------------------------------------------------------
.../apache/camel/impl/DefaultCamelContext.java | 2 +
.../apache/camel/model/AggregateDefinition.java | 54 ++++--------------
.../org/apache/camel/model/DelayDefinition.java | 9 +--
.../model/IdempotentConsumerDefinition.java | 29 ++++------
.../InterceptSendToEndpointDefinition.java | 6 +-
.../org/apache/camel/model/LoopDefinition.java | 8 +--
.../apache/camel/model/MulticastDefinition.java | 44 ++++-----------
.../camel/model/OnCompletionDefinition.java | 37 +++++-------
.../camel/model/OnExceptionDefinition.java | 10 +---
.../model/OptionalIdentifiedDefinition.java | 5 +-
.../apache/camel/model/ProcessorDefinition.java | 3 +-
.../camel/model/RecipientListDefinition.java | 59 ++++++--------------
.../camel/model/ResequenceDefinition.java | 6 +-
.../apache/camel/model/RollbackDefinition.java | 16 ++----
.../org/apache/camel/model/SplitDefinition.java | 32 ++++-------
.../apache/camel/model/ThrottleDefinition.java | 21 +++----
.../apache/camel/model/WireTapDefinition.java | 10 ++--
.../model/config/BatchResequencerConfig.java | 8 ---
.../model/dataformat/CastorDataFormat.java | 11 ++--
.../model/dataformat/XMLSecurityDataFormat.java | 26 ++++-----
.../model/language/ExpressionDefinition.java | 16 +++---
.../model/language/JsonPathExpression.java | 1 -
.../camel/model/language/SimpleExpression.java | 4 +-
.../camel/model/language/XPathExpression.java | 22 ++++----
.../FailoverLoadBalancerDefinition.java | 4 --
.../WeightedLoadBalancerDefinition.java | 20 +++----
.../model/rest/RestPropertyDefinition.java | 4 +-
.../camel/processor/RedeliveryErrorHandler.java | 2 +-
28 files changed, 161 insertions(+), 308 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index caba987..fc4b6a2 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -1363,6 +1363,8 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
// extract options from the node
Map<String, Object> options = new LinkedHashMap<String, Object>();
IntrospectionSupport.getProperties(target, options, "", false);
+ // remove outputs which we do not want to include
+ options.remove("outputs");
// include other rows
for (Map<String, String> row : rows) {
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java b/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
index 97fe0bf..f9865b6 100644
--- a/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
@@ -171,9 +171,10 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
Expression correlation = getExpression().createExpression(routeContext);
AggregationStrategy strategy = createAggregationStrategy(routeContext);
- boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing());
- ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "Aggregator", this, isParallelProcessing());
- if (threadPool == null && !isParallelProcessing()) {
+ boolean parallel = getParallelProcessing() != null && getParallelProcessing();
+ boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, parallel);
+ ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "Aggregator", this, parallel);
+ if (threadPool == null && !parallel) {
// executor service is mandatory for the Aggregator
// we do not run in parallel mode, but use a synchronous executor, so we run in current thread
threadPool = new SynchronousExecutorService();
@@ -208,8 +209,10 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
answer.setShutdownTimeoutCheckerExecutorService(shutdownTimeoutThreadPool);
// set other options
- answer.setParallelProcessing(isParallelProcessing());
- answer.setOptimisticLocking(isOptimisticLocking());
+ answer.setParallelProcessing(parallel);
+ if (getOptimisticLocking() != null) {
+ answer.setOptimisticLocking(getOptimisticLocking());
+ }
if (getCompletionPredicate() != null) {
Predicate predicate = getCompletionPredicate().createPredicate(routeContext);
answer.setCompletionPredicate(predicate);
@@ -232,19 +235,19 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
answer.setCompletionSize(getCompletionSize());
}
if (getCompletionFromBatchConsumer() != null) {
- answer.setCompletionFromBatchConsumer(isCompletionFromBatchConsumer());
+ answer.setCompletionFromBatchConsumer(getCompletionFromBatchConsumer());
}
if (getEagerCheckCompletion() != null) {
- answer.setEagerCheckCompletion(isEagerCheckCompletion());
+ answer.setEagerCheckCompletion(getEagerCheckCompletion());
}
if (getIgnoreInvalidCorrelationKeys() != null) {
- answer.setIgnoreInvalidCorrelationKeys(isIgnoreInvalidCorrelationKeys());
+ answer.setIgnoreInvalidCorrelationKeys(getIgnoreInvalidCorrelationKeys());
}
if (getCloseCorrelationKeyOnCompletion() != null) {
answer.setCloseCorrelationKeyOnCompletion(getCloseCorrelationKeyOnCompletion());
}
if (getDiscardOnCompletionTimeout() != null) {
- answer.setDiscardOnCompletionTimeout(isDiscardOnCompletionTimeout());
+ answer.setDiscardOnCompletionTimeout(getDiscardOnCompletionTimeout());
}
if (getForceCompletionOnStop() != null) {
answer.setForceCompletionOnStop(getForceCompletionOnStop());
@@ -489,10 +492,6 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
return groupExchanges;
}
- public boolean isGroupExchanges() {
- return groupExchanges != null && groupExchanges;
- }
-
public void setGroupExchanges(Boolean groupExchanges) {
this.groupExchanges = groupExchanges;
}
@@ -501,10 +500,6 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
return completionFromBatchConsumer;
}
- public boolean isCompletionFromBatchConsumer() {
- return completionFromBatchConsumer != null && completionFromBatchConsumer;
- }
-
public void setCompletionFromBatchConsumer(Boolean completionFromBatchConsumer) {
this.completionFromBatchConsumer = completionFromBatchConsumer;
}
@@ -525,18 +520,10 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
this.optimisticLocking = optimisticLocking;
}
- public boolean isOptimisticLocking() {
- return optimisticLocking != null && optimisticLocking;
- }
-
public Boolean getParallelProcessing() {
return parallelProcessing;
}
- public boolean isParallelProcessing() {
- return parallelProcessing != null && parallelProcessing;
- }
-
public void setParallelProcessing(boolean parallelProcessing) {
this.parallelProcessing = parallelProcessing;
}
@@ -553,10 +540,6 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
return eagerCheckCompletion;
}
- public boolean isEagerCheckCompletion() {
- return eagerCheckCompletion != null && eagerCheckCompletion;
- }
-
public void setEagerCheckCompletion(Boolean eagerCheckCompletion) {
this.eagerCheckCompletion = eagerCheckCompletion;
}
@@ -565,10 +548,6 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
return ignoreInvalidCorrelationKeys;
}
- public boolean isIgnoreInvalidCorrelationKeys() {
- return ignoreInvalidCorrelationKeys != null && ignoreInvalidCorrelationKeys;
- }
-
public void setIgnoreInvalidCorrelationKeys(Boolean ignoreInvalidCorrelationKeys) {
this.ignoreInvalidCorrelationKeys = ignoreInvalidCorrelationKeys;
}
@@ -601,10 +580,6 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
return discardOnCompletionTimeout;
}
- public boolean isDiscardOnCompletionTimeout() {
- return discardOnCompletionTimeout != null && discardOnCompletionTimeout;
- }
-
public void setDiscardOnCompletionTimeout(Boolean discardOnCompletionTimeout) {
this.discardOnCompletionTimeout = discardOnCompletionTimeout;
}
@@ -625,15 +600,10 @@ public class AggregateDefinition extends ProcessorDefinition<AggregateDefinition
return timeoutCheckerExecutorServiceRef;
}
-
public Boolean getForceCompletionOnStop() {
return forceCompletionOnStop;
}
- public boolean isForceCompletionOnStop() {
- return forceCompletionOnStop != null && forceCompletionOnStop;
- }
-
public void setForceCompletionOnStop(Boolean forceCompletionOnStop) {
this.forceCompletionOnStop = forceCompletionOnStop;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/DelayDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/DelayDefinition.java b/camel-core/src/main/java/org/apache/camel/model/DelayDefinition.java
index 207c1eb..b8dd1f1 100644
--- a/camel-core/src/main/java/org/apache/camel/model/DelayDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/DelayDefinition.java
@@ -77,8 +77,9 @@ public class DelayDefinition extends ExpressionNode implements ExecutorServiceAw
Processor childProcessor = this.createChildProcessor(routeContext, false);
Expression delay = createAbsoluteTimeDelayExpression(routeContext);
- boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isAsyncDelayed());
- ScheduledExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredScheduledExecutorService(routeContext, "Delay", this, isAsyncDelayed());
+ boolean async = getAsyncDelayed() != null && getAsyncDelayed();
+ boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, async);
+ ScheduledExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredScheduledExecutorService(routeContext, "Delay", this, async);
Delayer answer = new Delayer(routeContext.getCamelContext(), childProcessor, delay, threadPool, shutdownThreadPool);
if (getAsyncDelayed() != null) {
@@ -163,10 +164,6 @@ public class DelayDefinition extends ExpressionNode implements ExecutorServiceAw
this.asyncDelayed = asyncDelayed;
}
- public boolean isAsyncDelayed() {
- return asyncDelayed != null && asyncDelayed;
- }
-
public Boolean getCallerRunsWhenRejected() {
return callerRunsWhenRejected;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/IdempotentConsumerDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/IdempotentConsumerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/IdempotentConsumerDefinition.java
index ea39835..ed91903 100644
--- a/camel-core/src/main/java/org/apache/camel/model/IdempotentConsumerDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/IdempotentConsumerDefinition.java
@@ -27,6 +27,7 @@ import org.apache.camel.Processor;
import org.apache.camel.processor.idempotent.IdempotentConsumer;
import org.apache.camel.spi.IdempotentRepository;
import org.apache.camel.spi.Label;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.util.ObjectHelper;
@@ -39,11 +40,11 @@ import org.apache.camel.util.ObjectHelper;
public class IdempotentConsumerDefinition extends ExpressionNode {
@XmlAttribute(required = true)
private String messageIdRepositoryRef;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private Boolean eager;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private Boolean skipDuplicate;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private Boolean removeOnFailure;
@XmlTransient
private IdempotentRepository<?> idempotentRepository;
@@ -158,11 +159,6 @@ public class IdempotentConsumerDefinition extends ExpressionNode {
this.eager = eager;
}
- public boolean isEager() {
- // defaults to true if not configured
- return eager != null ? eager : true;
- }
-
public Boolean getSkipDuplicate() {
return skipDuplicate;
}
@@ -171,11 +167,6 @@ public class IdempotentConsumerDefinition extends ExpressionNode {
this.skipDuplicate = skipDuplicate;
}
- public boolean isSkipDuplicate() {
- // defaults to true if not configured
- return skipDuplicate != null ? skipDuplicate : true;
- }
-
public Boolean getRemoveOnFailure() {
return removeOnFailure;
}
@@ -184,11 +175,6 @@ public class IdempotentConsumerDefinition extends ExpressionNode {
this.removeOnFailure = removeOnFailure;
}
- public boolean isRemoveOnFailure() {
- // defaults to true if not configured
- return removeOnFailure != null ? removeOnFailure : true;
- }
-
@Override
@SuppressWarnings("unchecked")
public Processor createProcessor(RouteContext routeContext) throws Exception {
@@ -203,7 +189,12 @@ public class IdempotentConsumerDefinition extends ExpressionNode {
Expression expression = getExpression().createExpression(routeContext);
- return new IdempotentConsumer(expression, idempotentRepository, isEager(), isSkipDuplicate(), isRemoveOnFailure(), childProcessor);
+ // these boolean should be true by default
+ boolean eager = getEager() == null || getEager();
+ boolean duplicate = getSkipDuplicate() == null || getSkipDuplicate();
+ boolean remove = getRemoveOnFailure() == null || getRemoveOnFailure();
+
+ return new IdempotentConsumer(expression, idempotentRepository, eager, duplicate, remove, childProcessor);
}
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java b/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
index 4d1ef7e..fb40b5b 100644
--- a/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
@@ -97,7 +97,7 @@ public class InterceptSendToEndpointDefinition extends OutputDefinition<Intercep
} else if (getUri() == null || matchPattern(routeContext.getCamelContext(), uri, getUri())) {
// only proxy if the uri is matched decorate endpoint with our proxy
// should be false by default
- boolean skip = isSkipSendToOriginalEndpoint();
+ boolean skip = getSkipSendToOriginalEndpoint() != null && getSkipSendToOriginalEndpoint();
InterceptSendToEndpoint proxy = new InterceptSendToEndpoint(endpoint, skip);
proxy.setDetour(detour);
return proxy;
@@ -217,10 +217,6 @@ public class InterceptSendToEndpointDefinition extends OutputDefinition<Intercep
this.skipSendToOriginalEndpoint = skipSendToOriginalEndpoint;
}
- public boolean isSkipSendToOriginalEndpoint() {
- return skipSendToOriginalEndpoint != null && skipSendToOriginalEndpoint;
- }
-
public String getUri() {
return uri;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java b/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java
index e923550..5a27b76 100644
--- a/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/LoopDefinition.java
@@ -80,11 +80,6 @@ public class LoopDefinition extends ExpressionNode {
this.copy = copy;
}
- public boolean isCopy() {
- // do not copy by default to be backwards compatible
- return copy != null ? copy : false;
- }
-
@Override
public String toString() {
return "Loop[" + getExpression() + " -> " + getOutputs() + "]";
@@ -98,7 +93,8 @@ public class LoopDefinition extends ExpressionNode {
@Override
public Processor createProcessor(RouteContext routeContext) throws Exception {
Processor output = this.createChildProcessor(routeContext, true);
- return new LoopProcessor(output, getExpression().createExpression(routeContext), isCopy());
+ boolean isCopy = getCopy() != null && getCopy();
+ return new LoopProcessor(output, getExpression().createExpression(routeContext), isCopy);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java b/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
index 4eb5fb7..44c2fab 100644
--- a/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/MulticastDefinition.java
@@ -279,20 +279,26 @@ public class MulticastDefinition extends OutputDefinition<MulticastDefinition> i
strategy = new UseLatestAggregationStrategy();
}
- boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing());
- ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "Multicast", this, isParallelProcessing());
+ boolean isParallelProcessing = getParallelProcessing() != null && getParallelProcessing();
+ boolean isShareUnitOfWork = getShareUnitOfWork() != null && getShareUnitOfWork();
+ boolean isStreaming = getStreaming() != null && getStreaming();
+ boolean isStopOnException = getStopOnException() != null && getStopOnException();
+ boolean isParallelAggregate = getParallelAggregate() != null && getParallelAggregate();
+
+ boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing);
+ ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "Multicast", this, isParallelProcessing);
long timeout = getTimeout() != null ? getTimeout() : 0;
- if (timeout > 0 && !isParallelProcessing()) {
+ if (timeout > 0 && !isParallelProcessing) {
throw new IllegalArgumentException("Timeout is used but ParallelProcessing has not been enabled.");
}
if (onPrepareRef != null) {
onPrepare = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), onPrepareRef, Processor.class);
}
- MulticastProcessor answer = new MulticastProcessor(routeContext.getCamelContext(), list, strategy, isParallelProcessing(),
- threadPool, shutdownThreadPool, isStreaming(), isStopOnException(), timeout, onPrepare, isShareUnitOfWork(), isParallelAggregate());
- if (isShareUnitOfWork()) {
+ MulticastProcessor answer = new MulticastProcessor(routeContext.getCamelContext(), list, strategy, isParallelProcessing,
+ threadPool, shutdownThreadPool, isStreaming, isStopOnException, timeout, onPrepare, isShareUnitOfWork, isParallelAggregate);
+ if (isShareUnitOfWork) {
// wrap answer in a sub unit of work, since we share the unit of work
CamelInternalProcessor internalProcessor = new CamelInternalProcessor(answer);
internalProcessor.addAdvice(new CamelInternalProcessor.SubUnitOfWorkProcessorAdvice());
@@ -344,10 +350,6 @@ public class MulticastDefinition extends OutputDefinition<MulticastDefinition> i
this.parallelProcessing = parallelProcessing;
}
- public boolean isParallelProcessing() {
- return parallelProcessing != null && parallelProcessing;
- }
-
public Boolean getStreaming() {
return streaming;
}
@@ -356,10 +358,6 @@ public class MulticastDefinition extends OutputDefinition<MulticastDefinition> i
this.streaming = streaming;
}
- public boolean isStreaming() {
- return streaming != null && streaming;
- }
-
public Boolean getStopOnException() {
return stopOnException;
}
@@ -368,10 +366,6 @@ public class MulticastDefinition extends OutputDefinition<MulticastDefinition> i
this.stopOnException = stopOnException;
}
- public Boolean isStopOnException() {
- return stopOnException != null && stopOnException;
- }
-
public ExecutorService getExecutorService() {
return executorService;
}
@@ -459,24 +453,10 @@ public class MulticastDefinition extends OutputDefinition<MulticastDefinition> i
this.shareUnitOfWork = shareUnitOfWork;
}
- public boolean isShareUnitOfWork() {
- return shareUnitOfWork != null && shareUnitOfWork;
- }
-
public Boolean getParallelAggregate() {
return parallelAggregate;
}
- /**
- * Whether to aggregate using a sequential single thread, or allow parallel aggregation.
- * <p/>
- * Notice that if enabled, then the {@link org.apache.camel.processor.aggregate.AggregationStrategy} in use
- * must be implemented as thread safe, as concurrent threads can call the <tt>aggregate</tt> methods at the same time.
- */
- public boolean isParallelAggregate() {
- return parallelAggregate != null && parallelAggregate;
- }
-
public void setParallelAggregate(Boolean parallelAggregate) {
this.parallelAggregate = parallelAggregate;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java b/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
index 07cd838..8c881a1 100644
--- a/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
@@ -23,7 +23,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -120,7 +119,12 @@ public class OnCompletionDefinition extends ProcessorDefinition<OnCompletionDefi
routeScoped = super.getParent() != null;
}
- if (isOnCompleteOnly() && isOnFailureOnly()) {
+ boolean isOnCompleteOnly = getOnCompleteOnly() != null && getOnCompleteOnly();
+ boolean isOnFailureOnly = getOnFailureOnly() != null && getOnFailureOnly();
+ boolean isParallelProcessing = getParallelProcessing() != null && getParallelProcessing();
+ boolean original = getUseOriginalMessagePolicy() != null && getUseOriginalMessagePolicy();
+
+ if (isOnCompleteOnly && isOnFailureOnly) {
throw new IllegalArgumentException("Both onCompleteOnly and onFailureOnly cannot be true. Only one of them can be true. On node: " + this);
}
@@ -140,16 +144,14 @@ public class OnCompletionDefinition extends ProcessorDefinition<OnCompletionDefi
when = onWhen.getExpression().createPredicate(routeContext);
}
- boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing());
- ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "OnCompletion", this, isParallelProcessing());
+ boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing);
+ ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "OnCompletion", this, isParallelProcessing);
// should be after consumer by default
boolean afterConsumer = mode == null || mode == OnCompletionMode.AfterConsumer;
- // should be false by default
- boolean original = getUseOriginalMessagePolicy() != null ? getUseOriginalMessagePolicy() : false;
OnCompletionProcessor answer = new OnCompletionProcessor(routeContext.getCamelContext(), internal,
- threadPool, shutdownThreadPool, isOnCompleteOnly(), isOnFailureOnly(), when, original, afterConsumer);
+ threadPool, shutdownThreadPool, isOnCompleteOnly, isOnFailureOnly, when, original, afterConsumer);
return answer;
}
@@ -209,7 +211,8 @@ public class OnCompletionDefinition extends ProcessorDefinition<OnCompletionDefi
* @return the builder
*/
public OnCompletionDefinition onCompleteOnly() {
- if (isOnFailureOnly()) {
+ boolean isOnFailureOnly = getOnFailureOnly() != null && getOnFailureOnly();
+ if (isOnFailureOnly) {
throw new IllegalArgumentException("Both onCompleteOnly and onFailureOnly cannot be true. Only one of them can be true. On node: " + this);
}
// must define return type as OutputDefinition and not this type to avoid end user being able
@@ -225,7 +228,8 @@ public class OnCompletionDefinition extends ProcessorDefinition<OnCompletionDefi
* @return the builder
*/
public OnCompletionDefinition onFailureOnly() {
- if (isOnCompleteOnly()) {
+ boolean isOnCompleteOnly = getOnCompleteOnly() != null && getOnCompleteOnly();
+ if (isOnCompleteOnly) {
throw new IllegalArgumentException("Both onCompleteOnly and onFailureOnly cannot be true. Only one of them can be true. On node: " + this);
}
// must define return type as OutputDefinition and not this type to avoid end user being able
@@ -322,10 +326,6 @@ public class OnCompletionDefinition extends ProcessorDefinition<OnCompletionDefi
this.onCompleteOnly = onCompleteOnly;
}
- public boolean isOnCompleteOnly() {
- return onCompleteOnly != null && onCompleteOnly;
- }
-
public Boolean getOnFailureOnly() {
return onFailureOnly;
}
@@ -334,10 +334,6 @@ public class OnCompletionDefinition extends ProcessorDefinition<OnCompletionDefi
this.onFailureOnly = onFailureOnly;
}
- public boolean isOnFailureOnly() {
- return onFailureOnly != null && onFailureOnly;
- }
-
public WhenDefinition getOnWhen() {
return onWhen;
}
@@ -363,7 +359,7 @@ public class OnCompletionDefinition extends ProcessorDefinition<OnCompletionDefi
}
public Boolean getUseOriginalMessagePolicy() {
- return useOriginalMessagePolicy != null;
+ return useOriginalMessagePolicy;
}
/**
@@ -383,9 +379,4 @@ public class OnCompletionDefinition extends ProcessorDefinition<OnCompletionDefi
this.parallelProcessing = parallelProcessing;
}
- public boolean isParallelProcessing() {
- return parallelProcessing != null && parallelProcessing;
- }
-
-
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java b/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
index e304f39..68f9f71 100644
--- a/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
@@ -928,20 +928,16 @@ public class OnExceptionDefinition extends ProcessorDefinition<OnExceptionDefini
this.useOriginalMessagePolicy = useOriginalMessagePolicy;
}
- public boolean isUseOriginalMessage() {
- return useOriginalMessagePolicy != null && useOriginalMessagePolicy;
- }
+ // Implementation methods
+ //-------------------------------------------------------------------------
- public boolean isAsyncDelayedRedelivery(CamelContext context) {
+ protected boolean isAsyncDelayedRedelivery(CamelContext context) {
if (getRedeliveryPolicy() != null) {
return getRedeliveryPolicy().isAsyncDelayedRedelivery(context);
}
return false;
}
- // Implementation methods
- //-------------------------------------------------------------------------
-
protected RedeliveryPolicyDefinition getOrCreateRedeliveryPolicy() {
if (redeliveryPolicyType == null) {
redeliveryPolicyType = new RedeliveryPolicyDefinition();
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java b/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java
index 061788d..ab346d8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java
@@ -160,10 +160,7 @@ public abstract class OptionalIdentifiedDefinition<T extends OptionalIdentifiedD
return getId();
}
- /**
- * Whether the node id was explicit set, or was auto generated by Camel.
- */
- public Boolean isCustomId() {
+ public Boolean getCustomId() {
return customId;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index 63f2053..b94e959 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -289,7 +289,8 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
// do not use error handler for multicast as it offers fine grained error handlers for its outputs
// however if share unit of work is enabled, we need to wrap an error handler on the multicast parent
MulticastDefinition def = (MulticastDefinition) defn;
- if (def.isShareUnitOfWork() && child == null) {
+ boolean isShareUnitOfWork = def.getShareUnitOfWork() != null && def.getShareUnitOfWork();
+ if (isShareUnitOfWork && child == null) {
// only wrap the parent (not the children of the multicast)
wrapChannelInErrorHandler(channel, routeContext);
} else {
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
index e3da36d..0f13e77 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
@@ -109,6 +109,13 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
public Processor createProcessor(RouteContext routeContext) throws Exception {
final Expression expression = getExpression().createExpression(routeContext);
+ boolean isParallelProcessing = getParallelProcessing() != null && getParallelProcessing();
+ boolean isStreaming = getStreaming() != null && getStreaming();
+ boolean isParallelAggregate = getParallelAggregate() != null && getParallelAggregate();
+ boolean isShareUnitOfWork = getShareUnitOfWork() != null && getShareUnitOfWork();
+ boolean isStopOnException = getStopOnException() != null && getStopOnException();
+ boolean isIgnoreInvalidEndpoints = getIgnoreInvalidEndpoints() != null && getIgnoreInvalidEndpoints();
+
RecipientList answer;
if (delimiter != null) {
answer = new RecipientList(routeContext.getCamelContext(), expression, delimiter);
@@ -116,10 +123,12 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
answer = new RecipientList(routeContext.getCamelContext(), expression);
}
answer.setAggregationStrategy(createAggregationStrategy(routeContext));
- answer.setParallelProcessing(isParallelProcessing());
- answer.setParallelAggregate(isParallelAggregate());
- answer.setStreaming(isStreaming());
- answer.setShareUnitOfWork(isShareUnitOfWork());
+ answer.setParallelProcessing(isParallelProcessing);
+ answer.setParallelAggregate(isParallelAggregate);
+ answer.setStreaming(isStreaming);
+ answer.setShareUnitOfWork(isShareUnitOfWork);
+ answer.setStopOnException(isStopOnException);
+ answer.setIgnoreInvalidEndpoints(isIgnoreInvalidEndpoints);
if (getCacheSize() != null) {
answer.setCacheSize(getCacheSize());
}
@@ -129,22 +138,16 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
if (onPrepare != null) {
answer.setOnPrepare(onPrepare);
}
- if (stopOnException != null) {
- answer.setStopOnException(isStopOnException());
- }
- if (ignoreInvalidEndpoints != null) {
- answer.setIgnoreInvalidEndpoints(ignoreInvalidEndpoints);
- }
if (getTimeout() != null) {
answer.setTimeout(getTimeout());
}
- boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing());
- ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "RecipientList", this, isParallelProcessing());
+ boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing);
+ ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "RecipientList", this, isParallelProcessing);
answer.setExecutorService(threadPool);
answer.setShutdownExecutorService(shutdownThreadPool);
long timeout = getTimeout() != null ? getTimeout() : 0;
- if (timeout > 0 && !isParallelProcessing()) {
+ if (timeout > 0 && !isParallelProcessing) {
throw new IllegalArgumentException("Timeout is used but ParallelProcessing has not been enabled.");
}
@@ -433,10 +436,6 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
this.parallelProcessing = parallelProcessing;
}
- public boolean isParallelProcessing() {
- return parallelProcessing != null && parallelProcessing;
- }
-
public String getStrategyRef() {
return strategyRef;
}
@@ -488,10 +487,6 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
this.ignoreInvalidEndpoints = ignoreInvalidEndpoints;
}
- public boolean isIgnoreInvalidEndpoints() {
- return ignoreInvalidEndpoints != null && ignoreInvalidEndpoints;
- }
-
public Boolean getStopOnException() {
return stopOnException;
}
@@ -500,10 +495,6 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
this.stopOnException = stopOnException;
}
- public boolean isStopOnException() {
- return stopOnException != null && stopOnException;
- }
-
public AggregationStrategy getAggregationStrategy() {
return aggregationStrategy;
}
@@ -532,10 +523,6 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
this.streaming = streaming;
}
- public boolean isStreaming() {
- return streaming != null && streaming;
- }
-
public Long getTimeout() {
return timeout;
}
@@ -568,10 +555,6 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
this.shareUnitOfWork = shareUnitOfWork;
}
- public boolean isShareUnitOfWork() {
- return shareUnitOfWork != null && shareUnitOfWork;
- }
-
public Integer getCacheSize() {
return cacheSize;
}
@@ -584,16 +567,6 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
return parallelAggregate;
}
- /**
- * Whether to aggregate using a sequential single thread, or allow parallel aggregation.
- * <p/>
- * Notice that if enabled, then the {@link org.apache.camel.processor.aggregate.AggregationStrategy} in use
- * must be implemented as thread safe, as concurrent threads can call the <tt>aggregate</tt> methods at the same time.
- */
- public boolean isParallelAggregate() {
- return parallelAggregate != null && parallelAggregate;
- }
-
public void setParallelAggregate(Boolean parallelAggregate) {
this.parallelAggregate = parallelAggregate;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
index 9180136..ec3b415 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
@@ -357,8 +357,10 @@ public class ResequenceDefinition extends ProcessorDefinition<ResequenceDefiniti
ObjectHelper.notNull(config, "config", this);
ObjectHelper.notNull(expression, "expression", this);
- Resequencer resequencer = new Resequencer(routeContext.getCamelContext(), internal, expression,
- config.isAllowDuplicates(), config.isReverse());
+ boolean isReverse = config.getReverse() != null && config.getReverse();
+ boolean isAllowDuplicates = config.getAllowDuplicates() != null && config.getAllowDuplicates();
+
+ Resequencer resequencer = new Resequencer(routeContext.getCamelContext(), internal, expression, isAllowDuplicates, isReverse);
resequencer.setBatchSize(config.getBatchSize());
resequencer.setBatchTimeout(config.getBatchTimeout());
if (config.getIgnoreInvalidExchanges() != null) {
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/RollbackDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/RollbackDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RollbackDefinition.java
index b2df9f3..492d9f3 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RollbackDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RollbackDefinition.java
@@ -63,14 +63,17 @@ public class RollbackDefinition extends NoOutputDefinition<RollbackDefinition> {
@Override
public Processor createProcessor(RouteContext routeContext) {
+ boolean isMarkRollbackOnly = getMarkRollbackOnly() != null && getMarkRollbackOnly();
+ boolean isMarkRollbackOnlyLast = getMarkRollbackOnlyLast() != null && getMarkRollbackOnlyLast();
+
// validate that only either mark rollbacks is chosen and not both
- if (isMarkRollbackOnly() && isMarkRollbackOnlyLast()) {
+ if (isMarkRollbackOnly && isMarkRollbackOnlyLast) {
throw new IllegalArgumentException("Only either one of markRollbackOnly and markRollbackOnlyLast is possible to select as true");
}
RollbackProcessor answer = new RollbackProcessor(message);
- answer.setMarkRollbackOnly(isMarkRollbackOnly());
- answer.setMarkRollbackOnlyLast(isMarkRollbackOnlyLast());
+ answer.setMarkRollbackOnly(isMarkRollbackOnly);
+ answer.setMarkRollbackOnlyLast(isMarkRollbackOnlyLast);
return answer;
}
@@ -96,10 +99,6 @@ public class RollbackDefinition extends NoOutputDefinition<RollbackDefinition> {
this.markRollbackOnly = markRollbackOnly;
}
- public boolean isMarkRollbackOnly() {
- return markRollbackOnly != null && markRollbackOnly;
- }
-
public Boolean getMarkRollbackOnlyLast() {
return markRollbackOnlyLast;
}
@@ -113,7 +112,4 @@ public class RollbackDefinition extends NoOutputDefinition<RollbackDefinition> {
this.markRollbackOnlyLast = markRollbackOnlyLast;
}
- public boolean isMarkRollbackOnlyLast() {
- return markRollbackOnlyLast != null && markRollbackOnlyLast;
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java b/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
index e519f1e..70aa71c 100644
--- a/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/SplitDefinition.java
@@ -100,11 +100,16 @@ public class SplitDefinition extends ExpressionNode implements ExecutorServiceAw
Processor childProcessor = this.createChildProcessor(routeContext, true);
aggregationStrategy = createAggregationStrategy(routeContext);
- boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing());
- ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "Split", this, isParallelProcessing());
+
+ boolean isParallelProcessing = getParallelProcessing() != null && getParallelProcessing();
+ boolean isStreaming = getStreaming() != null && getStreaming();
+ boolean isShareUnitOfWork = getShareUnitOfWork() != null && getShareUnitOfWork();
+ boolean isParallelAggregate = getParallelAggregate() != null && getParallelAggregate();
+ boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isParallelProcessing);
+ ExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredExecutorService(routeContext, "Split", this, isParallelProcessing);
long timeout = getTimeout() != null ? getTimeout() : 0;
- if (timeout > 0 && !isParallelProcessing()) {
+ if (timeout > 0 && !isParallelProcessing) {
throw new IllegalArgumentException("Timeout is used but ParallelProcessing has not been enabled.");
}
if (onPrepareRef != null) {
@@ -114,9 +119,9 @@ public class SplitDefinition extends ExpressionNode implements ExecutorServiceAw
Expression exp = getExpression().createExpression(routeContext);
Splitter answer = new Splitter(routeContext.getCamelContext(), exp, childProcessor, aggregationStrategy,
- isParallelProcessing(), threadPool, shutdownThreadPool, isStreaming(), isStopOnException(),
- timeout, onPrepare, isShareUnitOfWork(), isParallelAggregate());
- if (isShareUnitOfWork()) {
+ isParallelProcessing, threadPool, shutdownThreadPool, isStreaming, isStopOnException(),
+ timeout, onPrepare, isShareUnitOfWork, isParallelAggregate);
+ if (isShareUnitOfWork) {
// wrap answer in a sub unit of work, since we share the unit of work
CamelInternalProcessor internalProcessor = new CamelInternalProcessor(answer);
internalProcessor.addAdvice(new CamelInternalProcessor.SubUnitOfWorkProcessorAdvice());
@@ -352,10 +357,6 @@ public class SplitDefinition extends ExpressionNode implements ExecutorServiceAw
this.parallelProcessing = parallelProcessing;
}
- public boolean isParallelProcessing() {
- return parallelProcessing != null && parallelProcessing;
- }
-
public Boolean getStreaming() {
return streaming;
}
@@ -364,18 +365,10 @@ public class SplitDefinition extends ExpressionNode implements ExecutorServiceAw
this.streaming = streaming;
}
- public boolean isStreaming() {
- return streaming != null && streaming;
- }
-
public Boolean getParallelAggregate() {
return parallelAggregate;
}
- public boolean isParallelAggregate() {
- return parallelAggregate != null && parallelAggregate;
- }
-
public void setParallelAggregate(Boolean parallelAggregate) {
this.parallelAggregate = parallelAggregate;
}
@@ -475,7 +468,4 @@ public class SplitDefinition extends ExpressionNode implements ExecutorServiceAw
this.shareUnitOfWork = shareUnitOfWork;
}
- public boolean isShareUnitOfWork() {
- return shareUnitOfWork != null && shareUnitOfWork;
- }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/ThrottleDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ThrottleDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ThrottleDefinition.java
index 05f4d89..c38b5ce 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ThrottleDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ThrottleDefinition.java
@@ -83,8 +83,9 @@ public class ThrottleDefinition extends ExpressionNode implements ExecutorServic
public Processor createProcessor(RouteContext routeContext) throws Exception {
Processor childProcessor = this.createChildProcessor(routeContext, true);
- boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, isAsyncDelayed());
- ScheduledExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredScheduledExecutorService(routeContext, "Throttle", this, isAsyncDelayed());
+ boolean async = getAsyncDelayed() != null && getAsyncDelayed();
+ boolean shutdownThreadPool = ProcessorDefinitionHelper.willCreateNewThreadPool(routeContext, this, async);
+ ScheduledExecutorService threadPool = ProcessorDefinitionHelper.getConfiguredScheduledExecutorService(routeContext, "Throttle", this, async);
// should be default 1000 millis
long period = getTimePeriodMillis() != null ? getTimePeriodMillis() : 1000L;
@@ -95,12 +96,10 @@ public class ThrottleDefinition extends ExpressionNode implements ExecutorServic
throw new IllegalArgumentException("MaxRequestsPerPeriod expression must be provided on " + this);
}
- Throttler answer = new Throttler(routeContext.getCamelContext(), childProcessor, maxRequestsExpression, period, threadPool, shutdownThreadPool, isRejectExecution());
+ boolean reject = getRejectExecution() != null && getRejectExecution();
+ Throttler answer = new Throttler(routeContext.getCamelContext(), childProcessor, maxRequestsExpression, period, threadPool, shutdownThreadPool, reject);
- if (getAsyncDelayed() != null) {
- answer.setAsyncDelayed(getAsyncDelayed());
- }
-
+ answer.setAsyncDelayed(async);
if (getCallerRunsWhenRejected() == null) {
// should be true by default
answer.setCallerRunsWhenRejected(true);
@@ -222,10 +221,6 @@ public class ThrottleDefinition extends ExpressionNode implements ExecutorServic
this.asyncDelayed = asyncDelayed;
}
- public boolean isAsyncDelayed() {
- return asyncDelayed != null && asyncDelayed;
- }
-
public Boolean getCallerRunsWhenRejected() {
return callerRunsWhenRejected;
}
@@ -250,8 +245,8 @@ public class ThrottleDefinition extends ExpressionNode implements ExecutorServic
this.executorServiceRef = executorServiceRef;
}
- public boolean isRejectExecution() {
- return rejectExecution != null ? rejectExecution : false;
+ public Boolean getRejectExecution() {
+ return rejectExecution;
}
public void setRejectExecution(Boolean rejectExecution) {
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/WireTapDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/WireTapDefinition.java b/camel-core/src/main/java/org/apache/camel/model/WireTapDefinition.java
index 90d286f..4ff69c4 100644
--- a/camel-core/src/main/java/org/apache/camel/model/WireTapDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/WireTapDefinition.java
@@ -112,8 +112,11 @@ public class WireTapDefinition<Type extends ProcessorDefinition<Type>> extends N
CamelInternalProcessor internal = new CamelInternalProcessor(target);
internal.addAdvice(new CamelInternalProcessor.UnitOfWorkProcessorAdvice(routeId));
+ // is true bt default
+ boolean isCopy = getCopy() == null || getCopy();
+
WireTapProcessor answer = new WireTapProcessor(endpoint, internal, getPattern(), threadPool, shutdownThreadPool);
- answer.setCopy(isCopy());
+ answer.setCopy(isCopy);
if (newExchangeProcessorRef != null) {
newExchangeProcessor = routeContext.mandatoryLookup(newExchangeProcessorRef, Processor.class);
}
@@ -403,11 +406,6 @@ public class WireTapDefinition<Type extends ProcessorDefinition<Type>> extends N
this.copy = copy;
}
- public boolean isCopy() {
- // should default to true if not configured
- return copy != null ? copy : true;
- }
-
public String getOnPrepareRef() {
return onPrepareRef;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/config/BatchResequencerConfig.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/config/BatchResequencerConfig.java b/camel-core/src/main/java/org/apache/camel/model/config/BatchResequencerConfig.java
index 10526ff..4ad9362 100644
--- a/camel-core/src/main/java/org/apache/camel/model/config/BatchResequencerConfig.java
+++ b/camel-core/src/main/java/org/apache/camel/model/config/BatchResequencerConfig.java
@@ -96,10 +96,6 @@ public class BatchResequencerConfig extends ResequencerConfig {
this.batchTimeout = batchTimeout;
}
- public boolean isAllowDuplicates() {
- return allowDuplicates != null && allowDuplicates;
- }
-
public Boolean getAllowDuplicates() {
return allowDuplicates;
}
@@ -111,10 +107,6 @@ public class BatchResequencerConfig extends ResequencerConfig {
this.allowDuplicates = allowDuplicates;
}
- public boolean isReverse() {
- return reverse != null && reverse;
- }
-
public Boolean getReverse() {
return reverse;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java
index 0460d92..7c049b3 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/CastorDataFormat.java
@@ -38,7 +38,7 @@ import org.apache.camel.spi.Metadata;
public class CastorDataFormat extends DataFormatDefinition {
@XmlAttribute
private String mappingFile;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private Boolean validation;
@XmlAttribute @Metadata(defaultValue = "UTF-8")
private String encoding;
@@ -51,11 +51,6 @@ public class CastorDataFormat extends DataFormatDefinition {
super("castor");
}
- public boolean isValidation() {
- // defaults to true if not configured
- return validation != null ? validation : true;
- }
-
public Boolean getValidation() {
return validation;
}
@@ -120,7 +115,9 @@ public class CastorDataFormat extends DataFormatDefinition {
if (mappingFile != null) {
setProperty(camelContext, dataFormat, "mappingFile", mappingFile);
}
- setProperty(camelContext, dataFormat, "validation", isValidation());
+ // should be true by default
+ boolean isValidation = getValidation() == null || getValidation();
+ setProperty(camelContext, dataFormat, "validation", isValidation);
if (encoding != null) {
setProperty(camelContext, dataFormat, "encoding", encoding);
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
index cd49c99..68999fa 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/XMLSecurityDataFormat.java
@@ -257,7 +257,8 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements Names
setProperty(camelContext, dataFormat, "secureTag", "");
}
- setProperty(camelContext, dataFormat, "secureTagContents", isSecureTagContents());
+ boolean isSecureTagContents = getSecureTagContents() != null && getSecureTagContents();
+ setProperty(camelContext, dataFormat, "secureTagContents", isSecureTagContents);
if (passPhrase != null) {
setProperty(camelContext, dataFormat, "passPhrase", getPassPhrase().getBytes());
@@ -293,9 +294,9 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements Names
if (mgfAlgorithm != null) {
setProperty(camelContext, dataFormat, "mgfAlgorithm", this.getMgfAlgorithm());
}
- if (addKeyValueForEncryptedKey != null) {
- setProperty(camelContext, dataFormat, "addKeyValueForEncryptedKey", isAddKeyValueForEncryptedKey());
- }
+ // should be true by default
+ boolean isAddKeyValueForEncryptedKey = getAddKeyValueForEncryptedKey() == null || getAddKeyValueForEncryptedKey();
+ setProperty(camelContext, dataFormat, "addKeyValueForEncryptedKey", isAddKeyValueForEncryptedKey);
}
public String getXmlCipherAlgorithm() {
@@ -361,10 +362,6 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements Names
this.secureTagContents = secureTagContents;
}
- public boolean isSecureTagContents() {
- return secureTagContents != null && secureTagContents;
- }
-
/**
* The cipher algorithm to be used for encryption/decryption of the asymmetric key. The available choices are:
* <ul>
@@ -405,6 +402,10 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements Names
return this.keyOrTrustStoreParametersId;
}
+ public KeyStoreParameters getKeyOrTrustStoreParameters() {
+ return keyOrTrustStoreParameters;
+ }
+
/**
* Configuration options for creating and loading a KeyStore instance that represents the sender's trustStore or recipient's keyStore.
*/
@@ -456,16 +457,15 @@ public class XMLSecurityDataFormat extends DataFormatDefinition implements Names
public void setMgfAlgorithm(String mgfAlgorithm) {
this.mgfAlgorithm = mgfAlgorithm;
}
-
- public boolean isAddKeyValueForEncryptedKey() {
- // The default value is true
- return addKeyValueForEncryptedKey != null ? addKeyValueForEncryptedKey : true;
+
+ public Boolean getAddKeyValueForEncryptedKey() {
+ return addKeyValueForEncryptedKey;
}
/**
* Whether to add the public key used to encrypt the session key as a KeyValue in the EncryptedKey structure or not.
*/
- public void setAddKeyValueForEncryptedKey(boolean addKeyValueForEncryptedKey) {
+ public void setAddKeyValueForEncryptedKey(Boolean addKeyValueForEncryptedKey) {
this.addKeyValueForEncryptedKey = addKeyValueForEncryptedKey;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java b/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
index 815509f..904697d 100644
--- a/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
@@ -35,6 +35,7 @@ import org.apache.camel.Expression;
import org.apache.camel.Predicate;
import org.apache.camel.spi.Label;
import org.apache.camel.spi.Language;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.Required;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.util.CollectionStringBuffer;
@@ -58,7 +59,7 @@ public class ExpressionDefinition implements Expression, Predicate {
private String id;
@XmlValue
private String expression;
- @XmlAttribute
+ @XmlAttribute @Metadata(defaultValue = "true")
private Boolean trim;
@XmlTransient
private Predicate predicate;
@@ -155,8 +156,10 @@ public class ExpressionDefinition implements Expression, Predicate {
ObjectHelper.notNull("language", getLanguage());
Language language = camelContext.resolveLanguage(getLanguage());
String exp = getExpression();
+ // should be true by default
+ boolean isTrim = getTrim() == null || getTrim();
// trim if configured to trim
- if (exp != null && isTrim()) {
+ if (exp != null && isTrim) {
exp = exp.trim();
}
predicate = language.createPredicate(exp);
@@ -178,8 +181,10 @@ public class ExpressionDefinition implements Expression, Predicate {
ObjectHelper.notNull("language", getLanguage());
Language language = camelContext.resolveLanguage(getLanguage());
String exp = getExpression();
+ // should be true by default
+ boolean isTrim = getTrim() == null || getTrim();
// trim if configured to trim
- if (exp != null && isTrim()) {
+ if (exp != null && isTrim) {
exp = exp.trim();
}
setExpressionValue(language.createExpression(exp));
@@ -236,11 +241,6 @@ public class ExpressionDefinition implements Expression, Predicate {
this.trim = trim;
}
- public boolean isTrim() {
- // trim by default
- return trim == null || trim;
- }
-
/**
* Returns some descriptive text to describe this node
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/language/JsonPathExpression.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/language/JsonPathExpression.java b/camel-core/src/main/java/org/apache/camel/model/language/JsonPathExpression.java
index badd6db..51855ab 100644
--- a/camel-core/src/main/java/org/apache/camel/model/language/JsonPathExpression.java
+++ b/camel-core/src/main/java/org/apache/camel/model/language/JsonPathExpression.java
@@ -40,7 +40,6 @@ public class JsonPathExpression extends ExpressionDefinition {
@XmlAttribute(name = "resultType")
private String resultTypeName;
-
@XmlTransient
private Class<?> resultType;
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java b/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java
index 3348288..3d684f4 100644
--- a/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java
+++ b/camel-core/src/main/java/org/apache/camel/model/language/SimpleExpression.java
@@ -91,7 +91,9 @@ public class SimpleExpression extends ExpressionDefinition {
}
String exp = getExpression();
- if (isTrim() && exp != null) {
+ // should be true by default
+ boolean isTrim = getTrim() == null || getTrim();
+ if (exp != null && isTrim) {
exp = exp.trim();
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java b/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
index 5d07f04..25fcd93 100644
--- a/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
+++ b/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
@@ -136,10 +136,6 @@ public class XPathExpression extends NamespaceAwareExpression {
return saxon;
}
- public boolean isSaxon() {
- return saxon != null && saxon;
- }
-
/**
* References to a custom XPathFactory to lookup in the registry
*/
@@ -173,10 +169,6 @@ public class XPathExpression extends NamespaceAwareExpression {
return logNamespaces;
}
- public boolean isLogNamespaces() {
- return logNamespaces != null && logNamespaces;
- }
-
public String getHeaderName() {
return headerName;
}
@@ -216,13 +208,16 @@ public class XPathExpression extends NamespaceAwareExpression {
@Override
protected void configureExpression(CamelContext camelContext, Expression expression) {
+ boolean isSaxon = getSaxon() != null && getSaxon();
+ boolean isLogNamespaces = getLogNamespaces() != null && getLogNamespaces();
+
if (documentType != null) {
setProperty(expression, "documentType", documentType);
}
if (resultType != null) {
setProperty(expression, "resultType", resultType);
}
- if (isSaxon()) {
+ if (isSaxon) {
ObjectHelper.cast(XPathBuilder.class, expression).enableSaxon();
}
if (xpathFactory != null) {
@@ -231,7 +226,7 @@ public class XPathExpression extends NamespaceAwareExpression {
if (objectModel != null) {
setProperty(expression, "objectModelUri", objectModel);
}
- if (isLogNamespaces()) {
+ if (isLogNamespaces) {
ObjectHelper.cast(XPathBuilder.class, expression).setLogNamespaces(true);
}
if (ObjectHelper.isNotEmpty(getHeaderName())) {
@@ -244,13 +239,16 @@ public class XPathExpression extends NamespaceAwareExpression {
@Override
protected void configurePredicate(CamelContext camelContext, Predicate predicate) {
+ boolean isSaxon = getSaxon() != null && getSaxon();
+ boolean isLogNamespaces = getLogNamespaces() != null && getLogNamespaces();
+
if (documentType != null) {
setProperty(predicate, "documentType", documentType);
}
if (resultType != null) {
setProperty(predicate, "resultType", resultType);
}
- if (isSaxon()) {
+ if (isSaxon) {
ObjectHelper.cast(XPathBuilder.class, predicate).enableSaxon();
}
if (xpathFactory != null) {
@@ -259,7 +257,7 @@ public class XPathExpression extends NamespaceAwareExpression {
if (objectModel != null) {
setProperty(predicate, "objectModelUri", objectModel);
}
- if (isLogNamespaces()) {
+ if (isLogNamespaces) {
ObjectHelper.cast(XPathBuilder.class, predicate).setLogNamespaces(true);
}
if (ObjectHelper.isNotEmpty(getHeaderName())) {
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java
index f0fd211..e4c8311 100644
--- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/FailoverLoadBalancerDefinition.java
@@ -94,10 +94,6 @@ public class FailoverLoadBalancerDefinition extends LoadBalancerDefinition {
this.exceptions = exceptions;
}
- public boolean isRoundRobin() {
- return roundRobin != null && roundRobin;
- }
-
public Boolean getRoundRobin() {
return roundRobin;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java
index 60b45c8..959b5e8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/loadbalancer/WeightedLoadBalancerDefinition.java
@@ -68,11 +68,12 @@ public class WeightedLoadBalancerDefinition extends LoadBalancerDefinition {
for (String ratio : ratios) {
distributionRatioList.add(new Integer(ratio.trim()));
}
-
- if (!isRoundRobin()) {
- loadBalancer = new WeightedRandomLoadBalancer(distributionRatioList);
- } else {
+
+ boolean isRoundRobin = getRoundRobin() != null && getRoundRobin();
+ if (isRoundRobin) {
loadBalancer = new WeightedRoundRobinLoadBalancer(distributionRatioList);
+ } else {
+ loadBalancer = new WeightedRandomLoadBalancer(distributionRatioList);
}
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
@@ -94,10 +95,6 @@ public class WeightedLoadBalancerDefinition extends LoadBalancerDefinition {
this.roundRobin = roundRobin;
}
- public boolean isRoundRobin() {
- return roundRobin != null && roundRobin;
- }
-
public String getDistributionRatio() {
return distributionRatio;
}
@@ -125,10 +122,11 @@ public class WeightedLoadBalancerDefinition extends LoadBalancerDefinition {
@Override
public String toString() {
- if (!isRoundRobin()) {
- return "WeightedRandomLoadBalancer[" + distributionRatio + "]";
- } else {
+ boolean isRoundRobin = getRoundRobin() != null && getRoundRobin();
+ if (isRoundRobin) {
return "WeightedRoundRobinLoadBalancer[" + distributionRatio + "]";
+ } else {
+ return "WeightedRandomLoadBalancer[" + distributionRatio + "]";
}
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java
index 254ad5b..593a50f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestPropertyDefinition.java
@@ -32,10 +32,10 @@ import org.apache.camel.spi.Label;
public class RestPropertyDefinition {
@XmlAttribute(required = true)
- String key;
+ private String key;
@XmlAttribute(required = true)
- String value;
+ private String value;
/**
* Property key
http://git-wip-us.apache.org/repos/asf/camel/blob/76e9aab4/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
index fd39cf1..da63f3c 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
@@ -767,7 +767,7 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport impleme
data.handledPredicate = exceptionPolicy.getHandledPolicy();
data.continuedPredicate = exceptionPolicy.getContinuedPolicy();
data.retryWhilePredicate = exceptionPolicy.getRetryWhilePolicy();
- data.useOriginalInMessage = exceptionPolicy.isUseOriginalMessage();
+ data.useOriginalInMessage = exceptionPolicy.getUseOriginalMessagePolicy() != null && exceptionPolicy.getUseOriginalMessagePolicy();
// route specific failure handler?
Processor processor = null;