View Javadoc

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