org.nakedobjects.metamodel.config
Class ConfigurationBuilderAbstract

java.lang.Object
  extended by org.nakedobjects.metamodel.config.ConfigurationBuilderAbstract
All Implemented Interfaces:
Injectable, ConfigurationBuilder
Direct Known Subclasses:
ConfigurationBuilderDefault, ConfigurationBuilderFileSystem

public class ConfigurationBuilderAbstract
extends java.lang.Object
implements ConfigurationBuilder

Adapter for ConfigurationBuilder, loading the specified configuration resource (file) from the given ResourceStreamSource(s).

If a property is in multiple configuration resources then the latter resources will overwrite the former.


Constructor Summary
ConfigurationBuilderAbstract()
           
ConfigurationBuilderAbstract(ResourceStreamSource... resourceStreamSources)
           
ConfigurationBuilderAbstract(ResourceStreamSource resourceStreamSource)
           
 
Method Summary
 void add(java.util.Properties properties)
          Adds additional properties.
 void add(java.lang.String key, java.lang.String value)
          Adds additional property.
 void addConfigurationResource(java.lang.String configurationResource, NotFoundPolicy notFoundPolicy)
          Registers the configuration resource (usually, a file) with the specified name from the first ResourceStreamSource available.
protected  void addDefaultConfigurationResources()
          May be overridden by subclasses if required.
protected  void addProperties(PropertiesConfiguration configuration, java.util.Properties properties)
           
 NakedObjectConfiguration getConfiguration()
          Returns the current configuration.
 ResourceStreamSource getResourceStreamSource()
          The underlying ResourceStreamSource from which the configuration is being read.
 void injectInto(java.lang.Object candidate)
          Will inject itself into the candidate if the candidate implements the corresponding *Aware type.
protected  void loadConfigurationResource(PropertiesConfiguration configuration, java.lang.String configurationResource, NotFoundPolicy notFoundPolicy)
          Loads the configuration resource (usually, a file) with the specified name from the first ResourceStreamSource available.
 void setIncludeSystemProperties(boolean includeSystemProperties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationBuilderAbstract

public ConfigurationBuilderAbstract()

ConfigurationBuilderAbstract

public ConfigurationBuilderAbstract(ResourceStreamSource resourceStreamSource)

ConfigurationBuilderAbstract

public ConfigurationBuilderAbstract(ResourceStreamSource... resourceStreamSources)
Method Detail

addDefaultConfigurationResources

protected void addDefaultConfigurationResources()
May be overridden by subclasses if required.


getResourceStreamSource

public ResourceStreamSource getResourceStreamSource()
Description copied from interface: ConfigurationBuilder
The underlying ResourceStreamSource from which the configuration is being read.

Note that this may be a composite.

Specified by:
getResourceStreamSource in interface ConfigurationBuilder

addConfigurationResource

public void addConfigurationResource(java.lang.String configurationResource,
                                     NotFoundPolicy notFoundPolicy)
Registers the configuration resource (usually, a file) with the specified name from the first ResourceStreamSource available.

If the configuration resource cannot be found then the provided NotFoundPolicy determines whether an exception is thrown or not.

Must be called before getConfiguration(); the resource is actually read on getConfiguration().

Specified by:
addConfigurationResource in interface ConfigurationBuilder

setIncludeSystemProperties

public void setIncludeSystemProperties(boolean includeSystemProperties)

add

public void add(java.lang.String key,
                java.lang.String value)
Adds additional property.

Specified by:
add in interface ConfigurationBuilder

add

public void add(java.util.Properties properties)
Adds additional properties.

Specified by:
add in interface ConfigurationBuilder

getConfiguration

public NakedObjectConfiguration getConfiguration()
Returns the current configuration.

Specified by:
getConfiguration in interface ConfigurationBuilder

loadConfigurationResource

protected void loadConfigurationResource(PropertiesConfiguration configuration,
                                         java.lang.String configurationResource,
                                         NotFoundPolicy notFoundPolicy)
Loads the configuration resource (usually, a file) with the specified name from the first ResourceStreamSource available.

If the configuration resource cannot be found then the provided NotFoundPolicy determines whether an exception is thrown or not.


addProperties

protected void addProperties(PropertiesConfiguration configuration,
                             java.util.Properties properties)

injectInto

public void injectInto(java.lang.Object candidate)
Description copied from interface: Injectable
Will inject itself into the candidate if the candidate implements the corresponding *Aware type.

Specified by:
injectInto in interface Injectable


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.