Coverage Report - org.mule.construct.builder.AbstractFlowConstructWithSingleInboundAndOutboundEndpointBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractFlowConstructWithSingleInboundAndOutboundEndpointBuilder
0%
0/19
0%
0/8
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.construct.builder;
 8  
 
 9  
 import java.util.List;
 10  
 
 11  
 import org.mule.MessageExchangePattern;
 12  
 import org.mule.api.MuleContext;
 13  
 import org.mule.api.MuleException;
 14  
 import org.mule.api.endpoint.EndpointBuilder;
 15  
 import org.mule.api.endpoint.OutboundEndpoint;
 16  
 import org.mule.api.processor.MessageProcessor;
 17  
 import org.mule.construct.AbstractFlowConstruct;
 18  
 
 19  
 @SuppressWarnings("unchecked")
 20  0
 public abstract class AbstractFlowConstructWithSingleInboundAndOutboundEndpointBuilder<T extends AbstractFlowConstructBuilder, F extends AbstractFlowConstruct>
 21  
     extends AbstractFlowConstructWithSingleInboundEndpointBuilder<T, F>
 22  
 {
 23  
     private OutboundEndpoint outboundEndpoint;
 24  
     private EndpointBuilder outboundEndpointBuilder;
 25  
     private String outboundAddress;
 26  
 
 27  
     // setters should be exposed only for builders where it makes sense
 28  
     protected List<MessageProcessor> outboundTransformers;
 29  
     protected List<MessageProcessor> outboundResponseTransformers;
 30  
 
 31  
     public T outboundEndpoint(OutboundEndpoint outboundEndpoint)
 32  
     {
 33  0
         this.outboundEndpoint = outboundEndpoint;
 34  0
         return (T) this;
 35  
     }
 36  
 
 37  
     public T outboundEndpoint(EndpointBuilder outboundEndpointBuilder)
 38  
     {
 39  0
         this.outboundEndpointBuilder = outboundEndpointBuilder;
 40  0
         return (T) this;
 41  
     }
 42  
 
 43  
     public T outboundAddress(String outboundAddress)
 44  
     {
 45  0
         this.outboundAddress = outboundAddress;
 46  0
         return (T) this;
 47  
     }
 48  
 
 49  
     protected OutboundEndpoint getOrBuildOutboundEndpoint(MuleContext muleContext) throws MuleException
 50  
     {
 51  0
         if (outboundEndpoint != null)
 52  
         {
 53  0
             return outboundEndpoint;
 54  
         }
 55  
 
 56  0
         if (outboundEndpointBuilder == null)
 57  
         {
 58  0
             outboundEndpointBuilder = muleContext.getEndpointFactory().getEndpointBuilder(
 59  
                 outboundAddress);
 60  
         }
 61  
 
 62  0
         outboundEndpointBuilder.setExchangePattern(getOutboundMessageExchangePattern());
 63  
 
 64  0
         if (outboundTransformers != null)
 65  
         {
 66  0
             outboundEndpointBuilder.setMessageProcessors(outboundTransformers);
 67  
         }
 68  
 
 69  0
         if (outboundResponseTransformers != null)
 70  
         {
 71  0
             outboundEndpointBuilder.setResponseMessageProcessors(outboundResponseTransformers);
 72  
         }
 73  
 
 74  0
         doConfigureOutboundEndpointBuilder(muleContext, outboundEndpointBuilder);
 75  
 
 76  0
         return outboundEndpointBuilder.buildOutboundEndpoint();
 77  
     }
 78  
 
 79  
     protected abstract MessageExchangePattern getOutboundMessageExchangePattern();
 80  
 
 81  
     protected void doConfigureOutboundEndpointBuilder(MuleContext muleContext, EndpointBuilder endpointBuilder)
 82  
     {
 83  
         // template method
 84  0
     }
 85  
 
 86  
 }