Refine search
@Override @Nullable public BeanDefinition parse(Element element, ParserContext parserContext) { parserContext.getReaderContext().error( "Class [" + getClass().getName() + "] does not support custom elements.", element); return null; }
@Override @Nullable public BeanDefinition parse(Element element, ParserContext parserContext) { parserContext.getReaderContext().error( "Class [" + getClass().getName() + "] does not support custom elements.", element); return null; }
private void attrNotAllowed(ParserContext context, String attrName, String otherAttrName, Element element) { context.getReaderContext().error( "Only one of '" + attrName + "' or '" + otherAttrName + "' can be set.", element); }
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String path = element.getAttribute("path"); if (!StringUtils.hasText(path)) { parserContext.getReaderContext().error("Attribute 'path' must not be empty", element); return; } int dotIndex = path.indexOf('.'); if (dotIndex == -1) { parserContext.getReaderContext().error( "Attribute 'path' must follow pattern 'beanName.propertyName'", element); return; } String beanName = path.substring(0, dotIndex); String propertyPath = path.substring(dotIndex + 1); builder.addPropertyValue("targetBeanName", beanName); builder.addPropertyValue("propertyPath", propertyPath); }
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); String defaultValue = element.getAttribute(DEFAULT_VALUE); String defaultRef = element.getAttribute(DEFAULT_REF); if (StringUtils.hasLength(defaultValue)) { if (StringUtils.hasLength(defaultRef)) { parserContext.getReaderContext().error("<jndi-lookup> element is only allowed to contain either " + "'default-value' attribute OR 'default-ref' attribute, not both", element); } builder.addPropertyValue(DEFAULT_OBJECT, defaultValue); } else if (StringUtils.hasLength(defaultRef)) { builder.addPropertyValue(DEFAULT_OBJECT, new RuntimeBeanReference(defaultRef)); } }
@Nullable protected Integer parseAcknowledgeMode(Element ele, ParserContext parserContext) { String acknowledge = ele.getAttribute(ACKNOWLEDGE_ATTRIBUTE); if (StringUtils.hasText(acknowledge)) { int acknowledgeMode = Session.AUTO_ACKNOWLEDGE; if (ACKNOWLEDGE_TRANSACTED.equals(acknowledge)) { acknowledgeMode = Session.SESSION_TRANSACTED; } else if (ACKNOWLEDGE_DUPS_OK.equals(acknowledge)) { acknowledgeMode = Session.DUPS_OK_ACKNOWLEDGE; } else if (ACKNOWLEDGE_CLIENT.equals(acknowledge)) { acknowledgeMode = Session.CLIENT_ACKNOWLEDGE; } else if (!ACKNOWLEDGE_AUTO.equals(acknowledge)) { parserContext.getReaderContext().error("Invalid listener container 'acknowledge' setting [" + acknowledge + "]: only \"auto\", \"client\", \"dups-ok\" and \"transacted\" supported.", ele); } return acknowledgeMode; } else { return null; } }
@Override @Nullable public BeanDefinition parse(Element element, ParserContext parserContext) { parserContext.getReaderContext().error( "Class [" + getClass().getName() + "] does not support custom elements.", element); return null; }
@Override @Nullable public BeanDefinition parse(Element element, ParserContext parserContext) { parserContext.getReaderContext().error( "Class [" + getClass().getName() + "] does not support custom elements.", element); return null; }
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String cleanup = element.getAttribute("verifierLengthBytes"); if (StringUtils.hasText(cleanup)) { try { builder.addPropertyValue("verifierLengthBytes", Integer.parseInt(cleanup)); } catch (NumberFormatException e) { parserContext.getReaderContext().error("Invalid value " + cleanup + " for attribute verifierLengthBytes.", element); } } } }
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String cleanup = element.getAttribute("cleanupInterval"); if (StringUtils.hasText(cleanup)) { try { builder.addPropertyValue("cleanupIntervalSeconds", Integer.parseInt(cleanup)); } catch (NumberFormatException e) { parserContext.getReaderContext().error("Invalid value " + cleanup + " for attribute cleanupIntervalSeconds.", element); } } } }
protected void parseListenerConfiguration(Element ele, ParserContext parserContext, MutablePropertyValues configValues) { String destination = ele.getAttribute(DESTINATION_ATTRIBUTE); if (!StringUtils.hasText(destination)) { parserContext.getReaderContext().error( "Listener 'destination' attribute contains empty value.", ele); String subscription = ele.getAttribute(SUBSCRIPTION_ATTRIBUTE); if (!StringUtils.hasText(subscription)) { parserContext.getReaderContext().error( "Listener 'subscription' attribute contains empty value.", ele); String selector = ele.getAttribute(SELECTOR_ATTRIBUTE); if (!StringUtils.hasText(selector)) { parserContext.getReaderContext().error( "Listener 'selector' attribute contains empty value.", ele); String concurrency = ele.getAttribute(CONCURRENCY_ATTRIBUTE); if (!StringUtils.hasText(concurrency)) { parserContext.getReaderContext().error( "Listener 'concurrency' attribute contains empty value.", ele);
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { builder.addPropertyReference("transactionManager", TxNamespaceHandler.getTransactionManagerName(element)); List<Element> txAttributes = DomUtils.getChildElementsByTagName(element, ATTRIBUTES_ELEMENT); if (txAttributes.size() > 1) { parserContext.getReaderContext().error( "Element <attributes> is allowed at most once inside element <advice>", element); } else if (txAttributes.size() == 1) { // Using attributes source. Element attributeSourceElement = txAttributes.get(0); RootBeanDefinition attributeSourceDefinition = parseAttributeSource(attributeSourceElement, parserContext); builder.addPropertyValue("transactionAttributeSource", attributeSourceDefinition); } else { // Assume annotations source. builder.addPropertyValue("transactionAttributeSource", new RootBeanDefinition("org.springframework.transaction.annotation.AnnotationTransactionAttributeSource")); } }
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String path = element.getAttribute("path"); if (!StringUtils.hasText(path)) { parserContext.getReaderContext().error("Attribute 'path' must not be empty", element); return; } int dotIndex = path.indexOf('.'); if (dotIndex == -1) { parserContext.getReaderContext().error( "Attribute 'path' must follow pattern 'beanName.propertyName'", element); return; } String beanName = path.substring(0, dotIndex); String propertyPath = path.substring(dotIndex + 1); builder.addPropertyValue("targetBeanName", beanName); builder.addPropertyValue("propertyPath", propertyPath); }
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); String defaultValue = element.getAttribute(DEFAULT_VALUE); String defaultRef = element.getAttribute(DEFAULT_REF); if (StringUtils.hasLength(defaultValue)) { if (StringUtils.hasLength(defaultRef)) { parserContext.getReaderContext().error("<jndi-lookup> element is only allowed to contain either " + "'default-value' attribute OR 'default-ref' attribute, not both", element); } builder.addPropertyValue(DEFAULT_OBJECT, defaultValue); } else if (StringUtils.hasLength(defaultRef)) { builder.addPropertyValue(DEFAULT_OBJECT, new RuntimeBeanReference(defaultRef)); } }
/** * Parse a '{@code declare-parents}' element and register the appropriate * DeclareParentsAdvisor with the BeanDefinitionRegistry encapsulated in the * supplied ParserContext. */ private AbstractBeanDefinition parseDeclareParents(Element declareParentsElement, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(DeclareParentsAdvisor.class); builder.addConstructorArgValue(declareParentsElement.getAttribute(IMPLEMENT_INTERFACE)); builder.addConstructorArgValue(declareParentsElement.getAttribute(TYPE_PATTERN)); String defaultImpl = declareParentsElement.getAttribute(DEFAULT_IMPL); String delegateRef = declareParentsElement.getAttribute(DELEGATE_REF); if (StringUtils.hasText(defaultImpl) && !StringUtils.hasText(delegateRef)) { builder.addConstructorArgValue(defaultImpl); } else if (StringUtils.hasText(delegateRef) && !StringUtils.hasText(defaultImpl)) { builder.addConstructorArgReference(delegateRef); } else { parserContext.getReaderContext().error( "Exactly one of the " + DEFAULT_IMPL + " or " + DELEGATE_REF + " attributes must be specified", declareParentsElement, this.parseState.snapshot()); } AbstractBeanDefinition definition = builder.getBeanDefinition(); definition.setSource(parserContext.extractSource(declareParentsElement)); parserContext.getReaderContext().registerWithGeneratedName(definition); return definition; }
private void addFeaturePolicy(Element featurePolicyElement, ParserContext context) { BeanDefinitionBuilder headersWriter = BeanDefinitionBuilder .genericBeanDefinition(FeaturePolicyHeaderWriter.class); String policyDirectives = featurePolicyElement .getAttribute(ATT_POLICY_DIRECTIVES); if (!StringUtils.hasText(policyDirectives)) { context.getReaderContext().error( ATT_POLICY_DIRECTIVES + " requires a 'value' to be set.", featurePolicyElement); } else { headersWriter.addConstructorArgValue(policyDirectives); } headerWriters.add(headersWriter.getBeanDefinition()); }
private void addContentSecurityPolicy(Element contentSecurityPolicyElement, ParserContext context) { BeanDefinitionBuilder headersWriter = BeanDefinitionBuilder .genericBeanDefinition(ContentSecurityPolicyHeaderWriter.class); String policyDirectives = contentSecurityPolicyElement.getAttribute(ATT_POLICY_DIRECTIVES); if (!StringUtils.hasText(policyDirectives)) { context.getReaderContext().error( ATT_POLICY_DIRECTIVES + " requires a 'value' to be set.", contentSecurityPolicyElement); } else { headersWriter.addConstructorArgValue(policyDirectives); } String reportOnly = contentSecurityPolicyElement.getAttribute(ATT_REPORT_ONLY); if (StringUtils.hasText(reportOnly)) { headersWriter.addPropertyValue("reportOnly", reportOnly); } headerWriters.add(headersWriter.getBeanDefinition()); }
String resourceAdapterBeanName = containerEle.getAttribute(RESOURCE_ADAPTER_ATTRIBUTE); if (!StringUtils.hasText(resourceAdapterBeanName)) { parserContext.getReaderContext().error( "Listener container 'resource-adapter' attribute contains empty value.", containerEle); if (StringUtils.hasText(activationSpecFactoryBeanName)) { if (StringUtils.hasText(destinationResolverBeanName)) { parserContext.getReaderContext().error("Specify either 'activation-spec-factory' or " + "'destination-resolver', not both. If you define a dedicated JmsActivationSpecFactory bean, " + "specify the custom DestinationResolver there (if possible).", containerEle);
private Object parsePointcutProperty(Element element, ParserContext parserContext) { if (element.hasAttribute(POINTCUT) && element.hasAttribute(POINTCUT_REF)) { parserContext.getReaderContext().error( "Cannot define both 'pointcut' and 'pointcut-ref' on <advisor> tag.", element, this.parseState.snapshot()); String pointcutRef = element.getAttribute(POINTCUT_REF); if (!StringUtils.hasText(pointcutRef)) { parserContext.getReaderContext().error( "'pointcut-ref' attribute contains empty value.", element, this.parseState.snapshot()); return null; parserContext.getReaderContext().error( "Must define one of 'pointcut' or 'pointcut-ref' on <advisor> tag.", element, this.parseState.snapshot());
parserContext.getReaderContext().error("Invalid listener container 'destination-type': only " + "\"queue\", \"topic\", \"durableTopic\", \"sharedTopic\", \"sharedDurableTopic\" supported.", containerEle); parserContext.getReaderContext().error("Invalid listener container 'response-destination-type': only " + "\"queue\", \"topic\" supported.", containerEle); String clientId = containerEle.getAttribute(CLIENT_ID_ATTRIBUTE); if (!StringUtils.hasText(clientId)) { parserContext.getReaderContext().error( "Listener 'client-id' attribute contains empty value.", containerEle); String messageConverter = containerEle.getAttribute(MESSAGE_CONVERTER_ATTRIBUTE); if (!StringUtils.hasText(messageConverter)) { parserContext.getReaderContext().error( "listener container 'message-converter' attribute contains empty value.", containerEle);