org.kuali.spring.util
Class PropertiesLoader

java.lang.Object
  extended by org.kuali.spring.util.PropertiesLoader

public class PropertiesLoader
extends Object


Field Summary
static String DEFAULT_ENVIRONMENT_PROPERTY_PREFIX
           
static boolean DEFAULT_IS_IGNORE_RESOURCE_NOT_FOUND
           
static boolean DEFAULT_IS_LOCAL_OVERRIDE
           
static boolean DEFAULT_IS_SEARCH_SYSTEM_ENVIRONMENT
           
static boolean DEFAULT_IS_USE_ENVIRONMENT_PROPERTY_PREFIX
           
static SystemPropertiesMode DEFAULT_SYSTEM_PROPERTIES_MODE
           
(package private)  Properties environmentProperties
           
(package private)  String environmentPropertyPrefix
           
(package private)  String fileEncoding
           
(package private)  boolean ignoreResourceNotFound
           
(package private)  boolean localOverride
           
(package private)  Properties[] localProperties
           
(package private)  org.springframework.core.io.Resource[] locations
           
private static org.slf4j.Logger logger
           
(package private)  Properties mergedLocalProperties
           
(package private)  PropertyLogger plogger
           
(package private)  Properties properties
           
(package private)  org.springframework.util.PropertiesPersister propertiesPersister
           
(package private)  Properties resourceProperties
           
(package private)  boolean searchSystemEnvironment
           
(package private)  Properties systemProperties
           
(package private)  SystemPropertiesMode systemPropertiesMode
           
(package private)  boolean useEnvironmentPropertyPrefix
           
 
Constructor Summary
PropertiesLoader()
           
 
Method Summary
 Properties getEnvironmentProperties()
           
protected  Properties getEnvironmentProperties(String prefix)
          Get a handle to our environment properties.
 String getEnvironmentPropertyPrefix()
           
 String getFileEncoding()
           
 Properties[] getLocalProperties()
           
 org.springframework.core.io.Resource[] getLocations()
           
 org.slf4j.Logger getLogger()
           
 Properties getMergedLocalProperties()
           
 PropertyLogger getPlogger()
           
 Properties getProperties()
           
protected  Properties getProperties(org.springframework.core.io.Resource location, InputStream is)
          Given a resource and an InputStream, load and return a Properties object.
 org.springframework.util.PropertiesPersister getPropertiesPersister()
           
 Properties getResourceProperties()
           
 Properties getSystemProperties()
           
 SystemPropertiesMode getSystemPropertiesMode()
           
protected  Properties handleResourceNotFound(org.springframework.core.io.Resource location)
          Throw an exception unless ignoreResourceNotFound is true
 boolean isIgnoreResourceNotFound()
           
 boolean isLocalOverride()
           
 boolean isSearchSystemEnvironment()
           
 boolean isUseEnvironmentPropertyPrefix()
           
protected  boolean isXMLFile(org.springframework.core.io.Resource location)
          True if this location represents an XML file, false otherwise
protected  Properties loadEnvironmentProperties()
          Get properties from the environment
 Properties loadProperties()
          Fill in a Properties object
protected  Properties loadProperties(org.springframework.core.io.Resource location)
          Load properties from a Resource object.
 Properties loadResourceProperties()
           
protected  Properties loadSystemProperties()
          Get system properties
protected  void logResult(PropertyMergeResult result)
           
protected  Properties mergeLocalProperties()
          Merge the Properties[] into a single Properties object
 void mergeProperties(PropertiesMergeContext context)
           
 Properties mergeProperties(Properties local, Properties resource, Properties sys, Properties env)
          Merge local, resource, system, and environment properties into a single Properties object.
 PropertyMergeResult mergeProperty(PropertiesMergeContext context, String key)
          Merge a property under 'key' from newProps into currentProps using the settings from PropertiesMergeContext
protected  void nullSafeClose(InputStream is)
          Close the InputStream
 void setEnvironmentProperties(Properties environmentProperties)
           
 void setEnvironmentPropertyPrefix(String environmentPropertyPrefix)
           
 void setFileEncoding(String fileEncoding)
           
 void setIgnoreResourceNotFound(boolean ignoreResourceNotFound)
           
 void setLocalOverride(boolean localOverride)
           
 void setLocalProperties(Properties[] localProperties)
           
 void setLocations(org.springframework.core.io.Resource[] locations)
           
 void setMergedLocalProperties(Properties mergedLocalProperties)
           
 void setPlogger(PropertyLogger propertiesLogger)
           
 void setProperties(Properties properties)
           
 void setPropertiesPersister(org.springframework.util.PropertiesPersister propertiesPersister)
           
 void setResourceProperties(Properties resourceProperties)
           
 void setSearchSystemEnvironment(boolean searchSystemEnvironment)
           
 void setSystemProperties(Properties systemProperties)
           
 void setSystemPropertiesMode(SystemPropertiesMode systemPropertiesMode)
           
 void setUseEnvironmentPropertyPrefix(boolean useEnvironmentPropertyPrefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.slf4j.Logger logger

DEFAULT_ENVIRONMENT_PROPERTY_PREFIX

public static final String DEFAULT_ENVIRONMENT_PROPERTY_PREFIX
See Also:
Constant Field Values

DEFAULT_IS_USE_ENVIRONMENT_PROPERTY_PREFIX

public static final boolean DEFAULT_IS_USE_ENVIRONMENT_PROPERTY_PREFIX
See Also:
Constant Field Values

DEFAULT_IS_LOCAL_OVERRIDE

public static final boolean DEFAULT_IS_LOCAL_OVERRIDE
See Also:
Constant Field Values

DEFAULT_IS_IGNORE_RESOURCE_NOT_FOUND

public static final boolean DEFAULT_IS_IGNORE_RESOURCE_NOT_FOUND
See Also:
Constant Field Values

DEFAULT_IS_SEARCH_SYSTEM_ENVIRONMENT

public static final boolean DEFAULT_IS_SEARCH_SYSTEM_ENVIRONMENT
See Also:
Constant Field Values

DEFAULT_SYSTEM_PROPERTIES_MODE

public static final SystemPropertiesMode DEFAULT_SYSTEM_PROPERTIES_MODE

environmentPropertyPrefix

String environmentPropertyPrefix

useEnvironmentPropertyPrefix

boolean useEnvironmentPropertyPrefix

systemPropertiesMode

SystemPropertiesMode systemPropertiesMode

localOverride

boolean localOverride

ignoreResourceNotFound

boolean ignoreResourceNotFound

searchSystemEnvironment

boolean searchSystemEnvironment

fileEncoding

String fileEncoding

localProperties

Properties[] localProperties

locations

org.springframework.core.io.Resource[] locations

propertiesPersister

org.springframework.util.PropertiesPersister propertiesPersister

plogger

PropertyLogger plogger

systemProperties

Properties systemProperties

environmentProperties

Properties environmentProperties

resourceProperties

Properties resourceProperties

mergedLocalProperties

Properties mergedLocalProperties

properties

Properties properties
Constructor Detail

PropertiesLoader

public PropertiesLoader()
Method Detail

getEnvironmentProperties

protected Properties getEnvironmentProperties(String prefix)
Get a handle to our environment properties. Prefix is optional


getProperties

protected Properties getProperties(org.springframework.core.io.Resource location,
                                   InputStream is)
                            throws IOException
Given a resource and an InputStream, load and return a Properties object. Supports regular as well as XML style properties files

Parameters:
location -
is -
Returns:
Throws:
IOException

loadProperties

protected Properties loadProperties(org.springframework.core.io.Resource location)
                             throws IOException
Load properties from a Resource object. Returns an empty Properties object if ignoreResourceNotFound is true and the resource could not be located

Parameters:
location -
Returns:
Throws:
IOException

isXMLFile

protected boolean isXMLFile(org.springframework.core.io.Resource location)
True if this location represents an XML file, false otherwise

Parameters:
location -
Returns:

handleResourceNotFound

protected Properties handleResourceNotFound(org.springframework.core.io.Resource location)
Throw an exception unless ignoreResourceNotFound is true

Parameters:
location -
Returns:

nullSafeClose

protected void nullSafeClose(InputStream is)
                      throws IOException
Close the InputStream

Parameters:
is -
Throws:
IOException

mergeLocalProperties

protected Properties mergeLocalProperties()
Merge the Properties[] into a single Properties object


loadEnvironmentProperties

protected Properties loadEnvironmentProperties()
Get properties from the environment


loadSystemProperties

protected Properties loadSystemProperties()
Get system properties


mergeProperties

public Properties mergeProperties(Properties local,
                                  Properties resource,
                                  Properties sys,
                                  Properties env)
Merge local, resource, system, and environment properties into a single Properties object. User supplied settings control which property "wins" if a property is defined in multiple areas


loadProperties

public Properties loadProperties()
Fill in a Properties object


mergeProperty

public PropertyMergeResult mergeProperty(PropertiesMergeContext context,
                                         String key)
Merge a property under 'key' from newProps into currentProps using the settings from PropertiesMergeContext

Parameters:
context -
key -

mergeProperties

public void mergeProperties(PropertiesMergeContext context)

logResult

protected void logResult(PropertyMergeResult result)

loadResourceProperties

public Properties loadResourceProperties()
                                  throws IOException
Throws:
IOException

isIgnoreResourceNotFound

public boolean isIgnoreResourceNotFound()

getFileEncoding

public String getFileEncoding()

getLocalProperties

public Properties[] getLocalProperties()

setLocalProperties

public void setLocalProperties(Properties[] localProperties)

getLocations

public org.springframework.core.io.Resource[] getLocations()

isLocalOverride

public boolean isLocalOverride()

getPropertiesPersister

public org.springframework.util.PropertiesPersister getPropertiesPersister()

getEnvironmentPropertyPrefix

public String getEnvironmentPropertyPrefix()

setEnvironmentPropertyPrefix

public void setEnvironmentPropertyPrefix(String environmentPropertyPrefix)

getLogger

public org.slf4j.Logger getLogger()

setPropertiesPersister

public void setPropertiesPersister(org.springframework.util.PropertiesPersister propertiesPersister)

setLocations

public void setLocations(org.springframework.core.io.Resource[] locations)

setLocalOverride

public void setLocalOverride(boolean localOverride)

setIgnoreResourceNotFound

public void setIgnoreResourceNotFound(boolean ignoreResourceNotFound)

setFileEncoding

public void setFileEncoding(String fileEncoding)

getSystemPropertiesMode

public SystemPropertiesMode getSystemPropertiesMode()

setSystemPropertiesMode

public void setSystemPropertiesMode(SystemPropertiesMode systemPropertiesMode)

isSearchSystemEnvironment

public boolean isSearchSystemEnvironment()

setSearchSystemEnvironment

public void setSearchSystemEnvironment(boolean searchSystemEnvironment)

setResourceProperties

public void setResourceProperties(Properties resourceProperties)

setSystemProperties

public void setSystemProperties(Properties systemProperties)

setEnvironmentProperties

public void setEnvironmentProperties(Properties environmentProperties)

setMergedLocalProperties

public void setMergedLocalProperties(Properties mergedLocalProperties)

isUseEnvironmentPropertyPrefix

public boolean isUseEnvironmentPropertyPrefix()

setUseEnvironmentPropertyPrefix

public void setUseEnvironmentPropertyPrefix(boolean useEnvironmentPropertyPrefix)

getPlogger

public PropertyLogger getPlogger()

setPlogger

public void setPlogger(PropertyLogger propertiesLogger)

getProperties

public Properties getProperties()

setProperties

public void setProperties(Properties properties)

getSystemProperties

public Properties getSystemProperties()

getEnvironmentProperties

public Properties getEnvironmentProperties()

getResourceProperties

public Properties getResourceProperties()

getMergedLocalProperties

public Properties getMergedLocalProperties()


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.