Ejemplo n.º 1
0
 public DefaultMuleMessage(Object message, Map properties) {
   // Explicitly check for MuleMessage as a safeguard since MuleMessage is instance of
   // MessageAdapter
   if (message instanceof MuleMessage) {
     adapter = ((MuleMessage) message).getAdapter();
   } else if (message instanceof MessageAdapter) {
     adapter = (MessageAdapter) message;
   } else {
     adapter = new DefaultMessageAdapter(message);
   }
   addProperties(properties);
   resetAccessControl();
 }
Ejemplo n.º 2
0
 public DefaultMuleMessage(Object message, MessageAdapter previous) {
   if (message instanceof MessageAdapter) {
     adapter = (MessageAdapter) message;
     ((ThreadSafeAccess) adapter).resetAccessControl();
   } else {
     adapter = new DefaultMessageAdapter(message, previous);
   }
   if (previous.getExceptionPayload() != null) {
     setExceptionPayload(previous.getExceptionPayload());
   }
   setEncoding(previous.getEncoding());
   if (previous.getAttachmentNames().size() > 0) {
     Set<String> attNames = adapter.getAttachmentNames();
     for (String s : attNames) {
       try {
         addAttachment(s, adapter.getAttachment(s));
       } catch (Exception e) {
         throw new MuleRuntimeException(CoreMessages.failedToReadAttachment(s), e);
       }
     }
   }
   resetAccessControl();
 }