activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r521139 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/test/java/org/apache/camel/builder/ camel-spring/src/main/java/org/apache/camel/spring/ camel-spring/src/main/resources/org/apache/camel/s...
Date Thu, 22 Mar 2007 07:03:12 GMT
Author: chirino
Date: Thu Mar 22 00:03:10 2007
New Revision: 521139

URL: http://svn.apache.org/viewvc?view=rev&rev=521139
Log:
Some substancial improvement of the CamelBeanDefinitionParser.  It can now handle using builder sub statement to create arguments to builder methods.
This was needed to implement the filter case.


Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyProcessor.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java
      - copied, changed from r521037, activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderAction.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderStatement.java
      - copied, changed from r521037, activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderStatement.java
Removed:
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderAction.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderStatement.java
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FilterBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java
    activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderFactory.java
    activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java Thu Mar 22 00:03:10 2007
@@ -16,17 +16,17 @@
  */
 package org.apache.camel.builder;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Expression;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
 import org.apache.camel.processor.LoggingLevel;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.List;
-import java.util.ArrayList;
-
 /**
  * Base class for implementation inheritance
  *
@@ -55,14 +55,16 @@
     /**
      * Resolves the given URI to an endpoint
      */
-    public Endpoint<E> endpoint(String uri) {
+    @Fluent
+    public Endpoint<E> endpoint(@FluentArg("uri") String uri) {
         return getContext().resolveEndpoint(uri);
     }
 
     /**
      * Resolves the list of URIs into a list of {@link Endpoint} instances
      */
-    public List<Endpoint<E>> endpoints(String... uris) {
+    @Fluent
+    public List<Endpoint<E>> endpoints(@FluentArg("uris") String... uris) {
         List<Endpoint<E>> endpoints = new ArrayList<Endpoint<E>>();
         for (String uri : uris) {
             endpoints.add(endpoint(uri));
@@ -73,7 +75,8 @@
     /**
      * Helper method to create a list of {@link Endpoint} instances
      */
-    public List<Endpoint<E>> endpoints(Endpoint<E>... endpoints) {
+    @Fluent
+    public List<Endpoint<E>> endpoints(@FluentArg("endpoints") Endpoint<E>... endpoints) {
         List<Endpoint<E>> answer = new ArrayList<Endpoint<E>>();
         for (Endpoint<E> endpoint : endpoints) {
             answer.add(endpoint);
@@ -87,7 +90,8 @@
     /**
      * Returns a predicate and value builder for headers on an exchange
      */
-    public ValueBuilder<E> header(String name) {
+    @Fluent
+    public ValueBuilder<E> header(@FluentArg("name") String name) {
         Expression<E> expression = ExpressionBuilder.headerExpression(name);
         return new ValueBuilder<E>(expression);
     }
@@ -95,6 +99,7 @@
     /**
      * Returns a predicate and value builder for the inbound body on an exchange
      */
+    @Fluent
     public ValueBuilder<E> body() {
         Expression<E> expression = ExpressionBuilder.bodyExpression();
         return new ValueBuilder<E>(expression);
@@ -103,7 +108,8 @@
     /**
      * Returns a predicate and value builder for the inbound message body as a specific type
      */
-    public <T> ValueBuilder<E> bodyAs(Class<T> type) {
+    @Fluent
+    public <T> ValueBuilder<E> bodyAs(@FluentArg("class") Class<T> type) {
         Expression<E> expression = ExpressionBuilder.bodyExpression(type);
         return new ValueBuilder<E>(expression);
     }
@@ -111,6 +117,7 @@
     /**
      * Returns a predicate and value builder for the outbound body on an exchange
      */
+    @Fluent
     public ValueBuilder<E> outBody() {
         Expression<E> expression = ExpressionBuilder.bodyExpression();
         return new ValueBuilder<E>(expression);
@@ -119,7 +126,8 @@
     /**
      * Returns a predicate and value builder for the outbound message body as a specific type
      */
-    public <T> ValueBuilder<E> outBody(Class<T> type) {
+    @Fluent
+    public <T> ValueBuilder<E> outBody(@FluentArg("class") Class<T> type) {
         Expression<E> expression = ExpressionBuilder.bodyExpression(type);
         return new ValueBuilder<E>(expression);
     }
@@ -127,6 +135,7 @@
     /**
      * Creates a disabled error handler for removing the default error handler
      */
+    @Fluent
     public NoErrorHandlerBuilder<E> noErrorHandler() {
         return new NoErrorHandlerBuilder<E>();
     }
@@ -134,6 +143,7 @@
     /**
      * Creates an error handler which just logs errors
      */
+    @Fluent
     public LoggingErrorHandlerBuilder<E> loggingErrorHandler() {
         return new LoggingErrorHandlerBuilder<E>();
     }
@@ -141,33 +151,39 @@
     /**
      * Creates an error handler which just logs errors
      */
-    public LoggingErrorHandlerBuilder<E> loggingErrorHandler(String log) {
+    @Fluent
+    public LoggingErrorHandlerBuilder<E> loggingErrorHandler(@FluentArg("log") String log) {
         return loggingErrorHandler(LogFactory.getLog(log));
     }
 
     /**
      * Creates an error handler which just logs errors
      */
-    public LoggingErrorHandlerBuilder<E> loggingErrorHandler(Log log) {
+    @Fluent
+    public LoggingErrorHandlerBuilder<E> loggingErrorHandler(@FluentArg("log") Log log) {
         return new LoggingErrorHandlerBuilder<E>(log);
     }
 
     /**
      * Creates an error handler which just logs errors
      */
-    public LoggingErrorHandlerBuilder<E> loggingErrorHandler(Log log, LoggingLevel level) {
+    @Fluent
+    public LoggingErrorHandlerBuilder<E> loggingErrorHandler(@FluentArg("log") Log log, @FluentArg("level") LoggingLevel level) {
         return new LoggingErrorHandlerBuilder<E>(log, level);
     }
 
+    @Fluent
     public DeadLetterChannelBuilder<E> deadLetterChannel() {
         return new DeadLetterChannelBuilder<E>();
     }
 
-    public DeadLetterChannelBuilder<E> deadLetterChannel(String deadLetterUri) {
+    @Fluent
+    public DeadLetterChannelBuilder<E> deadLetterChannel(@FluentArg("uri") String deadLetterUri) {
         return deadLetterChannel(endpoint(deadLetterUri));
     }
 
-    public DeadLetterChannelBuilder<E> deadLetterChannel(Endpoint<E> deadLetterEndpoint) {
+    @Fluent
+    public DeadLetterChannelBuilder<E> deadLetterChannel(@FluentArg("endpoint") Endpoint<E> deadLetterEndpoint) {
         return new DeadLetterChannelBuilder<E>(deadLetterEndpoint);
     }
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FilterBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FilterBuilder.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FilterBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FilterBuilder.java Thu Mar 22 00:03:10 2007
@@ -33,7 +33,7 @@
     }
 
     /**
-     * Adds another predicate using a logican AND
+     * Adds another predicate using a logical AND
      */
     public FilterBuilder<E> and(Predicate<E> predicate) {
         this.predicate = PredicateBuilder.and(this.predicate, predicate);
@@ -41,7 +41,7 @@
     }
 
     /**
-     * Adds another predicate using a logican OR
+     * Adds another predicate using a logical OR
      */
     public FilterBuilder<E> or(Predicate<E> predicate) {
         this.predicate = PredicateBuilder.or(this.predicate, predicate);

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java Thu Mar 22 00:03:10 2007
@@ -28,4 +28,6 @@
 @Target(ElementType.PARAMETER)
 public @interface FluentArg {
 	String value();
+	boolean attribute() default true;
+	boolean element() default false;
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FromBuilder.java Thu Mar 22 00:03:10 2007
@@ -16,6 +16,10 @@
  */
 package org.apache.camel.builder;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
@@ -26,10 +30,6 @@
 import org.apache.camel.processor.Pipeline;
 import org.apache.camel.processor.RecipientList;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
 /**
  * @version $Revision$
  */
@@ -124,7 +124,7 @@
      * Adds the custom processor to this destination
      */
     @Fluent
-    public ConstantProcessorBuilder<E> process(@FluentArg("processor") Processor<E> processor) {
+    public ConstantProcessorBuilder<E> process(@FluentArg("ref") Processor<E> processor) {
         ConstantProcessorBuilder<E> answer = new ConstantProcessorBuilder<E>(processor);
         addProcessBuilder(answer);
         return answer;
@@ -137,7 +137,9 @@
      * @return the builder for a predicate
      */
     @Fluent
-    public FilterBuilder<E> filter(@FluentArg("predicate") Predicate<E> predicate) {
+    public FilterBuilder<E> filter(
+    		@FluentArg(value="predicate",element=true) 
+    		Predicate<E> predicate) {
         FilterBuilder<E> answer = new FilterBuilder<E>(this, predicate);
         addProcessBuilder(answer);
         return answer;

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java?view=auto&rev=521139
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java Thu Mar 22 00:03:10 2007
@@ -0,0 +1,241 @@
+/*
+ * 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.builder;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
+import org.apache.camel.Predicate;
+import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.ObjectHelper.notNull;
+
+/**
+ * A helper class for working with predicates
+ *
+ * @version $Revision: 520261 $
+ */
+public class PredicateBuilder {
+    /**
+     * A helper method to combine multiple predicates by a logical AND
+     */
+    public static <E extends Exchange> Predicate<E> and(final Predicate<E> left, final Predicate<E> right) {
+        notNull(left, "left");
+        notNull(right, "right");
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                return left.evaluate(exchange) && right.evaluate(exchange);
+            }
+
+            @Override
+            public String toString() {
+                return "(" + left + ") and (" + right + ")";
+            }
+        };
+    }
+
+    /**
+     * A helper method to combine multiple predicates by a logical OR
+     */
+    public static <E extends Exchange> Predicate<E> or(final Predicate<E> left, final Predicate<E> right) {
+        notNull(left, "left");
+        notNull(right, "right");
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                return left.evaluate(exchange) || right.evaluate(exchange);
+            }
+
+            @Override
+            public String toString() {
+                return "(" + left + ") or (" + right + ")";
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> isEqualTo(final Expression<E> left, final Expression<E> right) {
+        notNull(left, "left");
+        notNull(right, "right");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value1 = left.evaluate(exchange);
+                Object value2 = right.evaluate(exchange);
+                return ObjectHelper.equals(value1, value2);
+            }
+
+            @Override
+            public String toString() {
+                return left + " == " + right;
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> isNotEqualTo(final Expression<E> left, final Expression<E> right) {
+        notNull(left, "left");
+        notNull(right, "right");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value1 = left.evaluate(exchange);
+                Object value2 = right.evaluate(exchange);
+                return !ObjectHelper.equals(value1, value2);
+            }
+
+            @Override
+            public String toString() {
+                return left + " != " + right;
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> isLessThan(final Expression<E> left, final Expression<E> right) {
+        notNull(left, "left");
+        notNull(right, "right");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value1 = left.evaluate(exchange);
+                Object value2 = right.evaluate(exchange);
+                return ObjectHelper.compare(value1, value2) < 0;
+            }
+
+            @Override
+            public String toString() {
+                return left + " < " + right;
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> isLessThanOrEqualTo(final Expression<E> left, final Expression<E> right) {
+        notNull(left, "left");
+        notNull(right, "right");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value1 = left.evaluate(exchange);
+                Object value2 = right.evaluate(exchange);
+                return ObjectHelper.compare(value1, value2) <= 0;
+            }
+
+            @Override
+            public String toString() {
+                return left + " <= " + right;
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> isGreaterThan(final Expression<E> left, final Expression<E> right) {
+        notNull(left, "left");
+        notNull(right, "right");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value1 = left.evaluate(exchange);
+                Object value2 = right.evaluate(exchange);
+                return ObjectHelper.compare(value1, value2) > 0;
+            }
+
+            @Override
+            public String toString() {
+                return left + " > " + right;
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> isGreaterThanOrEqualTo(final Expression<E> left, final Expression<E> right) {
+        notNull(left, "left");
+        notNull(right, "right");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value1 = left.evaluate(exchange);
+                Object value2 = right.evaluate(exchange);
+                return ObjectHelper.compare(value1, value2) >= 0;
+            }
+
+            @Override
+            public String toString() {
+                return left + " >= " + right;
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> isInstanceOf(final Expression<E> expression, final Class type) {
+        notNull(expression, "expression");
+        notNull(type, "type");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value = expression.evaluate(exchange);
+                return type.isInstance(value);
+            }
+
+            @Override
+            public String toString() {
+                return expression + " instanceof " + type.getName();
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> isNull(final Expression<E> expression) {
+        notNull(expression, "expression");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value = expression.evaluate(exchange);
+                return value == null;
+            }
+
+            @Override
+            public String toString() {
+                return expression + " == null";
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> isNotNull(final Expression<E> expression) {
+        notNull(expression, "expression");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value = expression.evaluate(exchange);
+                return value != null;
+            }
+
+            @Override
+            public String toString() {
+                return expression + " != null";
+            }
+        };
+    }
+
+    public static <E extends Exchange> Predicate<E> contains(final Expression<E> left, final Expression<E> right) {
+        notNull(left, "left");
+        notNull(right, "right");
+
+        return new Predicate<E>() {
+            public boolean evaluate(E exchange) {
+                Object value1 = left.evaluate(exchange);
+                Object value2 = right.evaluate(exchange);
+                return ObjectHelper.contains(value1, value2);
+            }
+
+            @Override
+            public String toString() {
+                return left + ".contains(" + right + ")";
+            }
+        };
+    }
+}

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java Thu Mar 22 00:03:10 2007
@@ -31,59 +31,71 @@
     public ValueBuilder(Expression<E> expression) {
         this.expression = expression;
     }
+    
+    public Expression<E> getExpression() {
+        return expression;
+    }
 
-    public Predicate<E> isNotEqualTo(Object value) {
+    @Fluent
+    public Predicate<E> isNotEqualTo(@FluentArg("value") Object value) {
         Expression<E> right = ExpressionBuilder.constantExpression(value);
         return PredicateBuilder.isNotEqualTo(expression, right);
     }
 
-    public Predicate<E> isEqualTo(Object value) {
+    @Fluent
+    public Predicate<E> isEqualTo(@FluentArg("value") Object value) {
         Expression<E> right = ExpressionBuilder.constantExpression(value);
         return PredicateBuilder.isEqualTo(expression, right);
     }
 
-    public Predicate<E> isLessThan(Object value) {
+    @Fluent
+    public Predicate<E> isLessThan(@FluentArg("value") Object value) {
         Expression<E> right = ExpressionBuilder.constantExpression(value);
         return PredicateBuilder.isLessThan(expression, right);
     }
 
-    public Predicate<E> isLessThanOrEqualTo(Object value) {
+    @Fluent
+    public Predicate<E> isLessThanOrEqualTo(@FluentArg("value") Object value) {
         Expression<E> right = ExpressionBuilder.constantExpression(value);
         return PredicateBuilder.isLessThanOrEqualTo(expression, right);
     }
 
-    public Predicate<E> isGreaterThan(Object value) {
+    @Fluent
+    public Predicate<E> isGreaterThan(@FluentArg("value") Object value) {
         Expression<E> right = ExpressionBuilder.constantExpression(value);
         return PredicateBuilder.isGreaterThan(expression, right);
     }
 
-    public Predicate<E> isGreaterThanOrEqualTo(Object value) {
+    @Fluent
+    public Predicate<E> isGreaterThanOrEqualTo(@FluentArg("value") Object value) {
         Expression<E> right = ExpressionBuilder.constantExpression(value);
         return PredicateBuilder.isGreaterThanOrEqualTo(expression, right);
     }
 
-    public Predicate<E> isInstanceOf(Class type) {
+    @Fluent
+    public Predicate<E> isInstanceOf(@FluentArg("class") Class type) {
         return PredicateBuilder.isInstanceOf(expression, type);
     }
 
+    @Fluent
     public Predicate<E> isNull() {
         return PredicateBuilder.isNull(expression);
     }
 
+    @Fluent
     public Predicate<E> isNotNull() {
         return PredicateBuilder.isNotNull(expression);
     }
 
 
-    public Expression<E> getExpression() {
-        return expression;
-    }
 
+    @Fluent
     public ValueBuilder<E> tokenize() {
         return tokenize("\n");
     }
 
-    public ValueBuilder<E> tokenize(String token) {
+    @Fluent
+    public ValueBuilder<E> tokenize(@FluentArg("token") String token) {
         Expression<E> newExp = ExpressionBuilder.tokenizeExpression(expression, token);
         return new ValueBuilder<E>(newExp);
     }

Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyProcessor.java?view=auto&rev=521139
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyProcessor.java (added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyProcessor.java Thu Mar 22 00:03:10 2007
@@ -0,0 +1,31 @@
+/*
+ * 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.builder;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
+public class MyProcessor implements Processor<Exchange> {
+    public void onExchange(Exchange exchange) {
+        System.out.println("Called with exchange: " + exchange);
+    }
+
+    @Override
+    public String toString() {
+        return "MyProcessor";
+    }
+}
\ No newline at end of file

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java Thu Mar 22 00:03:10 2007
@@ -40,16 +40,8 @@
  * @version $Revision$
  */
 public class RouteBuilderTest extends TestSupport {
-    protected Processor<Exchange> myProcessor = new Processor<Exchange>() {
-        public void onExchange(Exchange exchange) {
-            System.out.println("Called with exchange: " + exchange);
-        }
-
-        @Override
-        public String toString() {
-            return "MyProcessor";
-        }
-    };
+	
+	protected Processor<Exchange> myProcessor = new MyProcessor();    	
 	private InterceptorProcessor<Exchange> interceptor1;
 	private InterceptorProcessor<Exchange> interceptor2;
     

Copied: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java (from r521037, activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderAction.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java?view=diff&rev=521139&p1=activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderAction.java&r1=521037&p2=activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderAction.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderAction.java Thu Mar 22 00:03:10 2007
@@ -8,17 +8,17 @@
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
 
-public class RouteBuilderAction {
+public class BuilderAction {
 
 	private final MethodInfo methodInfo;
 	private final HashMap<String, Object> parameterValues;
 
-	public RouteBuilderAction(MethodInfo methodInfo, HashMap<String, Object> parameterValues) {
+	public BuilderAction(MethodInfo methodInfo, HashMap<String, Object> parameterValues) {
 		this.methodInfo = methodInfo;
 		this.parameterValues = parameterValues;
 	}
 
-	public Object invoke(BeanFactory beanFactory, Object builder) {
+	public Object invoke(BeanFactory beanFactory, Object rootBuilder, Object contextBuilder) {
 		SimpleTypeConverter converter = new SimpleTypeConverter();
 		Object args[] = new Object[methodInfo.parameters.size()];
 		int pos=0;
@@ -30,13 +30,17 @@
 				if( value.getClass() == RuntimeBeanReference.class ) {
 					value = beanFactory.getBean(((RuntimeBeanReference)value).getBeanName());
 				}
+				if( value.getClass() == BuilderStatement.class ) {
+					BuilderStatement bs = (BuilderStatement) value;
+					value = bs.create(beanFactory, rootBuilder);
+				}				
 				args[pos] = converter.convertIfNecessary(value, paramClass);				
 			}
 			
 		}
 		
 		try {
-			return methodInfo.method.invoke(builder, args);
+			return methodInfo.method.invoke(contextBuilder, args);
 		} catch (InvocationTargetException e) {
 			throw new IllegalArgumentException(e.getCause());
 		} catch (RuntimeException e) {

Copied: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderStatement.java (from r521037, activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderStatement.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderStatement.java?view=diff&rev=521139&p1=activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderStatement.java&r1=521037&p2=activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderStatement.java&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderStatement.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/BuilderStatement.java Thu Mar 22 00:03:10 2007
@@ -4,26 +4,37 @@
 
 import org.springframework.beans.factory.BeanFactory;
 
-public class RouteBuilderStatement {
-	private ArrayList<RouteBuilderAction> actions;
+public class BuilderStatement {
+	private ArrayList<BuilderAction> actions;
+	private Class returnType;
 
-	public void create(BeanFactory beanFactory, Object builder) {
-		Object currentBuilder = builder;
-		RouteBuilderAction lastAction=null;
-		for (RouteBuilderAction action : actions) {
+	public Object create(BeanFactory beanFactory, Object rootBuilder) {
+		Object currentBuilder = rootBuilder;
+		BuilderAction lastAction=null;
+		for (BuilderAction action : actions) {
 			// The last action may have left us without a builder to invoke next!
-			if( builder == null ) {
-				throw new IllegalArgumentException("Invalid route configuration.  The '"+lastAction.getName()+"' action cannot be followed by the '"+action.getName()+"' action.");
+			if( currentBuilder == null ) {
+				throw new IllegalArgumentException("Invalid configuration.  The '"+lastAction.getName()+"' action cannot be followed by the '"+action.getName()+"' action.");
 			}
-			currentBuilder = action.invoke(beanFactory, currentBuilder);
+			currentBuilder = action.invoke(beanFactory, rootBuilder, currentBuilder);
 			lastAction = action;
 		}
+		return currentBuilder;
 	}
 
-	public ArrayList<RouteBuilderAction> getActions() {
+	public ArrayList<BuilderAction> getActions() {
 		return actions;
 	}
-	public void setActions(ArrayList<RouteBuilderAction> actions) {
+	public void setActions(ArrayList<BuilderAction> actions) {
 		this.actions = actions;
 	}
+
+	public Class getReturnType() {
+		return returnType;
+	}
+	public void setReturnType(Class returnType) {
+		this.returnType = returnType;
+		
+	}
+
 }

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanDefinitionParser.java Thu Mar 22 00:03:10 2007
@@ -7,6 +7,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Set;
@@ -19,6 +20,7 @@
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
 import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.util.StringUtils;
 import org.springframework.util.xml.DomUtils;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
@@ -30,15 +32,15 @@
 
 	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
 		BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(RouteBuilderFactory.class);
-		
+
 		List childElements = DomUtils.getChildElementsByTagName(element, "route");
-		ArrayList<RouteBuilderStatement> routes = new ArrayList<RouteBuilderStatement>(childElements.size());
+		ArrayList<BuilderStatement> routes = new ArrayList<BuilderStatement>(childElements.size());
 
 		if (childElements != null && childElements.size() > 0) {
 			for (int i = 0; i < childElements.size(); ++i) {
 				Element routeElement = (Element) childElements.get(i);
-				RouteBuilderStatement def = parseRouteElement(routeElement);
-				routes.add(def);
+				BuilderStatement statement = parseRouteElement(routeElement);
+				routes.add(statement);
 			}
 		}
 
@@ -46,96 +48,199 @@
 		return factory.getBeanDefinition();
 	}
 
-	/** 
+	/**
 	 * Use reflection to figure out what is the valid next element.
 	 * 
 	 * @param routeElement
 	 * @return
 	 */
-	private RouteBuilderStatement parseRouteElement(Element element) {
-		RouteBuilderStatement rc = new RouteBuilderStatement();
+	private BuilderStatement parseRouteElement(Element element) {
+		BuilderStatement rc = new BuilderStatement();
 		Class currentBuilder = RouteBuilder.class;
-		
+
 		NodeList childElements = element.getChildNodes();
-		ArrayList<RouteBuilderAction> actions = new ArrayList<RouteBuilderAction>(childElements.getLength());
+		ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>(childElements.getLength());
 		if (childElements != null && childElements.getLength() > 0) {
-			Element previousElement=null;
+			Element previousElement = null;
 			for (int i = 0; i < childElements.getLength(); ++i) {
 				Node node = childElements.item(i);
-				if( node.getNodeType() == Node.ELEMENT_NODE ) {
-					currentBuilder = parseAction(currentBuilder, actions, (Element)node, previousElement);
-					previousElement = (Element)node;
+				if (node.getNodeType() == Node.ELEMENT_NODE) {
+					currentBuilder = parseAction(currentBuilder, actions, (Element) node, previousElement);
+					previousElement = (Element) node;
 				}
 			}
 		}
-		
+
+		rc.setReturnType(currentBuilder);
 		rc.setActions(actions);
 		return rc;
 	}
 
-	private Class parseAction(Class currentBuilder, ArrayList<RouteBuilderAction> actions, Element element, Element previousElement) {
-		
+	private Class parseAction(Class currentBuilder, ArrayList<BuilderAction> actions, Element element, Element previousElement) {
+
 		String actionName = element.getLocalName();
-		
+
 		// Get a list of method names that match the action.
-		ArrayList<MethodInfo> methods = findFluentMethodsWithName( currentBuilder, element.getLocalName() );		
-		if( methods.isEmpty() ) {
-			throw new IllegalRouteException(actionName, previousElement==null? null : previousElement.getLocalName());
+		ArrayList<MethodInfo> methods = findFluentMethodsWithName(currentBuilder, element.getLocalName());
+		if (methods.isEmpty()) {
+			throw new IllegalRouteException(actionName, previousElement == null ? null : previousElement.getLocalName());
 		}
-		
-		// Pick the best method out of the list.  Sort by argument length.  Pick first longest match.
-		Collections.sort(methods, new Comparator<MethodInfo>(){
+
+		// Pick the best method out of the list. Sort by argument length. Pick
+		// first longest match.
+		Collections.sort(methods, new Comparator<MethodInfo>() {
 			public int compare(MethodInfo m1, MethodInfo m2) {
-				return m1.method.getParameterTypes().length - m2.method.getParameterTypes().length; 
+				return m1.method.getParameterTypes().length - m2.method.getParameterTypes().length;
 			}
 		});
+
+		// Build the possible list of arguments from the attributes and child
+		// elements
+		HashMap<String, Object> attributeArguments = getArugmentsFromAttributes(element);
+		HashMap<String, ArrayList<Element>> elementArguments = getArgumentsFromElements(element);
+
+		// Find the first method that we can supply arguments for.
+		MethodInfo match = null;
+		match = findMethodMatch(methods, attributeArguments.keySet(), elementArguments.keySet());
+		if (match == null)
+			throw new IllegalRouteException(actionName, previousElement == null ? null : previousElement.getLocalName());
+
+		// Move element arguments into the attributeArguments map if needed. 
+		Set<String> parameterNames = new HashSet<String>(match.parameters.keySet());
+		parameterNames.removeAll(attributeArguments.keySet());
+		for (String key : parameterNames) {
+			ArrayList<Element> elements = elementArguments.get(key);
+			Class clazz = match.parameters.get(key);
+			Object value = convertTo(elements, clazz);
+			attributeArguments.put(key, value);
+			for (Element el : elements) {
+				// remove the argument nodes so that they don't get interpreted as
+				// actions.
+				el.getParentNode().removeChild(el);
+			}
+		}
 		
-		// Build an ordered list of the element attributes.
-		HashMap<String, Object> attributes = getAttributes(element);
-		
-		// Do we have enough parameters for this action.
-		MethodInfo match=findBestMethod(methods, attributes);
-		if( match == null )
-			throw new IllegalRouteException(actionName, previousElement==null? null : previousElement.getLocalName());
-			
-		actions.add( new RouteBuilderAction(match, attributes) );
+		actions.add(new BuilderAction(match, attributeArguments));
 		return match.method.getReturnType();
 	}
 
-	private MethodInfo findBestMethod(ArrayList<MethodInfo> methods, HashMap<String, Object> attributes) {
-		Set<String> attributeNames = attributes.keySet();
-		for (MethodInfo method : methods) {
-			Set<String> parameterNames = method.parameters.keySet();
+	private Object convertTo(ArrayList<Element> elements, Class clazz) {
+
+		if( clazz.isArray() || elements.size() > 1 ) {
+			// TODO: we could support arrays one day soon.
+			throw new IllegalStateException("We don't support injecting array values.");
+		} else {
+			
+			Element element = elements.get(0);
+			String ref = element.getAttribute("ref");
+			if( StringUtils.hasText(ref) ) {
+				return new RuntimeBeanReference(ref);
+			}
 			
-			// If all the parameters are specified as parameters.
-			if(    attributeNames.size()==parameterNames.size() 
-				&& attributeNames.containsAll(parameterNames)) {
+			BuilderStatement statement = parseRouteElement(element);
+			if( !clazz.isAssignableFrom( statement.getReturnType() ) ) {
+				throw new IllegalStateException("Builder does not produce object of expected type: "+clazz.getName());
+			}
+			return statement;
+		}
+	}
+
+	private MethodInfo findMethodMatch(ArrayList<MethodInfo> methods, Set<String> attributeNames, Set<String> elementNames) {
+		for (MethodInfo method : methods) {
+
+			// make sure all the given attribute parameters can be assigned via
+			// attributes
+			boolean miss = false;
+			for (String key : attributeNames) {
+				FluentArg arg = method.annotations.get(key);
+				if (arg == null || !arg.attribute()) {
+					miss = true;
+					break;
+				}
+			}
+			if (miss)
+				continue; // Keep looking...
+
+			Set<String> parameterNames = new HashSet<String>(method.parameters.keySet());
+			parameterNames.removeAll(attributeNames);
+
+			// Bingo we found a match.
+			if (parameterNames.isEmpty()) {
+				return method;
+			}
+
+			// We may still be able to match using elements as parameters.
+			for (String key : elementNames) {
+				if (parameterNames.isEmpty()) {
+					break;
+				}
+				// We only want to use the first child elements as arguments,
+				// once we don't match, we can stop looking.
+				FluentArg arg = method.annotations.get(key);
+				if (arg == null || !arg.element()) {
+					break;
+				}
+				if (!parameterNames.remove(key)) {
+					break;
+				}
+			}
+
+			// All parameters found! We have a match!
+			if (parameterNames.isEmpty()) {
 				return method;
 			}
+
 		}
 		return null;
 	}
 
-	private HashMap<String, Object> getAttributes(Element element) {
+	private LinkedHashMap<String, ArrayList<Element>> getArgumentsFromElements(Element element) {
+		LinkedHashMap<String, ArrayList<Element>> elements = new LinkedHashMap<String, ArrayList<Element>>();
+		NodeList childNodes = element.getChildNodes();
+		String lastTag = null;
+		for (int i = 0; i < childNodes.getLength(); i++) {
+			Node node = childNodes.item(i);
+			if (node.getNodeType() == Node.ELEMENT_NODE) {
+				Element el = (Element) node;
+				String tag = el.getLocalName();
+				ArrayList<Element> els = elements.get(tag);
+				if (els == null) {
+					els = new ArrayList<Element>();
+					elements.put(el.getLocalName(), els);
+					els.add(el);
+					lastTag = tag;
+				} else {
+					// add to array if the elements are consecutive
+					if (tag.equals(lastTag)) {
+						els.add(el);
+						lastTag = tag;
+					}
+				}
+			}
+		}
+		return elements;
+	}
+
+	private HashMap<String, Object> getArugmentsFromAttributes(Element element) {
 		HashMap<String, Object> attributes = new HashMap<String, Object>();
 		NamedNodeMap childNodes = element.getAttributes();
-		for( int i=0; i < childNodes.getLength(); i++) {
+		for (int i = 0; i < childNodes.getLength(); i++) {
 			Node node = childNodes.item(i);
-			if( node.getNodeType() == Node.ATTRIBUTE_NODE ) {
+			if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
 				Attr attr = (Attr) node;
-				
+
 				String str = attr.getValue();
 				Object value = str;
-				
+
 				// If the value starts with # then it's a bean reference
-				if( str.startsWith("#")) {
+				if (str.startsWith("#")) {
 					str = str.substring(1);
 					// Support using ## to escape the bean reference feature.
-					if( !str.startsWith("#")) {
+					if (!str.startsWith("#")) {
 						value = new RuntimeBeanReference(str);
-					}					
+					}
 				}
-				
+
 				attributes.put(attr.getName(), value);
 			}
 		}
@@ -144,8 +249,9 @@
 
 	/**
 	 * Finds all the methods on the clazz that match the name and which have the
-	 * {@see Fluent} annotation and whoes parameters have the {@see FluentArg} annotation.
-	 *  
+	 * {@see Fluent} annotation and whoes parameters have the {@see FluentArg}
+	 * annotation.
+	 * 
 	 * @param clazz
 	 * @param name
 	 * @return
@@ -155,30 +261,31 @@
 		Method[] methods = clazz.getMethods();
 		for (int i = 0; i < methods.length; i++) {
 			Method method = methods[i];
-			if( name.equals(method.getName())) {
-				
-				if( !method.isAnnotationPresent(Fluent.class) ) {
+			if (name.equals(method.getName())) {
+
+				if (!method.isAnnotationPresent(Fluent.class)) {
 					List<Annotation> l = Arrays.asList(method.getAnnotations());
 					System.out.println(l);
 					continue;
 				}
-				
-				
+
 				LinkedHashMap<String, Class> map = new LinkedHashMap<String, Class>();
+				LinkedHashMap<String, FluentArg> amap = new LinkedHashMap<String, FluentArg>();
 				Class<?>[] parameters = method.getParameterTypes();
 				for (int j = 0; j < parameters.length; j++) {
 					Class<?> parameter = parameters[j];
 					FluentArg annotation = getParameterAnnotation(FluentArg.class, method, j);
-					if( annotation!=null ) {
+					if (annotation != null) {
 						map.put(annotation.value(), parameter);
+						amap.put(annotation.value(), annotation);
 					} else {
 						break;
 					}
 				}
-				
+
 				// If all the parameters were annotated...
-				if( parameters.length == map.size() ) {
-					rc.add(new MethodInfo(method, map));
+				if (parameters.length == map.size()) {
+					rc.add(new MethodInfo(method, map, amap));
 				}
 			}
 		}
@@ -188,8 +295,8 @@
 	private <T> T getParameterAnnotation(Class<T> annotationClass, Method method, int index) {
 		Annotation[] annotations = method.getParameterAnnotations()[index];
 		for (int i = 0; i < annotations.length; i++) {
-			if( annotationClass.isAssignableFrom(annotations[i].getClass()) ) {
-				return (T)annotations[i];
+			if (annotationClass.isAssignableFrom(annotations[i].getClass())) {
+				return (T) annotations[i];
 			}
 		}
 		return null;

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/MethodInfo.java Thu Mar 22 00:03:10 2007
@@ -6,15 +6,17 @@
 import java.lang.reflect.Method;
 import java.util.LinkedHashMap;
 
-import org.springframework.beans.BeanWrapperImpl;
+import org.apache.camel.builder.FluentArg;
 
 public class MethodInfo {
 	final Method method;
 	final LinkedHashMap<String, Class> parameters;
+	final LinkedHashMap<String, FluentArg> annotations;
 	
-	public MethodInfo(Method method, LinkedHashMap<String, Class> parameters) {
+	public MethodInfo(Method method, LinkedHashMap<String, Class> parameters, LinkedHashMap<String, FluentArg> annotations) {
 		this.method=method;
 		this.parameters=parameters;
+		this.annotations = annotations;
 	}
 
 	public String getName() {

Modified: activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderFactory.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderFactory.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderFactory.java (original)
+++ activemq/camel/trunk/camel-spring/src/main/java/org/apache/camel/spring/RouteBuilderFactory.java Thu Mar 22 00:03:10 2007
@@ -9,25 +9,25 @@
 import org.springframework.beans.factory.FactoryBean;
 
 public class RouteBuilderFactory implements FactoryBean, BeanFactoryAware {
-	private ArrayList<RouteBuilderStatement> routes;
+	private ArrayList<BuilderStatement> routes;
 	private boolean singleton;
 	private BeanFactory beanFactory;
 
 	class SpringRouteBuilder extends RouteBuilder {
-		private ArrayList<RouteBuilderStatement> routes;
+		private ArrayList<BuilderStatement> routes;
 		private BeanFactory beanFactory;
 
 		@Override
 		public void configure() {
-			for (RouteBuilderStatement routeFactory : routes) {
+			for (BuilderStatement routeFactory : routes) {
 				routeFactory.create(beanFactory, this);
 			}
 		}
 
-		public ArrayList<RouteBuilderStatement> getRoutes() {
+		public ArrayList<BuilderStatement> getRoutes() {
 			return routes;
 		}
-		public void setRoutes(ArrayList<RouteBuilderStatement> routes) {
+		public void setRoutes(ArrayList<BuilderStatement> routes) {
 			this.routes = routes;
 		}
 
@@ -54,10 +54,10 @@
 		this.singleton = singleton;
 	}
 
-	public ArrayList<RouteBuilderStatement> getRoutes() {
+	public ArrayList<BuilderStatement> getRoutes() {
 		return routes;
 	}
-	public void setRoutes(ArrayList<RouteBuilderStatement> routes) {
+	public void setRoutes(ArrayList<BuilderStatement> routes) {
 		this.routes = routes;
 	}
 

Modified: activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd (original)
+++ activemq/camel/trunk/camel-spring/src/main/resources/org/apache/camel/spring/camel-1.0.xsd Thu Mar 22 00:03:10 2007
@@ -97,7 +97,7 @@
     <xs:complexType>
       <xs:sequence>
         <xs:element ref="c:header"/>
-        <xs:element ref="c:equalTo"/>
+        <xs:element ref="c:isEqualTo"/>
       </xs:sequence>
     </xs:complexType>
   </xs:element>
@@ -106,7 +106,7 @@
       <xs:attribute name="name" use="required" type="xs:NCName"/>
     </xs:complexType>
   </xs:element>
-  <xs:element name="equalTo">
+  <xs:element name="isEqualTo">
     <xs:complexType>
       <xs:attribute name="value" use="required" type="xs:NCName"/>
     </xs:complexType>

Modified: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java (original)
+++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/SpringRouteBuilderTest.java Thu Mar 22 00:03:10 2007
@@ -61,8 +61,10 @@
 	
 	@Override
 	protected RouteBuilder<Exchange> buildCustomProcessorWithFilter() {
-		// TODO Auto-generated method stub
-		return super.buildCustomProcessorWithFilter();
+		myProcessor = (Processor<Exchange>) ctx.getBean("myProcessor");
+		RouteBuilder<Exchange> builder = (RouteBuilder<Exchange>) ctx.getBean("buildCustomProcessorWithFilter");
+		assertNotNull(builder);
+		return builder;
 	}
 	
 	@Override

Modified: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml (original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/examples.xml Thu Mar 22 00:03:10 2007
@@ -21,6 +21,11 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
     ">
+    
+    <!--  
+          put all combinations of possible usages in this file so that XML->XSD converters
+          (like trang) can generate a pretty good XSD.
+     -->
 
     <routeBuilder id="buildSimpleRoute" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
     </routeBuilder>
@@ -53,13 +58,13 @@
          <filter>
              <predicate>
                 <header name="foo"/>
-                <equalTo value="bar"/>
+                <isEqualTo value="bar"/>
              </predicate>
          </filter>
          <filter>
              <predicate>
                 <header name="foo"/>
-                <equalTo value="bar"/>
+                <isEqualTo value="bar"/>
              </predicate>
          </filter>
          <process ref="#myProcessor"/>
@@ -84,14 +89,14 @@
              <when>
                  <predicate>
                     <header name="foo"/>
-                    <equalTo value="bar"/>
+                    <isEqualTo value="bar"/>
                  </predicate>
                  <to uri="queue:b"/>
              </when>
              <when>
                  <predicate>
                     <header name="foo"/>
-                    <equalTo value="cheese"/>
+                    <isEqualTo value="cheese"/>
                  </predicate>
                  <to endpoint="queue:c"/>
              </when>
@@ -106,7 +111,7 @@
          <filter>
              <predicate>
                 <header name="foo"/>
-                <equalTo value="bar"/>
+                <isEqualTo value="bar"/>
              </predicate>
          </filter>
          <to uri="queue:b"/>

Modified: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml?view=diff&rev=521139&r1=521138&r2=521139
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml (original)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/spring_route_builder_test.xml Thu Mar 22 00:03:10 2007
@@ -44,23 +44,19 @@
     </routeBuilder>
 
     <!-- 
-        from("queue:a").filter(headerEquals("foo", "bar")).process(myProcessor);
+        from("queue:a").filter(header("foo").isEqualTo("bar")).process(myProcessor);
      -->
     <routeBuilder id="buildCustomProcessorWithFilter" xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
-    <!-- 
        <route>
          <from uri="queue:a"/>
          <filter>
-             <predicate>
-                <header name="foo"/>
-                <equalTo value="bar"/>
-             </predicate>
+           <predicate>
+             <header name="foo"/>
+             <isEqualTo value="bar"/>
+           </predicate>
          </filter>
-         <processor>
-           <s:bean class="some.Processor"/>
-         </processor>
+         <process ref="#myProcessor"/>
        </route>
-     -->
     </routeBuilder>
 
     <!-- 



Mime
View raw message