Class AbstractFlowParser
java.lang.Object
org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser
org.springframework.batch.core.configuration.xml.AbstractFlowParser
- All Implemented Interfaces:
org.springframework.beans.factory.xml.BeanDefinitionParser
- Direct Known Subclasses:
InlineFlowParser,TopLevelFlowParser
public abstract class AbstractFlowParser
extends org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser
- Author:
- Dave Syer, Michael Minella, Chris Schaefer, Mahmoud Ben Hassine
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringEstablishes a Decision element.protected static final StringEstablishes an End element.protected static intUsed as a suffix to generate unique state names for end transitions.protected static final StringEstablishes a Exit Code element.protected static final StringEstablishes a Fail element.protected static final StringEstablishes a Flow element.protected static final StringEstablishes the ID attribute.protected static final StringEstablishes a Next attribute.protected static final StringEstablishes a Next element.protected static final StringEstablishes an On element.protected static final StringEstablishes a Restart attribute.protected static final StringEstablishes a Split element.protected static final StringEstablishes a Step element.protected static final StringEstablishes a Stop element.protected static final StringEstablishes a To attribute.Fields inherited from class org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
ID_ATTRIBUTE, NAME_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static Collection<org.springframework.beans.factory.config.BeanDefinition>createTransition(FlowExecutionStatus status, String on, String next, String exitCode, org.springframework.beans.factory.config.BeanDefinition stateDef, org.springframework.beans.factory.xml.ParserContext parserContext, boolean abandon) protected voiddoParse(Element element, org.springframework.beans.factory.xml.ParserContext parserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder builder) Performs the parsing for a flow definition.protected voidfindAllReachableElements(String startElement, Map<String, Set<String>> reachableElementMap, Set<String> accumulator) Find all of the elements that are reachable from thestartElement.protected static FlowExecutionStatusgetBatchStatusFromEndTransitionName(String elementName) Gets the batch status from the end transition name by the element.protected Class<?>getBeanClass(Element element) static Collection<org.springframework.beans.factory.config.BeanDefinition>getNextElements(org.springframework.beans.factory.xml.ParserContext parserContext, String stepId, org.springframework.beans.factory.config.BeanDefinition stateDef, Element element) Retrieve a list ofStateTransitioninstances from aParserContext.static Collection<org.springframework.beans.factory.config.BeanDefinition>getNextElements(org.springframework.beans.factory.xml.ParserContext parserContext, org.springframework.beans.factory.config.BeanDefinition stateDef, Element element) static org.springframework.beans.factory.config.BeanDefinitiongetStateTransitionReference(org.springframework.beans.factory.xml.ParserContext parserContext, org.springframework.beans.factory.config.BeanDefinition stateDefinition, String on, String next) Gets a reference to the state transition.protected voidsetJobFactoryRef(String jobFactoryRef) Convenience method for subclasses to set the job factory reference if it is available (null is fine, but the quality of error reports is better if it is available).protected static voidverifyUniquePattern(Element transitionElement, List<String> patterns, Element element, org.springframework.beans.factory.xml.ParserContext parserContext) Verifies thattransitionElementis not in the list of state transition patterns.Methods inherited from class org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser
doParse, getBeanClassName, getParentName, parseInternalMethods inherited from class org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
parse, postProcessComponentDefinition, registerBeanDefinition, resolveId, shouldFireEvents, shouldGenerateId, shouldGenerateIdAsFallback, shouldParseNameAsAliases
-
Field Details
-
ID_ATTR
Establishes the ID attribute.- See Also:
-
STEP_ELE
Establishes a Step element.- See Also:
-
FLOW_ELE
Establishes a Flow element.- See Also:
-
DECISION_ELE
Establishes a Decision element.- See Also:
-
SPLIT_ELE
Establishes a Split element.- See Also:
-
NEXT_ATTR
Establishes a Next attribute.- See Also:
-
NEXT_ELE
Establishes a Next element.- See Also:
-
END_ELE
Establishes an End element.- See Also:
-
FAIL_ELE
Establishes a Fail element.- See Also:
-
STOP_ELE
Establishes a Stop element.- See Also:
-
ON_ATTR
Establishes an On element.- See Also:
-
TO_ATTR
Establishes a To attribute.- See Also:
-
RESTART_ATTR
Establishes a Restart attribute.- See Also:
-
EXIT_CODE_ATTR
Establishes a Exit Code element.- See Also:
-
endCounter
protected static int endCounterUsed as a suffix to generate unique state names for end transitions.
-
-
Constructor Details
-
AbstractFlowParser
public AbstractFlowParser()
-
-
Method Details
-
setJobFactoryRef
Convenience method for subclasses to set the job factory reference if it is available (null is fine, but the quality of error reports is better if it is available).- Parameters:
jobFactoryRef- name of the ref
-
getBeanClass
- Overrides:
getBeanClassin classorg.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser
-
doParse
protected void doParse(Element element, org.springframework.beans.factory.xml.ParserContext parserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder builder) Performs the parsing for a flow definition.- Overrides:
doParsein classorg.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser- Parameters:
element- the top level element containing a flow definitionparserContext- theParserContext
-
findAllReachableElements
protected void findAllReachableElements(String startElement, Map<String, Set<String>> reachableElementMap, Set<String> accumulator) Find all of the elements that are reachable from thestartElement.- Parameters:
startElement- Name of the element to start fromreachableElementMap- Map of elements that can be reached from the startElementaccumulator- A collection of reachable element names
-
getNextElements
public static Collection<org.springframework.beans.factory.config.BeanDefinition> getNextElements(org.springframework.beans.factory.xml.ParserContext parserContext, org.springframework.beans.factory.config.BeanDefinition stateDef, Element element) - Parameters:
parserContext- The parser context for the bean factorystateDef- The bean definition for the current stateelement- The <step/gt; element to parse- Returns:
- a collection of
StateTransitionreferences
-
getNextElements
public static Collection<org.springframework.beans.factory.config.BeanDefinition> getNextElements(org.springframework.beans.factory.xml.ParserContext parserContext, String stepId, org.springframework.beans.factory.config.BeanDefinition stateDef, Element element) Retrieve a list ofStateTransitioninstances from aParserContext.- Parameters:
parserContext- The parser context for the bean factorystepId- The ID of the current state if it is a step state, null otherwisestateDef- The bean definition for the current stateelement- The <step/gt; element to parse- Returns:
- a collection of
StateTransitionreferences
-
verifyUniquePattern
protected static void verifyUniquePattern(Element transitionElement, List<String> patterns, Element element, org.springframework.beans.factory.xml.ParserContext parserContext) Verifies thattransitionElementis not in the list of state transition patterns.- Parameters:
transitionElement- The element to parsepatterns- A list of patterns on state transitions for this elementelement- TheElementrepresenting the source.parserContext- The parser context for the bean factory
-
createTransition
protected static Collection<org.springframework.beans.factory.config.BeanDefinition> createTransition(FlowExecutionStatus status, String on, String next, String exitCode, org.springframework.beans.factory.config.BeanDefinition stateDef, org.springframework.beans.factory.xml.ParserContext parserContext, boolean abandon) - Parameters:
status- The batch status that this transition will set. Use BatchStatus.UNKNOWN if not applicable.on- The pattern that this transition should match. Use null for "no restriction" (same as "*").next- The state to which this transition should go. Use null if not applicable.exitCode- The exit code that this transition will set. Use null to default to batchStatus.stateDef- The bean definition for the current stateparserContext- The parser context for the bean factoryabandon- Theabandonflag to be used by the transition.- Returns:
- a collection of
StateTransitionreferences
-
getBatchStatusFromEndTransitionName
Gets the batch status from the end transition name by the element.- Parameters:
elementName- An end transition element name- Returns:
- the
BatchStatuscorresponding to the transition name.
-
getStateTransitionReference
public static org.springframework.beans.factory.config.BeanDefinition getStateTransitionReference(org.springframework.beans.factory.xml.ParserContext parserContext, org.springframework.beans.factory.config.BeanDefinition stateDefinition, String on, String next) Gets a reference to the state transition.- Parameters:
parserContext- The parser contextstateDefinition- A reference to the state implementationon- The pattern valuenext- The next step id- Returns:
- a bean definition for a
StateTransition
-