camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r958504 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/component/file/strategy/ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/processor/ camel-core/src/main/java/org/apache/camel/pr...
Date Mon, 28 Jun 2010 08:40:15 GMT
Author: davsclaus
Date: Mon Jun 28 08:40:14 2010
New Revision: 958504

URL: http://svn.apache.org/viewvc?rev=958504&view=rev
Log:
CAMEL-2723: Refactored defs which should not be delegates to make it simpler to maintain.
Introduced no output variation of expression node.

Added:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/NoneOutputExpressionNode.java
  (with props)
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java
      - copied, changed from r958464, camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncCBRTest.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileChangedExclusiveReadLockStrategy.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetBodyDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetHeaderDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetOutHeaderDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetPropertyDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransformDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/ValidateDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/CatchProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptEndpointProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoopProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SamplingThrottler.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/PredicateValidatingProcessor.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileChangedExclusiveReadLockStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileChangedExclusiveReadLockStrategy.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileChangedExclusiveReadLockStrategy.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileChangedExclusiveReadLockStrategy.java
Mon Jun 28 08:40:14 2010
@@ -29,7 +29,7 @@ import org.apache.commons.logging.LogFac
 
 /**
  * Acquires exclusive read lock to the given file by checking whether the file is being
- * changed by scanning the file at different intervals (to detec changes).
+ * changed by scanning the file at different intervals (to detect changes).
  */
 public class FileChangedExclusiveReadLockStrategy extends MarkerFileExclusiveReadLockStrategy
{
     private static final transient Log LOG = LogFactory.getLog(FileChangedExclusiveReadLockStrategy.class);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java Mon Jun
28 08:40:14 2010
@@ -87,9 +87,9 @@ public class LogDefinition extends Proce
     }
 
     @Override
-    public void addOutput(ProcessorDefinition processorType) {
+    public void addOutput(ProcessorDefinition output) {
         // add outputs on parent as this log does not support outputs
-        getParent().addOutput(processorType);
+        getParent().addOutput(output);
     }
 
     public LoggingLevel getLoggingLevel() {

Added: camel/trunk/camel-core/src/main/java/org/apache/camel/model/NoneOutputExpressionNode.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/NoneOutputExpressionNode.java?rev=958504&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/NoneOutputExpressionNode.java
(added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/NoneOutputExpressionNode.java
Mon Jun 28 08:40:14 2010
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.model;
+
+import java.util.Collections;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+import org.apache.camel.Expression;
+import org.apache.camel.Predicate;
+import org.apache.camel.model.language.ExpressionDefinition;
+
+/**
+ * An {@link org.apache.camel.model.ExpressionNode} which does <b>not</b> support
any outputs.
+ * <p/>
+ * This node is to be extended by definitions which need to support an expression but the
definition should not
+ * contain any outputs, such as {@link org.apache.camel.model.TransformDefinition}.
+ *
+ * @version $Revision$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class NoneOutputExpressionNode extends ExpressionNode {
+
+    public NoneOutputExpressionNode() {
+        super();
+    }
+
+    public NoneOutputExpressionNode(ExpressionDefinition expression) {
+        super(expression);
+    }
+
+    public NoneOutputExpressionNode(Expression expression) {
+        super(expression);
+    }
+
+    public NoneOutputExpressionNode(Predicate predicate) {
+        super(predicate);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public List<ProcessorDefinition> getOutputs() {
+        return Collections.EMPTY_LIST;
+    }
+
+    @Override
+    public void addOutput(ProcessorDefinition output) {
+        // add it to the parent as we do not support outputs
+        getParent().addOutput(output);
+    }
+
+}

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/model/NoneOutputExpressionNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/model/NoneOutputExpressionNode.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Mon
Jun 28 08:40:14 2010
@@ -154,14 +154,14 @@ public abstract class ProcessorDefinitio
         }
     }
 
-    public void addOutput(ProcessorDefinition processorType) {
-        processorType.setParent(this);
-        configureChild(processorType);
+    public void addOutput(ProcessorDefinition output) {
+        output.setParent(this);
+        configureChild(output);
         if (blocks.isEmpty()) {
-            getOutputs().add(processorType);
+            getOutputs().add(output);
         } else {
             Block block = blocks.getLast();
-            block.addOutput(processorType);
+            block.addOutput(output);
         }
     }
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
Mon Jun 28 08:40:14 2010
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.model;
 
-import java.util.Collections;
-import java.util.List;
 import java.util.concurrent.ExecutorService;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -41,7 +39,7 @@ import org.apache.camel.util.concurrent.
  */
 @XmlRootElement(name = "recipientList")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class RecipientListDefinition<Type extends ProcessorDefinition> extends ExpressionNode
implements ExecutorServiceAwareDefinition<RecipientListDefinition> {
+public class RecipientListDefinition<Type extends ProcessorDefinition> extends NoneOutputExpressionNode
implements ExecutorServiceAwareDefinition<RecipientListDefinition> {
 
     @XmlTransient
     private AggregationStrategy aggregationStrategy;
@@ -121,18 +119,6 @@ public class RecipientListDefinition<Typ
         return aggregationStrategy;
     }
 
-    @Override
-    @SuppressWarnings("unchecked")
-    public List<ProcessorDefinition> getOutputs() {
-        return Collections.EMPTY_LIST;
-    }
-
-    @Override
-    public void addOutput(ProcessorDefinition processorType) {
-        // add it to the parent as a recipient list does not support outputs
-        getParent().addOutput(processorType);
-    }
-
     // Fluent API
     // -------------------------------------------------------------------------
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
Mon Jun 28 08:40:14 2010
@@ -29,14 +29,13 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.Builder;
 import org.apache.camel.processor.RoutingSlip;
 import org.apache.camel.spi.RouteContext;
-import org.apache.camel.util.ObjectHelper;
 
 /**
  * Represents an XML &lt;routingSlip/&gt; element
  */
 @XmlRootElement(name = "routingSlip")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class RoutingSlipDefinition <Type extends ProcessorDefinition> extends ExpressionNode
{
+public class RoutingSlipDefinition <Type extends ProcessorDefinition> extends NoneOutputExpressionNode
{
     public static final String DEFAULT_DELIMITER = ",";
     @XmlAttribute
     private String headerName;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetBodyDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetBodyDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetBodyDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetBodyDefinition.java Mon
Jun 28 08:40:14 2010
@@ -22,7 +22,6 @@ import javax.xml.bind.annotation.XmlRoot
 
 import org.apache.camel.Expression;
 import org.apache.camel.Processor;
-import org.apache.camel.builder.ExpressionClause;
 import org.apache.camel.processor.SetBodyProcessor;
 import org.apache.camel.spi.RouteContext;
 
@@ -31,7 +30,7 @@ import org.apache.camel.spi.RouteContext
  */
 @XmlRootElement(name = "setBody")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class SetBodyDefinition extends ExpressionNode {
+public class SetBodyDefinition extends NoneOutputExpressionNode {
 
     public SetBodyDefinition() {
     }
@@ -58,18 +57,7 @@ public class SetBodyDefinition extends E
     @Override
     public Processor createProcessor(RouteContext routeContext) throws Exception {
         Expression expr = getExpression().createExpression(routeContext);
-        Processor childProcessor = routeContext.createProcessor(this);
-
-        return new SetBodyProcessor(expr, childProcessor);
+        return new SetBodyProcessor(expr);
     }
     
-     // Fluent API
-    //-------------------------------------------------------------------------
-    /**
-     * Set the expression that SetBodyType class will use
-     * @return the builder
-     */
-    public ExpressionClause<SetBodyDefinition> expression() {
-        return ExpressionClause.createAndSetExpression(this);
-    }
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetHeaderDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetHeaderDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetHeaderDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetHeaderDefinition.java Mon
Jun 28 08:40:14 2010
@@ -24,7 +24,6 @@ import javax.xml.bind.annotation.XmlRoot
 import org.apache.camel.Expression;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.ExpressionBuilder;
-import org.apache.camel.builder.ExpressionClause;
 import org.apache.camel.builder.ProcessorBuilder;
 import org.apache.camel.model.language.ExpressionDefinition;
 import org.apache.camel.spi.RouteContext;
@@ -35,7 +34,7 @@ import org.apache.camel.util.ObjectHelpe
  */
 @XmlRootElement(name = "setHeader")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class SetHeaderDefinition extends ExpressionNode {
+public class SetHeaderDefinition extends NoneOutputExpressionNode {
     @XmlAttribute(required = true)
     private String headerName;
     
@@ -87,13 +86,4 @@ public class SetHeaderDefinition extends
         return headerName;
     }
     
-    // Fluent API
-    //-------------------------------------------------------------------------
-    /**
-     * Set the expression that SetHeaderType will use
-     * @return the builder
-     */
-    public ExpressionClause<SetHeaderDefinition> expression() {
-        return ExpressionClause.createAndSetExpression(this);
-    }
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetOutHeaderDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetOutHeaderDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetOutHeaderDefinition.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetOutHeaderDefinition.java
Mon Jun 28 08:40:14 2010
@@ -23,7 +23,6 @@ import javax.xml.bind.annotation.XmlRoot
 
 import org.apache.camel.Expression;
 import org.apache.camel.Processor;
-import org.apache.camel.builder.ExpressionClause;
 import org.apache.camel.builder.ProcessorBuilder;
 import org.apache.camel.model.language.ExpressionDefinition;
 import org.apache.camel.spi.RouteContext;
@@ -76,13 +75,4 @@ public class SetOutHeaderDefinition exte
         return headerName;
     }
     
-    // Fluent API
-    //-------------------------------------------------------------------------
-    /**
-     * Set the expression that SetOutHeaderType will use
-     * @return the builder
-     */
-    public ExpressionClause<SetOutHeaderDefinition> expression() {
-        return ExpressionClause.createAndSetExpression(this);
-    }
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetPropertyDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetPropertyDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetPropertyDefinition.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/SetPropertyDefinition.java
Mon Jun 28 08:40:14 2010
@@ -24,7 +24,6 @@ import javax.xml.bind.annotation.XmlRoot
 import org.apache.camel.Expression;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.ExpressionBuilder;
-import org.apache.camel.builder.ExpressionClause;
 import org.apache.camel.builder.ProcessorBuilder;
 import org.apache.camel.model.language.ExpressionDefinition;
 import org.apache.camel.spi.RouteContext;
@@ -35,7 +34,7 @@ import org.apache.camel.util.ObjectHelpe
  */
 @XmlRootElement(name = "setProperty")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class SetPropertyDefinition extends ExpressionNode {
+public class SetPropertyDefinition extends NoneOutputExpressionNode {
     @XmlAttribute(required = true)
     private String propertyName;
     
@@ -82,14 +81,4 @@ public class SetPropertyDefinition exten
         return propertyName;
     }
     
-    // Fluent API
-    //-------------------------------------------------------------------------
-
-    /**
-     * Set the expression that SetPropertyType will use
-     * @return the builder
-     */
-    public ExpressionClause<SetPropertyDefinition> expression() {
-        return ExpressionClause.createAndSetExpression(this);
-    }
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransformDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransformDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransformDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransformDefinition.java Mon
Jun 28 08:40:14 2010
@@ -31,7 +31,7 @@ import org.apache.camel.spi.RouteContext
  */
 @XmlRootElement(name = "transform")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class TransformDefinition extends ExpressionNode {
+public class TransformDefinition extends NoneOutputExpressionNode {
 
     public TransformDefinition() {
     }
@@ -53,18 +53,7 @@ public class TransformDefinition extends
     @Override
     public Processor createProcessor(RouteContext routeContext) throws Exception {
         Expression expr = getExpression().createExpression(routeContext);
-        Processor childProcessor = routeContext.createProcessor(this);
-
-        return new TransformProcessor(expr, childProcessor);
+        return new TransformProcessor(expr);
     }
     
-    // Fluent API
-    //-------------------------------------------------------------------------
-    /**
-     * Set the expression to be used
-     * @return the builder
-     */
-    public ExpressionClause<TransformDefinition> expression() {
-        return ExpressionClause.createAndSetExpression(this);
-    }
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ValidateDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ValidateDefinition.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ValidateDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ValidateDefinition.java Mon
Jun 28 08:40:14 2010
@@ -20,7 +20,7 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.apache.camel.Processor;
+import org.apache.camel.Predicate;
 import org.apache.camel.processor.validation.PredicateValidatingProcessor;
 import org.apache.camel.spi.RouteContext;
 
@@ -31,7 +31,7 @@ import org.apache.camel.spi.RouteContext
  */
 @XmlRootElement(name = "validate")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class ValidateDefinition extends ExpressionNode {
+public class ValidateDefinition extends NoneOutputExpressionNode {
 
     public ValidateDefinition() {
         super();
@@ -50,8 +50,8 @@ public class ValidateDefinition extends 
 
     @Override
     public PredicateValidatingProcessor createProcessor(RouteContext routeContext) throws
Exception {
-        Processor childProcessor = routeContext.createProcessor(this);
-        return new PredicateValidatingProcessor(getExpression().createPredicate(routeContext),
childProcessor);
+        Predicate pred = getExpression().createPredicate(routeContext);
+        return new PredicateValidatingProcessor(pred);
     }
 
 }
\ No newline at end of file

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/CatchProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/CatchProcessor.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/CatchProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/CatchProcessor.java Mon
Jun 28 08:40:14 2010
@@ -29,7 +29,7 @@ import org.apache.camel.util.ObjectHelpe
  *
  * @version $Revision$
  */
-public class CatchProcessor extends DelegateProcessor implements Traceable {
+public class CatchProcessor extends DelegateAsyncProcessor implements Traceable {
     private final List<Class> exceptions;
     private final Predicate onWhen;
     private final Predicate handled;
@@ -103,8 +103,8 @@ public class CatchProcessor extends Dele
      * <p/>
      * This default implementation will match as:
      * <ul>
-     * <li>Always true if no when predicate on the exception type
-     * <li>Otherwise the when predicate is matches against the current exchange
+     *   <li>Always true if no when predicate on the exception type
+     *   <li>Otherwise the when predicate is matches against the current exchange
      * </ul>
      *
      * @param exchange the current {@link org.apache.camel.Exchange}

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptEndpointProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptEndpointProcessor.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptEndpointProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/InterceptEndpointProcessor.java
Mon Jun 28 08:40:14 2010
@@ -23,7 +23,7 @@ import org.apache.camel.Processor;
  *
  * @version $Revision$
  */
-public class InterceptEndpointProcessor extends DelegateProcessor {
+public class InterceptEndpointProcessor extends DelegateAsyncProcessor {
 
     private final String uri;
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoopProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoopProcessor.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoopProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/LoopProcessor.java Mon
Jun 28 08:40:14 2010
@@ -33,6 +33,8 @@ public class LoopProcessor extends Deleg
 
     private final Expression expression;
 
+    // TODO: should support async routing engine
+
     public LoopProcessor(Expression expression, Processor processor) {
         super(processor);
         this.expression = expression;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SamplingThrottler.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SamplingThrottler.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SamplingThrottler.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SamplingThrottler.java
Mon Jun 28 08:40:14 2010
@@ -37,6 +37,9 @@ import org.apache.commons.logging.LogFac
  * @version $Revision$
  */
 public class SamplingThrottler extends DelegateProcessor {
+
+    // TODO: should support async routing engine
+
     protected final transient Log log = LogFactory.getLog(getClass());
     private long samplePeriod;
     private long periodInNanos;
@@ -57,7 +60,7 @@ public class SamplingThrottler extends D
         }
         this.samplePeriod = samplePeriod;
         this.units = units;
-        periodInNanos = units.toNanos(samplePeriod);
+        this.periodInNanos = units.toNanos(samplePeriod);
     }
 
     @Override

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SetBodyProcessor.java
Mon Jun 28 08:40:14 2010
@@ -25,18 +25,13 @@ import org.apache.camel.impl.DefaultMess
 /**
  * A processor which sets the body on the IN message with an expression
  */
-public class SetBodyProcessor extends DelegateProcessor implements Traceable {
+public class SetBodyProcessor implements Processor, Traceable {
     private final Expression expression;
 
     public SetBodyProcessor(Expression expression) {
         this.expression = expression;
     }
 
-    public SetBodyProcessor(Expression expression, Processor childProcessor) {
-        super(childProcessor);
-        this.expression = expression;
-    }
-
     public void process(Exchange exchange) throws Exception {
         Object newBody = expression.evaluate(exchange, Object.class);
 
@@ -47,13 +42,11 @@ public class SetBodyProcessor extends De
         msg.copyFrom(old);
         msg.setBody(newBody);
         exchange.setIn(msg);
-
-        super.process(exchange);
     }
 
     @Override
     public String toString() {
-        return "SetBody(" + expression + (processor != null ? "," + processor : "") + ")";
+        return "SetBody(" + expression + ")";
     }
 
     public String getTraceLabel() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
Mon Jun 28 08:40:14 2010
@@ -23,18 +23,13 @@ import org.apache.camel.Processor;
 /**
  * A processor which sets the body on the OUT message with an expression
  */
-public class TransformProcessor extends DelegateProcessor implements Traceable {
+public class TransformProcessor implements Processor, Traceable {
     private final Expression expression;
 
     public TransformProcessor(Expression expression) {
         this.expression = expression;
     }
 
-    public TransformProcessor(Expression expression, Processor childProcessor) {
-        super(childProcessor);
-        this.expression = expression;
-    }
-
     public void process(Exchange exchange) throws Exception {
         Object newBody = expression.evaluate(exchange, Object.class);
         exchange.getOut().setBody(newBody);
@@ -42,13 +37,11 @@ public class TransformProcessor extends 
         // propagate headers and attachments
         exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
         exchange.getOut().setAttachments(exchange.getIn().getAttachments());
-
-        super.process(exchange);
     }
 
     @Override
     public String toString() {
-        return "Transform(" + expression + (processor != null ? "," + processor : "") + ")";
+        return "Transform(" + expression + ")";
     }
 
     public String getTraceLabel() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java Mon
Jun 28 08:40:14 2010
@@ -27,6 +27,8 @@ import org.apache.camel.util.ServiceHelp
 public class WrapProcessor extends DelegateProcessor {
     private final Processor wrapped;
 
+    // TODO: Should support async routing engine
+
     public WrapProcessor(Processor processor, Processor wrapped) {
         super(processor);
         this.wrapped = wrapped;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/idempotent/IdempotentConsumer.java
Mon Jun 28 08:40:14 2010
@@ -42,6 +42,8 @@ public class IdempotentConsumer extends 
     private final IdempotentRepository<String> idempotentRepository;
     private final boolean eager;
 
+    // TODO: should support async routing engine
+
     public IdempotentConsumer(Expression messageIdExpression, 
             IdempotentRepository<String> idempotentRepository, boolean eager, Processor
processor) {
         this.messageIdExpression = messageIdExpression;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/PredicateValidatingProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/PredicateValidatingProcessor.java?rev=958504&r1=958503&r2=958504&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/PredicateValidatingProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/PredicateValidatingProcessor.java
Mon Jun 28 08:40:14 2010
@@ -19,7 +19,6 @@ package org.apache.camel.processor.valid
 import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
-import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.processor.Traceable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -30,14 +29,13 @@ import org.apache.commons.logging.LogFac
  * 
  * @version $Revision$
  */
-public class PredicateValidatingProcessor extends DelegateProcessor implements Traceable
{
+public class PredicateValidatingProcessor implements Processor, Traceable {
     
     private static final Log LOG = LogFactory.getLog(PredicateValidatingProcessor.class);
 
     private final Predicate predicate;
     
-    public PredicateValidatingProcessor(Predicate predicate, Processor processor) {
-        super(processor);
+    public PredicateValidatingProcessor(Predicate predicate) {
         this.predicate = predicate;
     }
 
@@ -48,23 +46,21 @@ public class PredicateValidatingProcesso
             LOG.debug("Validation " + (matches ? "succeed " : "failed ") + "for " + exchange
+ " with Predicate[" + predicate + "]");
         }
 
-        if (matches) {
-            super.process(exchange);
-        } else {
+        if (!matches) {
             throw new PredicateValidationException(exchange, predicate);
         }
     }
-    
+
+    public Predicate getPredicate() {
+        return predicate;
+    }
+
     @Override
     public String toString() {
-        return "validate[" + predicate + "]";
+        return "validate(" + predicate + ")";
     }
 
     public String getTraceLabel() {
-        return "validate";
-    }
-    
-    public Predicate getPredicate() {
-        return predicate;
+        return "validate[" + predicate + "]";
     }
 }
\ No newline at end of file

Copied: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java
(from r958464, camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncCBRTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java?p2=camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java&p1=camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncCBRTest.java&r1=958464&r2=958504&rev=958504&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncCBRTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java
Mon Jun 28 08:40:14 2010
@@ -23,13 +23,13 @@ import org.junit.Test;
 /**
  * @version $Revision$
  */
-public class JettyAsyncCBRTest extends CamelTestSupport {
+public class JettyAsyncTransformTest extends CamelTestSupport {
 
     @Test
     public void testJettyAsync() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
 
-        String reply = template.requestBody("http://localhost:8876/myservice", "Hello Camel",
String.class);
+        String reply = template.requestBody("http://localhost:8876/myservice", null, String.class);
         assertEquals("Bye World", reply);
 
         assertMockEndpointsSatisfied();
@@ -43,11 +43,11 @@ public class JettyAsyncCBRTest extends C
                 context.addComponent("async", new MyAsyncComponent());
 
                 from("jetty:http://localhost:8876/myservice")
+                    .to("log:foo")
                     .convertBodyTo(String.class)
-                    .choice()
-                        .when(body().contains("Camel"))
-                            .to("async:Bye World")
-                        .end()
+                    .transform(constant("Hello World"))
+                    .to("async:Hi World")
+                    .transform(constant("Bye World"))
                     .to("mock:result");
             }
         };



Mime
View raw message