Coverage Report - org.mule.config.spring.parsers.specific.TransactionDefinitionParser
 
Classes in this File Line Coverage Branch Coverage Complexity
TransactionDefinitionParser
0%
0/13
N/A
1
 
 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.config.spring.parsers.specific;
 8  
 
 9  
 import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser;
 10  
 import org.mule.config.spring.parsers.MuleDefinitionParser;
 11  
 import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser;
 12  
 import org.mule.config.spring.parsers.generic.ChildDefinitionParser;
 13  
 import org.mule.config.spring.parsers.processors.BlockAttribute;
 14  
 
 15  
 /**
 16  
  * Generates a transaction config with embedded factory.  If no factory is defined, it's taken from the
 17  
  * factory-class or factory-ref attributes.
 18  
  */
 19  
 public class TransactionDefinitionParser extends AbstractSingleParentFamilyDefinitionParser
 20  
 {
 21  
 
 22  
     public static final String FACTORY = "factory";
 23  
     public static final String FACTORY_REF = FACTORY + "-ref";
 24  
     public static final String FACTORY_CLASS = FACTORY + "-" + AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS;
 25  
     public static final String ACTION = "action";
 26  
     public static final String TIMEOUT = "timeout";
 27  
     public static final String INTERACT_WTH_EXTERNAL = "interactWithExternal";
 28  
 
 29  
     public TransactionDefinitionParser()
 30  0
     {
 31  0
         commonInit(null);
 32  0
     }
 33  
 
 34  
     public TransactionDefinitionParser(Class factoryClass)
 35  0
     {
 36  0
         commonInit(factoryClass);
 37  0
         MuleDefinitionParser factoryParser = getDelegate(1);
 38  
         // don't allow these if the class is specified in the constructor
 39  0
         factoryParser.registerPreProcessor(new BlockAttribute(new String[]{FACTORY_CLASS, FACTORY_REF}));
 40  0
     }
 41  
 
 42  
     private void commonInit(Class factoryClass)
 43  
     {
 44  0
         addDelegate(new TransactionConfigDefinitionParser())
 45  
                 .setIgnoredDefault(true)
 46  
                 .removeIgnored(FACTORY_REF)
 47  
                 .removeIgnored(ACTION)
 48  
                 .removeIgnored(TIMEOUT)
 49  
                 .removeIgnored(INTERACT_WTH_EXTERNAL);
 50  0
         addDelegateAsChild(new ChildDefinitionParser(FACTORY, factoryClass))
 51  
                 .setIgnoredDefault(false)
 52  
                 .addIgnored(FACTORY_REF)
 53  
                 .addIgnored(ACTION)
 54  
                 .addIgnored(TIMEOUT)
 55  
                 .addIgnored(INTERACT_WTH_EXTERNAL)
 56  
                 .addAlias(FACTORY_CLASS, AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS)
 57  
                 // the ref is set on the parent
 58  
                 .registerPreProcessor(new BlockAttribute(FACTORY));
 59  0
         addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME);
 60  0
         addHandledException(BlockAttribute.BlockAttributeException.class);
 61  0
     }
 62  
 
 63  
 }