Module net.shibboleth.ext.spring
Package net.shibboleth.ext.spring.util
Class BaseSpringNamespaceHandler
- java.lang.Object
-
- net.shibboleth.ext.spring.util.BaseSpringNamespaceHandler
-
- All Implemented Interfaces:
NamespaceHandler
public abstract class BaseSpringNamespaceHandler extends Object implements NamespaceHandler
A base class forNamespaceHandlerimplementations. This code is heavily based on Spring'sNamespaceHandlerSupport. The largest difference is that bean definition parsers may be registered against either an elements name or schema type. During parser lookup the schema type is preferred.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogClass logger.private Map<QName,BeanDefinitionParser>parsersStores theBeanDefinitionParserimplementations keyed by the local name of theElementsthey handle.
-
Constructor Summary
Constructors Constructor Description BaseSpringNamespaceHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BeanDefinitionHolderdecorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext)A noop decorator.protected BeanDefinitionParserfindParserForElement(Element element)Locates theBeanDefinitionParserfrom the register implementations using the local name of the suppliedElement.BeanDefinitionparse(Element element, ParserContext parserContext)Parses the suppliedElementby delegating to theBeanDefinitionParserthat is registered for thatElement.protected voidregisterBeanDefinitionParser(QName elementNameOrType, BeanDefinitionParser parser)Subclasses can call this to register the suppliedBeanDefinitionParserto handle the specified element.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.beans.factory.xml.NamespaceHandler
init
-
-
-
-
Field Detail
-
log
private final org.slf4j.Logger log
Class logger.
-
parsers
private Map<QName,BeanDefinitionParser> parsers
Stores theBeanDefinitionParserimplementations keyed by the local name of theElementsthey handle.
-
-
Method Detail
-
decorate
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext)
A noop decorator. Returns the input.- Specified by:
decoratein interfaceNamespaceHandler- Parameters:
node- the node decorating a the given bean definitiondefinition- the bean being decoratedparserContext- the current parser context- Returns:
- the input bean definition
-
parse
public BeanDefinition parse(Element element, ParserContext parserContext)
Parses the suppliedElementby delegating to theBeanDefinitionParserthat is registered for thatElement.- Specified by:
parsein interfaceNamespaceHandler- Parameters:
element- the element to be parsed into a bean definitionparserContext- the context within which the bean definition is created- Returns:
- the bean definition created from the given element
-
findParserForElement
protected BeanDefinitionParser findParserForElement(Element element)
Locates theBeanDefinitionParserfrom the register implementations using the local name of the suppliedElement.- Parameters:
element- the element to locate the bean definition parser for- Returns:
- the parser for the given bean element
-
registerBeanDefinitionParser
protected void registerBeanDefinitionParser(QName elementNameOrType, BeanDefinitionParser parser)
Subclasses can call this to register the suppliedBeanDefinitionParserto handle the specified element. The element name is the local (non-namespace qualified) name.- Parameters:
elementNameOrType- the element name or schema type the parser is forparser- the parser to register
-
-