View Javadoc

1   /*
2    * $Id: EndpointChildDefinitionParser.java 11101 2008-02-27 22:51:17Z dandiep $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.transport.cxf.config;
12  
13  import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser;
14  import org.mule.config.spring.parsers.processors.NamedSetterChildElementIterator;
15  import org.mule.config.spring.parsers.processors.AddAttribute;
16  import org.mule.config.spring.parsers.assembly.MapEntryCombiner;
17  import org.mule.config.spring.parsers.assembly.DefaultBeanAssemblerFactory;
18  import org.mule.config.spring.parsers.assembly.configuration.SimplePropertyConfiguration;
19  import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration;
20  import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate;
21  
22  public class EndpointChildDefinitionParser extends ChildSingletonMapDefinitionParser
23  {
24  
25      public static final String PROPERTIES = "properties";
26  
27      public EndpointChildDefinitionParser(String elementName)
28      {
29          super(PROPERTIES);
30          addCollection(PROPERTIES);
31          addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE);
32          PropertyConfiguration configuration = new SimplePropertyConfiguration();
33          configuration.addCollection(MapEntryCombiner.VALUE);
34          registerPreProcessor(new AddAttribute(MapEntryCombiner.KEY, elementName));
35          registerPostProcessor(
36                  new NamedSetterChildElementIterator(
37                          MapEntryCombiner.VALUE, new DefaultBeanAssemblerFactory(), configuration));
38      }
39  
40  }