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.Logger
Class logger.private Map<QName,
BeanDefinitionParser> Stores theBeanDefinitionParser
implementations keyed by the local name of theElements
they handle. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecorate
(Node node, BeanDefinitionHolder definition, ParserContext parserContext) A noop decorator.protected BeanDefinitionParser
findParserForElement
(Element element) Locates theBeanDefinitionParser
from the register implementations using the local name of the suppliedElement
.parse
(Element element, ParserContext parserContext) Parses the suppliedElement
by delegating to theBeanDefinitionParser
that is registered for thatElement
.protected void
registerBeanDefinitionParser
(QName elementNameOrType, BeanDefinitionParser parser) Subclasses can call this to register the suppliedBeanDefinitionParser
to 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 Details
-
log
private final org.slf4j.Logger logClass logger. -
parsers
Stores theBeanDefinitionParser
implementations keyed by the local name of theElements
they 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:
decorate
in 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 suppliedElement
by delegating to theBeanDefinitionParser
that is registered for thatElement
.- Specified by:
parse
in 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 theBeanDefinitionParser
from 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 suppliedBeanDefinitionParser
to 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
-