All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.contributions.ContributionsNamespaceHandler Maven / Gradle / Ivy

Go to download

This project adds a so called contribution mechanism (like known from Tapestry IOC or Eclipse Plugins) for configuration and extension of services to the Spring project.

There is a newer version: 2.0.0
Show newest version
package org.springframework.contributions;

import org.springframework.beans.factory.xml.NamespaceHandler;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
import org.springframework.contributions.mapped.MappedContributionBeanDefinitionParser;
import org.springframework.contributions.mapped.MappedContributionRefBeanDefinitionParser;
import org.springframework.contributions.ordered.ContributionBeanDefinitionDecorator;
import org.springframework.contributions.ordered.OrderedContributionBeanDefinitionParser;
import org.springframework.contributions.ordered.OrderedContributionRefBeanDefinitionParser;

/**
 * Spring namespace handler for contributions.
 *
 * @author Christian Köberl
 */
public class ContributionsNamespaceHandler extends NamespaceHandlerSupport implements NamespaceHandler
{
    /**
     * XML namespace for contributions.
     */
    public static final String CONTRIBUTION_NAMESPACE = "http://www.springframework.org/schema/contributions";

    /**
     * Prefix for mapped contributions.
     */
    public static final String MAPPED_CONTRIBUTION_PREFIX = "org.springframework.contributions.mapped.";

    /**
     * Prefix for ordered contributions.
     */
    public static final String ORDERED_CONTRIBUTION_PREFIX = "org.springframework.contributions.ordered.";

    /**
     * {@inheritDoc}
     */
    public void init()
    {
        ContributionBeanDefinitionDecorator contributionBeanDefinitionDecorator =
            new ContributionBeanDefinitionDecorator();
        registerBeanDefinitionDecoratorForAttribute("contributeTo", contributionBeanDefinitionDecorator);
        registerBeanDefinitionDecorator("contribute", contributionBeanDefinitionDecorator);

        registerBeanDefinitionParser("contribution-ref", new OrderedContributionRefBeanDefinitionParser());
        registerBeanDefinitionParser("contribution", new OrderedContributionBeanDefinitionParser());

        registerBeanDefinitionParser("mapped-contribution", new MappedContributionBeanDefinitionParser());
        registerBeanDefinitionParser("mapped-contribution-ref", new MappedContributionRefBeanDefinitionParser());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy