Coverage Report - org.mule.processor.AbstractInterceptingMessageProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractInterceptingMessageProcessor
0%
0/12
0%
0/6
0
 
 1  
 /*
 2  
  * $Id$
 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  
 
 11  
 package org.mule.processor;
 12  
 
 13  
 import org.mule.DefaultMuleEvent;
 14  
 import org.mule.api.MuleEvent;
 15  
 import org.mule.api.MuleException;
 16  
 import org.mule.api.endpoint.OutboundEndpoint;
 17  
 import org.mule.api.processor.InterceptingMessageProcessor;
 18  
 import org.mule.api.processor.MessageProcessor;
 19  
 import org.mule.util.ObjectUtils;
 20  
 
 21  
 import org.apache.commons.logging.Log;
 22  
 import org.apache.commons.logging.LogFactory;
 23  
 
 24  
 /**
 25  
  * Abstract implementation of {@link InterceptingMessageProcessor} that simply
 26  
  * provides an implementation of setNext and holds the next message processor as an
 27  
  * attribute.
 28  
  */
 29  0
 public abstract class AbstractInterceptingMessageProcessor implements InterceptingMessageProcessor
 30  
 {
 31  0
     protected Log logger = LogFactory.getLog(getClass());
 32  
 
 33  
     public void setListener(MessageProcessor next)
 34  
     {
 35  0
         this.next = next;
 36  0
     }
 37  
 
 38  
     protected MessageProcessor next;
 39  
 
 40  
     protected MuleEvent processNext(MuleEvent event) throws MuleException
 41  
     {
 42  0
         if (next == null)
 43  
         {
 44  0
             return event;
 45  
         }
 46  
         else
 47  
         {
 48  0
             if (logger.isTraceEnabled())
 49  
             {
 50  0
                 logger.trace("Invoking next MessageProcessor: '" + next.getClass().getName() + "' ");
 51  
             }
 52  
             // If the next message processor is an outbound router then create outbound event
 53  0
             if (next instanceof OutboundEndpoint)
 54  
             {
 55  0
                 event = new DefaultMuleEvent(event.getMessage(), (OutboundEndpoint) next, event.getSession());
 56  
             }
 57  0
             return next.process(event);
 58  
         }
 59  
     }
 60  
     
 61  
     @Override
 62  
     public String toString()
 63  
     {
 64  0
         return ObjectUtils.toString(this);
 65  
     }
 66  
 }