Author: ffang
Date: Thu Jul  2 08:37:30 2009
New Revision: 790498

URL: http://svn.apache.org/viewvc?rev=790498&view=rev
Log:
[SMXCOMP-577]servicemix camel can't deal with the message have the security 
subject rightly

Modified:
    
servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java

Modified: 
servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java?rev=790498&r1=790497&r2=790498&view=diff
==============================================================================
--- 
servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java
 (original)
+++ 
servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java
 Thu Jul  2 08:37:30 2009
@@ -85,6 +85,7 @@
         normalizedMessage.setContent(getJbiInContent(camelExchange));
         addJbiHeaders(jbiExchange, normalizedMessage, camelExchange);
         addJbiAttachments(jbiExchange, normalizedMessage, camelExchange);
+        addSecuritySubject(jbiExchange, normalizedMessage, 
camelExchange.getIn());
         return jbiExchange;
     }
 
@@ -133,7 +134,7 @@
                 answer = exchangeFactory.createExchange(new 
URI(mep.toString()));
             }
         }
-        // TODO: this is not really usefull as the out will not be
+        // TODO: this is not really useful as the out will not be
         // TODO: populated at that time
         if (answer == null) {
             // lets try choose the best MEP based on the camel message
@@ -182,6 +183,17 @@
             copyNormalizedMessageHeaders(normalizedMessage, 
camelNormalizedMessage);
         }
     }
+    
+    protected void addSecuritySubject(MessageExchange jbiExchange, 
NormalizedMessage normalizedMessage, Message camelMessage) {
+        if (camelMessage instanceof JbiMessage) {
+            JbiMessage message = (JbiMessage)camelMessage;
+            if (message.getNormalizedMessage() != null) {
+                // copy the security subject
+                
normalizedMessage.setSecuritySubject(message.getNormalizedMessage().getSecuritySubject());
+            }
+        }
+
+    }
 
     private void copySerializableHeaders(Map<String, Object> headers, 
NormalizedMessage normalizedMessage) {
         for (Map.Entry<String, Object> entry : headers.entrySet()) {


Reply via email to