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 failiure 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.
 FormatterFactory getFormatterFactory()
          Returns an instance of FormatterFactory that is responsible for creating Formatter objects for converting rich types into Strings for display on pages.
 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 ot a web application.
 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.
 void init()
          Called by the DispatcherServlet to initialize the Configuration.
 void setBootstrapPropertyResolver(BootstrapPropertyResolver resolver)
          Supplies the Configuration with a BootstrapPropertyResolver.
 

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

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 ot 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

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


© Copyright 2005, Stripes Development Team.