001/* 002 * Copyright 2009-2014 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.springframework.batch.core.configuration.xml; 017 018import org.springframework.batch.core.listener.AbstractListenerFactoryBean; 019import org.springframework.beans.factory.support.BeanDefinitionBuilder; 020import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; 021import org.springframework.beans.factory.xml.ParserContext; 022import org.w3c.dom.Element; 023 024/** 025 * Parse <step-listener/> elements in the batch namespace. 026 * 027 * @author Dan Garrette 028 * @since 2.0 029 */ 030public class TopLevelStepListenerParser extends AbstractSingleBeanDefinitionParser { 031 032 private static final StepListenerParser stepListenerParser = new StepListenerParser(); 033 034 @Override 035 protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { 036 CoreNamespaceUtils.autoregisterBeansForNamespace(parserContext, element); 037 stepListenerParser.doParse(element, parserContext, builder); 038 } 039 040 @Override 041 protected Class<? extends AbstractListenerFactoryBean<?>> getBeanClass(Element element) { 042 return stepListenerParser.getBeanClass(); 043 } 044 045}