Example usage for org.springframework.beans.factory.support BeanDefinitionBuilder addPropertyValue

List of usage examples for org.springframework.beans.factory.support BeanDefinitionBuilder addPropertyValue

Introduction

In this page you can find the example usage for org.springframework.beans.factory.support BeanDefinitionBuilder addPropertyValue.

Prototype

public BeanDefinitionBuilder addPropertyValue(String name, @Nullable Object value) 

Source Link

Document

Add the supplied property value under the given property name.

Usage

From source file:edu.internet2.middleware.shibboleth.common.config.profile.AbstractRequestURIMappedProfileHandlerBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element config, BeanDefinitionBuilder builder) {
    log.info("Parsing configuration for profile handler: {}", XMLHelper.getXSIType(config).getLocalPart());

    builder.addPropertyValue("requestPaths", getRequestPaths(config));
}

From source file:nz.co.senanque.madura.bundle.spring.ManagerBeanDefinitionParser.java

protected void doParse(Element element, BeanDefinitionBuilder bean) {
    String directory = element.getAttribute("directory");
    if (StringUtils.hasText(directory)) {
        bean.addPropertyValue("directory", directory);
    }//w w w. j a v  a 2  s.  c  o m
    String id = element.getAttribute("id");
    if (!StringUtils.hasText(id)) {
        bean.addPropertyValue("id", "bundleManager");
    }
    String time = element.getAttribute("time");
    if (StringUtils.hasLength(time)) {
        bean.addPropertyValue("time", time);
    }
    String export = element.getAttribute("export");
    if (StringUtils.hasLength(export)) {
        bean.addPropertyValue("export", export);
    }
    String childFirst = element.getAttribute("childFirst");
    if (StringUtils.hasLength(childFirst)) {
        bean.addPropertyValue("childFirst", childFirst);
    }
}

From source file:org.jboss.windup.config.spring.namespace.simple.RegexHintBeanParser.java

@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
    BeanDefinitionBuilder beanBuilder = BeanDefinitionBuilder
            .rootBeanDefinition(RegexPatternHintProcessor.class);
    beanBuilder.addPropertyValue("regexPattern", element.getAttribute("regex"));

    if (element.hasAttribute("hint")) {
        beanBuilder.addPropertyValue("hint", element.getAttribute("hint"));
    } else {/*from  ww  w.  ja v a  2 s.  c om*/
        String markdown = element.getTextContent();

        String lines[] = markdown.split("\\r?\\n");
        StringBuilder markdownRebuilder = new StringBuilder();

        for (int i = 0; i < lines.length; i++) {
            String line = lines[i];

            line = StringUtils.trim(line);
            if (line != null) {
                markdownRebuilder.append(line);
            }
            //test to see if it is last line...
            if (i < lines.length - 1) {
                markdownRebuilder.append(SystemUtils.LINE_SEPARATOR);
            }
        }
        beanBuilder.addPropertyValue("hint", markdownRebuilder.toString());
    }

    if (element.hasAttribute("effort")) {
        beanBuilder.addPropertyValue("effort", Integer.parseInt(element.getAttribute("effort")));
    }

    return beanBuilder.getBeanDefinition();
}

From source file:edu.internet2.middleware.assurance.mcb.config.profile.authn.MCBLoginHandlerBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element config, BeanDefinitionBuilder builder) {
    super.doParse(config, builder);

    if (config.hasAttributeNS(null, "previousSession")) {
        builder.addPropertyValue("previousSession",
                XMLHelper.getAttributeValueAsBoolean(config.getAttributeNodeNS(null, "previousSession")));
    } else {//from w  w w .  jav  a 2s . co  m
        builder.addPropertyValue("previousSession", false);
    }

    if (config.hasAttributeNS(null, "depends-on")) {
        builder.addPropertyValue("dependsOn",
                DatatypeHelper.safeTrim(config.getAttributeNS(null, "depends-on")));
    } else {
        builder.addPropertyValue("dependsOn", null);
    }

}

From source file:fr.acxio.tools.agia.alfresco.configuration.FolderDefinitionParser.java

protected BeanDefinition parseFolder(Element sElement) {
    BeanDefinitionBuilder aBuilder = BeanDefinitionBuilder.rootBeanDefinition(SimpleFolderDefinition.class);

    aBuilder.addPropertyValue("nodeType", sElement.getAttribute(PROPDEF_NODETYPE));
    aBuilder.addPropertyValue("versionOperation", sElement.getAttribute(PROPDEF_VERSIONOP));
    aBuilder.addPropertyValue("condition", sElement.getAttribute(PROPDEF_CONDITION));
    aBuilder.addPropertyValue("assocTargetId", sElement.getAttribute(PROPDEF_ASSOC_TARGET_ID));

    return aBuilder.getBeanDefinition();
}

From source file:org.jolokia.jvmagent.spring.config.AgentBeanDefinitionParser.java

@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    Element config = DomUtils.getChildElementByTagName(element, "config");
    if (config != null) {
        builder.addPropertyValue("config",
                parserContext.getDelegate().parseCustomElement(config, builder.getRawBeanDefinition()));
    }//from w  w  w.java2 s .  c o  m
    String lookupConfig = element.getAttribute("lookupConfig");
    if (StringUtils.hasLength(lookupConfig)) {
        builder.addPropertyValue("lookupConfig", Boolean.parseBoolean(lookupConfig));
    } else {
        builder.addPropertyValue("lookupConfig", false);
    }
    String systemPropertiesMode = element.getAttribute("systemPropertiesMode");
    if (StringUtils.hasLength(systemPropertiesMode)) {
        builder.addPropertyValue("systemPropertiesMode", systemPropertiesMode);
    }
}

From source file:org.synyx.hades.dao.config.AuditingBeanDefinitionParser.java

private BeanDefinition createLazyInitTargetSourceBeanDefinition(String auditorAwareRef) {

    BeanDefinitionBuilder targetSourceBuilder = rootBeanDefinition(LazyInitTargetSource.class);
    targetSourceBuilder.addPropertyValue("targetBeanName", auditorAwareRef);

    BeanDefinitionBuilder builder = rootBeanDefinition(ProxyFactoryBean.class);
    builder.addPropertyValue("targetSource", targetSourceBuilder.getBeanDefinition());

    return builder.getBeanDefinition();
}

From source file:edu.internet2.middleware.shibboleth.idp.config.profile.authn.UsernamePasswordLoginHandlerBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element config, BeanDefinitionBuilder builder) {
    super.doParse(config, builder);

    if (config.hasAttributeNS(null, "authenticationServletURL")) {
        builder.addPropertyValue("authenticationServletURL",
                DatatypeHelper.safeTrim(config.getAttributeNS(null, "authenticationServletURL")));
    } else {/*ww w.  ja  va 2s. co m*/
        builder.addPropertyValue("authenticationServletURL", "/Authn/UserPassword");
    }

    String jaasConfigurationURL = DatatypeHelper
            .safeTrim(config.getAttributeNS(null, "jaasConfigurationLocation"));
    log.debug("Setting JAAS configuration file to: {}", jaasConfigurationURL);
    System.setProperty("java.security.auth.login.config", jaasConfigurationURL);
}