Coverage Report - org.mule.model.pipeline.PipelineService
 
Classes in this File Line Coverage Branch Coverage Complexity
PipelineService
0%
0/21
0%
0/8
3
 
 1  
 /*
 2  
  * $Id: PipelineService.java 12269 2008-07-10 04:19:03Z 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.model.pipeline;
 12  
 
 13  
 import org.mule.api.MuleEvent;
 14  
 import org.mule.api.MuleException;
 15  
 import org.mule.api.MuleMessage;
 16  
 import org.mule.api.MuleRuntimeException;
 17  
 import org.mule.api.component.Component;
 18  
 import org.mule.api.transport.DispatchException;
 19  
 import org.mule.component.SimpleCallableJavaComponent;
 20  
 import org.mule.config.i18n.CoreMessages;
 21  
 import org.mule.model.direct.DirectService;
 22  
 
 23  
 public class PipelineService extends DirectService
 24  
 {
 25  
     /**
 26  
      * Serial version
 27  
      */
 28  
     private static final long serialVersionUID = -2788210157354765190L;
 29  
 
 30  
     public PipelineService()
 31  
     {
 32  0
         super();
 33  0
     }
 34  
 
 35  
     protected MuleMessage doSend(MuleEvent event) throws MuleException
 36  
     {
 37  
         try
 38  
         {
 39  0
             MuleMessage result = component.onCall(event);
 40  0
             MuleMessage returnMessage = null;
 41  0
             returnMessage = (MuleMessage) result;
 42  
 
 43  0
             if (!event.isStopFurtherProcessing())
 44  
             {
 45  
                 // // TODO what about this code?
 46  
                 // Map context = RequestContext.clearProperties();
 47  
                 // if (context != null) {
 48  
                 // returnMessage.addProperties(context);
 49  
                 // }
 50  0
                 if (outboundRouter.hasEndpoints())
 51  
                 {
 52  0
                     MuleMessage outboundReturnMessage = outboundRouter.route(returnMessage, event.getSession(),
 53  
                         event.isSynchronous());
 54  0
                     if (outboundReturnMessage != null)
 55  
                     {
 56  0
                         returnMessage = outboundReturnMessage;
 57  
                     }
 58  0
                 }
 59  
                 else
 60  
                 {
 61  0
                     logger.debug("Outbound router on service '" + name + "' doesn't have any endpoints configured.");
 62  
                 }
 63  
             }
 64  
 
 65  0
             return returnMessage;
 66  
         }
 67  0
         catch (Exception e)
 68  
         {
 69  0
             throw new DispatchException(event.getMessage(), event.getEndpoint(), e);
 70  
         }
 71  
     }
 72  
 
 73  
     protected void doDispatch(MuleEvent event) throws MuleException
 74  
     {
 75  0
         sendEvent(event);
 76  0
     }
 77  
 
 78  
     // @Override
 79  
     public void setComponent(Component component)
 80  
     {
 81  0
         if (!(component instanceof SimpleCallableJavaComponent))
 82  
         {
 83  0
             throw new MuleRuntimeException(CoreMessages.objectNotOfCorrectType(component.getClass(),
 84  
                 SimpleCallableJavaComponent.class));
 85  
         }
 86  0
         super.setComponent(component);
 87  0
     }
 88  
 
 89  
 }