com.sourceforge.jpatterns.core.configuration
Interface IPropertiesManager

All Superinterfaces:
Serializable
All Known Implementing Classes:
PropertiesManagerImpl

public interface IPropertiesManager
extends Serializable

This interface defines the methods would be used later for the working with the configuration functionality defined at the properties.
The com.sourceforge.jpatterns.core.configuration.PropertiesBasedFactory class contains the getter returning the implementation of the IPropertiesManager. It is the single place where the configuration specifying which implementation of the interface should be used is configured at the Java Sources. All the configuration settings necessary for implementing the "factory" pattern is placed at the properties file, and then the JPatterns built-in pattern "factory" and xml configuration is used later for retrieving the implementations of the interfaces.
Please review com.sourceforge.jpatterns.core.configuration.PropertiesBasedFactory#getPropertiesManager()
Please review properly the following Java Docs - it is important for understanding of the algorithm of working of the JPatterns configuration functionality. com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_FRAMEWORK_PROPERTIES todo [zmicer]: not sure if all these methods should take place here (e.g. getDefaultBundle etc) $Author:: zmicer $
$Rev:: 67 $
* $Date:: 2007-08-28 21:37:07 #$
$Date:: 2007-08-28 21:37:07 #$


Method Summary
 boolean customConfigPresents()
           
 boolean defaultConfigPresents()
           
 String getBundle(Class key)
          Get bundle for the provided key - it is a class.
 String getBundle(String key)
          Return the bundle value using the ResourceBundle already retrieved.
 Object getBundledObject(Class key)
          Get bundled object by the key provided.
 Object getBundledObject(String key)
          Get bundled object by the String key provided.
 String getCustomBundle(String key)
          Get the value from the custom bundle. this was provided in any case - potentially it could be used at the unit tests etc.
 String getDefaultBundle(String key)
          Get the value from the default bundle. this was provided in any case - potentially it could be used at the unit tests etc.
 Set<String> getMergedKeys()
           
 boolean useOnlyCustomConfigIfPresent()
          This method returns the value of the props signing if custom properties file totally overrides the default, and if it is present, then the values from the default properties are not used at all.
 

Method Detail

customConfigPresents

boolean customConfigPresents()
Returns:
true if the custom resource bundle is presents at the class path

defaultConfigPresents

boolean defaultConfigPresents()
Returns:
true if the default config resource bundle is presents at the class path

useOnlyCustomConfigIfPresent

boolean useOnlyCustomConfigIfPresent()
This method returns the value of the props signing if custom properties file totally overrides the default, and if it is present, then the values from the default properties are not used at all.
Please review properly the following Java Docs - it is important for understanding of the algorithm of working of the JPatterns configuration functionality. com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_FRAMEWORK_PROPERTIES

Returns:
true if the approrpiate property is set to the true, false otherwise.

getBundle

String getBundle(String key)
Return the bundle value using the ResourceBundle already retrieved. This method analyzes two bundles - default and custom one, the priority has custom - it provides the user with the possibility to override the values defined at the default properties, and it is a good customization point for the framework.

Parameters:
key - for the value we need. Can not be null (otherwise IllegalArgumentException would appear).
Returns:
the value for this bundle or just null in the case there is not defined bundles with such name

getBundle

String getBundle(Class key)
Get bundle for the provided key - it is a class. The shorten name is used - Serializable, PropertiesManagerImpl etc. - without packaging

Parameters:
key - for the value we need, Class object. Can not be null (otherwise IllegalArgumentException would appear).
Returns:
the value for this bundle or just null in the case there is not defined bundles with such name

getBundledObject

Object getBundledObject(Class key)
Get bundled object by the key provided. We would obtain the full class name using this key, and then try to instantiate the object. In the case value for the this key is null, or object can not be instantiated the JPConfigException would appear.

Parameters:
key - the class for which we should obtain appropriate implementation (usually it is class of the interface of abstract class implementation of which we would obtain.)
Returns:
the Object which was instantiated (following the Java Docs above we would throw the JPConfigException exception in the case the key was not found or the object can not be instantiated.)

getBundledObject

Object getBundledObject(String key)
Get bundled object by the String key provided. We would obtain the full class name using this key, and then try to instantiate the object. In the case value for the this key is null, or object can not be instantiated the JPConfigException would appear.

Parameters:
key - the class for which we should obtain appropriate implementation (usually it is String - base name of the interface of abstract class implementation of which we would obtain.)
Returns:
the Object which was instantiated (following the Java Docs above we would throw the JPConfigException exception in the case the key was not found or the object can not be instantiated.)

getDefaultBundle

String getDefaultBundle(String key)
Get the value from the default bundle. this was provided in any case - potentially it could be used at the unit tests etc.
Please be noticed that we should check if the default configuration presents before the getting the value. The absence of the default configuration is a failure for the JPatterns framework.

Parameters:
key - to be processed. Can not be null (otherwise IllegalArgumentException would appear).
Returns:
String, the value required

getCustomBundle

String getCustomBundle(String key)
Get the value from the custom bundle. this was provided in any case - potentially it could be used at the unit tests etc.
Please be noticed that we should check if the custom configuration presents before the getting the value. The absence of the custom configuration is a normal behavioral of the system.

Parameters:
key - to be processed. Can not be null (otherwise IllegalArgumentException would appear).
Returns:
String, the value required

getMergedKeys

Set<String> getMergedKeys()
Returns:
the Enumeration of the keys (merged one or the custom one or the default one - it depends on the following: a. if custom properties files is present or was specified at the JVM parameter b. study the com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_FRAMEWORK_PROPERTIES)


Copyright © 2007 jzmicer.team. All Rights Reserved.