camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r552469 [2/3] - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/util/ components/camel-spring/src/main/java/org/apache/camel/component/ components/camel-spring/src/main/java/org/apache/camel/component/bean/ components/ca...
Date Mon, 02 Jul 2007 11:23:16 GMT
Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java Mon Jul  2 04:23:12 2007
@@ -17,19 +17,6 @@
  */
 package org.apache.camel.spring.xml;
 
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-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;
-import java.util.Map;
-
 import org.apache.camel.Expression;
 import org.apache.camel.builder.Fluent;
 import org.apache.camel.builder.FluentArg;
@@ -37,10 +24,8 @@
 import org.apache.camel.builder.ValueBuilder;
 import org.springframework.beans.SimpleTypeConverter;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.support.AbstractBeanDefinition;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.ChildBeanDefinition;
 import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.springframework.util.StringUtils;
@@ -51,6 +36,18 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+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.Map;
+import java.util.Set;
+
 public class CamelBeanDefinitionParser extends AbstractBeanDefinitionParser {
     private final CamelNamespaceHandler namespaceHandler;
     private int counter;
@@ -60,113 +57,114 @@
     }
 
     protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
-		BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(RouteBuilderFactoryBean.class);
+        BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(RouteBuilderFactoryBean.class);
 
-		List childElements = DomUtils.getChildElementsByTagName(element, "route");
-		ArrayList<BuilderStatement> routes = new ArrayList<BuilderStatement>(childElements.size());
+        List childElements = DomUtils.getChildElementsByTagName(element, "route");
+        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);
-
-				ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>();
-				Class type = parseBuilderElement(parserContext, routeElement, RouteBuilder.class, actions);
-				BuilderStatement statement = new BuilderStatement();
-				statement.setReturnType(type);
-				statement.setActions(actions);
-				routes.add(statement);
-			}
-		}
+        if (childElements != null && childElements.size() > 0) {
+            for (int i = 0; i < childElements.size(); ++i) {
+                Element routeElement = (Element) childElements.get(i);
+
+                ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>();
+                Class type = parseBuilderElement(parserContext, routeElement, RouteBuilder.class, actions);
+                BuilderStatement statement = new BuilderStatement();
+                statement.setReturnType(type);
+                statement.setActions(actions);
+                routes.add(statement);
+            }
+        }
 
-		factory.addPropertyValue("routes", routes);
-		return factory.getBeanDefinition();
-	}
-
-	/**
-	 * Use reflection to figure out what is the valid next element.
-	 */
-	private Class parseBuilderElement(ParserContext parserContext, Element element, Class<RouteBuilder> builder, ArrayList<BuilderAction> actions) {
-		Class currentBuilder = builder;
-		NodeList childElements = element.getChildNodes();
-		Element previousElement = null;
-		for (int i = 0; i < childElements.getLength(); ++i) {
-			Node node = childElements.item(i);
-			if (node.getNodeType() == Node.ELEMENT_NODE) {
-				currentBuilder = parseAction(parserContext, currentBuilder, actions, (Element) node, previousElement);
-				previousElement = (Element) node;
-				BuilderAction action = actions.get(actions.size()-1);
-				
-				if( action.getMethodInfo().methodAnnotation.nestedActions() ) {
-					currentBuilder = parseBuilderElement(parserContext, (Element) node, currentBuilder, actions);
-				} else {
-					// Make sure the there are no child elements.
-					if( hasChildElements(node) ) {
-						throw new IllegalArgumentException("The element "+node.getLocalName()+" should not have any child elements.");
-					}
-				}
-				
-			}
-		}
-		
-		// Add the builder actions that are annotated with @Fluent(callOnElementEnd=true) 
-		if( currentBuilder!=null ) {
-			Method[] methods = currentBuilder.getMethods();
-			for (int i = 0; i < methods.length; i++) {
-				Method method = methods[i];
-				Fluent annotation = method.getAnnotation(Fluent.class);
-				if( annotation!=null && annotation.callOnElementEnd() ) {
-					
-					if( method.getParameterTypes().length > 0 ) {
-						throw new RuntimeException("Only methods with no parameters can annotated with @Fluent(callOnElementEnd=true): "+method); 
-					}
-					
-					MethodInfo methodInfo = new MethodInfo(method, annotation, new LinkedHashMap<String, Class>(), new LinkedHashMap<String, FluentArg>());
-					actions.add(new BuilderAction(methodInfo, new HashMap<String, Object>()));
-					currentBuilder = method.getReturnType();
-				}
-			}
-		}
-		return currentBuilder;
-	}
-
-	private boolean hasChildElements(Node node) {
-		NodeList nl = node.getChildNodes();
-		for (int j = 0; j < nl.getLength(); ++j) {
-			if( nl.item(j).getNodeType() == Node.ELEMENT_NODE ) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	private Class parseAction(ParserContext parserContext, 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 IllegalActionException(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>() {
-			public int compare(MethodInfo m1, MethodInfo m2) {
-				return m1.method.getParameterTypes().length - m2.method.getParameterTypes().length;
-			}
-		});
+        factory.addPropertyValue("routes", routes);
+        return factory.getBeanDefinition();
+    }
+
+    /**
+     * Use reflection to figure out what is the valid next element.
+     */
+    private Class parseBuilderElement(ParserContext parserContext, Element element, Class<RouteBuilder> builder, ArrayList<BuilderAction> actions) {
+        Class currentBuilder = builder;
+        NodeList childElements = element.getChildNodes();
+        Element previousElement = null;
+        for (int i = 0; i < childElements.getLength(); ++i) {
+            Node node = childElements.item(i);
+            if (node.getNodeType() == Node.ELEMENT_NODE) {
+                currentBuilder = parseAction(parserContext, currentBuilder, actions, (Element) node, previousElement);
+                previousElement = (Element) node;
+                BuilderAction action = actions.get(actions.size() - 1);
+
+                if (action.getMethodInfo().methodAnnotation.nestedActions()) {
+                    currentBuilder = parseBuilderElement(parserContext, (Element) node, currentBuilder, actions);
+                }
+                else {
+                    // Make sure the there are no child elements.
+                    if (hasChildElements(node)) {
+                        throw new IllegalArgumentException("The element " + node.getLocalName() + " should not have any child elements.");
+                    }
+                }
+            }
+        }
+
+        // Add the builder actions that are annotated with @Fluent(callOnElementEnd=true)
+        if (currentBuilder != null) {
+            Method[] methods = currentBuilder.getMethods();
+            for (int i = 0; i < methods.length; i++) {
+                Method method = methods[i];
+                Fluent annotation = method.getAnnotation(Fluent.class);
+                if (annotation != null && annotation.callOnElementEnd()) {
+
+                    if (method.getParameterTypes().length > 0) {
+                        throw new RuntimeException("Only methods with no parameters can annotated with @Fluent(callOnElementEnd=true): " + method);
+                    }
+
+                    MethodInfo methodInfo = new MethodInfo(method, annotation, new LinkedHashMap<String, Class>(), new LinkedHashMap<String, FluentArg>());
+                    actions.add(new BuilderAction(methodInfo, new HashMap<String, Object>()));
+                    currentBuilder = method.getReturnType();
+                }
+            }
+        }
+        return currentBuilder;
+    }
+
+    private boolean hasChildElements(Node node) {
+        NodeList nl = node.getChildNodes();
+        for (int j = 0; j < nl.getLength(); ++j) {
+            if (nl.item(j).getNodeType() == Node.ELEMENT_NODE) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private Class parseAction(ParserContext parserContext, 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 IllegalActionException(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>() {
+            public int compare(MethodInfo m1, MethodInfo m2) {
+                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 IllegalActionException(actionName, previousElement == null ? null : previousElement.getLocalName());
+        // 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 IllegalActionException(actionName, previousElement == null ? null : previousElement.getLocalName());
+        }
 
         // lets convert any references
         Set<Map.Entry<String, Object>> attributeEntries = attributeArguments.entrySet();
@@ -182,26 +180,26 @@
         }
 
         // 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);
+        Set<String> parameterNames = new HashSet<String>(match.parameters.keySet());
+        parameterNames.removeAll(attributeArguments.keySet());
+        for (String key : parameterNames) {
+            ArrayList<Element> elements = elementArguments.get(key);
             if (elements == null) {
                 elements = getFirstChildElements(element);
             }
             Class clazz = match.parameters.get(key);
-			Object value = convertTo(parserContext, 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);
-			}
-		}
-		
-		actions.add(new BuilderAction(match, attributeArguments));
-		return match.method.getReturnType();
-	}
+            Object value = convertTo(parserContext, 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);
+            }
+        }
+
+        actions.add(new BuilderAction(match, attributeArguments));
+        return match.method.getReturnType();
+    }
 
     private ArrayList<Element> getFirstChildElements(Element element) {
         ArrayList<Element> answer = new ArrayList<Element>();
@@ -218,16 +216,16 @@
 
     private Object convertTo(ParserContext parserContext, ArrayList<Element> elements, Class clazz) {
 
-		if( clazz.isArray() || elements.size() > 1 ) {
+        if (clazz.isArray() || elements.size() > 1) {
             List list = new ArrayList();
-			for( int i=0; i < elements.size(); i ++ ) {
-				ArrayList<Element> e = new ArrayList<Element>(1);
-				e.add(elements.get(i));
-				Object value = convertTo(parserContext, e, clazz.getComponentType());
+            for (int i = 0; i < elements.size(); i++) {
+                ArrayList<Element> e = new ArrayList<Element>(1);
+                e.add(elements.get(i));
+                Object value = convertTo(parserContext, e, clazz.getComponentType());
 
                 list.add(value);
-			}
-			return list;
+            }
+            return list;
             /*
             Object array = Array.newInstance(clazz.getComponentType(), elements.size());
 			for( int i=0; i < elements.size(); i ++ ) {
@@ -239,42 +237,45 @@
 			}
 			return array;
 			*/
-		} else {
-			
-			Element element = elements.get(0);
-			String ref = element.getAttribute("ref");
-			if( StringUtils.hasText(ref) ) {
-				return new RuntimeBeanReference(ref);
-			}
-			
-			// Use a builder to create the value..
-			if( hasChildElements(element) ) {
-				
-				ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>();
-				Class type = parseBuilderElement(parserContext, element, RouteBuilder.class, actions);
-
-				if ( type == ValueBuilder.class && clazz==Expression.class ) {					
-					Method method;
-					try {
-						method = ValueBuilder.class.getMethod("getExpression", new Class[]{});
-					} catch (Throwable e) {
-						throw new RuntimeException(ValueBuilder.class.getName()+" does not have the getExpression() method.");
-					}
-					MethodInfo methodInfo = new MethodInfo(method, null, new LinkedHashMap<String, Class>(), new LinkedHashMap<String, FluentArg>());
-					actions.add(new BuilderAction(methodInfo, new HashMap<String, Object>()));
-					type = Expression.class;
-				} 
-				
-				BuilderStatement statement = new BuilderStatement();
-				statement.setReturnType(type);
-				statement.setActions(actions);
-				
-				if( !clazz.isAssignableFrom( statement.getReturnType() ) ) {					
-					throw new IllegalStateException("Builder does not produce object of expected type: "+clazz.getName()+", it produced: "+statement.getReturnType());
-				}
-				
-				return statement;
-			} else {
+        }
+        else {
+
+            Element element = elements.get(0);
+            String ref = element.getAttribute("ref");
+            if (StringUtils.hasText(ref)) {
+                return new RuntimeBeanReference(ref);
+            }
+
+            // Use a builder to create the value..
+            if (hasChildElements(element)) {
+
+                ArrayList<BuilderAction> actions = new ArrayList<BuilderAction>();
+                Class type = parseBuilderElement(parserContext, element, RouteBuilder.class, actions);
+
+                if (type == ValueBuilder.class && clazz == Expression.class) {
+                    Method method;
+                    try {
+                        method = ValueBuilder.class.getMethod("getExpression", new Class[]{});
+                    }
+                    catch (Throwable e) {
+                        throw new RuntimeException(ValueBuilder.class.getName() + " does not have the getExpression() method.");
+                    }
+                    MethodInfo methodInfo = new MethodInfo(method, null, new LinkedHashMap<String, Class>(), new LinkedHashMap<String, FluentArg>());
+                    actions.add(new BuilderAction(methodInfo, new HashMap<String, Object>()));
+                    type = Expression.class;
+                }
+
+                BuilderStatement statement = new BuilderStatement();
+                statement.setReturnType(type);
+                statement.setActions(actions);
+
+                if (!clazz.isAssignableFrom(statement.getReturnType())) {
+                    throw new IllegalStateException("Builder does not produce object of expected type: " + clazz.getName() + ", it produced: " + statement.getReturnType());
+                }
+
+                return statement;
+            }
+            else {
                 // if we are on an element which has a custom parser, lets use that.
                 String name = element.getLocalName();
                 if (namespaceHandler.getParserElementNames().contains(name)) {
@@ -285,41 +286,42 @@
                 }
 
                 // Just use the text in the element as the value.
-				SimpleTypeConverter converter = new SimpleTypeConverter();
-				return converter.convertIfNecessary(element.getTextContent(), clazz);
-			}
-		}
-	}
+                SimpleTypeConverter converter = new SimpleTypeConverter();
+                return converter.convertIfNecessary(element.getTextContent(), clazz);
+            }
+        }
+    }
 
     protected synchronized String createBeanId(String name) {
         return "_internal:camel:bean:" + name + (++counter);
     }
 
     private MethodInfo findMethodMatch(ArrayList<MethodInfo> methods, Set<String> attributeNames, Set<String> elementNames) {
-		for (MethodInfo method : methods) {
+        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.parameterAnnotations.get(key);
-				if (arg == null || !arg.attribute()) {
-					miss = true;
-					break;
-				}
-			}
-			if (miss)
-				continue; // Keep looking...
+            // make sure all the given attribute parameters can be assigned via
+            // attributes
+            boolean miss = false;
+            for (String key : attributeNames) {
+                FluentArg arg = method.parameterAnnotations.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);
+            Set<String> parameterNames = new HashSet<String>(method.parameters.keySet());
+            parameterNames.removeAll(attributeNames);
 
-			// Bingo we found a match.
-			if (parameterNames.isEmpty()) {
-				return method;
-			}
+            // Bingo we found a match.
+            if (parameterNames.isEmpty()) {
+                return method;
+            }
 
-			// We may still be able to match using elements as parameters.
+            // We may still be able to match using elements as parameters.
             /*
             for (String key : elementNames) {
 				if (parameterNames.isEmpty()) {
@@ -343,116 +345,118 @@
 			*/
             return method;
         }
-		return null;
-	}
+        return null;
+    }
 
-	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++) {
-			Node node = childNodes.item(i);
-			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("#")) {
-					str = str.substring(1);
-					// Support using ## to escape the bean reference feature.
-					if (!str.startsWith("#")) {
-						value = new RuntimeBeanReference(str);
-					}
-				}
+    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;
+    }
 
-				attributes.put(attr.getName(), value);
-			}
-		}
-		return attributes;
-	}
-
-	/**
-	 * 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.
-	 * 
-	 * @param clazz
-	 * @param name
-	 * @return
-	 */
-	private ArrayList<MethodInfo> findFluentMethodsWithName(Class clazz, String name) {
-		ArrayList<MethodInfo> rc = new ArrayList<MethodInfo>();
-		Method[] methods = clazz.getMethods();
-		for (int i = 0; i < methods.length; i++) {
-			Method method = methods[i];
-			if (!method.isAnnotationPresent(Fluent.class)) {
-				continue;
-			}
-			
-			// Use the fluent supplied name for the action, or the method name if not set.
-			Fluent fluentAnnotation = method.getAnnotation(Fluent.class);
-			if ( StringUtils.hasText(fluentAnnotation.value()) ? 
-					name.equals(fluentAnnotation.value()) :
-					name.equals(method.getName()) ) {
-
-				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) {
-						map.put(annotation.value(), parameter);
-						amap.put(annotation.value(), annotation);
-					} else {
-						break;
-					}
-				}
+    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++) {
+            Node node = childNodes.item(i);
+            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("#")) {
+                    str = str.substring(1);
+                    // Support using ## to escape the bean reference feature.
+                    if (!str.startsWith("#")) {
+                        value = new RuntimeBeanReference(str);
+                    }
+                }
 
-				// If all the parameters were annotated...
-				if (parameters.length == map.size()) {
-					rc.add(new MethodInfo(method, fluentAnnotation, map, amap));
-				}
-			}
-		}
-		return rc;
-	}
-
-	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];
-			}
-		}
+                attributes.put(attr.getName(), value);
+            }
+        }
+        return attributes;
+    }
+
+    /**
+     * 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.
+     *
+     * @param clazz
+     * @param name
+     * @return
+     */
+    private ArrayList<MethodInfo> findFluentMethodsWithName(Class clazz, String name) {
+        ArrayList<MethodInfo> rc = new ArrayList<MethodInfo>();
+        Method[] methods = clazz.getMethods();
+        for (int i = 0; i < methods.length; i++) {
+            Method method = methods[i];
+            if (!method.isAnnotationPresent(Fluent.class)) {
+                continue;
+            }
+
+            // Use the fluent supplied name for the action, or the method name if not set.
+            Fluent fluentAnnotation = method.getAnnotation(Fluent.class);
+            if (StringUtils.hasText(fluentAnnotation.value()) ?
+                    name.equals(fluentAnnotation.value()) :
+                    name.equals(method.getName())) {
+
+                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) {
+                        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, fluentAnnotation, map, amap));
+                }
+            }
+        }
+        return rc;
+    }
+
+    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];
+            }
+        }
 		return null;
 	}
 

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java Mon Jul  2 04:23:12 2007
@@ -17,11 +17,12 @@
  */
 package org.apache.camel.spring.xml;
 
+import org.apache.camel.builder.xml.XPathBuilder;
+import org.apache.camel.spring.CamelBeanPostProcessor;
 import org.apache.camel.spring.CamelContextFactoryBean;
 import org.apache.camel.spring.EndpointFactoryBean;
-import org.apache.camel.spring.CamelBeanPostProcessor;
-import static org.apache.camel.util.ObjectHelper.isNotNullOrBlank;
-import org.apache.camel.builder.xml.XPathBuilder;
+import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.ObjectHelper.isNotNullAndNonEmpty;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
 import org.springframework.beans.factory.parsing.BeanComponentDefinition;
@@ -33,8 +34,8 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import java.util.Set;
 import java.util.HashSet;
+import java.util.Set;
 
 public class CamelNamespaceHandler extends NamespaceHandlerSupport {
     protected CamelBeanDefinitionParser routesParser = new CamelBeanDefinitionParser(this);
@@ -54,6 +55,12 @@
 
                 String contextId = element.getAttribute("id");
 
+                // lets avoid folks having to explicitly give an ID to a camel context
+                if (ObjectHelper.isNullOrBlank(contextId)) {
+                    contextId = "camelContext";
+                    element.setAttribute("id", contextId);
+                }
+
                 Element routes = element.getOwnerDocument().createElement("routes");
                 // now lets move all the content there...
                 NodeList list = element.getChildNodes();
@@ -85,7 +92,7 @@
                     Element node = (Element) list.item(i);
                     definition = endpointParser.parse(node, parserContext);
                     String id = node.getAttribute("id");
-                    if (isNotNullOrBlank(id)) {
+                    if (isNotNullAndNonEmpty(id)) {
                         definition.getPropertyValues().addPropertyValue("context", new RuntimeBeanReference(contextId));
                         //definition.getPropertyValues().addPropertyValue("context", builder.getBeanDefinition());
                         parserContext.registerComponent(new BeanComponentDefinition(definition, id));
@@ -104,7 +111,6 @@
                 builder.addPropertyValue("namespacesFromDom", element);
             }
         });
-
 
         // scripting expressions
         registerScriptParser("script", null);

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/IllegalActionException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/IllegalActionException.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/IllegalActionException.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/IllegalActionException.java Mon Jul  2 04:23:12 2007
@@ -18,20 +18,19 @@
 package org.apache.camel.spring.xml;
 
 public class IllegalActionException extends IllegalArgumentException {
+    private static final long serialVersionUID = -2166507687211986107L;
+    private final String actionName;
+    private final String previousAction;
 
-	private static final long serialVersionUID = -2166507687211986107L;
-	private final String actionName;
-	private final String previousAction;
+    public IllegalActionException(String actionName, String previousAction) {
+        super("Illegal route.");
+        this.actionName = actionName;
+        this.previousAction = previousAction;
+    }
 
-	public IllegalActionException(String actionName, String previousAction) {
-		super("Illegal route.");
-		this.actionName = actionName;
-		this.previousAction = previousAction;
-	}
-
-	@Override
-	public String getMessage() {
-		String errorContext = previousAction==null ? "as the starting action." : "after action '"+previousAction+"'.";
-		return super.getMessage() + "The action '"+actionName+"' cannot be used "+errorContext;
-	}
+    @Override
+    public String getMessage() {
+        String errorContext = previousAction == null ? "as the starting action." : "after action '" + previousAction + "'.";
+        return super.getMessage() + "The action '" + actionName + "' cannot be used " + errorContext;
+    }
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/MethodInfo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/MethodInfo.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/MethodInfo.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/MethodInfo.java Mon Jul  2 04:23:12 2007
@@ -17,27 +17,26 @@
  */
 package org.apache.camel.spring.xml;
 
-import java.lang.reflect.Method;
-import java.util.LinkedHashMap;
-
 import org.apache.camel.builder.Fluent;
 import org.apache.camel.builder.FluentArg;
 
+import java.lang.reflect.Method;
+import java.util.LinkedHashMap;
+
 public class MethodInfo {
-	
-	final Method method;
-	final Fluent methodAnnotation;
-	final LinkedHashMap<String, Class> parameters;
-	final LinkedHashMap<String, FluentArg> parameterAnnotations;
-	
-	public MethodInfo(Method method, Fluent fluentAnnotation, LinkedHashMap<String, Class> parameters, LinkedHashMap<String, FluentArg> annotations) {
-		this.method=method;
-		this.methodAnnotation = fluentAnnotation;
-		this.parameters=parameters;
-		this.parameterAnnotations = annotations;
-	}
+    final Method method;
+    final Fluent methodAnnotation;
+    final LinkedHashMap<String, Class> parameters;
+    final LinkedHashMap<String, FluentArg> parameterAnnotations;
+
+    public MethodInfo(Method method, Fluent fluentAnnotation, LinkedHashMap<String, Class> parameters, LinkedHashMap<String, FluentArg> annotations) {
+        this.method = method;
+        this.methodAnnotation = fluentAnnotation;
+        this.parameters = parameters;
+        this.parameterAnnotations = annotations;
+    }
 
-	public String getName() {
-		return method.getName();
-	}
+    public String getName() {
+        return method.getName();
+    }
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java Mon Jul  2 04:23:12 2007
@@ -17,52 +17,52 @@
  */
 package org.apache.camel.spring.xml;
 
-import static org.apache.camel.util.ObjectHelper.notNull;
-
-import java.util.ArrayList;
-
 import org.apache.camel.CamelContext;
+import static org.apache.camel.util.ObjectHelper.notNull;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.BeanFactoryAware;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.InitializingBean;
 
+import java.util.ArrayList;
+
 /**
  * A {@link FactoryBean} which creates a RouteBuilder by parsing an XML file. This factory bean
  * must be injected with a context and will then install the rules in the context when the routing rules
- * are created. 
+ * are created.
  *
  * @version $Revision: 521369 $
  */
 public class RouteBuilderFactoryBean implements FactoryBean, BeanFactoryAware, InitializingBean {
-	private ArrayList<BuilderStatement> routes;
-	private BeanFactory beanFactory;
+    private ArrayList<BuilderStatement> routes;
+    private BeanFactory beanFactory;
     private CamelContext context;
     private StatementRouteBuilder builder = new StatementRouteBuilder();
 
     public Object getObject() throws Exception {
         return builder;
-	}
+    }
 
-	public Class getObjectType() {
-		return StatementRouteBuilder.class;
-	}
-
-	public boolean isSingleton() {
-		return true;
-	}
-
-	public ArrayList<BuilderStatement> getRoutes() {
-		return routes;
-	}
-	public void setRoutes(ArrayList<BuilderStatement> routes) {
-		this.routes = routes;
-	}
-
-	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
-		this.beanFactory = beanFactory;
-	}
+    public Class getObjectType() {
+        return StatementRouteBuilder.class;
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public ArrayList<BuilderStatement> getRoutes() {
+        return routes;
+    }
+
+    public void setRoutes(ArrayList<BuilderStatement> routes) {
+        this.routes = routes;
+    }
+
+    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
+        this.beanFactory = beanFactory;
+    }
 
     public CamelContext getContext() {
         return context;
@@ -75,8 +75,8 @@
     public void afterPropertiesSet() throws Exception {
         notNull(context, "context");
         notNull(routes, "routes");
-		builder.setBeanFactory(beanFactory);
-		builder.setRoutes(routes);
+        builder.setBeanFactory(beanFactory);
+        builder.setRoutes(routes);
 
         // now lets install the routes in the context
         context.addRoutes(builder);

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/ScriptDefinitionParser.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/ScriptDefinitionParser.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/ScriptDefinitionParser.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/ScriptDefinitionParser.java Mon Jul  2 04:23:12 2007
@@ -24,6 +24,7 @@
 
 /**
  * A parser of the various scripting language expressions
+ *
  * @version $Revision: 1.1 $
  */
 public class ScriptDefinitionParser extends LazyLoadingBeanDefinitionParser {
@@ -48,5 +49,4 @@
             builder.addPropertyValue("scriptText", scriptText);
         }
     }
-
 }

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/StatementRouteBuilder.java Mon Jul  2 04:23:12 2007
@@ -18,7 +18,6 @@
 package org.apache.camel.spring.xml;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.springframework.beans.factory.InitializingBean;
 import org.springframework.beans.factory.BeanFactory;
 
 import java.util.ArrayList;
@@ -29,8 +28,8 @@
  * the {@link RouteBuilderFactoryBean}
  *
  * @version $Revision: 1.1 $
-*/
-public class StatementRouteBuilder extends RouteBuilder  {
+ */
+public class StatementRouteBuilder extends RouteBuilder {
     private ArrayList<BuilderStatement> routes;
     private BeanFactory beanFactory;
 
@@ -44,6 +43,7 @@
     public ArrayList<BuilderStatement> getRoutes() {
         return routes;
     }
+
     public void setRoutes(ArrayList<BuilderStatement> routes) {
         this.routes = routes;
     }

Added: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java?view=auto&rev=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java (added)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java Mon Jul  2 04:23:12 2007
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.component.event;
+
+import org.springframework.context.ApplicationEvent;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class DummyEvent extends ApplicationEvent {
+    private final String text;
+
+    public DummyEvent(Object source, String text) {
+        super(source);
+        this.text = text;
+    }
+
+    public String getText() {
+        return text;
+    }
+}

Propchange: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/EventRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/EventRouteTest.java?view=auto&rev=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/EventRouteTest.java (added)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/EventRouteTest.java Mon Jul  2 04:23:12 2007
@@ -0,0 +1,59 @@
+/**
+ *
+ * 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.component.event;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class EventRouteTest extends SpringTestSupport {
+    protected Object expectedBody = "Hello there!";
+    protected String uri = "event:default";
+
+    public void testSendingCamelExchangeToEndpointResultsInValidApplicationEventAfterTheRefreshEvent() throws Exception {
+        MockEndpoint result = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+        result.expectedMessageCount(2);
+
+        template.sendBody(uri, expectedBody, "cheese", 123);
+
+        result.assertIsSatisfied();
+
+        // lets test we receive the context refreshed event
+        Exchange exchange = result.getReceivedExchanges().get(0);
+        Object body = exchange.getIn().getBody(ContextRefreshedEvent.class);
+        log.info("Received body: " + body);
+        assertNotNull(body);
+
+        // lets test we receive the camel event
+        exchange = result.getReceivedExchanges().get(1);
+        body = exchange.getIn().getBody();
+        log.info("Received body: " + body);
+        CamelEvent event = assertIsInstanceOf(CamelEvent.class, body);
+        Object actualBody = event.getExchange().getIn().getBody();
+        assertEquals("Received event body", expectedBody, actualBody);
+    }
+
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/event/camelContext.xml");
+    }
+}

Propchange: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/event/EventRouteTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextFactoryBeanTest.java Mon Jul  2 04:23:12 2007
@@ -17,8 +17,6 @@
  */
 package org.apache.camel.spring;
 
-import java.util.List;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
@@ -30,12 +28,14 @@
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+import java.util.List;
+
 /**
  * @version $Revision$
  */
 public class CamelContextFactoryBeanTest extends TestSupport {
     private static final transient Log log = LogFactory.getLog(CamelContextFactoryBeanTest.class);
-    
+
     public void testClassPathRouteLoading() throws Exception {
         ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/camelContextFactoryBean.xml");
 
@@ -76,7 +76,7 @@
 
         List<Route> routes = context.getRoutes();
         log.debug("Found routes: " + routes);
-        
+
         assertNotNull("Should have found some routes", routes);
         assertEquals("One Route should be found", 1, routes.size());
 
@@ -89,5 +89,4 @@
             assertEndpointUri(key, "queue:test.c");
         }
     }
-
 }

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/ContentBasedRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/ContentBasedRouteTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/ContentBasedRouteTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/ContentBasedRouteTest.java Mon Jul  2 04:23:12 2007
@@ -17,9 +17,9 @@
  */
 package org.apache.camel.spring;
 
+import org.apache.camel.component.mock.MockEndpoint;
 import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.apache.camel.component.mock.MockEndpoint;
 
 /**
  * @version $Revision: 1.1 $

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/CustomProcessorWithNamespacesTest.java Mon Jul  2 04:23:12 2007
@@ -17,13 +17,13 @@
  */
 package org.apache.camel.spring;
 
-import org.apache.camel.TestSupport;
+import org.apache.camel.CamelTemplate;
 import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.Message;
+import org.apache.camel.Processor;
 import org.apache.camel.Route;
+import org.apache.camel.TestSupport;
 import org.apache.camel.spring.example.MyProcessor;
-import org.apache.camel.CamelTemplate;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/EndpointReferenceTest.java Mon Jul  2 04:23:12 2007
@@ -45,7 +45,6 @@
 
         log.debug("Found dummy bean: " + dummyBean);
 
-
         MockEndpoint resultEndpoint = (MockEndpoint) resolveMandatoryEndpoint(camelContext, "mock:end");
         resultEndpoint.expectedBodiesReceived(body);
 

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java Mon Jul  2 04:23:12 2007
@@ -16,16 +16,15 @@
  */
 package org.apache.camel.spring;
 
+import org.apache.camel.CamelTemplate;
 import org.apache.camel.Endpoint;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Producer;
-import org.apache.camel.CamelTemplate;
 
 /**
  * @version $Revision: $
  */
 public class InjectedBean {
-
     // Endpoint
     //-----------------------------------------------------------------------
     @EndpointInject(uri = "direct:fieldInjectedEndpoint")
@@ -45,14 +44,12 @@
         this.propertyInjectedEndpoint = propertyInjectedEndpoint;
     }
 
-
     // Producer
     //-----------------------------------------------------------------------
     @EndpointInject(uri = "direct:fieldInjectedProducer")
     private Producer fieldInjectedProducer;
     private Producer propertyInjectedProducer;
 
-
     public Producer getFieldInjectedProducer() {
         return fieldInjectedProducer;
     }
@@ -65,7 +62,6 @@
     public void setPropertyInjectedProducer(Producer propertyInjectedProducer) {
         this.propertyInjectedProducer = propertyInjectedProducer;
     }
-
 
     // CamelTemplate
     //-----------------------------------------------------------------------

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java Mon Jul  2 04:23:12 2007
@@ -44,7 +44,6 @@
         assertNotNull("No CamelTemplate injected for getPropertyInjectedCamelTemplate()", bean.getPropertyInjectedCamelTemplate());
     }
 
-
     @Override
     protected void setUp() throws Exception {
         super.setUp();

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java Mon Jul  2 04:23:12 2007
@@ -17,13 +17,13 @@
  */
 package org.apache.camel.spring;
 
+import org.apache.camel.CamelTemplate;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
-import org.apache.camel.TestSupport;
 import org.apache.camel.Route;
+import org.apache.camel.TestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.CamelTemplate;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java Mon Jul  2 04:23:12 2007
@@ -81,6 +81,10 @@
         return resolveMandatoryEndpoint(camelContext, uri);
     }
 
+    protected <T extends Endpoint> T resolveMandatoryEndpoint(String uri, Class<T> endpointType) {
+        return resolveMandatoryEndpoint(camelContext, uri, endpointType);
+    }
+
     protected void assertValidContext(SpringCamelContext context) {
         assertNotNull("No context found!", context);
 

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java Mon Jul  2 04:23:12 2007
@@ -30,10 +30,8 @@
  */
 public class MyConsumer {
     private static final Log log = LogFactory.getLog(MyConsumer.class);
-
     @EndpointInject(uri = "mock:result")
     private CamelTemplate destination;
-
 
     @MessageDriven(uri = "direct:start")
     public void doSomething(String body) {

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyProcessor.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyProcessor.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyProcessor.java Mon Jul  2 04:23:12 2007
@@ -28,7 +28,6 @@
  */
 public class MyProcessor implements Processor {
     private static List exchanges = new CopyOnWriteArrayList();
-
     private String name = "James";
 
     public static List getExchanges() {

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MySender.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MySender.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MySender.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MySender.java Mon Jul  2 04:23:12 2007
@@ -26,10 +26,9 @@
  * @version $Revision: $
  */
 public class MySender {
-    @EndpointInject(uri="mock:a")
+    @EndpointInject(uri = "mock:a")
     private CamelTemplate successDesetination;
-
-    @EndpointInject(uri="mock:b")
+    @EndpointInject(uri = "mock:b")
     private CamelTemplate failureDesetination;
 
     public void doSomething(String name) {

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java Mon Jul  2 04:23:12 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.camel.spring.example;
 
-import org.apache.camel.spring.SpringTestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spring.SpringTestSupport;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java Mon Jul  2 04:23:12 2007
@@ -17,11 +17,11 @@
  */
 package org.apache.camel.spring.example;
 
-import org.apache.camel.processor.XPathFilterTest;
 import org.apache.camel.CamelContext;
-import org.apache.camel.spring.SpringCamelContext;
-import org.apache.camel.impl.NoRouteBuilder;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.NoRouteBuilder;
+import org.apache.camel.processor.XPathFilterTest;
+import org.apache.camel.spring.SpringCamelContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/ISay.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/ISay.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/ISay.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/ISay.java Mon Jul  2 04:23:12 2007
@@ -20,5 +20,5 @@
 import java.rmi.RemoteException;
 
 public interface ISay extends Remote {
-	public String say() throws RemoteException;
+    public String say() throws RemoteException;
 }

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SayService.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SayService.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SayService.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SayService.java Mon Jul  2 04:23:12 2007
@@ -17,24 +17,24 @@
 package org.apache.camel.spring.remoting;
 
 public class SayService implements ISay {
-	String message = "Hello";
-	
-	public SayService() {
-	}
-	public SayService(String message) {
-		this.message = message;
-	}
+    String message = "Hello";
 
-	public String say() {
-		return message;
-	}
+    public SayService() {
+    }
 
-	public String getMessage() {
-		return message;
-	}
+    public SayService(String message) {
+        this.message = message;
+    }
 
-	public void setMessage(String message) {
-		this.message = message;
-	}
+    public String say() {
+        return message;
+    }
 
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
 }

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java Mon Jul  2 04:23:12 2007
@@ -18,7 +18,6 @@
 package org.apache.camel.spring.remoting;
 
 import junit.framework.TestCase;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.SpringCamelContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -27,21 +26,19 @@
  * @version $Revision: 520220 $
  */
 public class SpringRemotingRouteTest extends TestCase {
-	
-    public void testPojoRoutes() throws Exception {    	
-    	
-    	ClassPathXmlApplicationContext spring = new ClassPathXmlApplicationContext("org/apache/camel/spring/remoting/spring.xml");
+    public void testPojoRoutes() throws Exception {
+
+        ClassPathXmlApplicationContext spring = new ClassPathXmlApplicationContext("org/apache/camel/spring/remoting/spring.xml");
         CamelContext camelContext = SpringCamelContext.springCamelContext(spring);
         camelContext.start();
-        
+
         // START SNIPPET: invoke
         ISay proxy = (ISay) spring.getBean("sayProxy");
         String rc = proxy.say();
         assertEquals("Hello", rc);
         // END SNIPPET: invoke
-        
+
         camelContext.stop();
         spring.destroy();
     }
-
 }

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java Mon Jul  2 04:23:12 2007
@@ -17,13 +17,13 @@
  */
 package org.apache.camel.spring.xml;
 
-import org.apache.camel.builder.RouteBuilderTest;
-import org.apache.camel.Route;
 import org.apache.camel.Processor;
-import org.apache.camel.spring.SpringCamelContext;
+import org.apache.camel.Route;
+import org.apache.camel.builder.RouteBuilderTest;
 import org.apache.camel.processor.DelegateProcessor;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.apache.camel.spring.SpringCamelContext;
 import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 import java.util.List;
 

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/META-INF/spring/camel-context.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/META-INF/spring/camel-context.xml?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/META-INF/spring/camel-context.xml (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/META-INF/spring/camel-context.xml Mon Jul  2 04:23:12 2007
@@ -29,7 +29,8 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
 
-  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring" packages="org.apache.camel.builder.RouteBuilder">
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring"
+                packages="org.apache.camel.builder.RouteBuilder">
   </camelContext>
 
 </beans>

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/builder/spring_route_builder_test.xml Mon Jul  2 04:23:12 2007
@@ -16,221 +16,221 @@
     limitations under the License.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
     ">
 
 
-    <!--
-      TODO: DELETE ME once we are sure there are no more snippet macros on the wiki pointing to this file!
-      TODO: This file has been replaced by the individual files in org/apache/camel/spring/xml/*.xml
-    -->
-
-
-    <!--
-        from("queue:a").to("queue:b");
-     -->
-    <!-- START SNIPPET: e1 -->
-    <camelContext id="buildSimpleRoute" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <to uri="queue:b"/>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: e1 -->
-    
-    <!-- 
-        from("queue:a").filter(header("foo").isEqualTo("bar")).to("queue:b");
-     -->
-    <!-- START SNIPPET: e2 -->
-    <camelContext id="buildSimpleRouteWithHeaderPredicate" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <filter>
-             <predicate>
-                <header name="foo"/>
-                <isEqualTo value="bar"/>
-             </predicate>
-         </filter>
-         <to uri="queue:b"/>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: e2 -->
-    
-    
-        <!-- 
-        from("queue:a").choice()
-                .when(header("foo").isEqualTo("bar")).to("queue:b")
-                .when(header("foo").isEqualTo("cheese")).to("queue:c")
-                .otherwise().to("queue:d");
-     -->
-    <!-- START SNIPPET: e3 -->
-    <camelContext id="buildSimpleRouteWithChoice" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <choice>
-             <when>
-                 <predicate>
-                    <header name="foo"/>
-                    <isEqualTo value="bar"/>
-                 </predicate>
-                 <to uri="queue:b"/>
-             </when>
-             <when>
-                 <predicate>
-                    <header name="foo"/>
-                    <isEqualTo value="cheese"/>
-                 </predicate>
-                 <to uri="queue:c"/>
-             </when>
-             <otherwise>
-                 <to uri="queue:d"/>
-             </otherwise>
-         </choice>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: e3 -->
-
-    
-    <!-- 
-        from("queue:a").process(myProcessor);
-     -->
-    <!-- START SNIPPET: e4 -->
-    <bean id="myProcessor" class="org.apache.camel.builder.MyProcessor"/>
-    <camelContext id="buildCustomProcessor" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <process ref="#myProcessor"/>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: e4 -->
-
-    <!-- 
-        from("queue:a").filter(header("foo").isEqualTo("bar")).process(myProcessor);
-     -->
-    <!-- START SNIPPET: e5 -->
-    <camelContext id="buildCustomProcessorWithFilter" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <filter>
-           <predicate>
-             <header name="foo"/>
-             <isEqualTo value="bar"/>
-           </predicate>
-         </filter>
-         <process ref="#myProcessor"/>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: e5 -->
-
-
-    <!-- 
-        from("queue:a").to("queue:tap", "queue:b");
-     -->
-    <!-- START SNIPPET: e6-->
-    <camelContext id="buildWireTap" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <to>
-            <uri>queue:tap</uri>
-            <uri>queue:b</uri>
-         </to>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: e6 -->
-    
-
-    <!-- 
-        from("queue:a")
-           .intercept()
-              .add(interceptor1)
-              .add(interceptor2)
-           .target().to("queue:d");
-     -->
-    <!-- START SNIPPET: e7 -->
-    <bean id="interceptor1" class="org.apache.camel.builder.MyInterceptorProcessor"/>
-    <bean id="interceptor2" class="org.apache.camel.builder.MyInterceptorProcessor"/>     
-    <camelContext id="buildRouteWithInterceptor" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <intercept>
-             <interceptor ref="#interceptor1"/>
-             <interceptor ref="#interceptor2"/>
-         </intercept>
-         <to uri="queue:d"/>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: e7 -->
-
-    <!-- 
-        from("queue:a").to("queue:b", "queue:c", "queue:d");
-     -->
-    <!-- START SNIPPET: e8 -->
-    <camelContext id="buildStaticRecipientList" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <to>
-            <uri>queue:b</uri>
-            <uri>queue:c</uri>
-            <uri>queue:d</uri>
-         </to>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: e8 -->
-    
-
-    <!-- 
-        from("queue:a").recipientList(header("foo"));
-     -->
-    <!-- START SNIPPET: e9 -->
-    <camelContext id="buildDynamicRecipientList" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <recipientList>
-         	<recipients>
-              <header name="foo"/>
-            </recipients>
-         </recipientList>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: e9 -->
-                    
-    <!-- 
-        from("queue:a").splitter(bodyAs(String.class).tokenize("\n")).to("queue:b");
-     -->
-    <!-- START SNIPPET: splitter -->
-    <camelContext id="buildSplitter" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-         <splitter>
-         	<recipients>
-	            <bodyAs class="java.lang.String"/>
-	            <tokenize token="
+  <!--
+    TODO: DELETE ME once we are sure there are no more snippet macros on the wiki pointing to this file!
+    TODO: This file has been replaced by the individual files in org/apache/camel/spring/xml/*.xml
+  -->
+
+
+  <!--
+     from("queue:a").to("queue:b");
+  -->
+  <!-- START SNIPPET: e1 -->
+  <camelContext id="buildSimpleRoute" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <to uri="queue:b"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+  <!--
+     from("queue:a").filter(header("foo").isEqualTo("bar")).to("queue:b");
+  -->
+  <!-- START SNIPPET: e2 -->
+  <camelContext id="buildSimpleRouteWithHeaderPredicate" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <filter>
+        <predicate>
+          <header name="foo"/>
+          <isEqualTo value="bar"/>
+        </predicate>
+      </filter>
+      <to uri="queue:b"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e2 -->
+
+
+  <!--
+     from("queue:a").choice()
+             .when(header("foo").isEqualTo("bar")).to("queue:b")
+             .when(header("foo").isEqualTo("cheese")).to("queue:c")
+             .otherwise().to("queue:d");
+  -->
+  <!-- START SNIPPET: e3 -->
+  <camelContext id="buildSimpleRouteWithChoice" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <choice>
+        <when>
+          <predicate>
+            <header name="foo"/>
+            <isEqualTo value="bar"/>
+          </predicate>
+          <to uri="queue:b"/>
+        </when>
+        <when>
+          <predicate>
+            <header name="foo"/>
+            <isEqualTo value="cheese"/>
+          </predicate>
+          <to uri="queue:c"/>
+        </when>
+        <otherwise>
+          <to uri="queue:d"/>
+        </otherwise>
+      </choice>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e3 -->
+
+
+  <!--
+     from("queue:a").process(myProcessor);
+  -->
+  <!-- START SNIPPET: e4 -->
+  <bean id="myProcessor" class="org.apache.camel.builder.MyProcessor"/>
+  <camelContext id="buildCustomProcessor" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <process ref="#myProcessor"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e4 -->
+
+  <!--
+     from("queue:a").filter(header("foo").isEqualTo("bar")).process(myProcessor);
+  -->
+  <!-- START SNIPPET: e5 -->
+  <camelContext id="buildCustomProcessorWithFilter" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <filter>
+        <predicate>
+          <header name="foo"/>
+          <isEqualTo value="bar"/>
+        </predicate>
+      </filter>
+      <process ref="#myProcessor"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e5 -->
+
+
+  <!--
+     from("queue:a").to("queue:tap", "queue:b");
+  -->
+  <!-- START SNIPPET: e6-->
+  <camelContext id="buildWireTap" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <to>
+        <uri>queue:tap</uri>
+        <uri>queue:b</uri>
+      </to>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e6 -->
+
+
+  <!--
+     from("queue:a")
+        .intercept()
+           .add(interceptor1)
+           .add(interceptor2)
+        .target().to("queue:d");
+  -->
+  <!-- START SNIPPET: e7 -->
+  <bean id="interceptor1" class="org.apache.camel.builder.MyInterceptorProcessor"/>
+  <bean id="interceptor2" class="org.apache.camel.builder.MyInterceptorProcessor"/>
+  <camelContext id="buildRouteWithInterceptor" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <intercept>
+        <interceptor ref="#interceptor1"/>
+        <interceptor ref="#interceptor2"/>
+      </intercept>
+      <to uri="queue:d"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e7 -->
+
+  <!--
+     from("queue:a").to("queue:b", "queue:c", "queue:d");
+  -->
+  <!-- START SNIPPET: e8 -->
+  <camelContext id="buildStaticRecipientList" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <to>
+        <uri>queue:b</uri>
+        <uri>queue:c</uri>
+        <uri>queue:d</uri>
+      </to>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e8 -->
+
+
+  <!--
+     from("queue:a").recipientList(header("foo"));
+  -->
+  <!-- START SNIPPET: e9 -->
+  <camelContext id="buildDynamicRecipientList" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <recipientList>
+        <recipients>
+          <header name="foo"/>
+        </recipients>
+      </recipientList>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e9 -->
+
+  <!--
+     from("queue:a").splitter(bodyAs(String.class).tokenize("\n")).to("queue:b");
+  -->
+  <!-- START SNIPPET: splitter -->
+  <camelContext id="buildSplitter" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <splitter>
+        <recipients>
+          <bodyAs class="java.lang.String"/>
+          <tokenize token="
 "/>
-         	</recipients>
-         </splitter>
-         <to uri="queue:b"/>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: splitter -->
-
-    <!--
-        from("queue:a").idempotentConsumer(header("myMessageId"), memoryMessageIdRepository()).to("queue:b");
-     -->
-    <!-- START SNIPPET: idempotent -->
-    <camelContext id="buildIdempotentConsumer" xmlns="http://activemq.apache.org/camel/schema/spring">
-       <route>
-         <from uri="queue:a"/>
-<!--
-         <idempotentConsumer>
-         </idempotentConsumer>
--->
-         <to uri="queue:b"/>
-       </route>
-    </camelContext>
-    <!-- END SNIPPET: idempotent -->
+        </recipients>
+      </splitter>
+      <to uri="queue:b"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: splitter -->
+
+  <!--
+     from("queue:a").idempotentConsumer(header("myMessageId"), memoryMessageIdRepository()).to("queue:b");
+  -->
+  <!-- START SNIPPET: idempotent -->
+  <camelContext id="buildIdempotentConsumer" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+      <from uri="queue:a"/>
+      <!--
+               <idempotentConsumer>
+               </idempotentConsumer>
+      -->
+      <to uri="queue:b"/>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: idempotent -->
 
 </beans>
-<!-- END SNIPPET: example -->
+        <!-- END SNIPPET: example -->

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoConsumer.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoConsumer.xml?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoConsumer.xml (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoConsumer.xml Mon Jul  2 04:23:12 2007
@@ -24,7 +24,7 @@
 
   <!-- START SNIPPET: example -->
   <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
-   <beanPostProcessor/>
+    <beanPostProcessor/>
   </camelContext>
   <!-- END SNIPPET: example -->
 

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoSender.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoSender.xml?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoSender.xml (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/pojoSender.xml Mon Jul  2 04:23:12 2007
@@ -24,7 +24,7 @@
 
   <!-- START SNIPPET: example -->
   <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
-   <beanPostProcessor/>
+    <beanPostProcessor/>
   </camelContext>
   <!-- END SNIPPET: example -->
 

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring.xml?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring.xml (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/spring.xml Mon Jul  2 04:23:12 2007
@@ -27,22 +27,22 @@
 
   <!--  Exposes the above bean as via the pojo:say endpoint -->
   <bean class="org.apache.camel.spring.remoting.CamelServiceExporter">
-	<property name="camelContext" ref="camel"/>
-	<property name="serviceName" value="say"/>
-	<property name="service" ref="sayService"/>
-	<property name="serviceInterface" value="org.apache.camel.spring.remoting.ISay"/>
+    <property name="camelContext" ref="camel"/>
+    <property name="serviceName" value="say"/>
+    <property name="service" ref="sayService"/>
+    <property name="serviceInterface" value="org.apache.camel.spring.remoting.ISay"/>
   </bean>
   <!-- END SNIPPET: export -->
 
   <!-- START SNIPPET: proxy -->
   <!--  Creates a proxy to the direct:say endpoint. -->
   <bean id="sayProxy" class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
-	<property name="camelContext" ref="camel"/>
-	<property name="serviceUrl" value="direct:say"/>
-	<property name="serviceInterface" value="org.apache.camel.spring.remoting.ISay"/>
+    <property name="camelContext" ref="camel"/>
+    <property name="serviceUrl" value="direct:say"/>
+    <property name="serviceInterface" value="org.apache.camel.spring.remoting.ISay"/>
   </bean>
   <!-- END SNIPPET: proxy -->
-  
+
   <!-- START SNIPPET: example -->
   <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
     <route>
@@ -52,7 +52,6 @@
   </camelContext>
   <!-- END SNIPPET: example -->
 
-  
-  
+
 </beans>
-<!-- END SNIPPET: example -->
+        <!-- END SNIPPET: example -->

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildDynamicRecipientList.xml Mon Jul  2 04:23:12 2007
@@ -31,8 +31,8 @@
       <from uri="queue:a"/>
       <recipientList>
         <recipients>
-           <header name="foo"/>
-         </recipients>
+          <header name="foo"/>
+        </recipients>
       </recipientList>
     </route>
   </camelContext>

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml?view=diff&rev=552469&r1=552468&r2=552469
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml (original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildIdempotentConsumer.xml Mon Jul  2 04:23:12 2007
@@ -29,10 +29,10 @@
   <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
     <route>
       <from uri="queue:a"/>
- <!--
-      <idempotentConsumer>
-      </idempotentConsumer>
- -->
+      <!--
+           <idempotentConsumer>
+           </idempotentConsumer>
+      -->
       <to uri="queue:b"/>
     </route>
   </camelContext>



Mime
View raw message