activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r521180 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/builder/xpath/ camel-core/src/main/java/org/apache/camel/component/p...
Date Thu, 22 Mar 2007 09:59:50 GMT
Author: jstrachan
Date: Thu Mar 22 02:59:46 2007
New Revision: 521180

URL: http://svn.apache.org/viewvc?view=rev&rev=521180
Log:
refactored the Exchange/Message API to remove Headers (it was just a pain for end users) and moved that API into Exchange and Message

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java   (with props)
Removed:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Headers.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultHeaders.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/HeadersSupport.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaders.java
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Message.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ChoiceBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ConstantProcessorBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionFactory.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/LoggingErrorHandlerBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateFactory.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RecipientListBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ToBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/WhenBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/DefaultNamespaceContext.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/ExchangeXPathExpression.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/InvalidXPathExpression.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/MessageVariableResolver.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/XPathBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpointResolver.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeConverter.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xpath/XPathTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/queue/QueueRouteTest.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultJmsMessage.java
    activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
    activemq/camel/trunk/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java Thu Mar 22 02:59:46 2007
@@ -17,10 +17,10 @@
  */
 package org.apache.camel;
 
+import org.apache.camel.builder.RouteBuilder;
+
 import java.util.Map;
 import java.util.concurrent.Callable;
-
-import org.apache.camel.builder.RouteBuilder;
 
 /**
  * Interface used to represent the context used to configure routes and the 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/EndpointResolver.java Thu Mar 22 02:59:46 2007
@@ -16,8 +16,6 @@
  */
 package org.apache.camel;
 
-import java.io.IOException;
-
 /**
  * A resolver of endpoints from a String URI
  *

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Thu Mar 22 02:59:46 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.camel;
 
+import java.util.Map;
 
 /**
  * Represents the base exchange interface providing access to the request, response and fault {@link Message} instances.
@@ -36,11 +37,31 @@
      */
     void setExchangeId(String id);
 
+
+    /**
+     * Accesses a specific header on this exchange
+     *
+     * @param name
+     * @return object header associated with the name
+     */
+    Object getHeader(String name);
+
     /**
-     * Returns the exchange headers
+     * Sets a header on the exchange
+     *
+     * @param name  of the header
+     * @param value to associate with the name
      */
-    Headers getHeaders();
+    void setHeader(String name, Object value);
 
+    /**
+     * Returns all of the headers associated with the exchange
+     *
+     * @return all the headers in a Map
+     */
+    Map<String, Object> getHeaders();
+
+    
     /**
      * Returns the inbound request message
      * @return the message

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Message.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Message.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Message.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Message.java Thu Mar 22 02:59:46 2007
@@ -17,6 +17,8 @@
  */
 package org.apache.camel;
 
+import java.util.Map;
+
 /**
  * Implements the <a href="http://activemq.apache.org/camel/message.html">Message</a>
  * pattern and represents an inbound or outbound message as part of an {@link Exchange}
@@ -24,11 +26,29 @@
  * @version $Revision$
  */
 public interface Message {
+    
+    /**
+     * Accesses a specific header
+     *
+     * @param name
+     * @return object header associated with the name
+     */
+    Object getHeader(String name);
+
+    /**
+     * Sets a header on the message
+     *
+     * @param name  of the header
+     * @param value to associate with the name
+     */
+    void setHeader(String name, Object value);
 
     /**
-     * Access the headers on the message
+     * Returns all of the headers associated with the message
+     *
+     * @return all the headers in a Map
      */
-    public Headers getHeaders();
+    Map<String, Object> getHeaders();
 
     /**
      * Returns the body of the message as a POJO
@@ -60,5 +80,7 @@
      * 
      * @return a new message instance copied from this message
      */
-    public Message copy();
+    Message copy();
+
+    
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ChoiceBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ChoiceBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ChoiceBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ChoiceBuilder.java Thu Mar 22 02:59:46 2007
@@ -16,14 +16,14 @@
  */
 package org.apache.camel.builder;
 
-import org.apache.camel.processor.ChoiceProcessor;
-import org.apache.camel.processor.FilterProcessor;
-import org.apache.camel.Predicate;
 import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
+import org.apache.camel.processor.ChoiceProcessor;
+import org.apache.camel.processor.FilterProcessor;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @version $Revision$

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ConstantProcessorBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ConstantProcessorBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ConstantProcessorBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ConstantProcessorBuilder.java Thu Mar 22 02:59:46 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.builder;
 
-import org.apache.camel.Processor;
 import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
 
 /**
  * @version $Revision$

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java Thu Mar 22 02:59:46 2007
@@ -19,9 +19,9 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 
-import java.util.StringTokenizer;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
 
 /**
  * @version $Revision: $
@@ -38,10 +38,10 @@
     public static <E extends Exchange> Expression<E> headerExpression(final String headerName) {
         return new Expression<E>() {
             public Object evaluate(E exchange) {
-                Object header = exchange.getIn().getHeaders().getHeader(headerName);
+                Object header = exchange.getIn().getHeader(headerName);
                 if (header == null) {
                     // lets try the exchange header
-                    header = exchange.getHeaders().getHeader(headerName);
+                    header = exchange.getHeader(headerName);
                 }
                 return header;
             }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionFactory.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionFactory.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionFactory.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionFactory.java Thu Mar 22 02:59:46 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.builder;
 
-import org.apache.camel.Expression;
 import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
 
 /**
  * A Factory of {@link Expression} objects typically implemented by a builder such as @{XPathBuilder}

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/LoggingErrorHandlerBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/LoggingErrorHandlerBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/LoggingErrorHandlerBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/LoggingErrorHandlerBuilder.java Thu Mar 22 02:59:46 2007
@@ -20,8 +20,8 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.processor.Logger;
-import org.apache.camel.processor.LoggingLevel;
 import org.apache.camel.processor.LoggingErrorHandler;
+import org.apache.camel.processor.LoggingLevel;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java Thu Mar 22 02:59:46 2007
@@ -17,11 +17,10 @@
  */
 package org.apache.camel.builder;
 
-import org.apache.camel.processor.MulticastProcessor;
-import org.apache.camel.processor.Pipeline;
-import org.apache.camel.Exchange;
 import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.processor.Pipeline;
 
 import java.util.Collection;
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateFactory.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateFactory.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateFactory.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateFactory.java Thu Mar 22 02:59:46 2007
@@ -17,7 +17,6 @@
  */
 package org.apache.camel.builder;
 
-import org.apache.camel.Expression;
 import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RecipientListBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RecipientListBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RecipientListBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RecipientListBuilder.java Thu Mar 22 02:59:46 2007
@@ -18,8 +18,8 @@
 package org.apache.camel.builder;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.Expression;
+import org.apache.camel.Processor;
 import org.apache.camel.processor.RecipientList;
 
 /**

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java Thu Mar 22 02:59:46 2007
@@ -18,10 +18,8 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.EndpointResolver;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.processor.DeadLetterChannel;
 import org.apache.camel.impl.DefaultCamelContext;
 
 import java.util.ArrayList;

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ToBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ToBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ToBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ToBuilder.java Thu Mar 22 02:59:46 2007
@@ -18,8 +18,8 @@
 package org.apache.camel.builder;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
 import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
 import org.apache.camel.processor.SendProcessor;
 
 /**

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/WhenBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/WhenBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/WhenBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/WhenBuilder.java Thu Mar 22 02:59:46 2007
@@ -17,9 +17,9 @@
  */
 package org.apache.camel.builder;
 
+import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
-import org.apache.camel.Endpoint;
 
 /**
  * @version $Revision$

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/DefaultNamespaceContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/DefaultNamespaceContext.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/DefaultNamespaceContext.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/DefaultNamespaceContext.java Thu Mar 22 02:59:46 2007
@@ -17,11 +17,13 @@
  */
 package org.apache.camel.builder.xpath;
 
-
-import javax.xml.xpath.*;
 import javax.xml.namespace.NamespaceContext;
-
-import java.util.*;
+import javax.xml.xpath.XPathFactory;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * An implementation of {@link NamespaceContext} which uses a simple Map where

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/ExchangeXPathExpression.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/ExchangeXPathExpression.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/ExchangeXPathExpression.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/ExchangeXPathExpression.java Thu Mar 22 02:59:46 2007
@@ -25,9 +25,9 @@
 import org.xml.sax.InputSource;
 
 import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathConstants;
 import java.io.StringReader;
 
 /**

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/InvalidXPathExpression.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/InvalidXPathExpression.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/InvalidXPathExpression.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/InvalidXPathExpression.java Thu Mar 22 02:59:46 2007
@@ -19,7 +19,6 @@
 
 import org.apache.camel.RuntimeExpressionException;
 
-import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathException;
 
 /**

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/MessageVariableResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/MessageVariableResolver.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/MessageVariableResolver.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/MessageVariableResolver.java Thu Mar 22 02:59:46 2007
@@ -53,10 +53,10 @@
         if (uri == null || uri.length() == 0) {
             Message message = exchange.getIn();
             if (message != null) {
-                answer = message.getHeaders().getHeader(localPart);
+                answer = message.getHeader(localPart);
             }
             if (answer == null) {
-                answer = exchange.getHeaders().getHeader(localPart);
+                answer = exchange.getHeader(localPart);
             }
         }
         else if (uri.equals(SYSTEM_PROPERTIES_NAMESPACE)) {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/XPathBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/XPathBuilder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/XPathBuilder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xpath/XPathBuilder.java Thu Mar 22 02:59:46 2007
@@ -19,21 +19,20 @@
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
-import org.apache.camel.RuntimeExpressionException;
-import org.apache.camel.Provider;
 import org.apache.camel.Predicate;
-import org.apache.camel.builder.PredicateFactory;
+import org.apache.camel.RuntimeExpressionException;
 import org.apache.camel.builder.ExpressionFactory;
+import org.apache.camel.builder.PredicateFactory;
 import org.w3c.dom.Document;
 
 import javax.xml.namespace.QName;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathException;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathFactoryConfigurationException;
-import javax.xml.xpath.XPathException;
 import javax.xml.xpath.XPathFunctionResolver;
 
 /**

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java Thu Mar 22 02:59:46 2007
@@ -16,10 +16,10 @@
  */
 package org.apache.camel.component.pojo;
 
-import java.util.HashMap;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
+
+import java.util.HashMap;
 
 /**
  * Represents the component that manages {@link PojoEndpoint}.  It holds the 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoEndpoint.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoEndpoint.java Thu Mar 22 02:59:46 2007
@@ -16,13 +16,13 @@
  */
 package org.apache.camel.component.pojo;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultEndpoint;
+
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.impl.DefaultEndpoint;
 
 /**
  * Represents a pojo endpoint that uses reflection

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java Thu Mar 22 02:59:46 2007
@@ -16,9 +16,9 @@
  */
 package org.apache.camel.component.pojo;
 
-import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultExchange;
 
 /**
  * @version $Revision: 519901 $

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueComponent.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueComponent.java Thu Mar 22 02:59:46 2007
@@ -16,12 +16,12 @@
  */
 package org.apache.camel.component.queue;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+
 import java.util.HashMap;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Component;
 
 /**
  * Represents the component that manages {@link QueueEndpoint}.  It holds the 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpoint.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpoint.java Thu Mar 22 02:59:46 2007
@@ -16,16 +16,16 @@
  */
 package org.apache.camel.component.queue;
 
-import java.util.Queue;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
 import org.apache.camel.CamelContext;
-import org.apache.camel.Processor;
 import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.impl.DefaultExchange;
+
+import java.util.Queue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
  * Represents a queue endpoint that uses a {@link BlockingQueue}

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpointResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpointResolver.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpointResolver.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpointResolver.java Thu Mar 22 02:59:46 2007
@@ -16,15 +16,15 @@
  */
 package org.apache.camel.component.queue;
 
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Callable;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.Endpoint;
 import org.apache.camel.EndpointResolver;
 import org.apache.camel.Exchange;
 import org.apache.camel.util.ObjectHelper;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Callable;
 
 /**
  * An implementation of {@link EndpointResolver} that creates 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java Thu Mar 22 02:59:46 2007
@@ -17,9 +17,9 @@
  */
 package org.apache.camel.impl;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.Component;
 import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.Exchange;
 
 /**
  * @version $Revision$

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java Thu Mar 22 02:59:46 2007
@@ -18,9 +18,11 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
-import org.apache.camel.Headers;
 import org.apache.camel.Message;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * A default implementation of {@link Exchange}
  *
@@ -28,7 +30,7 @@
  */
 public class DefaultExchange implements Exchange {
     protected final CamelContext context;
-    private Headers headers;
+    private Map<String, Object> headers;
     private Message in;
     private Message out;
     private Message fault;
@@ -46,7 +48,7 @@
     }
 
     public void copyFrom(Exchange exchange) {
-        setHeaders(exchange.getHeaders().copy());
+        setHeaders(new HashMap<String, Object>(exchange.getHeaders()));
         setIn(exchange.getIn().copy());
         setOut(exchange.getOut().copy());
         setFault(exchange.getFault().copy());
@@ -61,14 +63,25 @@
         return context;
     }
 
-    public Headers getHeaders() {
+    public Object getHeader(String name) {
+        if (headers != null) {
+            return headers.get(name);
+        }
+        return null;
+    }
+
+    public void setHeader(String name, Object value) {
+        getHeaders().put(name, value);
+    }
+
+    public Map<String, Object> getHeaders() {
         if (headers == null) {
-            headers = new DefaultHeaders();
+            headers = new HashMap<String, Object>();
         }
         return headers;
     }
 
-    public void setHeaders(Headers headers) {
+    public void setHeaders(Map<String, Object> headers) {
         this.headers = headers;
     }
 
@@ -81,6 +94,7 @@
 
     public void setIn(Message in) {
         this.in = in;
+        configureMessage(in);
     }
 
     public Message getOut() {
@@ -92,6 +106,7 @@
 
     public void setOut(Message out) {
         this.out = out;
+        configureMessage(out);
     }
 
     public Throwable getException() {
@@ -108,6 +123,7 @@
 
     public void setFault(Message fault) {
         this.fault = fault;
+        configureMessage(fault);
     }
 
     public String getExchangeId() {
@@ -118,11 +134,27 @@
         this.exchangeId = id;
     }
 
+    /**
+     * Factory method used to lazily create the IN message
+     */
     protected Message createInMessage() {
         return new DefaultMessage();
     }
 
+    /**
+     * Factory method to lazily create the OUT message
+     */
     protected Message createOutMessage() {
         return new DefaultMessage();
+    }
+
+    /**
+     * Configures the message after it has been set on the exchange
+     */
+    protected void configureMessage(Message message) {
+        if (message instanceof MessageSupport) {
+            MessageSupport messageSupport = (MessageSupport) message;
+            messageSupport.setExchange(this);
+        }
     }
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeConverter.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeConverter.java Thu Mar 22 02:59:46 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.impl;
 
-import org.apache.camel.ExchangeConverter;
 import org.apache.camel.Exchange;
+import org.apache.camel.ExchangeConverter;
 
 /**
  * @version $Revision$

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java Thu Mar 22 02:59:46 2007
@@ -18,54 +18,38 @@
 package org.apache.camel.impl;
 
 import org.apache.camel.Message;
-import org.apache.camel.Headers;
+
+import java.util.HashMap;
+import java.util.Map;
 
 /**
+ * The default implementation of {@link Message}
+ *
  * @version $Revision$
  */
-public class DefaultMessage implements Message {
-    private Headers headers;
-    private Object body;
-
-    public Object getBody() {
-        return body;
-    }
-
-    public void setBody(Object body) {
-        this.body = body;
-    }
+public class DefaultMessage extends MessageSupport {
+    private Map<String, Object> headers;
 
-    @SuppressWarnings({"unchecked"})
-    public <T> T getBody(Class<T> type) {
-        return (T) getBody();
+    public Object getHeader(String name) {
+        if (headers != null) {
+            return headers.get(name);
+        }
+        return null;
     }
 
-    public <T> void setBody(Object body, Class<T> type) {
-        setBody(body);
+    public void setHeader(String name, Object value) {
+        getHeaders().put(name, value);
     }
 
-    public Headers getHeaders() {
+    public Map<String, Object> getHeaders() {
         if (headers == null) {
-            headers = createHeaders();
+            headers = new HashMap<String, Object>();
         }
         return headers;
     }
 
-    public void setHeaders(Headers headers) {
+    public void setHeaders(Map<String, Object> headers) {
         this.headers = headers;
-    }
-
-    protected Headers createHeaders() {
-        return new DefaultHeaders();
-    }
-
-    public Message copy() {
-        DefaultMessage answer = newInstance();
-        answer.setBody(getBody());
-        Headers headers = createHeaders();
-        headers.getHeaders().putAll(getHeaders().getHeaders());
-        answer.setHeaders(headers);
-        return answer;
     }
 
     public DefaultMessage newInstance() {

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java?view=auto&rev=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java Thu Mar 22 02:59:46 2007
@@ -0,0 +1,86 @@
+/**
+ *
+ * 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.impl;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+
+/**
+ * A base class for implementation inheritence providing the core {@link Message} body
+ * handling features but letting the derived class deal with headers.
+ *
+ * Unless a specific provider wishes to do something particularly clever with headers you probably
+ * want to just derive from {@link DefaultMessage}
+ *
+ * @version $Revision$
+ */
+public abstract class MessageSupport implements Message {
+    private Exchange exchange;
+    private Object body;
+
+    public Object getBody() {
+        return body;
+    }
+
+    @SuppressWarnings({"unchecked"})
+    public <T> T getBody(Class<T> type) {
+        Exchange e = getExchange();
+        if (e != null) {
+            return e.getContext().getTypeConverter().convertTo(type, getBody());
+        }
+        return (T) getBody();
+    }
+
+    public void setBody(Object body) {
+        this.body = body;
+    }
+
+    public <T> void setBody(Object body, Class<T> type) {
+        Exchange e = getExchange();
+        if (e != null) {
+            T value = e.getContext().getTypeConverter().convertTo(type, body);
+            if (value != null) {
+                body = value;
+            }
+        }
+        setBody(body);
+    }
+
+    public Message copy() {
+        Message answer = newInstance();
+        answer.setBody(getBody());
+        answer.getHeaders().putAll(getHeaders());
+        return answer;
+    }
+
+    public Exchange getExchange() {
+        return exchange;
+    }
+
+    public void setExchange(Exchange exchange) {
+        this.exchange = exchange;
+    }
+
+    /**
+     * Returns a new instance
+     *
+     * @return
+     */
+    public abstract Message newInstance();
+
+}

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MessageSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ChoiceProcessor.java Thu Mar 22 02:59:46 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.processor;
 
-import org.apache.camel.Processor;
 import org.apache.camel.Predicate;
+import org.apache.camel.Processor;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java Thu Mar 22 02:59:46 2007
@@ -127,7 +127,7 @@
     protected void appendRedeliveryHeaders(E exchange, int redeliveryCounter) {
         String header = getRedeliveryCountHeader();
         if (header != null) {
-            exchange.getIn().getHeaders().setHeader(header, redeliveryCounter);
+            exchange.getIn().setHeader(header, redeliveryCounter);
         }
     }
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FilterProcessor.java Thu Mar 22 02:59:46 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.processor;
 
-import org.apache.camel.Processor;
 import org.apache.camel.Predicate;
+import org.apache.camel.Processor;
 
 /**
  * @version $Revision$

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java Thu Mar 22 02:59:46 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.processor;
 
-import org.apache.camel.Exchange;
 import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 
 import java.util.Collection;

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java Thu Mar 22 02:59:46 2007
@@ -17,14 +17,13 @@
  */
 package org.apache.camel.processor;
 
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.ExchangeHelper;
-import static org.apache.camel.util.ObjectHelper.notNull;
+import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.Expression;
-import org.apache.camel.Endpoint;
-import org.apache.camel.NoSuchEndpointException;
+import org.apache.camel.Processor;
+import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.ObjectHelper.notNull;
 
 import java.util.Iterator;
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java Thu Mar 22 02:59:46 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.processor;
 
-import java.util.Random;
 import java.io.Serializable;
+import java.util.Random;
 
 // Code taken from the ActiveMQ codebase
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendProcessor.java Thu Mar 22 02:59:46 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.processor;
 
-import org.apache.camel.Processor;
 import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
 
 /**
  * @version $Revision$

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java Thu Mar 22 02:59:46 2007
@@ -18,9 +18,10 @@
 package org.apache.camel.processor;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.Expression;
-import static org.apache.camel.util.ObjectHelper.*;
+import org.apache.camel.Processor;
+import static org.apache.camel.util.ObjectHelper.iterator;
+import static org.apache.camel.util.ObjectHelper.notNull;
 
 import java.util.Iterator;
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java Thu Mar 22 02:59:46 2007
@@ -21,9 +21,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Properties;
-
 import java.util.concurrent.ConcurrentHashMap;
-
 
 public class FactoryFinder {
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java Thu Mar 22 02:59:46 2007
@@ -29,8 +29,8 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
 
 public class IntrospectionSupport {
         

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Thu Mar 22 02:59:46 2007
@@ -16,10 +16,10 @@
  */
 package org.apache.camel.util;
 
-import java.util.Iterator;
-import java.util.Collection;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.Iterator;
 
 /**
  * @version $Revision$

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java Thu Mar 22 02:59:46 2007
@@ -21,10 +21,8 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.TestSupport;
-import org.apache.camel.processor.DeadLetterChannel;
 import org.apache.camel.processor.FilterProcessor;
 import org.apache.camel.processor.LoggingErrorHandler;
-import org.apache.camel.processor.RedeliveryPolicy;
 import org.apache.camel.processor.SendProcessor;
 
 import java.util.Map;

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xpath/XPathTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xpath/XPathTest.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xpath/XPathTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/xpath/XPathTest.java Thu Mar 22 02:59:46 2007
@@ -112,7 +112,7 @@
         CamelContext context = new DefaultCamelContext();
         Exchange exchange = new DefaultExchange(context);
         Message message = exchange.getIn();
-        message.getHeaders().setHeader("name", "James");
+        message.setHeader("name", "James");
         message.setBody(xml);
         return exchange;
     }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java Thu Mar 22 02:59:46 2007
@@ -17,17 +17,14 @@
  */
 package org.apache.camel.component.pojo;
 
-import java.util.concurrent.atomic.AtomicInteger;
-
 import junit.framework.TestCase;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
-import org.apache.camel.component.pojo.PojoExchange;
-import org.apache.camel.component.pojo.ISay;
+import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.processor.InterceptorProcessor;
-import org.apache.camel.builder.RouteBuilder;
+
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * @version $Revision: 520220 $

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/queue/QueueRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/queue/QueueRouteTest.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/queue/QueueRouteTest.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/queue/QueueRouteTest.java Thu Mar 22 02:59:46 2007
@@ -17,18 +17,17 @@
  */
 package org.apache.camel.component.queue;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
 import junit.framework.TestCase;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
 import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
 
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 /**
  * @version $Revision: 520220 $
  */
@@ -59,7 +58,7 @@
         // now lets fire in a message
         Endpoint<Exchange> endpoint = container.resolveEndpoint("queue:test.a");
         Exchange exchange = endpoint.createExchange();
-        exchange.getIn().getHeaders().setHeader("cheese", 123);
+        exchange.getIn().setHeader("cheese", 123);
         endpoint.onExchange(exchange);
 
         // now lets sleep for a while

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultJmsMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultJmsMessage.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultJmsMessage.java (original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultJmsMessage.java Thu Mar 22 02:59:46 2007
@@ -17,16 +17,21 @@
  */
 package org.apache.camel.component.jms;
 
-import org.apache.camel.impl.DefaultMessage;
-import org.apache.camel.Headers;
+import org.apache.camel.InvalidHeaderTypeException;
+import org.apache.camel.impl.MessageSupport;
 
+import javax.jms.JMSException;
 import javax.jms.Message;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
- * @version $Revision$
+ * @version $Revision:520964 $
  */
-public class DefaultJmsMessage extends DefaultMessage implements JmsMessage {
+public class DefaultJmsMessage extends MessageSupport implements JmsMessage {
     private Message jmsMessage;
+    private Map<String, Object> lazyHeaders;
 
     public DefaultJmsMessage() {
     }
@@ -43,13 +48,70 @@
         this.jmsMessage = jmsMessage;
     }
 
-    @Override
-    protected Headers createHeaders() {
-        return new JmsHeaders(this);
+    public Object getHeader(String name) {
+        if (jmsMessage != null) {
+            try {
+                Object value = jmsMessage.getObjectProperty(name);
+                try {
+                    return value;
+                }
+                catch (ClassCastException e) {
+                    throw new InvalidHeaderTypeException(e.getMessage(), value);
+                }
+            }
+            catch (JMSException e) {
+                throw new MessagePropertyAcessException(name, e);
+            }
+        }
+        return null;
+    }
+
+    public void setHeader(String name, Object value) {
+        if (jmsMessage != null) {
+            try {
+                jmsMessage.setObjectProperty(name, value);
+            }
+            catch (JMSException e) {
+                throw new MessagePropertyAcessException(name, e);
+            }
+        }
+        else {
+            if (lazyHeaders == null) {
+                lazyHeaders = new HashMap<String, Object>();
+            }
+            lazyHeaders.put(name, value);
+        }
+    }
+
+    public Map<String, Object> getHeaders() {
+        if (jmsMessage != null) {
+            Map<String, Object> answer = new HashMap<String, Object>();
+            Enumeration names;
+            try {
+                names = jmsMessage.getPropertyNames();
+            }
+            catch (JMSException e) {
+                throw new MessagePropertyNamesAcessException(e);
+            }
+            while (names.hasMoreElements()) {
+                String name = names.nextElement().toString();
+                try {
+                    Object value = jmsMessage.getObjectProperty(name);
+                    answer.put(name, value);
+                }
+                catch (JMSException e) {
+                    throw new MessagePropertyAcessException(name, e);
+                }
+            }
+            return answer;
+        }
+        else {
+            return lazyHeaders;
+        }
     }
 
     @Override
-    public DefaultMessage newInstance() {
+    public DefaultJmsMessage newInstance() {
         return new DefaultJmsMessage();
     }
 }

Modified: activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java (original)
+++ activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java Thu Mar 22 02:59:46 2007
@@ -53,8 +53,8 @@
             public void configure() {
                 from("jms:activemq:test.a").to("jms:activemq:test.b");
                 from("jms:activemq:test.b").process(new Processor<JmsExchange>() {
-                    public void onExchange(JmsExchange exchange) {
-                        System.out.println("Received exchange: " + exchange.getIn());
+                    public void onExchange(JmsExchange e) {
+                        System.out.println("Received exchange: " + e.getIn());
                         latch.countDown();
                     }
                 });
@@ -66,10 +66,10 @@
         
         // now lets fire in a message
         Endpoint<JmsExchange> endpoint = container.resolveEndpoint("jms:activemq:test.a");
-        JmsExchange exchange2 = endpoint.createExchange();
+        JmsExchange exchange = endpoint.createExchange();
         //exchange2.setInBody("Hello there!")
-        exchange2.getIn().getHeaders().setHeader("cheese", 123);
-        endpoint.onExchange(exchange2);
+        exchange.getIn().setHeader("cheese", 123);
+        endpoint.onExchange(exchange);
 
         // now lets sleep for a while
         boolean received = latch.await(5, TimeUnit.SECONDS);

Modified: activemq/camel/trunk/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTest.java?view=diff&rev=521180&r1=521179&r2=521180
==============================================================================
--- activemq/camel/trunk/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTest.java (original)
+++ activemq/camel/trunk/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTest.java Thu Mar 22 02:59:46 2007
@@ -59,7 +59,7 @@
         MinaExchange exchange = endpoint.createExchange();
         Message message = exchange.getIn();
         message.setBody("Hello there!");
-        message.getHeaders().setHeader("cheese", 123);
+        message.setHeader("cheese", 123);
 
         endpoint.onExchange(exchange);
 



Mime
View raw message