Coverage Report - org.mule.endpoint.DefaultOutboundEndpoint
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultOutboundEndpoint
0%
0/21
0%
0/8
0
 
 1  
 /*
 2  
  * $Id: DefaultOutboundEndpoint.java 20321 2010-11-24 15:21:24Z dfeist $
 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.endpoint;
 12  
 
 13  
 import org.mule.MessageExchangePattern;
 14  
 import org.mule.api.MuleContext;
 15  
 import org.mule.api.MuleEvent;
 16  
 import org.mule.api.MuleException;
 17  
 import org.mule.api.config.MuleProperties;
 18  
 import org.mule.api.construct.FlowConstruct;
 19  
 import org.mule.api.construct.FlowConstructAware;
 20  
 import org.mule.api.context.MuleContextAware;
 21  
 import org.mule.api.endpoint.EndpointMessageProcessorChainFactory;
 22  
 import org.mule.api.endpoint.EndpointURI;
 23  
 import org.mule.api.endpoint.OutboundEndpoint;
 24  
 import org.mule.api.lifecycle.Initialisable;
 25  
 import org.mule.api.processor.MessageProcessor;
 26  
 import org.mule.api.retry.RetryPolicyTemplate;
 27  
 import org.mule.api.transaction.TransactionConfig;
 28  
 import org.mule.api.transport.Connector;
 29  
 import org.mule.transport.AbstractConnector;
 30  
 import org.mule.util.StringUtils;
 31  
 
 32  
 import java.util.ArrayList;
 33  
 import java.util.Arrays;
 34  
 import java.util.List;
 35  
 import java.util.Map;
 36  
 
 37  
 public class DefaultOutboundEndpoint extends AbstractEndpoint implements OutboundEndpoint
 38  
 {
 39  
     private static final long serialVersionUID = 8860985949279708638L;
 40  
 
 41  
     private List<String> responseProperties;
 42  
 
 43  
     public DefaultOutboundEndpoint(Connector connector,
 44  
                                    EndpointURI endpointUri,
 45  
                                    String name,
 46  
                                    Map properties,
 47  
                                    TransactionConfig transactionConfig,
 48  
                                    boolean deleteUnacceptedMessage,
 49  
                                    MessageExchangePattern messageExchangePattern,
 50  
                                    int responseTimeout,
 51  
                                    String initialState,
 52  
                                    String endpointEncoding,
 53  
                                    String endpointBuilderName,
 54  
                                    MuleContext muleContext,
 55  
                                    RetryPolicyTemplate retryPolicyTemplate,
 56  
                                    String responsePropertiesList,
 57  
                                    EndpointMessageProcessorChainFactory messageProcessorsFactory,
 58  
                                    List <MessageProcessor> messageProcessors,
 59  
                                    List <MessageProcessor> responseMessageProcessors,
 60  
                                    boolean disableTransportTransformer,
 61  
                                    String endpointMimeType)
 62  
     {
 63  0
         super(connector, endpointUri, name, properties, transactionConfig, 
 64  
                 deleteUnacceptedMessage, messageExchangePattern, responseTimeout, initialState,
 65  
                 endpointEncoding, endpointBuilderName, muleContext, retryPolicyTemplate, 
 66  
                 messageProcessorsFactory, messageProcessors, responseMessageProcessors, disableTransportTransformer, endpointMimeType);
 67  
 
 68  0
         responseProperties = new ArrayList<String>();
 69  
         // Propagate the Correlation-related properties from the previous message by default (see EE-1613).
 70  0
         responseProperties.add(MuleProperties.MULE_CORRELATION_ID_PROPERTY);
 71  0
         responseProperties.add(MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY);
 72  0
         responseProperties.add(MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY);
 73  0
         responseProperties.add(MuleProperties.MULE_SESSION_PROPERTY);
 74  
         // Add any additional properties specified by the user.
 75  0
         String[] props = StringUtils.splitAndTrim(responsePropertiesList, ",");
 76  0
         if (props != null)
 77  
         {
 78  0
             responseProperties.addAll(Arrays.asList(props));
 79  
         }
 80  0
     }
 81  
 
 82  
     public List<String> getResponseProperties()
 83  
     {
 84  0
         return responseProperties;
 85  
     }
 86  
 
 87  
     public MuleEvent process(MuleEvent event) throws MuleException
 88  
     {
 89  0
         return getMessageProcessorChain(event.getFlowConstruct()).process(event);
 90  
     }
 91  
 
 92  
     @Override
 93  
     protected MessageProcessor createMessageProcessorChain(FlowConstruct flowContruct) throws MuleException
 94  
     {
 95  0
         EndpointMessageProcessorChainFactory factory = getMessageProcessorsFactory();
 96  0
         MessageProcessor chain = factory.createOutboundMessageProcessorChain(this, flowContruct,
 97  
             ((AbstractConnector) getConnector()).createDispatcherMessageProcessor(this));
 98  
 
 99  0
         if (chain instanceof MuleContextAware)
 100  
         {
 101  0
             ((MuleContextAware) chain).setMuleContext(getMuleContext());
 102  
         }
 103  0
         if (chain instanceof FlowConstructAware)
 104  
         {
 105  0
             ((FlowConstructAware) chain).setFlowConstruct(flowContruct);
 106  
         }
 107  0
         if (chain instanceof Initialisable)
 108  
         {
 109  0
             ((Initialisable) chain).initialise();
 110  
         }
 111  
         
 112  0
         return chain;
 113  
     }
 114  
 }