Author: davsclaus
Date: Mon Nov 24 11:28:11 2008
New Revision: 720269
URL: http://svn.apache.org/viewvc?rev=720269&view=rev
Log:
CAMEL-1087: Added javadoc for fluent builders
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitterType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/TryType.java
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/GenerateXmlTest.java
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/AggregatorType.java
Mon Nov 24 11:28:11 2008
@@ -37,7 +37,6 @@
import org.apache.camel.builder.ExpressionClause;
import org.apache.camel.model.language.ExpressionType;
import org.apache.camel.processor.Aggregator;
-import org.apache.camel.processor.FilterProcessor;
import org.apache.camel.processor.aggregate.AggregationCollection;
import org.apache.camel.processor.aggregate.AggregationStrategy;
import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
@@ -280,31 +279,68 @@
// Fluent API
//-------------------------------------------------------------------------
+
+ /**
+ * Sets the in batch size for number of exchanges recieved
+ *
+ * @param batchSize the batch size
+ * @return builder
+ */
public AggregatorType batchSize(int batchSize) {
setBatchSize(batchSize);
return this;
}
+ /**
+ * Sets the out batch size for number of exchanges sent
+ *
+ * @param batchSize the batch size
+ * @return builder
+ */
public AggregatorType outBatchSize(int batchSize) {
setOutBatchSize(batchSize);
return this;
}
+ /**
+ * Sets the batch timeout
+ *
+ * @param batchTimeout the timeout in millis
+ * @return the builder
+ */
public AggregatorType batchTimeout(long batchTimeout) {
setBatchTimeout(batchTimeout);
return this;
}
+ /**
+ * Sets the aggregate collection to use
+ *
+ * @param aggregationCollection the aggregate collection to use
+ * @return the builder
+ */
public AggregatorType aggregationCollection(AggregationCollection
aggregationCollection) {
setAggregationCollection(aggregationCollection);
return this;
}
+ /**
+ * Sets the aggegate strategy to use
+ *
+ * @param aggregationStrategy the aggreage startegy to use
+ * @return the builder
+ */
public AggregatorType aggregationStrategy(AggregationStrategy
aggregationStrategy) {
setAggregationStrategy(aggregationStrategy);
return this;
}
+ /**
+ * Sets the aggegate strategy to use
+ *
+ * @param strategyRef reference to the strategy to lookup in the registry
+ * @return the builder
+ */
public AggregatorType strategyRef(String strategyRef) {
setStrategyRef(strategyRef);
return this;
@@ -324,6 +360,8 @@
/**
* Sets the predicate used to determine if the aggregation is completed
+ *
+ * @param predicate the predicate
*/
public AggregatorType completedPredicate(Predicate predicate) {
checkNoCompletedPredicate();
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java
Mon Nov 24 11:28:11 2008
@@ -44,7 +44,6 @@
@XmlRootElement(name = "choice")
@XmlAccessorType(XmlAccessType.FIELD)
public class ChoiceType extends ProcessorType<ChoiceType> {
-
private static final transient Log LOG =
LogFactory.getLog(ChoiceType.class);
@XmlElementRef
@@ -76,18 +75,29 @@
if (otherwise != null) {
otherwiseProcessor = otherwise.createProcessor(routeContext);
} else {
- LOG.warn("No otherwise clause was specified for a choice block --
any unmatched exchanges will be dropped");
+ LOG.warn("No otherwise clause was specified for a choice block,
any unmatched exchanges will be dropped");
}
return new ChoiceProcessor(filters, otherwiseProcessor);
}
// Fluent API
//
-------------------------------------------------------------------------
+ /**
+ * Sets the predicate for the when node
+ *
+ * @param predicate the predicate
+ * @return the builder
+ */
public ChoiceType when(Predicate predicate) {
getWhenClauses().add(new WhenType(predicate));
return this;
}
+ /**
+ * Creates an expression for the when node
+ *
+ * @return expression to be used as builder to configure the when node
+ */
public ExpressionClause<ChoiceType> when() {
WhenType when = new WhenType();
getWhenClauses().add(when);
@@ -96,6 +106,11 @@
return clause;
}
+ /**
+ * Sets the otherwise node
+ *
+ * @return the builder
+ */
public ChoiceType otherwise() {
OtherwiseType answer = new OtherwiseType();
setOtherwise(answer);
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ExceptionType.java
Mon Nov 24 11:28:11 2008
@@ -130,26 +130,62 @@
// Fluent API
//-------------------------------------------------------------------------
+ /**
+ * Sets wether the exchange should be marked as handled or not.
+ *
+ * @param handled handled or not
+ * @return the builder
+ */
public ExceptionType handled(boolean handled) {
ConstantLanguage constant = new ConstantLanguage();
return handled(constant.createPredicate(Boolean.toString(handled)));
}
+ /**
+ * Sets wether the exchange should be marked as handled or not.
+ *
+ * @param handled predicate that determines true or false
+ * @return the builder
+ */
public ExceptionType handled(Predicate handled) {
setHandledPolicy(handled);
return this;
}
+ /**
+ * Sets wether the exchange should be marked as handled or not.
+ *
+ * @param handled expression that determines true or false
+ * @return the builder
+ */
public ExceptionType handled(Expression handled) {
setHandledPolicy(toPredicate(handled));
return this;
}
+ /**
+ * Sets an additional predicate that should be true before the onException
is triggered.
+ * <p/>
+ * To be used for fine grained controlling wether a thrown exception
should be intercepted
+ * by this exception type or not.
+ *
+ * @param predicate predicate that determines true or false
+ * @return the builder
+ */
public ExceptionType onWhen(Predicate predicate) {
setOnWhen(new WhenType(predicate));
return this;
}
+ /**
+ * Creates an expression to configure an additional predicate that should
be true before the
+ * onException is triggered.
+ * <p/>
+ * To be used for fine grained controlling wether a thrown exception
should be intercepted
+ * by this exception type or not.
+ *
+ * @return the expression clause to configure
+ */
public ExpressionClause<ExceptionType> onWhen() {
onWhen = new WhenType();
ExpressionClause<ExceptionType> clause = new
ExpressionClause<ExceptionType>(this);
@@ -157,51 +193,114 @@
return clause;
}
+ /**
+ * Sets the back off multiplier
+ *
+ * @param backOffMultiplier the back off multiplier
+ * @return the builder
+ */
public ExceptionType backOffMultiplier(double backOffMultiplier) {
getOrCreateRedeliveryPolicy().backOffMultiplier(backOffMultiplier);
return this;
}
+ /**
+ * Sets the collision avoidance factor
+ *
+ * @param collisionAvoidanceFactor the factor
+ * @return the builder
+ */
public ExceptionType collisionAvoidanceFactor(double
collisionAvoidanceFactor) {
getOrCreateRedeliveryPolicy().collisionAvoidanceFactor(collisionAvoidanceFactor);
return this;
}
+ /**
+ * Sets the collision avoidance percentage
+ *
+ * @param collisionAvoidancePercent the percentage
+ * @return the builder
+ */
public ExceptionType collisionAvoidancePercent(short
collisionAvoidancePercent) {
getOrCreateRedeliveryPolicy().collisionAvoidancePercent(collisionAvoidancePercent);
return this;
}
+ /**
+ * Sets the fixed delay between redeliveries
+ *
+ * @param delay delay in millis
+ * @return the builder
+ */
public ExceptionType delay(long delay) {
getOrCreateRedeliveryPolicy().delay(delay);
return this;
}
-
+
+ /**
+ * Sets the logging level to use when retries has exhausted
+ *
+ * @param retriesExhaustedLogLevel the logging level
+ * @return the builder
+ */
public ExceptionType retriesExhaustedLogLevel(LoggingLevel
retriesExhaustedLogLevel) {
getOrCreateRedeliveryPolicy().retriesExhaustedLogLevel(retriesExhaustedLogLevel);
return this;
}
+ /**
+ * Sets the logging level to use for logging retry attempts
+ *
+ * @param retryAttemptedLogLevel the logging level
+ * @return the builder
+ */
public ExceptionType retryAttemptedLogLevel(LoggingLevel
retryAttemptedLogLevel) {
getOrCreateRedeliveryPolicy().retryAttemptedLogLevel(retryAttemptedLogLevel);
return this;
}
-
+
+ /**
+ * Sets the maximum redeliveries
+ * <ul>
+ * <li>5 = default value</li>
+ * <li>0 = no redeliveries</li>
+ * <li>-1 = redeliver forever</li>
+ * </ul>
+ *
+ * @param maximumRedeliveries the value
+ * @return the builder
+ */
public ExceptionType maximumRedeliveries(int maximumRedeliveries) {
getOrCreateRedeliveryPolicy().maximumRedeliveries(maximumRedeliveries);
return this;
}
+ /**
+ * Turn on collision avoidance.
+ *
+ * @return the builder
+ */
public ExceptionType useCollisionAvoidance() {
getOrCreateRedeliveryPolicy().useCollisionAvoidance();
return this;
}
+ /**
+ * Turn on exponential backk off
+ *
+ * @return the builder
+ */
public ExceptionType useExponentialBackOff() {
getOrCreateRedeliveryPolicy().useExponentialBackOff();
return this;
}
+ /**
+ * Sets the maximum delay between redelivery
+ *
+ * @param maximumRedeliveryDelay the delay in millis
+ * @return the builder
+ */
public ExceptionType maximumRedeliveryDelay(long maximumRedeliveryDelay) {
getOrCreateRedeliveryPolicy().maximumRedeliveryDelay(maximumRedeliveryDelay);
return this;
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptType.java
Mon Nov 24 11:28:11 2008
@@ -16,8 +16,6 @@
*/
package org.apache.camel.model;
-import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@@ -26,7 +24,6 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
-import org.apache.camel.Intercept;
import org.apache.camel.Predicate;
import org.apache.camel.Processor;
import org.apache.camel.builder.PredicateBuilder;
@@ -78,6 +75,9 @@
/**
* Applies this interceptor only if the given predicate is true
+ *
+ * @param predicate the predicate
+ * @return the builder
*/
public ChoiceType when(Predicate predicate) {
usePredicate = Boolean.TRUE;
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LoadBalanceType.java
Mon Nov 24 11:28:11 2008
@@ -28,7 +28,6 @@
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Processor;
import org.apache.camel.model.loadbalancer.LoadBalancerType;
@@ -136,26 +135,52 @@
// Fluent API
//
-------------------------------------------------------------------------
+ /**
+ * Sets the load balancer to use
+ *
+ * @param loadBalancer the load balancer
+ * @return the builder
+ */
public LoadBalanceType setLoadBalancer(LoadBalancer loadBalancer) {
loadBalancerType = new LoadBalancerType(loadBalancer);
return this;
}
+ /**
+ * Uses round robin load balancer
+ *
+ * @return the builder
+ */
public LoadBalanceType roundRobin() {
loadBalancerType = new LoadBalancerType(new RoundRobinLoadBalancer());
return this;
}
+ /**
+ * Uses random load balancer
+ * @return the builder
+ */
public LoadBalanceType random() {
loadBalancerType = new LoadBalancerType(new RandomLoadBalancer());
return this;
}
+ /**
+ * Uses sticky load balancer
+ *
+ * @param correlationExpression the expression for correlation
+ * @return the builder
+ */
public LoadBalanceType sticky(Expression correlationExpression) {
loadBalancerType = new LoadBalancerType(new
StickyLoadBalancer(correlationExpression));
return this;
}
+ /**
+ * Uses topic load balancer
+ *
+ * @return the builder
+ */
public LoadBalanceType topic() {
loadBalancerType = new LoadBalancerType(new TopicLoadBalancer());
return this;
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedType.java
Mon Nov 24 11:28:11 2008
@@ -81,22 +81,31 @@
// Fluent API
//
-------------------------------------------------------------------------
- public T description(String text) {
- if (description == null) {
- description = new Description();
- }
- description.setText(text);
- return (T) this;
- }
-
- public T description(String text, String lang) {
- description(text);
- description.setLang(lang);
- return (T) this;
- }
- public T id(String id) {
- setId(id);
+ /**
+ * Sets the description of this node
+ *
+ * @param id sets the id, use null to not set an id
+ * @param text sets the text description, use null to not set a text
+ * @param lang sets the language for the description, use null to not set
a language
+ * @return the builder
+ */
+ public T description(String id, String text, String lang) {
+ if (id != null) {
+ setId(id);
+ }
+ if (text != null) {
+ if (description == null) {
+ description = new Description();
+ }
+ description.setText(text);
+ }
+ if (lang != null) {
+ if (description == null) {
+ description = new Description();
+ }
+ description.setLang(lang);
+ }
return (T) this;
}
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
Mon Nov 24 11:28:11 2008
@@ -1246,12 +1246,27 @@
return answer.when(predicate);
}
+ /**
+ * Creates a policy.
+ * <p/>
+ * Policy can be used for transactional policies.
+ *
+ * @return the policy builder to configure
+ */
public PolicyRef policies() {
PolicyRef answer = new PolicyRef();
addOutput(answer);
return answer;
}
+ /**
+ * Apply a [EMAIL PROTECTED] Policy}.
+ * <p/>
+ * Policy can be used for transactional policies.
+ *
+ * @param policy the policy to apply
+ * @return the policy builder to configure
+ */
public PolicyRef policy(Policy policy) {
PolicyRef answer = new PolicyRef(policy);
addOutput(answer);
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RedeliveryPolicyType.java
Mon Nov 24 11:28:11 2008
@@ -99,56 +99,125 @@
// Fluent API
//-------------------------------------------------------------------------
+ /**
+ * Sets the back off multiplier
+ *
+ * @param backOffMultiplier the back off multiplier
+ * @return the builder
+ */
public RedeliveryPolicyType backOffMultiplier(double backOffMultiplier) {
setBackOffMultiplier(backOffMultiplier);
return this;
}
+ /**
+ * Sets the collision avoidance percentage
+ *
+ * @param collisionAvoidancePercent the percentage
+ * @return the builder
+ */
public RedeliveryPolicyType collisionAvoidancePercent(double
collisionAvoidancePercent) {
setCollisionAvoidanceFactor(collisionAvoidancePercent * 0.01d);
return this;
}
+ /**
+ * Sets the collision avoidance factor
+ *
+ * @param collisionAvoidanceFactor the factor
+ * @return the builder
+ */
public RedeliveryPolicyType collisionAvoidanceFactor(double
collisionAvoidanceFactor) {
setCollisionAvoidanceFactor(collisionAvoidanceFactor);
return this;
}
+ /**
+ * Sets the fixed delay between redeliveries
+ *
+ * @param delay delay in millis
+ * @return the builder
+ */
public RedeliveryPolicyType delay(long delay) {
setDelay(delay);
return this;
}
+ /**
+ * Sets the logging level to use when retries has exhausted
+ *
+ * @param retriesExhaustedLogLevel the logging level
+ * @return the builder
+ */
public RedeliveryPolicyType retriesExhaustedLogLevel(LoggingLevel
retriesExhaustedLogLevel) {
setRetriesExhaustedLogLevel(retriesExhaustedLogLevel);
return this;
}
+ /**
+ * Sets the logging level to use for logging retry attempts
+ *
+ * @param retryAttemptedLogLevel the logging level
+ * @return the builder
+ */
public RedeliveryPolicyType retryAttemptedLogLevel(LoggingLevel
retryAttemptedLogLevel) {
setRetryAttemptedLogLevel(retryAttemptedLogLevel);
return this;
}
+ /**
+ * Sets the maximum redeliveries
+ * <ul>
+ * <li>5 = default value</li>
+ * <li>0 = no redeliveries</li>
+ * <li>-1 = redeliver forever</li>
+ * </ul>
+ *
+ * @param maximumRedeliveries the value
+ * @return the builder
+ */
public RedeliveryPolicyType maximumRedeliveries(int maximumRedeliveries) {
setMaximumRedeliveries(maximumRedeliveries);
return this;
}
+ /**
+ * Turn on collision avoidance.
+ *
+ * @return the builder
+ */
public RedeliveryPolicyType useCollisionAvoidance() {
setUseCollisionAvoidance(Boolean.TRUE);
return this;
}
+ /**
+ * Turn on exponential backk off
+ *
+ * @return the builder
+ */
public RedeliveryPolicyType useExponentialBackOff() {
setUseExponentialBackOff(Boolean.TRUE);
return this;
}
+ /**
+ * Sets the maximum delay between redelivery
+ *
+ * @param maximumRedeliveryDelay the delay in millis
+ * @return the builder
+ */
public RedeliveryPolicyType maximumRedeliveryDelay(long
maximumRedeliveryDelay) {
setMaximumRedeliveryDelay(maximumRedeliveryDelay);
return this;
}
+ /**
+ * Use redelivery policy looked up in the registry
+ *
+ * @param ref reference to the redelivery policy to lookup and use
+ * @return the builder
+ */
public RedeliveryPolicyType ref(String ref) {
setRef(ref);
return this;
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java
Mon Nov 24 11:28:11 2008
@@ -17,7 +17,6 @@
package org.apache.camel.model;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@@ -73,7 +72,7 @@
* Configures the stream-based resequencing algorithm using the default
* configuration.
*
- * @return <code>this</code> instance.
+ * @return the builder
*/
public ResequencerType stream() {
return stream(StreamResequencerConfig.getDefault());
@@ -83,7 +82,7 @@
* Configures the batch-based resequencing algorithm using the default
* configuration.
*
- * @return <code>this</code> instance.
+ * @return the builder
*/
public ResequencerType batch() {
return batch(BatchResequencerConfig.getDefault());
@@ -93,7 +92,8 @@
* Configures the stream-based resequencing algorithm using the given
* [EMAIL PROTECTED] StreamResequencerConfig}.
*
- * @return <code>this</code> instance.
+ * @param config the config
+ * @return the builder
*/
public ResequencerType stream(StreamResequencerConfig config) {
this.streamConfig = config;
@@ -105,7 +105,8 @@
* Configures the batch-based resequencing algorithm using the given
* [EMAIL PROTECTED] BatchResequencerConfig}.
*
- * @return <code>this</code> instance.
+ * @param config the config
+ * @return the builder
*/
public ResequencerType batch(BatchResequencerConfig config) {
this.batchConfig = config;
@@ -113,11 +114,73 @@
return this;
}
+ /**
+ * Sets the expression to use for reordering
+ *
+ * @param expression the expression
+ * @return the builder
+ */
public ResequencerType expression(ExpressionType expression) {
expressions.add(expression);
return this;
}
+ /**
+ * Sets the timeout
+ * @param timeout timeout in millis
+ * @return the builder
+ */
+ public ResequencerType timeout(long timeout) {
+ if (batchConfig != null) {
+ batchConfig.setBatchTimeout(timeout);
+ } else {
+ streamConfig.setTimeout(timeout);
+ }
+ return this;
+ }
+
+ /**
+ * Sets the in batch size for number of exchanges received
+ * @param batchSize the batch size
+ * @return the builder
+ */
+ public ResequencerType size(int batchSize) {
+ if (batchConfig == null) {
+ throw new IllegalStateException("size() only supported for batch
resequencer");
+ }
+ batchConfig.setBatchSize(batchSize);
+ return this;
+ }
+
+ /**
+ * Sets the capacity for the stream resequencer
+ *
+ * @param capacity the capacity
+ * @return the builder
+ */
+ public ResequencerType capacity(int capacity) {
+ if (streamConfig == null) {
+ throw new IllegalStateException("capacity() only supported for
stream resequencer");
+ }
+ streamConfig.setCapacity(capacity);
+ return this;
+
+ }
+
+ /**
+ * Sets the comparator to use for stream resequencer
+ *
+ * @param comparator the comparator
+ * @return the builder
+ */
+ public ResequencerType comparator(ExpressionResultComparator comparator) {
+ if (streamConfig == null) {
+ throw new IllegalStateException("comparator() only supported for
stream resequencer");
+ }
+ streamConfig.setComparator(comparator);
+ return this;
+ }
+
@Override
public String toString() {
return "Resequencer[" + getExpressions() + " -> " + getOutputs() + "]";
@@ -163,42 +226,7 @@
// TODO: find out how to have these two within an <xsd:choice>
stream(streamConfig);
}
-
- public ResequencerType timeout(long timeout) {
- if (batchConfig != null) {
- batchConfig.setBatchTimeout(timeout);
- } else {
- streamConfig.setTimeout(timeout);
- }
- return this;
- }
-
- public ResequencerType size(int batchSize) {
- if (batchConfig == null) {
- throw new IllegalStateException("size() only supported for batch
resequencer");
- }
- batchConfig.setBatchSize(batchSize);
- return this;
- }
- public ResequencerType capacity(int capacity) {
- if (streamConfig == null) {
- throw new IllegalStateException("capacity() only supported for
stream resequencer");
- }
- streamConfig.setCapacity(capacity);
- return this;
-
- }
-
- public ResequencerType comparator(ExpressionResultComparator comparator) {
- if (streamConfig == null) {
- throw new IllegalStateException("comparator() only supported for
stream resequencer");
- }
- streamConfig.setComparator(comparator);
- return this;
-
- }
-
@Override
public Processor createProcessor(RouteContext routeContext) throws
Exception {
if (batchConfig != null) {
@@ -252,8 +280,9 @@
return resequencer;
}
-
+
private Route<? extends Exchange> createBatchResequencerRoute(RouteContext
routeContext) throws Exception {
+ // TODO: No used should it be removed?
final Resequencer resequencer = createBatchResequencer(routeContext,
batchConfig);
return new Route(routeContext.getEndpoint(), resequencer) {
@Override
@@ -264,6 +293,7 @@
}
private Route<? extends Exchange>
createStreamResequencerRoute(RouteContext routeContext) throws Exception {
+ // TODO: No used should it be removed?
final StreamResequencer resequencer =
createStreamResequencer(routeContext, streamConfig);
return new Route(routeContext.getEndpoint(), resequencer) {
@Override
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java
Mon Nov 24 11:28:11 2008
@@ -34,7 +34,6 @@
import org.apache.camel.NoSuchEndpointException;
import org.apache.camel.Route;
import org.apache.camel.builder.ErrorHandlerBuilder;
-import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.DefaultRouteContext;
import org.apache.camel.processor.interceptor.StreamCachingInterceptor;
import org.apache.camel.spi.RouteContext;
@@ -102,6 +101,9 @@
/**
* Creates an input to the route
+ *
+ * @param uri the from uri
+ * @return the builder
*/
public RouteType from(String uri) {
getInputs().add(new FromType(uri));
@@ -110,6 +112,9 @@
/**
* Creates an input to the route
+ *
+ * @param endpoint the from endpoint
+ * @return the builder
*/
public RouteType from(Endpoint endpoint) {
getInputs().add(new FromType(endpoint));
@@ -118,12 +123,35 @@
/**
* Set the group name for this route
+ *
+ * @param name the group name
+ * @return the builder
*/
public RouteType group(String name) {
setGroup(name);
return this;
}
+ /**
+ * Disable stream caching for this route
+ *
+ * @return the builder
+ */
+ public RouteType noStreamCaching() {
+ StreamCachingInterceptor.noStreamCaching(interceptors);
+ return this;
+ }
+
+ /**
+ * Enable stream caching for this route
+ *
+ * @return the builder
+ */
+ public RouteType streamCaching() {
+ addInterceptor(new StreamCachingInterceptor());
+ return this;
+ }
+
// Properties
// -----------------------------------------------------------------------
@@ -243,22 +271,6 @@
*/
}
- /**
- * Disable stream caching for this Route.
- */
- public RouteType noStreamCaching() {
- StreamCachingInterceptor.noStreamCaching(interceptors);
- return this;
- }
-
- /**
- * Enable stream caching for this Route.
- */
- public RouteType streamCaching() {
- addInterceptor(new StreamCachingInterceptor());
- return this;
- }
-
@Override
public void addInterceptor(InterceptorType interceptor) {
getInterceptors().add(interceptor);
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutesType.java
Mon Nov 24 11:28:11 2008
@@ -130,6 +130,8 @@
/**
* Creates a new route
+ *
+ * @return the builder
*/
public RouteType route() {
RouteType route = createRoute();
@@ -138,6 +140,9 @@
/**
* Creates a new route from the given URI input
+ *
+ * @param uri the from uri
+ * @return the builder
*/
public RouteType from(String uri) {
RouteType route = createRoute();
@@ -147,6 +152,9 @@
/**
* Creates a new route from the given endpoint
+ *
+ * @param endpoint the from endpoint
+ * @return the builder
*/
public RouteType from(Endpoint endpoint) {
RouteType route = createRoute();
@@ -154,6 +162,12 @@
return route(route);
}
+ /**
+ * Creates a new route using the given route
+ *
+ * @param route the route
+ * @return the builder
+ */
public RouteType route(RouteType route) {
// lets configure the route
route.setCamelContext(getCamelContext());
@@ -175,23 +189,46 @@
return route;
}
+ /**
+ * Adds an interceptor
+ *
+ * @param interceptor the interceptor
+ * @return the builder
+ */
public RoutesType intercept(DelegateProcessor interceptor) {
getInterceptors().add(new InterceptorRef(interceptor));
return this;
}
+ /**
+ * Creates and adds an interceptor
+ *
+ * @return the interceptor builder to configure
+ */
public InterceptType intercept() {
InterceptType answer = new InterceptType();
getIntercepts().add(answer);
return answer;
}
+ /**
+ * Creates and adds an interceptor that is attached with a predicate
+ *
+ * @param predicate the predicate
+ * @return the builder
+ */
public ChoiceType intercept(Predicate predicate) {
InterceptType answer = new InterceptType();
getIntercepts().add(answer);
return answer.when(predicate);
}
+ /**
+ * Adds an on exception
+ *
+ * @param exceptionType the exception
+ * @return the builder
+ */
public ExceptionType onException(Class exceptionType) {
ExceptionType answer = new ExceptionType(exceptionType);
getExceptions().add(answer);
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitterType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitterType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitterType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SplitterType.java
Mon Nov 24 11:28:11 2008
@@ -118,7 +118,9 @@
/**
* Enables streaming.
- * Cfr. [EMAIL PROTECTED] SplitterType#setStreaming(boolean)} for more
information
+ * See [EMAIL PROTECTED] SplitterType#setStreaming(boolean)} for more
information
+ *
+ * @return the builder
*/
public SplitterType streaming() {
setStreaming(true);
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThreadType.java
Mon Nov 24 11:28:11 2008
@@ -140,51 +140,111 @@
+ " Instead set the errorHandler on the parent.");
}
+ /**
+ * Sets the core size
+ *
+ * @param coreSize the core size
+ * @return the builder
+ */
public ThreadType coreSize(int coreSize) {
setCoreSize(coreSize);
return this;
}
+ /**
+ * Sets the deamon option
+ *
+ * @param daemon deamon option
+ * @return the builder
+ */
public ThreadType daemon(boolean daemon) {
setDaemon(daemon);
return this;
}
+ /**
+ * Sets the keep alive time
+ *
+ * @param keepAliveTime keep alive time in millis
+ * @return the builder
+ */
public ThreadType keepAliveTime(long keepAliveTime) {
setKeepAliveTime(keepAliveTime);
return this;
}
+ /**
+ * Sets the max pool size
+ *
+ * @param maxSize the max pool size
+ * @return the builder
+ */
public ThreadType maxSize(int maxSize) {
setMaxSize(maxSize);
return this;
}
+ /**
+ * Sets the thread pool name
+ *
+ * @param name the name
+ * @return the builder
+ */
public ThreadType name(String name) {
setName(name);
return this;
}
+ /**
+ * Sets the thread pool priority
+ *
+ * @param priority the priority
+ * @return the builder
+ */
public ThreadType priority(int priority) {
setPriority(priority);
return this;
}
+ /**
+ * Sets the thread pool stack size
+ *
+ * @param stackSize the stack size
+ * @return the builder
+ */
public ThreadType stackSize(long stackSize) {
setStackSize(stackSize);
return this;
}
+ /**
+ * Sets the task queue
+ *
+ * @param taskQueue the task queue
+ * @return the builder
+ */
public ThreadType taskQueue(BlockingQueue<Runnable> taskQueue) {
setTaskQueue(taskQueue);
return this;
}
+ /**
+ * Sets the thread group
+ *
+ * @param threadGroup the thread group
+ * @return the builder
+ */
public ThreadType threadGroup(ThreadGroup threadGroup) {
setThreadGroup(threadGroup);
return this;
}
+ /**
+ * Sets the execute to use
+ *
+ * @param executor the executor
+ * @return the builder
+ */
public ThreadType executor(ThreadPoolExecutor executor) {
setExecutor(executor);
return this;
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java
Mon Nov 24 11:28:11 2008
@@ -78,6 +78,9 @@
/**
* Sets the time period during which the maximum request count is valid for
+ *
+ * @param timePeriodMillis period in millis
+ * @return the builder
*/
public ThrottlerType timePeriodMillis(long timePeriodMillis) {
this.timePeriodMillis = timePeriodMillis;
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/TryType.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/TryType.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/TryType.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/TryType.java
Mon Nov 24 11:28:11 2008
@@ -75,6 +75,13 @@
// Fluent API
//
-------------------------------------------------------------------------
+
+ /**
+ * Handles the given exception
+ *
+ * @param exceptionType the exception
+ * @return the try builder
+ */
public TryType handle(Class<?> exceptionType) {
popBlock();
CatchType answer = new CatchType(exceptionType);
@@ -83,6 +90,11 @@
return this;
}
+ /**
+ * The finally block for a given handle
+ *
+ * @return the try builder
+ */
public TryType finallyBlock() {
popBlock();
FinallyType answer = new FinallyType();
Modified:
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/GenerateXmlTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/GenerateXmlTest.java?rev=720269&r1=720268&r2=720269&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/GenerateXmlTest.java
(original)
+++
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/GenerateXmlTest.java
Mon Nov 24 11:28:11 2008
@@ -35,7 +35,7 @@
route.from("seda:a");
route.filter(new XQueryExpression("in.header.foo == 'bar'")).
to("seda:b");
- route.description("This is a description of the route");
+ route.description(null, "This is a description of the route", "en");
dump(context);
}
@@ -46,7 +46,7 @@
route.interceptors("interceptor1", "interceptor2");
route.filter(new GroovyExpression("in.headers.any { h ->
h.startsWith('foo') }")).
to("seda:b");
- route.description("This is a description of the route");
+ route.description(null, "This is a description of the route", "en");
List<ProcessorType<?>> list = route.getOutputs();
assertEquals("Size of list: " + list, 1, list.size());