Package net.shibboleth.ext.spring.util
Class BaseSpringNamespaceHandler
java.lang.Object
net.shibboleth.ext.spring.util.BaseSpringNamespaceHandler
- All Implemented Interfaces:
NamespaceHandler
A base class for
NamespaceHandler implementations.
This code is heavily based on Spring's NamespaceHandlerSupport. 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
FieldsModifier and TypeFieldDescriptionprivate final org.slf4j.LoggerClass logger.private Map<QName,BeanDefinitionParser> Stores theBeanDefinitionParserimplementations keyed by the local name of theElementsthey handle. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecorate(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.parse(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, waitMethods inherited from interface org.springframework.beans.factory.xml.NamespaceHandler
init
-
Field Details
-
log
private final org.slf4j.Logger logClass logger. -
parsers
Stores theBeanDefinitionParserimplementations keyed by the local name of theElementsthey handle.
-
-
Constructor Details
-
BaseSpringNamespaceHandler
public BaseSpringNamespaceHandler()
-
-
Method Details
-
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
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
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
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
-