View Javadoc
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.delegate;
8   
9   import org.mule.config.spring.parsers.MuleDefinitionParser;
10  
11  import org.springframework.beans.factory.support.AbstractBeanDefinition;
12  import org.springframework.beans.factory.xml.ParserContext;
13  import org.w3c.dom.Element;
14  
15  /**
16   * This allows a definition parsers to be dynamically represented by one instance
17   * selected from a set of parsers, depending on the context.  For example, a single
18   * Mule model may be defined across several file - the first file used defines the
19   * model and subsequent uses extend it (for this particular case, see
20   * {@link InheritDefinitionParser}).
21   *
22   * <p>Note that the sub-parsers must be consistent.  That includes matching the
23   * same schema, for example.
24   */
25  public abstract class AbstractParallelDelegatingDefinitionParser extends AbstractDelegatingDefinitionParser
26  {
27  
28      protected AbstractParallelDelegatingDefinitionParser()
29      {
30          super();
31      }
32  
33      protected AbstractParallelDelegatingDefinitionParser(MuleDefinitionParser[] delegates)
34      {
35          super(delegates);
36      }
37  
38      public AbstractBeanDefinition muleParse(Element element, ParserContext parserContext)
39      {
40          return getDelegate(element, parserContext).muleParse(element, parserContext);
41      }
42  
43      protected abstract MuleDefinitionParser getDelegate(Element element, ParserContext parserContext);
44  
45  }