public static void autoregisterBeansForNamespace(ParserContext parserContext, Object source) { checkForStepScope(parserContext, source); checkForJobScope(parserContext, source); addRangePropertyEditor(parserContext); addCoreNamespacePostProcessor(parserContext); addStateTransitionComparator(parserContext); }
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { if (!CoreNamespaceUtils.namespaceMatchesVersion(element)) { parserContext.getReaderContext().error( "You are using a version of the spring-batch XSD that is not compatible with Spring Batch 3.0." + CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, parserContext.extractSource(element)); boolean isAbstract = CoreNamespaceUtils.isAbstract(element); builder.setAbstract(isAbstract);
/** * @param parserContext */ private static void addCoreNamespacePostProcessor(ParserContext parserContext) { BeanDefinitionRegistry registry = parserContext.getRegistry(); if (!coreNamespaceBeanPostProcessorAlreadyDefined(registry)) { AbstractBeanDefinition postProcessorBeanDef = BeanDefinitionBuilder.genericBeanDefinition( CORE_NAMESPACE_POST_PROCESSOR_CLASS_NAME).getBeanDefinition(); postProcessorBeanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); registry.registerBeanDefinition(CORE_NAMESPACE_POST_PROCESSOR_CLASS_NAME, postProcessorBeanDef); } }
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, element); jobListenerParser.doParse(element, parserContext, builder); }
protected static void autoregisterBeansForNamespace(ParserContext parserContext, Object source) { checkForStepScope(parserContext, source); addRangePropertyEditor(parserContext); addCoreNamespacePostProcessor(parserContext); }
/** * Should this element be treated as incomplete? If it has a parent or is * abstract, then it may not have all properties. * * @param element to be evaluated. * @return TRUE if the element is abstract or has a parent */ public static boolean isUnderspecified(Element element) { return isAbstract(element) || StringUtils.hasText(element.getAttribute("parent")); }
/** * Check that the schema location declared in the source file being parsed * matches the Spring Batch version. (The old 2.0 schema is not 100% * compatible with the new parser, so it is an error to explicitly define * 2.0. It might be an error to declare spring-batch.xsd as an alias, but * you are only going to find that out when one of the sub parses breaks.) * * @param element the element that is to be parsed next * @return true if we find a schema declaration that matches */ public static boolean namespaceMatchesVersion(Element element) { return matchesVersionInternal(element) && matchesVersionInternal(element.getOwnerDocument().getDocumentElement()); }
/** * Register a RangePropertyEditor if one does not already exist. * * @param parserContext */ private static void addRangePropertyEditor(ParserContext parserContext) { BeanDefinitionRegistry registry = parserContext.getRegistry(); if (!rangeArrayEditorAlreadyDefined(registry)) { AbstractBeanDefinition customEditorConfigurer = BeanDefinitionBuilder.genericBeanDefinition( CUSTOM_EDITOR_CONFIGURER_CLASS_NAME).getBeanDefinition(); customEditorConfigurer.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); ManagedMap<String, String> editors = new ManagedMap<>(); editors.put(RANGE_ARRAY_CLASS_NAME, RANGE_ARRAY_EDITOR_CLASS_NAME); customEditorConfigurer.getPropertyValues().addPropertyValue("customEditors", editors); registry.registerBeanDefinition(CUSTOM_EDITOR_CONFIGURER_CLASS_NAME, customEditorConfigurer); } }
boolean stepUnderspecified = CoreNamespaceUtils.isUnderspecified(stepElement); new TaskletParser().parseTasklet(stepElement, nestedElement, bd, parserContext, stepUnderspecified); boolean stepUnderspecified = CoreNamespaceUtils.isUnderspecified(stepElement); parseFlow(stepElement, nestedElement, bd, parserContext, stepUnderspecified); boolean stepUnderspecified = CoreNamespaceUtils.isUnderspecified(stepElement); parsePartition(stepElement, nestedElement, bd, parserContext, stepUnderspecified, jobFactoryRef); boolean stepUnderspecified = CoreNamespaceUtils.isUnderspecified(stepElement); parseJob(stepElement, nestedElement, bd, parserContext, stepUnderspecified);
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, element); stepListenerParser.doParse(element, parserContext, builder); }
/** * Should this element be treated as incomplete? If it has a parent or is * abstract, then it may not have all properties. * * @param element * @return TRUE if the element is abstract or has a parent */ public static boolean isUnderspecified(Element element) { return isAbstract(element) || StringUtils.hasText(element.getAttribute("parent")); }
/** * Check that the schema location declared in the source file being parsed * matches the Spring Batch version. (The old 2.0 schema is not 100% * compatible with the new parser, so it is an error to explicitly define * 2.0. It might be an error to declare spring-batch.xsd as an alias, but * you are only going to find that out when one of the sub parses breaks.) * * @param element the element that is to be parsed next * @return true if we find a schema declaration that matches */ public static boolean namespaceMatchesVersion(Element element) { return matchesVersionInternal(element) && matchesVersionInternal(element.getOwnerDocument().getDocumentElement()); }
/** * Register a RangePropertyEditor if one does not already exist. * * @param parserContext */ private static void addRangePropertyEditor(ParserContext parserContext) { BeanDefinitionRegistry registry = parserContext.getRegistry(); if (!rangeArrayEditorAlreadyDefined(registry)) { AbstractBeanDefinition customEditorConfigurer = BeanDefinitionBuilder.genericBeanDefinition( CUSTOM_EDITOR_CONFIGURER_CLASS_NAME).getBeanDefinition(); customEditorConfigurer.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); ManagedMap<String, String> editors = new ManagedMap<String, String>(); editors.put(RANGE_ARRAY_CLASS_NAME, RANGE_ARRAY_EDITOR_CLASS_NAME); customEditorConfigurer.getPropertyValues().addPropertyValue("customEditors", editors); registry.registerBeanDefinition(CUSTOM_EDITOR_CONFIGURER_CLASS_NAME, customEditorConfigurer); } }
boolean stepUnderspecified = CoreNamespaceUtils.isUnderspecified(stepElement); new TaskletParser().parseTasklet(stepElement, taskletElement, bd, parserContext, stepUnderspecified); boolean stepUnderspecified = CoreNamespaceUtils.isUnderspecified(stepElement); parseFlow(stepElement, flowElement, bd, parserContext, stepUnderspecified); boolean stepUnderspecified = CoreNamespaceUtils.isUnderspecified(stepElement); parsePartition(stepElement, partitionElement, bd, parserContext, stepUnderspecified); boolean stepUnderspecified = CoreNamespaceUtils.isUnderspecified(stepElement); parseJob(stepElement, jobElement, bd, parserContext, stepUnderspecified);
public static void autoregisterBeansForNamespace(ParserContext parserContext, Object source) { checkForStepScope(parserContext, source); checkForJobScope(parserContext, source); addRangePropertyEditor(parserContext); addCoreNamespacePostProcessor(parserContext); addStateTransitionComparator(parserContext); }
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { if (!CoreNamespaceUtils.namespaceMatchesVersion(element)) { parserContext.getReaderContext().error( "You cannot use spring-batch-2.0.xsd with Spring Batch 2.1. Please upgrade your schema declarations " CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, parserContext.extractSource(element)); boolean isAbstract = CoreNamespaceUtils.isAbstract(element); builder.setAbstract(isAbstract);
@Override protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, parserContext.extractSource(element)); return stepParser.parse(element, parserContext); }
/** * @param parserContext */ private static void addCoreNamespacePostProcessor(ParserContext parserContext) { BeanDefinitionRegistry registry = parserContext.getRegistry(); if (!coreNamespaceBeanPostProcessorAlreadyDefined(registry)) { AbstractBeanDefinition postProcessorBeanDef = BeanDefinitionBuilder.genericBeanDefinition( CORE_NAMESPACE_POST_PROCESSOR_CLASS_NAME).getBeanDefinition(); postProcessorBeanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); registry.registerBeanDefinition(CORE_NAMESPACE_POST_PROCESSOR_CLASS_NAME, postProcessorBeanDef); } }
/** * Should this element be treated as incomplete? If it has a parent or is * abstract, then it may not have all properties. * * @param element * @return TRUE if the element is abstract or has a parent */ public static boolean isUnderspecified(Element element) { return isAbstract(element) || StringUtils.hasText(element.getAttribute("parent")); }
/** * Check that the schema location declared in the source file being parsed * matches the Spring Batch version. (The old 2.0 schema is not 100% * compatible with the new parser, so it is an error to explicitly define * 2.0. It might be an error to declare spring-batch.xsd as an alias, but * you are only going to find that out when one of the sub parses breaks.) * * @param element the element that is to be parsed next * @return true if we find a schema declaration that matches */ public static boolean namespaceMatchesVersion(Element element) { return matchesVersionInternal(element) && matchesVersionInternal(element.getOwnerDocument().getDocumentElement()); }