Spring Security Framework

org.springframework.security.authoritymapping
Class XmlMappableAttributesRetriever

java.lang.Object
  extended by org.springframework.security.authoritymapping.XmlMappableAttributesRetriever
All Implemented Interfaces:
InitializingBean, MappableAttributesRetriever
Direct Known Subclasses:
WebXmlMappableAttributesRetriever

public abstract class XmlMappableAttributesRetriever
extends Object
implements MappableAttributesRetriever, InitializingBean

This implementation for the MappableAttributesRetriever interface retrieves the list of mappable attributes from an XML file.

This class is defined as abstract because it is too generic to be used directly. As this class is usually used to read very specific XML files (e.g. web.xml, ejb-jar.xml), subclasses should usually define the actual XPath-expression to use, and define a more specifically named setter for the XML InputStream (e.g. setWebXmlInputStream).

Since:
2.0
Author:
Ruud Senden

Nested Class Summary
static class XmlMappableAttributesRetriever.IgnoreCloseInputStream
           
 
Constructor Summary
XmlMappableAttributesRetriever()
           
 
Method Summary
 void afterPropertiesSet()
          Check whether all required properties have been set.
 String[] getMappableAttributes()
          Implementations of this method should return a list of all string attributes which can be mapped to GrantedAuthoritys.
 void setCloseInputStream(boolean b)
          Define whether the provided InputStream must be closed after reading it.
protected  void setXmlInputStream(InputStream aStream)
          Subclasses should provide this method with a more specific name (e.g.
protected  void setXpathExpression(String anXpathExpression)
          Subclasses usually want to set an XPath expression by themselves (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlMappableAttributesRetriever

public XmlMappableAttributesRetriever()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Check whether all required properties have been set.

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getMappableAttributes

public String[] getMappableAttributes()
Description copied from interface: MappableAttributesRetriever
Implementations of this method should return a list of all string attributes which can be mapped to GrantedAuthoritys.

Specified by:
getMappableAttributes in interface MappableAttributesRetriever
Returns:
list of all mappable roles

setXmlInputStream

protected void setXmlInputStream(InputStream aStream)
Subclasses should provide this method with a more specific name (e.g. indicating the type of XML file the subclass expects, like setWebXmlInputStream).


setXpathExpression

protected void setXpathExpression(String anXpathExpression)
Subclasses usually want to set an XPath expression by themselves (e.g. not user-configurable). However subclasses may provide configuration options to for example choose from a list of predefined XPath expressions (e.g. to support multiple versions of the same type of XML file), as such we provide a setter instead of mandatory constructor argument.


setCloseInputStream

public void setCloseInputStream(boolean b)
Define whether the provided InputStream must be closed after reading it.


Spring Security Framework

Copyright © 2004-2010 SpringSource, Inc. All Rights Reserved.