activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r521259 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
Date Thu, 22 Mar 2007 13:36:05 GMT
Author: jstrachan
Date: Thu Mar 22 06:36:04 2007
New Revision: 521259

URL: http://svn.apache.org/viewvc?view=rev&rev=521259
Log:
another minor change; added helper method so that implementors only need to worry about doing
the initial population

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultMessage.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java

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=521259&r1=521258&r2=521259
==============================================================================
--- 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 06:36:04 2007
@@ -66,7 +66,16 @@
      * @return return a newly constructed Map possibly containing headers from the underlying
inbound transport
      */
     protected Map<String, Object> createHeaders() {
-        return new HashMap<String, Object>();
+        HashMap<String, Object> map = new HashMap<String, Object>();
+        populateInitialHeaders(map);
+        return map;
     }
 
+    /**
+     * A strategy method populate the initial set of headers on an inbound message from an
underlying binding
+     *
+     * @param map is the empty header map to populate
+     */
+    protected void populateInitialHeaders(Map<String, Object> map) {
+    }
 }

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java?view=diff&rev=521259&r1=521258&r2=521259
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessage.java
Thu Mar 22 06:36:04 2007
@@ -83,8 +83,7 @@
     }
 
     @Override
-    protected Map<String, Object> createHeaders() {
-        HashMap<String, Object> answer = new HashMap<String, Object>();
+    protected void populateInitialHeaders(Map<String, Object> map) {
         if (jmsMessage != null) {
             Enumeration names;
             try {
@@ -97,14 +96,13 @@
                 String name = names.nextElement().toString();
                 try {
                     Object value = jmsMessage.getObjectProperty(name);
-                    answer.put(name, value);
+                    map.put(name, value);
                 }
                 catch (JMSException e) {
                     throw new MessagePropertyAcessException(name, e);
                 }
             }
         }
-        return answer;
     }
 }
 



Mime
View raw message