public class PropertiesUtility
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static LgMessageDirectorIF |
logger |
static java.lang.String |
propertiesLocationKey |
static java.lang.String |
propertiesParentFolderKey |
static java.lang.String |
systemVariable |
Constructor and Description |
---|
PropertiesUtility() |
Modifier and Type | Method and Description |
---|---|
static java.util.Properties |
loadPropertiesFromClasspath(java.lang.String absolutePath)
Load a properties file from the classpath.
|
static java.util.Properties |
loadPropertiesFromFileOrURL(java.lang.String propertiesFile)
Create a java properties object from a location.
|
static java.util.Properties |
locateAndLoadPropFile(java.lang.String fileName)
Convenience method that combines locatePropFile(fileName) and
loadPropertiesFromFileOrURL(String)
|
static java.util.Properties |
locateAndLoadPropFile(java.lang.String fileName,
java.lang.String classToSearchFor)
Convenience method that combines locatePropFile(fileName,
classToSearchFor) and loadPropertiesFromFileOrURL(String)
|
static java.util.Properties |
locateAndLoadPropFileConfigureLog4J(java.lang.String fileName,
java.lang.String log4JConfigFilePropertyName)
Convenience method that combines locatePropFile(fileName,
classToSearchFor) and loadPropertiesFromFileOrURL(String) and
Log4JUtility.configureLog4JFromPathSpecifiedInProperties
|
static java.util.Properties |
locateAndLoadPropFileConfigureLog4J(java.lang.String fileName,
java.lang.String log4JConfigFilePropertyName,
java.lang.String classToSearchFor)
Convenience method that combines locatePropFile(fileName,
classToSearchFor) and loadPropertiesFromFileOrURL(String) and
Log4JUtility.configureLog4JFromPathSpecifiedInProperties
|
static java.lang.String |
locatePropFile(java.lang.String fileName)
Located the named file on the file system.
|
static java.lang.String |
locatePropFile(java.lang.String fileName,
java.lang.String classToSearchFor)
Located the named file on the file system.
|
static java.lang.String |
locatePropFile(java.lang.String fileName,
java.lang.String classToSearchFor,
LgLoggerIF logger) |
public static java.lang.String propertiesLocationKey
public static java.lang.String propertiesParentFolderKey
public static LgMessageDirectorIF logger
public static java.lang.String systemVariable
public static java.util.Properties loadPropertiesFromFileOrURL(java.lang.String propertiesFile) throws java.io.IOException
propertiesFile
- can be a file path or a url.java.io.IOException
public static java.util.Properties loadPropertiesFromClasspath(java.lang.String absolutePath) throws java.io.IOException
absolutePath
- absolute path to the properties file in the classpath. Should
start with '/'java.io.IOException
public static java.lang.String locatePropFile(java.lang.String fileName)
fileName
- Name of the file to locatepublic static java.lang.String locatePropFile(java.lang.String fileName, java.lang.String classToSearchFor)
fileName
- Name of the file to locateclassToSearchFor
- A class that exists in your classpath to use as a starting
point for the search. The recommended value for most use cases
is "this.getClass().getName()".public static java.lang.String locatePropFile(java.lang.String fileName, java.lang.String classToSearchFor, LgLoggerIF logger)
public static java.util.Properties locateAndLoadPropFile(java.lang.String fileName) throws java.io.IOException
fileName
- java.io.IOException
public static java.util.Properties locateAndLoadPropFile(java.lang.String fileName, java.lang.String classToSearchFor) throws java.io.IOException
fileName
- java.io.IOException
public static java.util.Properties locateAndLoadPropFileConfigureLog4J(java.lang.String fileName, java.lang.String log4JConfigFilePropertyName, java.lang.String classToSearchFor) throws java.lang.Exception
fileName
- java.lang.Exception
public static java.util.Properties locateAndLoadPropFileConfigureLog4J(java.lang.String fileName, java.lang.String log4JConfigFilePropertyName) throws java.lang.Exception
fileName
- java.lang.Exception