Coverage Report - org.mule.transport.rmi.RmiMessageAdapter
 
Classes in this File Line Coverage Branch Coverage Complexity
RmiMessageAdapter
45%
5/11
50%
1/2
1.4
 
 1  
 /*
 2  
  * $Id: RmiMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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  
 
 11  
 package org.mule.transport.rmi;
 12  
 
 13  
 import org.mule.api.ThreadSafeAccess;
 14  
 import org.mule.api.transport.MessageTypeNotSupportedException;
 15  
 import org.mule.transport.AbstractMessageAdapter;
 16  
 
 17  
 /**
 18  
  * Wraps an object obtained by calling a method on a Remote object
 19  
  */
 20  
 
 21  
 public class RmiMessageAdapter extends AbstractMessageAdapter
 22  
 {
 23  
     /**
 24  
      * Serial version
 25  
      */
 26  
     private static final long serialVersionUID = -1765089871661318129L;
 27  
 
 28  
     private final Object message;
 29  
 
 30  
     public RmiMessageAdapter(Object message) throws MessageTypeNotSupportedException
 31  50
     {
 32  50
         if (message == null)
 33  
         {
 34  0
             throw new MessageTypeNotSupportedException(null, getClass());
 35  
         }
 36  50
         this.message = message;
 37  50
     }
 38  
 
 39  
     protected RmiMessageAdapter(RmiMessageAdapter template)
 40  
     {
 41  0
         super(template);
 42  0
         message = template.message;
 43  0
     }
 44  
 
 45  
     /**
 46  
      * Converts the message implementation into a String representation
 47  
      * 
 48  
      * @param encoding The encoding to use when transforming the message (if
 49  
      *            necessary). The parameter is used when converting from a byte array
 50  
      * @return String representation of the message payload
 51  
      * @throws Exception Implementation may throw an endpoint specific exception
 52  
      */
 53  
     public String getPayloadAsString(String encoding) throws Exception
 54  
     {
 55  0
         return message.toString();
 56  
     }
 57  
 
 58  
     public Object getPayload()
 59  
     {
 60  50
         return message;
 61  
     }
 62  
 
 63  
     public ThreadSafeAccess newThreadCopy()
 64  
     {
 65  0
         return new RmiMessageAdapter(this);
 66  
     }
 67  
     
 68  
 }