net.sourceforge.stripes.config
Class BootstrapPropertyResolver

java.lang.Object
  extended by net.sourceforge.stripes.config.BootstrapPropertyResolver

public class BootstrapPropertyResolver
extends Object

Resolves configuration properties that are used to bootstrap the system. Essentially this boils down to a handful of properties that are needed to figure out which configuration class should be instantiated, and any values needed by that configuration class to locate configuration information.

Properties are looked for in the following order:

Author:
Tim Fennell

Field Summary
static String PACKAGES
          The Configuration Key for looking up the comma separated list of extension packages.
 
Constructor Summary
BootstrapPropertyResolver(FilterConfig filterConfig)
          Constructs a new BootstrapPropertyResolver with the given ServletConfig.
 
Method Summary
<T> Class<? extends T>
getClassProperty(String paramName, Class<T> targetType)
          Attempts to find a class the user has specified in web.xml or by auto-discovery in packages listed in web.xml under Extension.Packages.
<T> List<Class<? extends T>>
getClassPropertyList(Class<T> targetType)
          Attempts to find classes by auto-discovery in packages listed in web.xml under Extension.Packages.
 List<Class<?>> getClassPropertyList(String paramName)
          Attempts to find all classes the user has specified in web.xml.
<T> List<Class<? extends T>>
getClassPropertyList(String paramName, Class<T> targetType)
          Attempts to find all matching classes the user has specified in web.xml or by auto-discovery in packages listed in web.xml under Extension.Packages.
 FilterConfig getFilterConfig()
          Returns a reference to the StripesFilter's FilterConfig object.
 String getProperty(String key)
          Fetches a configuration property in the manner described in the class level javadoc for this class.
protected
<T> void
removeAbstractClasses(Collection<Class<? extends T>> classes)
          Removes any classes from the collection that are abstract or interfaces.
protected
<T> void
removeDontAutoloadClasses(Collection<Class<? extends T>> classes)
          Removes any classes from the collection that are marked with DontAutoLoad.
 void setFilterConfig(FilterConfig filterConfig)
          Stores a reference to the filter's FilterConfig object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PACKAGES

public static final String PACKAGES
The Configuration Key for looking up the comma separated list of extension packages.

See Also:
Constant Field Values
Constructor Detail

BootstrapPropertyResolver

public BootstrapPropertyResolver(FilterConfig filterConfig)
Constructs a new BootstrapPropertyResolver with the given ServletConfig.

Method Detail

setFilterConfig

public void setFilterConfig(FilterConfig filterConfig)
Stores a reference to the filter's FilterConfig object.


getFilterConfig

public FilterConfig getFilterConfig()
Returns a reference to the StripesFilter's FilterConfig object.


getProperty

public String getProperty(String key)
Fetches a configuration property in the manner described in the class level javadoc for this class.

Parameters:
key - the String name of the configuration value to be looked up
Returns:
String the value of the configuration item or null

getClassProperty

public <T> Class<? extends T> getClassProperty(String paramName,
                                               Class<T> targetType)
Attempts to find a class the user has specified in web.xml or by auto-discovery in packages listed in web.xml under Extension.Packages. Classes specified in web.xml take precedence.

Parameters:
paramName - the parameter to look for in web.xml
targetType - the type that we're looking for
Returns:
the Class that was found

getClassPropertyList

public List<Class<?>> getClassPropertyList(String paramName)
Attempts to find all classes the user has specified in web.xml.

Parameters:
paramName - the parameter to look for in web.xml
Returns:
a List of classes found

getClassPropertyList

public <T> List<Class<? extends T>> getClassPropertyList(Class<T> targetType)
Attempts to find classes by auto-discovery in packages listed in web.xml under Extension.Packages.

Parameters:
targetType - the type that we're looking for
Returns:
a List of classes found

getClassPropertyList

public <T> List<Class<? extends T>> getClassPropertyList(String paramName,
                                                         Class<T> targetType)
Attempts to find all matching classes the user has specified in web.xml or by auto-discovery in packages listed in web.xml under Extension.Packages.

Parameters:
paramName - the parameter to look for in web.xml
targetType - the type that we're looking for
Returns:
the Class that was found

removeDontAutoloadClasses

protected <T> void removeDontAutoloadClasses(Collection<Class<? extends T>> classes)
Removes any classes from the collection that are marked with DontAutoLoad.


removeAbstractClasses

protected <T> void removeAbstractClasses(Collection<Class<? extends T>> classes)
Removes any classes from the collection that are abstract or interfaces.



? Copyright 2005-2006, Stripes Development Team.