com.sourceforge.jpatterns.core.configuration
Class PropertiesProvider

java.lang.Object
  extended by com.sourceforge.jpatterns.core.configuration.PropertiesProvider

public class PropertiesProvider
extends Object

This class would store the properties per the key. The values are defined at the properties file of the JPatterns.
The storage would be the Map, the initialization of the properties would be performed at this class (method #init).
Please remember that the priority has custom properties files (PropertiesManagerImpl.m_customBundle), and then the default bundle is asked to provide the property: (PropertiesManagerImpl.m_defaultBundle).
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] think over the moving this functionality to the common utility/framework.
Also important feature in the behaviour of this class is: it won't store the keys/values which define the implementations of the interfaces/abstract classes. It is done in the following way. We would check the values of the properties trying to instantiate the appropriate classes instances. If it is done succesfully - we would exclude such values. $Author:: zmicer $
$Rev:: 67 $
* $Date:: 2007-08-28 21:37:07 #$
$Date:: 2007-08-28 21:37:07 #$


Nested Class Summary
static interface PropertiesProvider.JPProperties
          This interface stores the keys for necessary and important for the JPatterns properties.
static class PropertiesProvider.OverridingDepths
          This enum defines the depths we could use for the defining the overriding types.
 
Field Summary
static org.apache.log4j.Logger LOG
          Logger instance.
 
Method Summary
protected  void checkIfInitialized()
          Check if the PropertiesProvider was iinitialized.
 Boolean getBooleanProperty(String key)
           
static PropertiesProvider getInstance(IPropertiesManager manager, boolean reloadAnyWay)
          Get instance of the PropertiesProvider.
 String getStringProperty(String key)
           
protected  void init(IPropertiesManager manager)
          Init method - initializes the provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.log4j.Logger LOG
Logger instance.

Method Detail

init

protected void init(IPropertiesManager manager)
Init method - initializes the provided. todo [zmicer]: think over the adjustment here!!! we should initialize the objects just to check they are working

Parameters:
manager - the manager, entry point to the properties values. Can not be null (otherwise IllegalArgumentException would appear).

getInstance

public static PropertiesProvider getInstance(IPropertiesManager manager,
                                             boolean reloadAnyWay)
Get instance of the PropertiesProvider. todo: [zmicer] seems to be not the best way (because IPropertiesProvider is passed.)

Parameters:
manager - is necessary for the initializing properties values (if they are initialized already - it is just skipped.) Can not be null (otherwise IllegalArgumentException would appear).
reloadAnyWay - says to reload the properties anyway. It could be used at the unit tests. In the normal life - it should be set to false;
Returns:
the PropertiesProvider instance.

getBooleanProperty

public Boolean getBooleanProperty(String key)
Parameters:
key - The key to retrieve the appropriate value. Can not be null (otherwise IllegalArgumentException would appear). Please use the values of JPProperties (surely having the boolean sense).
Returns:
the boolean property.

getStringProperty

public String getStringProperty(String key)
Parameters:
key - The key to retrieve the appropriate value. Can not be null (otherwise IllegalArgumentException would appear). Please use the values of JPProperties (surely having the boolean sense).
Returns:
the String property.

checkIfInitialized

protected void checkIfInitialized()
Check if the PropertiesProvider was iinitialized.



Copyright © 2007 jzmicer.team. All Rights Reserved.