Spring Framework AbstractBeanDefinitionParser - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework AbstractBeanDefinitionParser class.

This code example shows how to use the following methods:
 * 
 * @author Dave Syer 
 * @author Juergen Hoeller 
 * @since 3.0 
 */ 
class InitializeDatabaseBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
	@Override 
	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
		BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DataSourceInitializer.class);
		builder.addPropertyReference("dataSource", element.getAttribute("data-source"));
		builder.addPropertyValue("enabled", element.getAttribute("enabled"));
		DatabasePopulatorConfigUtils.setDatabasePopulator(element, builder);
		builder.getRawBeanDefinition().setSource(parserContext.extractSource(element));
		return builder.getBeanDefinition();
	} 
 
	@Override 
	protected boolean shouldGenerateId() { 
		return true; 
8
CodeRank
This code example shows how to use the following methods:
 * 
 * @author Oliver Gierke 
 * @author Juergen Hoeller 
 * @since 3.0 
 */ 
class EmbeddedDatabaseBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
	@Override 
	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
		BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(EmbeddedDatabaseFactoryBean.class);
		setDatabaseType(element, builder);
		DatabasePopulatorConfigUtils.setDatabasePopulator(element, builder);
		useIdAsDatabaseNameIfGiven(element, builder);
		builder.getRawBeanDefinition().setSource(parserContext.extractSource(element));
		return builder.getBeanDefinition();
	} 
 
	private void useIdAsDatabaseNameIfGiven(Element element, BeanDefinitionBuilder builder) {
		String id = element.getAttribute(ID_ATTRIBUTE);
		if (StringUtils.hasText(id)) {
8
CodeRank
This code example shows how to use the following methods:
import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;
 
public class ComponentBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
	@Override 
	protected AbstractBeanDefinition parseInternal(Element element,
			ParserContext parserContext) {
		return parseComponentElement(element);
	} 
 
	private static AbstractBeanDefinition parseComponentElement(Element element) {
		BeanDefinitionBuilder factory = BeanDefinitionBuilder
				.rootBeanDefinition(ComponentFactoryBean.class);
 
		factory.addPropertyValue("parent", parseComponent(element));
 
		List<Element> childElements = DomUtils.getChildElementsByTagName(
8
CodeRank
This code example shows how to use the following methods:
 * @author Mark Fisher 
 * @author Juergen Hoeller 
 * @since 2.5 
 * @see org.springframework.jmx.export.annotation.AnnotationMBeanExporter 
 */ 
class MBeanServerBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
	private static final String MBEAN_SERVER_BEAN_NAME = "mbeanServer";
 
	private static final String AGENT_ID_ATTRIBUTE = "agent-id";
 
 
	private static final boolean weblogicPresent = ClassUtils.isPresent(
			"weblogic.management.Helper", MBeanServerBeanDefinitionParser.class.getClassLoader());
 
	private static final boolean webspherePresent = ClassUtils.isPresent(
			"com.ibm.websphere.management.AdminServiceFactory", MBeanServerBeanDefinitionParser.class.getClassLoader());
 
 
	@Override 
8
CodeRank
This code example shows how to use the following methods:
 * @author Juergen Hoeller 
 * @author Mark Fisher 
 * @since 2.5 
 * @see org.springframework.jmx.export.annotation.AnnotationMBeanExporter 
 */ 
class MBeanExportBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
	private static final String MBEAN_EXPORTER_BEAN_NAME = "mbeanExporter";
 
	private static final String DEFAULT_DOMAIN_ATTRIBUTE = "default-domain";
 
	private static final String SERVER_ATTRIBUTE = "server";
 
	private static final String REGISTRATION_ATTRIBUTE = "registration";
 
	private static final String REGISTRATION_IGNORE_EXISTING = "ignoreExisting";
 
	private static final String REGISTRATION_REPLACE_EXISTING = "replaceExisting";
 
 
8
CodeRank
This code example shows how to use the following methods:
 * Parser for the OAuth "client" element supporting client apps using {@link OAuth2RestTemplate}. 
 *  
 * @author Ryan Heaton 
 * @author Dave Syer 
 */ 
public class ClientBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
	@Override 
	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
 
		String redirectStrategyRef = element.getAttribute("redirect-strategy-ref");
 
		BeanDefinitionBuilder clientContextFilterBean = BeanDefinitionBuilder
				.rootBeanDefinition(OAuth2ClientContextFilter.class);
 
		if (StringUtils.hasText(redirectStrategyRef)) {
			clientContextFilterBean.addPropertyReference("redirectStrategy", redirectStrategyRef);
		} 
 
		return clientContextFilterBean.getBeanDefinition();
7
CodeRank
This code example shows how to use the following methods:
 * Parser for the OAuth "provider" element. 
 * 
 * @author Ryan Heaton 
 * @author Dave Syer 
 */ 
public abstract class ProviderBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
	@Override 
	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
 
		String tokenServicesRef = element.getAttribute("token-services-ref");
		String serializerRef = element.getAttribute("serialization-service-ref");
 
		if (!StringUtils.hasText(tokenServicesRef)) {
			tokenServicesRef = "oauth2TokenServices";
			BeanDefinitionBuilder tokenServices = BeanDefinitionBuilder.rootBeanDefinition(DefaultTokenServices.class);
			AbstractBeanDefinition tokenStore = BeanDefinitionBuilder.rootBeanDefinition(InMemoryTokenStore.class).getBeanDefinition();
			tokenServices.addPropertyValue("tokenStore", tokenStore);
			parserContext.getRegistry().registerBeanDefinition(tokenServicesRef, tokenServices.getBeanDefinition());
		} 
7
CodeRank
This code example shows how to use the following methods:
 *     &lt;hz:hibernate-region-factory id="localRegionFactory" instance-ref="instance" mode="LOCAL" /&gt; 
 * </code> 
 * </pre> 
 * 
 */ 
public class RegionFactoryBeanDefinitionParser extends AbstractBeanDefinitionParser {
 
    protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
        final NamedNodeMap atts = element.getAttributes();
        String instanceRefName = "instance";
        String mode = "DISTRIBUTED";
        if (atts != null) {
            for (int a = 0; a < atts.getLength(); a++) {
                final Node att = atts.item(a);
                final String name = att.getNodeName();
                if ("instance-ref".equals(name)) {
                    instanceRefName = att.getTextContent();
                } else if ("mode".equals(name)) {
                    mode = att.getTextContent();
                } 
7
CodeRank
This code example shows how to use the following methods:
/** 
 * 
 * @author Luke Taylor 
 * @since 3.1 
 */ 
public class MethodSecurityMetadataSourceBeanDefinitionParser extends AbstractBeanDefinitionParser {
    static final String ATT_METHOD = "method";
    static final String ATT_ACCESS = "access";
 
    public AbstractBeanDefinition parseInternal(Element elt, ParserContext pc) {
        // Parse the included methods 
        List<Element> methods = DomUtils.getChildElementsByTagName(elt, Elements.PROTECT);
        Map<String, List<ConfigAttribute>> mappings = new LinkedHashMap<String, List<ConfigAttribute>>();
 
        for (Element protectmethodElt : methods) {
            String[] tokens = StringUtils.commaDelimitedListToStringArray(protectmethodElt.getAttribute(ATT_ACCESS));
            String methodName = protectmethodElt.getAttribute(ATT_METHOD);
 
            mappings.put(methodName, SecurityConfig.createList(tokens));
        } 
7
CodeRank
This code example shows how to use the following methods:
 * {@link org.springframework.batch.core.Step}. 
 *  
 * @author Thomas Risberg 
 *  
 */ 
public class TopLevelStepParser extends AbstractBeanDefinitionParser {
 
	private static final StandaloneStepParser stepParser = new StandaloneStepParser();
 
	@Override 
	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
 
		CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, parserContext.extractSource(element));
 
		return stepParser.parse(element, parserContext);
 
	} 
 
} 
7
CodeRank