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