Coverage Report - org.mule.module.ibeans.spi.MuleRequestMessage
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleRequestMessage
0%
0/32
0%
0/2
0
 
 1  
 /*
 2  
  * $Id: MuleRequestMessage.java 19421 2010-09-08 08:00:48Z rossmason $
 3  
  * -------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 package org.mule.module.ibeans.spi;
 11  
 
 12  
 import org.mule.api.MuleMessage;
 13  
 import org.mule.api.MuleRuntimeException;
 14  
 import org.mule.api.transport.PropertyScope;
 15  
 
 16  
 import java.util.Set;
 17  
 
 18  
 import javax.activation.DataHandler;
 19  
 
 20  
 import org.ibeans.api.IBeanInvocationData;
 21  
 import org.ibeans.api.Request;
 22  
 
 23  
 /**
 24  
  * An implementation of an IBeans {@link org.ibeans.api.Request} that adapts to a {@link org.mule.api.MuleMessage}
 25  
  */
 26  
 public class MuleRequestMessage implements Request
 27  
 {
 28  
     private MuleMessage message;
 29  0
     private int timeout = 0;
 30  
     private IBeanInvocationData data;
 31  
 
 32  
     public MuleRequestMessage(IBeanInvocationData data, MuleMessage message)
 33  0
     {
 34  0
         this.message = message;
 35  0
         this.data = data;
 36  0
     }
 37  
 
 38  
     public Object getPayload()
 39  
     {
 40  0
         return message.getPayload();
 41  
     }
 42  
 
 43  
     public void setPayload(Object payload)
 44  
     {
 45  0
         message.setPayload(payload);
 46  0
     }
 47  
 
 48  
     public void addHeader(String name, Object value)
 49  
     {
 50  0
         message.setOutboundProperty(name, value);
 51  0
     }
 52  
 
 53  
     public Object removeHeader(String name)
 54  
     {
 55  0
         return message.removeProperty(name, PropertyScope.OUTBOUND);
 56  
     }
 57  
 
 58  
     public Object getHeader(String name)
 59  
     {
 60  0
         return message.getOutboundProperty(name);
 61  
     }
 62  
 
 63  
     public Set<String> getHeaderNames()
 64  
     {
 65  0
         return message.getOutboundPropertyNames();
 66  
     }
 67  
 
 68  
     public void addAttachment(String name, DataHandler handler)
 69  
     {
 70  
         try
 71  
         {
 72  0
             message.addOutboundAttachment(name, handler);
 73  
         }
 74  0
         catch (Exception e)
 75  
         {
 76  0
             throw new MuleRuntimeException(e);
 77  0
         }
 78  0
     }
 79  
 
 80  
     public DataHandler removeAttachment(String name)
 81  
     {
 82  0
         DataHandler dh = message.getOutboundAttachment(name);
 83  
         try
 84  
         {
 85  0
             if(dh!=null)
 86  0
             message.removeOutboundAttachment(name);
 87  
         }
 88  0
         catch (Exception e)
 89  
         {
 90  0
             throw new MuleRuntimeException(e);
 91  0
         }
 92  0
         return dh;
 93  
     }
 94  
 
 95  
     public DataHandler getAttachment(String name)
 96  
     {
 97  0
         return message.getOutboundAttachment(name);
 98  
     }
 99  
 
 100  
     public Set<String> getAttachmentNames()
 101  
     {
 102  0
         return message.getOutboundAttachmentNames();
 103  
     }
 104  
 
 105  
     public int getTimeout()
 106  
     {
 107  0
         return timeout;
 108  
     }
 109  
 
 110  
     public void setTimeout(int timeout)
 111  
     {
 112  0
         this.timeout = timeout;
 113  0
     }
 114  
 
 115  
     public IBeanInvocationData getIBeanInvocationData()
 116  
     {
 117  0
         return data;
 118  
     }
 119  
 
 120  
     public MuleMessage getMessage()
 121  
     {
 122  0
         return message;
 123  
     }
 124  
 }