Coverage Report - org.mule.construct.builder.AbstractFlowConstructWithSingleInboundEndpointBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractFlowConstructWithSingleInboundEndpointBuilder
0%
0/19
0%
0/8
0
 
 1  
 /*
 2  
  * $Id: AbstractFlowConstructWithSingleInboundEndpointBuilder.java 20385 2010-11-29 20:25:26Z 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.construct.builder;
 12  
 
 13  
 import java.util.List;
 14  
 
 15  
 import org.mule.MessageExchangePattern;
 16  
 import org.mule.api.MuleContext;
 17  
 import org.mule.api.MuleException;
 18  
 import org.mule.api.endpoint.EndpointBuilder;
 19  
 import org.mule.api.endpoint.InboundEndpoint;
 20  
 import org.mule.api.processor.MessageProcessor;
 21  
 import org.mule.construct.AbstractFlowConstruct;
 22  
 
 23  
 @SuppressWarnings("unchecked")
 24  0
 public abstract class AbstractFlowConstructWithSingleInboundEndpointBuilder<T extends AbstractFlowConstructBuilder, F extends AbstractFlowConstruct>
 25  
     extends AbstractFlowConstructBuilder<T, F>
 26  
 {
 27  
     private InboundEndpoint inboundEndpoint;
 28  
     private EndpointBuilder inboundEndpointBuilder;
 29  
     private String inboundAddress;
 30  
 
 31  
     // setters should be exposed only for builders where it makes sense
 32  
     protected List<MessageProcessor> inboundTransformers;
 33  
     protected List<MessageProcessor> inboundResponseTransformers;
 34  
 
 35  
     public T inboundEndpoint(InboundEndpoint inboundEndpoint)
 36  
     {
 37  0
         this.inboundEndpoint = inboundEndpoint;
 38  0
         return (T) this;
 39  
     }
 40  
 
 41  
     public T inboundEndpoint(EndpointBuilder inboundEndpointBuilder)
 42  
     {
 43  0
         this.inboundEndpointBuilder = inboundEndpointBuilder;
 44  0
         return (T) this;
 45  
     }
 46  
 
 47  
     public T inboundAddress(String inboundAddress)
 48  
     {
 49  0
         this.inboundAddress = inboundAddress;
 50  0
         return (T) this;
 51  
     }
 52  
 
 53  
     protected InboundEndpoint getOrBuildInboundEndpoint(MuleContext muleContext) throws MuleException
 54  
     {
 55  0
         if (inboundEndpoint != null)
 56  
         {
 57  0
             return inboundEndpoint;
 58  
         }
 59  
 
 60  0
         if (inboundEndpointBuilder == null)
 61  
         {
 62  0
             inboundEndpointBuilder = muleContext.getEndpointFactory().getEndpointBuilder(
 63  
                 inboundAddress);
 64  
         }
 65  
 
 66  0
         inboundEndpointBuilder.setExchangePattern(getInboundMessageExchangePattern());
 67  
 
 68  0
         if (inboundTransformers != null)
 69  
         {
 70  0
             inboundEndpointBuilder.setMessageProcessors(inboundTransformers);
 71  
         }
 72  
 
 73  0
         if (inboundResponseTransformers != null)
 74  
         {
 75  0
             inboundEndpointBuilder.setResponseMessageProcessors(inboundResponseTransformers);
 76  
         }
 77  
 
 78  0
         doConfigureInboundEndpointBuilder(muleContext, inboundEndpointBuilder);
 79  
 
 80  0
         return inboundEndpointBuilder.buildInboundEndpoint();
 81  
     }
 82  
 
 83  
     protected abstract MessageExchangePattern getInboundMessageExchangePattern();
 84  
 
 85  
     protected void doConfigureInboundEndpointBuilder(MuleContext muleContext, EndpointBuilder endpointBuilder)
 86  
     {
 87  
         // template method
 88  0
     }
 89  
 }