net.sourceforge.stripes.config
Interface Configuration

All Known Implementing Classes:
DefaultConfiguration, RuntimeConfiguration

public interface Configuration

Type safe interface for accessing configuration information used to configure Stripes. All Configuration implementations are handed a reference to the BootstrapPropertyResolver to enable them to find initial values and fully initialize themselves. Through the BootstrapPropertyResolver implementations also get access to the ServletConfig of the DispatcherServlet which can be used for locating configuration values if desired.

Implementations of Configuration should fail fast. At initialization time they should detect as many failures as possible and raise an exception. Since exceptions in Configuration are considered fatal there are no exception specifications and implementations are expected to throw runtime exceptions with plenty of details about the failure and its suspected cause(s).

Author:
Tim Fennell

Method Summary
 ActionBeanContextFactory getActionBeanContextFactory()
          Returns an instance of an action bean context factory which will used throughout Stripes to manufacture ActionBeanContext objects.
 ActionBeanPropertyBinder getActionBeanPropertyBinder()
          Returns an instance of ActionBeanPropertyBinder that is responsible for binding all properties to all ActionBeans at runtime.
 ActionResolver getActionResolver()
          Returns an instance of ActionResolver that will be used by Stripes to lookup and resolve ActionBeans.
 BootstrapPropertyResolver getBootstrapPropertyResolver()
          Implementations should implement this method to simply return a reference to the BootstrapPropertyResolver passed to the Configuration at initialization time.
 ExceptionHandler getExceptionHandler()
          Returns an instance of ExceptionHandler that can be used by Stripes to handle any exceptions that arise as the result of processing a request.
 FormatterFactory getFormatterFactory()
          Returns an instance of FormatterFactory that is responsible for creating Formatter objects for converting rich types into Strings for display on pages.
 Collection<Interceptor> getInterceptors(LifecycleStage stage)
          Fetches the interceptors that should be executed around the lifecycle stage applied.
 LocalePicker getLocalePicker()
          Returns an instance of LocalePicker that is responsible for choosing the Locale for each request that enters the system.
 LocalizationBundleFactory getLocalizationBundleFactory()
          Returns an instance of LocalizationBundleFactory that is responsible for looking up resource bundles for the varying localization needs of a web application.
 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 PopulationStrategy that determines from where a tag's value should be repopulated.
 ServletContext getServletContext()
          Retrieves the ServletContext for the context within which the Stripes application is executing.
 TagErrorRendererFactory getTagErrorRendererFactory()
          Returns an instance of a tag error renderer factory for building custom error renderers for form input tags that have field errors.
 TypeConverterFactory getTypeConverterFactory()
          Returns an instance of TypeConverterFactory that is responsible for providing lookups and instances of TypeConverters for the validation system.
 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()
          Called by the DispatcherServlet to initialize the Configuration.
 boolean isDebugMode()
          Returns true if the Stripes application is running in debug mode.
 void setBootstrapPropertyResolver(BootstrapPropertyResolver resolver)
          Supplies the Configuration with a BootstrapPropertyResolver.
 void setDebugMode(boolean debugMode)
          Enable or disable debug mode.
 

Method Detail

setBootstrapPropertyResolver

void setBootstrapPropertyResolver(BootstrapPropertyResolver resolver)
Supplies the Configuration with a BootstrapPropertyResolver. This method is guaranteed to be invoked prior to the init method.

Parameters:
resolver - a BootStrapPropertyResolver which can be used to find any values required by the Configuration in order to initialize

init

void init()
Called by the DispatcherServlet to initialize the Configuration. Any operations which may fail and cause the Configuration to be inaccessible should be performed here (e.g. opening a configuration file and reading the contents).


getBootstrapPropertyResolver

BootstrapPropertyResolver getBootstrapPropertyResolver()
Implementations should implement this method to simply return a reference to the BootstrapPropertyResolver passed to the Configuration at initialization time.

Returns:
BootstrapPropertyResolver the instance passed to the init() method

getServletContext

ServletContext getServletContext()
Retrieves the ServletContext for the context within which the Stripes application is executing.

Returns:
the ServletContext in which the application is running

setDebugMode

void setDebugMode(boolean debugMode)
Enable or disable debug mode.


isDebugMode

boolean isDebugMode()
Returns true if the Stripes application is running in debug mode.


getActionResolver

ActionResolver getActionResolver()
Returns an instance of ActionResolver that will be used by Stripes to lookup and resolve ActionBeans. The instance should be cached by the Configuration since multiple entities in the system may access the ActionResolver throughout the lifetime of the application.

Returns:
the Class representing the configured ActionResolver

getActionBeanPropertyBinder

ActionBeanPropertyBinder getActionBeanPropertyBinder()
Returns an instance of ActionBeanPropertyBinder that is responsible for binding all properties to all ActionBeans at runtime. The instance should be cached by the Configuration since multiple entities in the system may access the ActionBeanPropertyBinder throughout the lifetime of the application.

Returns:
ActionBeanPropertyBinder the property binder to be used by Stripes

getTypeConverterFactory

TypeConverterFactory getTypeConverterFactory()
Returns an instance of TypeConverterFactory that is responsible for providing lookups and instances of TypeConverters for the validation system. The instance should be cached by the Configuration since multiple entities in the system may access the TypeConverterFactory throughout the lifetime of the application.

Returns:
TypeConverterFactory an instance of a TypeConverterFactory implementation

getLocalizationBundleFactory

LocalizationBundleFactory getLocalizationBundleFactory()
Returns an instance of LocalizationBundleFactory that is responsible for looking up resource bundles for the varying localization needs of a web application. The instance should be cached by the Configuration since multiple entities in the system may access the LocalizationBundleFactory throughout the lifetime of the application.

Returns:
LocalizationBundleFactory an instance of a LocalizationBundleFactory implementation

getLocalePicker

LocalePicker getLocalePicker()
Returns an instance of LocalePicker that is responsible for choosing the Locale for each request that enters the system.

Returns:
LocalePicker an instance of a LocalePicker implementation

getFormatterFactory

FormatterFactory getFormatterFactory()
Returns an instance of FormatterFactory that is responsible for creating Formatter objects for converting rich types into Strings for display on pages.

Returns:
LocalePicker an instance of a LocalePicker implementation

getTagErrorRendererFactory

TagErrorRendererFactory getTagErrorRendererFactory()
Returns an instance of a tag error renderer factory for building custom error renderers for form input tags that have field errors.

Returns:
TagErrorRendererFactory an instance of TagErrorRendererFactory

getPopulationStrategy

PopulationStrategy getPopulationStrategy()
Returns an instance of a PopulationStrategy that determines from where a tag's value should be repopulated.

Returns:
PopulationStrategy an instance of PopulationStrategy

getActionBeanContextFactory

ActionBeanContextFactory getActionBeanContextFactory()
Returns an instance of an action bean context factory which will used throughout Stripes to manufacture ActionBeanContext objects. This allows projects to extend ActionBeanContext and provide additional type safe methods for accessing contextual information cleanly.

Returns:
ActionBeanContextFactory an instance of ActionBeanContextFactory

getInterceptors

Collection<Interceptor> getInterceptors(LifecycleStage stage)
Fetches the interceptors that should be executed around the lifecycle stage applied. Must return a non-null collection, but the collection may be empty. The Interceptors are invoked around the code which executes the given lifecycle function (e.g. ActionBeanResolution), and as a result can execute code both before and after it.

Returns:
Collection an ordered collection of interceptors to be executed around the given lifecycle stage.

getExceptionHandler

ExceptionHandler getExceptionHandler()
Returns an instance of ExceptionHandler that can be used by Stripes to handle any exceptions that arise as the result of processing a request.

Returns:
ExceptionHandler an instance of ExceptionHandler

getMultipartWrapperFactory

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).

Returns:
MultipartWrapperFactory an instance of the wrapper factory

getValidationMetadataProvider

ValidationMetadataProvider getValidationMetadataProvider()
Returns an instance of ValidationMetadataProvider that can be used by Stripes to determine what validations need to be applied during LifecycleStage.BindingAndValidation.

Returns:
an instance of ValidationMetadataProvider


? Copyright 2005-2006, Stripes Development Team.