List of usage examples for org.springframework.util.xml DomUtils getChildElementByTagName
@Nullable public static Element getChildElementByTagName(Element ele, String childEleName)
From source file:org.mule.security.oauth.config.AbstractDevkitBasedDefinitionParser.java
protected boolean parseObjectRef(Element element, BeanDefinitionBuilder builder, String elementName, String propertyName) {/*from w ww . j a v a 2s .c o m*/ Element childElement = DomUtils.getChildElementByTagName(element, elementName); if (childElement != null) { if (hasAttribute(childElement, "ref")) { if (childElement.getAttribute("ref").startsWith("#")) { builder.addPropertyValue(propertyName, childElement.getAttribute("ref")); } else { builder.addPropertyValue(propertyName, (("#[registry:" + childElement.getAttribute("ref")) + "]")); } return true; } } return false; }
From source file:org.mule.security.oauth.config.AbstractDevkitBasedDefinitionParser.java
protected boolean parseObjectRefWithDefault(Element element, BeanDefinitionBuilder builder, String elementName, String propertyName, String defaultValue) { Element childElement = DomUtils.getChildElementByTagName(element, elementName); if (childElement != null) { if (hasAttribute(childElement, "ref")) { if (childElement.getAttribute("ref").startsWith("#")) { builder.addPropertyValue(propertyName, childElement.getAttribute("ref")); } else { builder.addPropertyValue(propertyName, (("#[registry:" + childElement.getAttribute("ref")) + "]")); }/*from ww w . j ava 2s. c o m*/ return true; } } else { builder.addPropertyValue(propertyName, defaultValue); } return false; }
From source file:org.mule.security.oauth.config.AbstractDevkitBasedDefinitionParser.java
protected boolean parseNoExprObjectRef(Element element, BeanDefinitionBuilder builder, String elementName, String propertyName) {//from ww w.j ava 2 s. c om Element childElement = DomUtils.getChildElementByTagName(element, elementName); if (childElement != null) { if (hasAttribute(childElement, "ref")) { if (childElement.getAttribute("ref").startsWith("#")) { builder.addPropertyValue(propertyName, childElement.getAttribute("ref")); } else { builder.addPropertyValue(propertyName, new RuntimeBeanReference(childElement.getAttribute("ref"))); } return true; } } return false; }
From source file:org.mule.security.oauth.config.AbstractDevkitBasedDefinitionParser.java
protected boolean parseNoExprObjectRefWithDefault(Element element, BeanDefinitionBuilder builder, String elementName, String propertyName, String defaultValue) { Element childElement = DomUtils.getChildElementByTagName(element, elementName); if (childElement != null) { if (hasAttribute(childElement, "ref")) { if (childElement.getAttribute("ref").startsWith("#")) { builder.addPropertyValue(propertyName, childElement.getAttribute("ref")); } else { builder.addPropertyValue(propertyName, new RuntimeBeanReference(childElement.getAttribute("ref"))); }/* w w w . ja v a2 s . com*/ return true; } } else { builder.addPropertyValue(propertyName, defaultValue); } return false; }
From source file:org.mule.security.oauth.config.AbstractDevkitBasedDefinitionParser.java
protected void parseTextProperty(BeanDefinitionBuilder builder, Element element, String elementName, String propertyName) {/*from w ww . j av a 2 s . c o m*/ Element childElement = DomUtils.getChildElementByTagName(element, elementName); if (childElement != null) { builder.addPropertyValue(propertyName, childElement.getTextContent()); } }
From source file:org.springframework.data.gemfire.config.ParsingUtils.java
/** * Parses the eviction sub-element. Populates the given attribute factory with the proper attributes. * * @param parserContext the context used for parsing the XML document. * @param element the XML elements being parsed. * @param regionAttributesBuilder the Region Attributes builder. * @return true if parsing actually occurred, false otherwise. *//*from w w w . ja va2 s . co m*/ static boolean parseEviction(ParserContext parserContext, Element element, BeanDefinitionBuilder regionAttributesBuilder) { Element evictionElement = DomUtils.getChildElementByTagName(element, "eviction"); if (evictionElement != null) { BeanDefinitionBuilder evictionAttributesBuilder = BeanDefinitionBuilder .genericBeanDefinition(EvictionAttributesFactoryBean.class); setPropertyValue(evictionElement, evictionAttributesBuilder, "action"); setPropertyValue(evictionElement, evictionAttributesBuilder, "threshold"); setPropertyValue(evictionElement, evictionAttributesBuilder, "type"); Element objectSizerElement = DomUtils.getChildElementByTagName(evictionElement, "object-sizer"); if (objectSizerElement != null) { Object sizer = parseRefOrNestedBeanDeclaration(parserContext, objectSizerElement, evictionAttributesBuilder); evictionAttributesBuilder.addPropertyValue("objectSizer", sizer); } regionAttributesBuilder.addPropertyValue("evictionAttributes", evictionAttributesBuilder.getBeanDefinition()); return true; } return false; }
From source file:org.springframework.data.gemfire.config.ParsingUtils.java
/** * Parses the subscription sub-element. Populates the given attribute factory with the proper attributes. * * @param parserContext the context used while parsing the XML document. * @param element the XML element being parsed. * @param regionAttributesBuilder the Region Attributes builder. * @return true if parsing actually occurred, false otherwise. *//* ww w .j av a 2 s . co m*/ @SuppressWarnings("unused") static boolean parseSubscription(ParserContext parserContext, Element element, BeanDefinitionBuilder regionAttributesBuilder) { Element subscriptionElement = DomUtils.getChildElementByTagName(element, "subscription"); if (subscriptionElement != null) { BeanDefinitionBuilder subscriptionAttributesBuilder = BeanDefinitionBuilder .genericBeanDefinition(SubscriptionAttributesFactoryBean.class); setPropertyValue(subscriptionElement, subscriptionAttributesBuilder, "type", "interestPolicy"); regionAttributesBuilder.addPropertyValue("subscriptionAttributes", subscriptionAttributesBuilder.getBeanDefinition()); return true; } return false; }
From source file:org.springframework.data.gemfire.config.ParsingUtils.java
static void parseTransportFilters(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element transportFilterElement = DomUtils.getChildElementByTagName(element, "transport-filter"); if (transportFilterElement != null) { builder.addPropertyValue("transportFilters", parseRefOrNestedBeanDeclaration(parserContext, transportFilterElement, builder)); }//from ww w. j a va 2s . c o m }
From source file:org.springframework.data.gemfire.config.ParsingUtils.java
@SuppressWarnings("unused") static void parseMembershipAttributes(ParserContext parserContext, Element element, BeanDefinitionBuilder regionAttributesBuilder) { Element membershipAttributes = DomUtils.getChildElementByTagName(element, "membership-attributes"); if (membershipAttributes != null) { String[] requiredRoles = StringUtils .commaDelimitedListToStringArray(membershipAttributes.getAttribute("required-roles")); String lossActionValue = membershipAttributes.getAttribute("loss-action"); LossAction lossAction = (StringUtils.hasText(lossActionValue) ? LossAction.fromName(lossActionValue.toUpperCase().replace("-", "_")) : LossAction.NO_ACCESS); String resumptionActionValue = membershipAttributes.getAttribute("resumption-action"); ResumptionAction resumptionAction = (StringUtils.hasText(resumptionActionValue) ? ResumptionAction.fromName(resumptionActionValue.toUpperCase().replace("-", "_")) : ResumptionAction.REINITIALIZE); regionAttributesBuilder.addPropertyValue("membershipAttributes", new MembershipAttributes(requiredRoles, lossAction, resumptionAction)); }/*from w ww . j av a 2 s .c om*/ }
From source file:org.springframework.data.gemfire.config.ParsingUtils.java
private static boolean parseExpiration(Element rootElement, String elementName, String propertyName, BeanDefinitionBuilder regionAttributesBuilder) { Element expirationElement = DomUtils.getChildElementByTagName(rootElement, elementName); if (expirationElement != null) { BeanDefinitionBuilder expirationAttributesBuilder = BeanDefinitionBuilder .genericBeanDefinition(ExpirationAttributesFactoryBean.class); setPropertyValue(expirationElement, expirationAttributesBuilder, "action"); setPropertyValue(expirationElement, expirationAttributesBuilder, "timeout"); regionAttributesBuilder.addPropertyValue(propertyName, expirationAttributesBuilder.getBeanDefinition()); return true; }/*from w w w . j a va 2 s .c om*/ return false; }