public class DefaultConfiguration extends Object implements Configuration
Centralized location for defaults for all Configuration properties. This implementation does not lookup configuration information anywhere! It returns hard-coded defaults that will result in a working system without any user intervention.
Despite it's name the DefaultConfiguration is not in fact the default Configuration
implementation in Stripes! Instead it is the retainer of default configuration values. The
Configuration implementation that is used when no alternative is configured is the
RuntimeConfiguration, which is a direct subclass of DefaultConfiguration, and when no
further configuration properties are supplied behaves identically to the DefaultConfiguration.
The DefaultConfiguration is designed to be easily extended as needed. The init() method ensures that components are initialized in the correct order (taking dependencies into account), and should generally not be overridden. It invokes a number of initXXX() methods, one per configurable component. Subclasses should override any of the initXXX() methods desirable to return a fully initialized instance of the relevant component type, or null if the default is desired.
| Constructor and Description |
|---|
DefaultConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addInterceptor(Map<LifecycleStage,Collection<Interceptor>> map,
Interceptor interceptor)
Adds the interceptor to the map, associating it with the
LifecycleStages indicated
by the Intercepts annotation. |
ActionBeanContextFactory |
getActionBeanContextFactory()
Returns the configured ActionBeanContextFactory.
|
ActionBeanPropertyBinder |
getActionBeanPropertyBinder()
Returns an instance of
DefaultActionBeanPropertyBinder unless a subclass has
overridden the default. |
ActionResolver |
getActionResolver()
Returns an instance of
NameBasedActionResolver unless a subclass has
overridden the default. |
BootstrapPropertyResolver |
getBootstrapPropertyResolver()
Returns a reference to the resolver supplied at initialization time.
|
ExceptionHandler |
getExceptionHandler()
Returns an instance of an ExceptionHandler.
|
FormatterFactory |
getFormatterFactory()
Returns an instance of a FormatterFactory.
|
Collection<Interceptor> |
getInterceptors(LifecycleStage stage)
Returns a list of interceptors that should be executed around the lifecycle stage
indicated.
|
LocalePicker |
getLocalePicker()
Returns an instance of a LocalePicker.
|
LocalizationBundleFactory |
getLocalizationBundleFactory()
Returns an instance of a LocalizationBundleFactory.
|
MultipartWrapperFactory |
getMultipartWrapperFactory()
Returns an instance of MultipartWrapperFactory that can be used by Stripes to construct
MultipartWrapper instances for dealing with multipart requests (those containing file
uploads).
|
PopulationStrategy |
getPopulationStrategy()
Returns an instance of a PopulationsStrategy.
|
ServletContext |
getServletContext()
Retrieves the ServletContext for the context within which the Stripes application is
executing.
|
TagErrorRendererFactory |
getTagErrorRendererFactory()
Returns an instance of a TagErrorRendererFactory.
|
TypeConverterFactory |
getTypeConverterFactory()
Returns an instance of
DefaultTypeConverterFactory unless a subclass has
overridden the default.. |
ValidationMetadataProvider |
getValidationMetadataProvider()
Returns an instance of
ValidationMetadataProvider that can be used by Stripes to
determine what validations need to be applied during
LifecycleStage.BindingAndValidation. |
void |
init()
Creates and stores instances of the objects of the type that the Configuration is
responsible for providing, except where subclasses have already provided instances.
|
protected ActionBeanContextFactory |
initActionBeanContextFactory()
Allows subclasses to initialize a non-default ActionBeanContextFactory.
|
protected ActionBeanPropertyBinder |
initActionBeanPropertyBinder()
Allows subclasses to initialize a non-default ActionBeanPropertyBinder.
|
protected ActionResolver |
initActionResolver()
Allows subclasses to initialize a non-default ActionResovler.
|
protected Map<LifecycleStage,Collection<Interceptor>> |
initCoreInterceptors()
Instantiates the core interceptors, allowing subclasses to override the default behavior
|
protected Boolean |
initDebugMode()
Allows subclasses to initialize a non-default debug mode value.
|
protected ExceptionHandler |
initExceptionHandler()
Allows subclasses to initialize a non-default ExceptionHandler instance to be used.
|
protected FormatterFactory |
initFormatterFactory()
Allows subclasses to initialize a non-default FormatterFactory.
|
protected Map<LifecycleStage,Collection<Interceptor>> |
initInterceptors()
Allows subclasses to initialize a non-default Map of Interceptor instances.
|
protected LocalePicker |
initLocalePicker()
Allows subclasses to initialize a non-default LocalePicker.
|
protected LocalizationBundleFactory |
initLocalizationBundleFactory()
Allows subclasses to initialize a non-default LocalizationBundleFactory.
|
protected MultipartWrapperFactory |
initMultipartWrapperFactory()
Allows subclasses to initialize a non-default MultipartWrapperFactory.
|
protected PopulationStrategy |
initPopulationStrategy()
Allows subclasses to initialize a non-default PopulationStrategy instance to be used.
|
protected TagErrorRendererFactory |
initTagErrorRendererFactory()
Allows subclasses to initialize a non-default TagErrorRendererFactory instance to be used.
|
protected TypeConverterFactory |
initTypeConverterFactory()
Allows subclasses to initialize a non-default TypeConverterFactory.
|
protected ValidationMetadataProvider |
initValidationMetadataProvider()
Allows subclasses to initialize a non-default
ValidationMetadataProvider. |
boolean |
isDebugMode()
Returns true if the Stripes application is running in debug mode.
|
protected void |
mergeInterceptorMaps(Map<LifecycleStage,Collection<Interceptor>> dst,
Map<LifecycleStage,Collection<Interceptor>> src)
|
void |
setBootstrapPropertyResolver(BootstrapPropertyResolver resolver)
Gratefully accepts the BootstrapPropertyResolver handed to the Configuration.
|
void |
setDebugMode(boolean debugMode)
Enable or disable debug mode.
|
public void setBootstrapPropertyResolver(BootstrapPropertyResolver resolver)
setBootstrapPropertyResolver in interface Configurationresolver - a BootStrapPropertyResolver which can be used to find any values required
by the Configuration in order to initializepublic void init()
init in interface Configurationpublic BootstrapPropertyResolver getBootstrapPropertyResolver()
getBootstrapPropertyResolver in interface Configurationpublic ServletContext getServletContext()
getServletContext in interface Configurationpublic void setDebugMode(boolean debugMode)
setDebugMode in interface Configurationpublic boolean isDebugMode()
isDebugMode in interface Configurationprotected Boolean initDebugMode()
public ActionResolver getActionResolver()
NameBasedActionResolver unless a subclass has
overridden the default.getActionResolver in interface Configurationprotected ActionResolver initActionResolver()
public ActionBeanPropertyBinder getActionBeanPropertyBinder()
DefaultActionBeanPropertyBinder unless a subclass has
overridden the default.getActionBeanPropertyBinder in interface Configurationprotected ActionBeanPropertyBinder initActionBeanPropertyBinder()
public ActionBeanContextFactory getActionBeanContextFactory()
getActionBeanContextFactory in interface Configurationprotected ActionBeanContextFactory initActionBeanContextFactory()
public TypeConverterFactory getTypeConverterFactory()
DefaultTypeConverterFactory unless a subclass has
overridden the default..getTypeConverterFactory in interface Configurationprotected TypeConverterFactory initTypeConverterFactory()
public LocalizationBundleFactory getLocalizationBundleFactory()
getLocalizationBundleFactory in interface Configurationprotected LocalizationBundleFactory initLocalizationBundleFactory()
public LocalePicker getLocalePicker()
getLocalePicker in interface Configurationprotected LocalePicker initLocalePicker()
public FormatterFactory getFormatterFactory()
getFormatterFactory in interface Configurationprotected FormatterFactory initFormatterFactory()
public TagErrorRendererFactory getTagErrorRendererFactory()
getTagErrorRendererFactory in interface Configurationprotected TagErrorRendererFactory initTagErrorRendererFactory()
public PopulationStrategy getPopulationStrategy()
DefaultPopulationStrategy.getPopulationStrategy in interface Configurationprotected PopulationStrategy initPopulationStrategy()
public ExceptionHandler getExceptionHandler()
DefaultExceptionHandler.getExceptionHandler in interface Configurationprotected ExceptionHandler initExceptionHandler()
public MultipartWrapperFactory getMultipartWrapperFactory()
getMultipartWrapperFactory in interface Configurationprotected MultipartWrapperFactory initMultipartWrapperFactory()
public ValidationMetadataProvider getValidationMetadataProvider()
ValidationMetadataProvider that can be used by Stripes to
determine what validations need to be applied during
LifecycleStage.BindingAndValidation.getValidationMetadataProvider in interface ConfigurationValidationMetadataProviderprotected ValidationMetadataProvider initValidationMetadataProvider()
ValidationMetadataProvider.public Collection<Interceptor> getInterceptors(LifecycleStage stage)
BeforeAfterMethodInterceptor.getInterceptors in interface Configurationprotected void mergeInterceptorMaps(Map<LifecycleStage,Collection<Interceptor>> dst, Map<LifecycleStage,Collection<Interceptor>> src)
Maps of LifecycleStage to Collection of
Interceptor. A simple Map.putAll(Map) does not work because it overwrites
the collections in the map instead of adding to them.protected void addInterceptor(Map<LifecycleStage,Collection<Interceptor>> map, Interceptor interceptor)
LifecycleStages indicated
by the Intercepts annotation. If the interceptor implements
ConfigurableComponent, then its init() method will be called.protected Map<LifecycleStage,Collection<Interceptor>> initCoreInterceptors()
protected Map<LifecycleStage,Collection<Interceptor>> initInterceptors()
© Copyright 2005-2006, Stripes Development Team.