net.sourceforge.stripes.config
Class DefaultConfiguration

java.lang.Object
  extended by net.sourceforge.stripes.config.DefaultConfiguration
All Implemented Interfaces:
Configuration
Direct Known Subclasses:
RuntimeConfiguration

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.

The DefaultConfiguration is designed to be easily extended as needed. Subclasses should simply implement their own init() method which instantiates the ConfigurableComponents in the manner required and then call super.setXXX() to set them on the configuration. The last step should be to call super.init(), which will allow the DefaultConfiguration to fill in any implementations that were not set by the child class.

Author:
Tim Fennell

Constructor Summary
DefaultConfiguration()
           
 
Method Summary
 ActionBeanContextFactory getActionBeanContextFactory()
          Returns the configured ActionBeanContextFactory.
 ActionBeanPropertyBinder getActionBeanPropertyBinder()
          Will always return an OgnlActionBeanPropertyBinder
 ActionResolver getActionResolver()
          Will always return an instance of AnnotatedClassActionResolver
 BootstrapPropertyResolver getBootstrapPropertyResolver()
          Returns a reference to the resolver supplied at initialziation time.
 FormatterFactory getFormatterFactory()
          Returns an instance of a FormatterFactory.
 LocalePicker getLocalePicker()
          Returns an instance of a LocalePicker.
 LocalizationBundleFactory getLocalizationBundleFactory()
          Returns an instance of a LocalizationBundleFactory.
 TagErrorRendererFactory getTagErrorRendererFactory()
          Returns an instance of a TagErrorRendererFactory.
 TypeConverterFactory getTypeConverterFactory()
          Will always return an instance of DefaultTypeConverterFactory.
 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  void setActionBeanContextFactory(ActionBeanContextFactory contextFactory)
          Allows subclasses to set the ActionBeanContextFactory instance to be used.
protected  void setActionBeanPropertyBinder(ActionBeanPropertyBinder propertyBinder)
          Allows subclasses to set the ActionBeanPropertyBinder instance to be used.
protected  void setActionResolver(ActionResolver actionResolver)
          Allows subclasses to set the ActionResolver instance to be used.
 void setBootstrapPropertyResolver(BootstrapPropertyResolver resolver)
          Gratefully accepts the BootstrapPropertyResolver handed to the Configuration.
protected  void setFormatterFactory(FormatterFactory formatterFactory)
          Allows subclasses to set the FormatterFactory instance to be used.
protected  void setLocalePicker(LocalePicker localePicker)
          Allows subclasses to set the LocalePicker instance to be used.
protected  void setLocalizationBundleFactory(LocalizationBundleFactory localizationBundleFactory)
          Allows subclasses to set the LocalizationBundleFactory instance to be used.
protected  void setTagErrorRendererFactory(TagErrorRendererFactory tagErrorRendererFactory)
          Allows subclasses to set the TagErrorRendererFactory instance to be used.
protected  void setTypeConverterFactory(TypeConverterFactory typeConverterFactory)
          Allows subclasses to set the TypeConverterFactory instance to be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConfiguration

public DefaultConfiguration()
Method Detail

setBootstrapPropertyResolver

public void setBootstrapPropertyResolver(BootstrapPropertyResolver resolver)
Gratefully accepts the BootstrapPropertyResolver handed to the Configuration.

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

init

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

Specified by:
init in interface Configuration

getBootstrapPropertyResolver

public BootstrapPropertyResolver getBootstrapPropertyResolver()
Returns a reference to the resolver supplied at initialziation time.

Specified by:
getBootstrapPropertyResolver in interface Configuration
Returns:
BootstrapPropertyResolver the instance passed to the init() method

getActionResolver

public ActionResolver getActionResolver()
Will always return an instance of AnnotatedClassActionResolver

Specified by:
getActionResolver in interface Configuration
Returns:
AnnotatedClassActionResolver an instance of the default resolver

setActionResolver

protected void setActionResolver(ActionResolver actionResolver)
Allows subclasses to set the ActionResolver instance to be used.


getActionBeanPropertyBinder

public ActionBeanPropertyBinder getActionBeanPropertyBinder()
Will always return an OgnlActionBeanPropertyBinder

Specified by:
getActionBeanPropertyBinder in interface Configuration
Returns:
OgnlActionBeanPropertyBinder an instance of the default binder

setActionBeanPropertyBinder

protected void setActionBeanPropertyBinder(ActionBeanPropertyBinder propertyBinder)
Allows subclasses to set the ActionBeanPropertyBinder instance to be used.


getActionBeanContextFactory

public ActionBeanContextFactory getActionBeanContextFactory()
Returns the configured ActionBeanContextFactory. Unless a subclass has configured a custom one, the instance will be a DefaultActionBeanContextFactory.

Specified by:
getActionBeanContextFactory in interface Configuration
Returns:
ActionBeanContextFactory an instance of a factory for creating ActionBeanContexts

setActionBeanContextFactory

protected void setActionBeanContextFactory(ActionBeanContextFactory contextFactory)
Allows subclasses to set the ActionBeanContextFactory instance to be used.


getTypeConverterFactory

public TypeConverterFactory getTypeConverterFactory()
Will always return an instance of DefaultTypeConverterFactory.

Specified by:
getTypeConverterFactory in interface Configuration
Returns:
TypeConverterFactory an instance of the default factory.

setTypeConverterFactory

protected void setTypeConverterFactory(TypeConverterFactory typeConverterFactory)
Allows subclasses to set the TypeConverterFactory instance to be used.


getLocalizationBundleFactory

public LocalizationBundleFactory getLocalizationBundleFactory()
Returns an instance of a LocalizationBundleFactory. By default this will be an instance of DefaultLocalizationBundleFactory unless another type has been configured.

Specified by:
getLocalizationBundleFactory in interface Configuration
Returns:
LocalizationBundleFactory an instance of a LocalizationBundleFactory implementation

setLocalizationBundleFactory

protected void setLocalizationBundleFactory(LocalizationBundleFactory localizationBundleFactory)
Allows subclasses to set the LocalizationBundleFactory instance to be used.


getLocalePicker

public LocalePicker getLocalePicker()
Returns an instance of a LocalePicker. Unless a subclass has picked another implementation will return an instance of DefaultLocalePicker.

Specified by:
getLocalePicker in interface Configuration
Returns:
LocalePicker an instance of a LocalePicker implementation

setLocalePicker

protected void setLocalePicker(LocalePicker localePicker)
Allows subclasses to set the LocalePicker instance to be used.


getFormatterFactory

public FormatterFactory getFormatterFactory()
Returns an instance of a FormatterFactory. Unless a subclass has picked another implementation will return an instance of DefaultFormatterFactory.

Specified by:
getFormatterFactory in interface Configuration
Returns:
LocalePicker an instance of a LocalePicker implementation

setFormatterFactory

protected void setFormatterFactory(FormatterFactory formatterFactory)
Allows subclasses to set the FormatterFactory instance to be used.


getTagErrorRendererFactory

public TagErrorRendererFactory getTagErrorRendererFactory()
Returns an instance of a TagErrorRendererFactory. Unless a subclass has picked another implementation, will return an instance of DefaultTagErrorRendererFactory.

Specified by:
getTagErrorRendererFactory in interface Configuration
Returns:
TagErrorRendererFactory an instance of TagErrorRendererFactory

setTagErrorRendererFactory

protected void setTagErrorRendererFactory(TagErrorRendererFactory tagErrorRendererFactory)
Allows subclasses to set the TagErrorRendererFactory instance to be used.



© Copyright 2005, Stripes Development Team.