com.netflix.config
Class WebApplicationProperties

java.lang.Object
  extended by com.netflix.config.WebApplicationProperties

public class WebApplicationProperties
extends java.lang.Object

This class helps in loading properties present in a typical web appplication. 1. In a series of application properties file (typically under WEB-INF/conf/*) 2. Every library (JAR) located in the web application's classpath i.e. WEB-INF/lib/*.jar, can contain properties in say META-INF/conf/config.properties This class helps load all the properties into the Default Configuration. In case you would like to load these properties into another Configuration instead, you can use getProperties() to obtain the properties and load these into the Configuration of your choice.


Constructor Summary
WebApplicationProperties()
           
 
Method Summary
static java.io.File getAppConfFolder()
           
static java.lang.String getLibraryPropertiesResourceRelativePath()
          Returns the relative Resource Path of the properties files in the JAR files
static java.util.Properties getProperties()
          Returns all the properties presently available
protected static void initApplicationProperties()
           
protected static void initClasspathPropertiesConfiguration()
           
static void initialize()
          Initialize.
static void initialize(java.io.File appConfFolderFromConfig, java.lang.String baseConfigFileName, boolean loadLibraryProperties, java.lang.String propertiesResourceRelativePath)
          Initialize.
static void setAppConfFolder(java.io.File appConfFolderFromConfig, java.lang.String baseConfigFileName)
          The folder where the application's properties files are located.
static void setLibraryPropertiesResourceRelativePath(java.lang.String libraryPropertiesResourceRelativePath)
          Please see ClasspathPropertiesConfiguration on Library Properties.
static void setLoadLibraryProperties(boolean loadLibraryProperties)
          Set this if you would like the ClasspathPropertiesConfiguration to scan the JAR files in the classpath and load those proerties into the default Configuration
static boolean shouldLoadLibraryProperties()
          Should we load the Library Properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebApplicationProperties

public WebApplicationProperties()
Method Detail

initialize

public static void initialize(java.io.File appConfFolderFromConfig,
                              java.lang.String baseConfigFileName,
                              boolean loadLibraryProperties,
                              java.lang.String propertiesResourceRelativePath)
Initialize. The application should call this method once the Application Folder is set using setAppConfFolder(File, String) method.

Parameters:
appConfFolderFromConfig -
baseConfigFileName -
loadLibraryProperties -
propertiesResourceRelativePath -

initialize

public static void initialize()
Initialize. The application should call this method once the Application Folder is set using setAppConfFolder(File, String) method.


initClasspathPropertiesConfiguration

protected static void initClasspathPropertiesConfiguration()

initApplicationProperties

protected static void initApplicationProperties()
                                         throws org.apache.commons.configuration.ConfigurationException,
                                                java.net.MalformedURLException
Throws:
org.apache.commons.configuration.ConfigurationException
java.net.MalformedURLException

getAppConfFolder

public static java.io.File getAppConfFolder()

setAppConfFolder

public static void setAppConfFolder(java.io.File appConfFolderFromConfig,
                                    java.lang.String baseConfigFileName)
The folder where the application's properties files are located.

Parameters:
appConfFolderFromConfig - the folder as a File object where the application's properties files are located
baseConfigFileName - the "base" name of the properties file. For e.g. if you have config.properties, config-test.properties, then the value to pass in is "config"

shouldLoadLibraryProperties

public static boolean shouldLoadLibraryProperties()
Should we load the Library Properties


setLoadLibraryProperties

public static void setLoadLibraryProperties(boolean loadLibraryProperties)
Set this if you would like the ClasspathPropertiesConfiguration to scan the JAR files in the classpath and load those proerties into the default Configuration

Parameters:
loadLibraryProperties -

getLibraryPropertiesResourceRelativePath

public static java.lang.String getLibraryPropertiesResourceRelativePath()
Returns the relative Resource Path of the properties files in the JAR files


setLibraryPropertiesResourceRelativePath

public static void setLibraryPropertiesResourceRelativePath(java.lang.String libraryPropertiesResourceRelativePath)
Please see ClasspathPropertiesConfiguration on Library Properties. This methods sets the relativeResource path

Parameters:
libraryPropertiesResourceRelativePath -

getProperties

public static java.util.Properties getProperties()
Returns all the properties presently available