// Path: elastic-config-spring/src/main/java/com/github/config/spring/datasource/tag/ZookeeperConfigBeanDefinitionParserTag.java
// @NoArgsConstructor(access = AccessLevel.PRIVATE)
// public class ZookeeperConfigBeanDefinitionParserTag {
// 
//     public static final String REGISTRY_CENTER_REF_ATTRIBUTE = "registry-center-ref";
// 
//     public static final String SERVERLIST_ATTRIBUTE = "serverlist";
// 
//     public static final String NAMESPACE_ATTRIBUTE = "namespace";
// 
//     public static final String PROJECT_ATTRIBUTE = "project";
// 
//     public static final String CONFIG_ATTRIBUTE = "node";
// 
//     public static final String VERSION_ATTRIBUTE = "version";
// 
//     public static final String REGISTER_CONFIG_ELEMENT = "config";
// 
//     public static final String CONFIG_REFRESH = "refresh";
// 
//     public static final String REGISTER_PLACEHOLDER_ELEMENT = "placeholder";
// 
// }
// 
// Path: elastic-config-spring/src/main/java/com/github/config/spring/namespace/parser/ConfigGroupBeanDefinitionParser.java
// public class ConfigGroupBeanDefinitionParser extends AbstractBeanDefinitionParser {
// 
//     @Override
//     protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
// 
//         BeanDefinitionBuilder groupBuilder = BeanDefinitionBuilder
//             .rootBeanDefinition(SpringZookeeperElasticConfigGroup.class);
//         groupBuilder.addConstructorArgValue(createConfiguration(element));
//         groupBuilder.setDestroyMethodName("close");
// 
//         return groupBuilder.getBeanDefinition();
//     }
// 
//     private SpringZookeeperConfiguration createConfiguration(final Element element) {
//         SpringZookeeperConfiguration result = new SpringZookeeperConfiguration(
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.SERVERLIST_ATTRIBUTE),
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.NAMESPACE_ATTRIBUTE),
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.PROJECT_ATTRIBUTE),
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.VERSION_ATTRIBUTE),
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.CONFIG_ATTRIBUTE));
//         result.setRefresh(element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.CONFIG_REFRESH));
//         return result;
//     }
// }
// 
// Path: elastic-config-spring/src/main/java/com/github/config/spring/namespace/parser/PlaceholderBeanDefinitionParser.java
// public class PlaceholderBeanDefinitionParser extends AbstractBeanDefinitionParser {
// 
//     @Override
//     protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
//         BeanDefinitionBuilder factory = BeanDefinitionBuilder
//             .rootBeanDefinition(PropertySourcesPlaceholderConfigurer.class);
//         BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder
//             .rootBeanDefinition(RegistryPropertySources.class);
//         definitionBuilder.addConstructorArgReference(element
//             .getAttribute(ZookeeperConfigBeanDefinitionParserTag.REGISTRY_CENTER_REF_ATTRIBUTE));
//         factory.addPropertyValue("propertySources", definitionBuilder.getBeanDefinition());
//         factory.addPropertyValue("order", "-1");
//         return factory.getBeanDefinition();
//     }
// }


import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
import com.github.config.spring.datasource.tag.ZookeeperConfigBeanDefinitionParserTag;
import com.github.config.spring.namespace.parser.ConfigGroupBeanDefinitionParser;
import com.github.config.spring.namespace.parser.PlaceholderBeanDefinitionParser;
package com.github.config.spring.namespace.handler;



/**
 * 注册中心的命名空间处理器.
 * 
 * @author ZhangWei
 */
public class RegNamespaceHandler extends NamespaceHandlerSupport {

    @Override
    public void init() {
        registerBeanDefinitionParser(ZookeeperConfigBeanDefinitionParserTag.REGISTER_CONFIG_ELEMENT,
// Path: elastic-config-spring/src/main/java/com/github/config/spring/datasource/tag/ZookeeperConfigBeanDefinitionParserTag.java
// @NoArgsConstructor(access = AccessLevel.PRIVATE)
// public class ZookeeperConfigBeanDefinitionParserTag {
// 
//     public static final String REGISTRY_CENTER_REF_ATTRIBUTE = "registry-center-ref";
// 
//     public static final String SERVERLIST_ATTRIBUTE = "serverlist";
// 
//     public static final String NAMESPACE_ATTRIBUTE = "namespace";
// 
//     public static final String PROJECT_ATTRIBUTE = "project";
// 
//     public static final String CONFIG_ATTRIBUTE = "node";
// 
//     public static final String VERSION_ATTRIBUTE = "version";
// 
//     public static final String REGISTER_CONFIG_ELEMENT = "config";
// 
//     public static final String CONFIG_REFRESH = "refresh";
// 
//     public static final String REGISTER_PLACEHOLDER_ELEMENT = "placeholder";
// 
// }
// 
// Path: elastic-config-spring/src/main/java/com/github/config/spring/namespace/parser/ConfigGroupBeanDefinitionParser.java
// public class ConfigGroupBeanDefinitionParser extends AbstractBeanDefinitionParser {
// 
//     @Override
//     protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
// 
//         BeanDefinitionBuilder groupBuilder = BeanDefinitionBuilder
//             .rootBeanDefinition(SpringZookeeperElasticConfigGroup.class);
//         groupBuilder.addConstructorArgValue(createConfiguration(element));
//         groupBuilder.setDestroyMethodName("close");
// 
//         return groupBuilder.getBeanDefinition();
//     }
// 
//     private SpringZookeeperConfiguration createConfiguration(final Element element) {
//         SpringZookeeperConfiguration result = new SpringZookeeperConfiguration(
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.SERVERLIST_ATTRIBUTE),
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.NAMESPACE_ATTRIBUTE),
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.PROJECT_ATTRIBUTE),
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.VERSION_ATTRIBUTE),
//             element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.CONFIG_ATTRIBUTE));
//         result.setRefresh(element.getAttribute(ZookeeperConfigBeanDefinitionParserTag.CONFIG_REFRESH));
//         return result;
//     }
// }
// 
// Path: elastic-config-spring/src/main/java/com/github/config/spring/namespace/parser/PlaceholderBeanDefinitionParser.java
// public class PlaceholderBeanDefinitionParser extends AbstractBeanDefinitionParser {
// 
//     @Override
//     protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
//         BeanDefinitionBuilder factory = BeanDefinitionBuilder
//             .rootBeanDefinition(PropertySourcesPlaceholderConfigurer.class);
//         BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder
//             .rootBeanDefinition(RegistryPropertySources.class);
//         definitionBuilder.addConstructorArgReference(element
//             .getAttribute(ZookeeperConfigBeanDefinitionParserTag.REGISTRY_CENTER_REF_ATTRIBUTE));
//         factory.addPropertyValue("propertySources", definitionBuilder.getBeanDefinition());
//         factory.addPropertyValue("order", "-1");
//         return factory.getBeanDefinition();
//     }
// }


// Path: elastic-config-spring/src/main/java/com/github/config/spring/namespace/handler/RegNamespaceHandler.java
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
import com.github.config.spring.datasource.tag.ZookeeperConfigBeanDefinitionParserTag;
import com.github.config.spring.namespace.parser.ConfigGroupBeanDefinitionParser;
import com.github.config.spring.namespace.parser.PlaceholderBeanDefinitionParser;

package com.github.config.spring.namespace.handler;



/**
 * 注册中心的命名空间处理器.
 * 
 * @author ZhangWei
 */
public class RegNamespaceHandler extends NamespaceHandlerSupport {

    @Override
    public void init() {
        registerBeanDefinitionParser(ZookeeperConfigBeanDefinitionParserTag.REGISTER_CONFIG_ELEMENT,
            new ConfigGroupBeanDefinitionParser());