public abstract class ConfigPropertiesCascadeBase extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
ConfigPropertiesCascadeBase.ConfigFile |
protected static class |
ConfigPropertiesCascadeBase.ConfigFileType
config file type
|
Constructor and Description |
---|
ConfigPropertiesCascadeBase() |
Modifier and Type | Method and Description |
---|---|
boolean |
assertPropertyValueBoolean(String key,
boolean required)
make sure a value is boolean in properties
|
boolean |
assertPropertyValueClass(String key,
Class<?> classType,
boolean required)
make sure a property is a class of a certain type
|
boolean |
assertPropertyValueRequired(String key)
make sure a value exists in properties
|
abstract void |
clearCachedCalculatedValues()
if there are things that are calculated, clear them out (e.g.
|
boolean |
containsKey(String key)
if the key is there, whether or not the value is blank
|
protected boolean |
filesNeedReloadingBasedOnContents() |
protected Class<?> |
getClassInSiblingJar()
if its ok to put the config file in the same directory as a jar,
then return a class in the jar here
|
protected abstract String |
getHierarchyConfigKey()
config key of the hierarchy value
|
protected abstract String |
getMainConfigClasspath()
get the main config classpath, e.g.
|
protected abstract String |
getMainExampleConfigClasspath()
get the example config classpath, e.g.
|
protected abstract String |
getSecondsToCheckConfigKey()
config key of the time in seconds to check config.
|
protected Integer |
getTimeToCheckConfigSeconds()
when we build the config object, get the time to check config in seconds
|
protected static void |
logDebug(String logMessage)
make sure LOG is there, after things are initialized
|
protected static void |
logError(String logMessage,
Throwable t)
make sure LOG is there, after things are initialized
|
protected static void |
logInfo(String logMessage,
Throwable t)
make sure LOG is there, after things are initialized
|
protected boolean |
needToCheckIfFilesNeedReloading() |
Properties |
properties()
get the properties object for this config file
|
protected static Properties |
propertiesFromResourceName(String resourceName,
boolean exceptionIfNotExist)
read properties from a resource, dont modify the properties returned since they are cached
|
protected Properties |
propertiesHelper(boolean setValues)
get the properties object for this config file
|
Map<String,String> |
propertiesMap(Pattern pattern)
find all keys/values with a certain pattern in a properties file.
|
Map<String,String> |
propertiesOverrideMap()
override map for properties for testing
|
Map<String,String> |
propertiesThreadLocalOverrideMap()
override map for properties in thread local to be used in a web server or the like, based on property class
this is static since the properties class can get reloaded, but these shouldnt
|
Set<String> |
propertyNames() |
Boolean |
propertyValueBoolean(String key)
get a boolean and validate from grouper.client.properties or null if not there
|
boolean |
propertyValueBoolean(String key,
boolean defaultValue)
get a boolean and validate from grouper.client.properties
|
protected Boolean |
propertyValueBoolean(String key,
Boolean defaultValue,
boolean required)
get a boolean and validate from the config file
|
boolean |
propertyValueBooleanRequired(String key)
get a boolean and validate from grouper.client.properties
|
Integer |
propertyValueInt(String key)
get a boolean and validate from grouper.client.properties
|
int |
propertyValueInt(String key,
int defaultValue)
get a boolean and validate from grouper.client.properties
|
protected Integer |
propertyValueInt(String key,
Integer defaultValue,
boolean required)
get an int and validate from the config file
|
int |
propertyValueIntRequired(String key)
get a boolean and validate from grouper.client.properties
|
String |
propertyValueString(String key)
get the property value as a string or null if not there
|
String |
propertyValueString(String key,
String defaultValue)
get the property value as a string
|
protected edu.internet2.middleware.grouperActivemq.config.ConfigPropertiesCascadeBase.PropertyValueResult |
propertyValueString(String key,
String defaultValue,
boolean required)
get the property value as a string
|
protected edu.internet2.middleware.grouperActivemq.config.ConfigPropertiesCascadeBase.PropertyValueResult |
propertyValueStringHelper(String key,
String defaultValue,
boolean required)
get the property value as a string
|
String |
propertyValueStringRequired(String key)
get the property value as a string
|
protected static <T extends ConfigPropertiesCascadeBase> |
retrieveConfig(Class<T> configClass)
retrieve a config from the config file or from cache
|
protected ConfigPropertiesCascadeBase |
retrieveFromConfigFileOrCache()
see if there is one in cache, if so, use it, if not, get from config files
|
protected ConfigPropertiesCascadeBase |
retrieveFromConfigFiles()
get the config object from config files
|
protected static String |
substituteCommonVars(String string)
substitute common vars like $space$ and $newline$
|
protected static <T extends ConfigPropertiesCascadeBase> T retrieveConfig(Class<T> configClass)
T
- class which is the return type of config classconfigClass
- protected Class<?> getClassInSiblingJar()
protected abstract String getSecondsToCheckConfigKey()
public abstract void clearCachedCalculatedValues()
public Map<String,String> propertiesThreadLocalOverrideMap()
public Map<String,String> propertiesOverrideMap()
public Properties properties()
protected Properties propertiesHelper(boolean setValues)
setValues
- if we should set the values for the properties.
if not, the values might not be correct, but this will be more performant
depending on how many EL properties there arepublic String propertyValueStringRequired(String key)
key
- public String propertyValueString(String key, String defaultValue)
key
- defaultValue
- public String propertyValueString(String key)
key
- protected edu.internet2.middleware.grouperActivemq.config.ConfigPropertiesCascadeBase.PropertyValueResult propertyValueString(String key, String defaultValue, boolean required)
key
- defaultValue
- required
- true if required, if doesnt exist, throw exceptionprotected edu.internet2.middleware.grouperActivemq.config.ConfigPropertiesCascadeBase.PropertyValueResult propertyValueStringHelper(String key, String defaultValue, boolean required)
key
- defaultValue
- required
- true if required, if doesnt exist, throw exceptionprotected static String substituteCommonVars(String string)
string
- protected Integer getTimeToCheckConfigSeconds()
protected ConfigPropertiesCascadeBase retrieveFromConfigFiles()
protected static void logDebug(String logMessage)
logMessage
- protected static void logInfo(String logMessage, Throwable t)
logMessage
- t
- protected static void logError(String logMessage, Throwable t)
logMessage
- t
- protected ConfigPropertiesCascadeBase retrieveFromConfigFileOrCache()
protected boolean needToCheckIfFilesNeedReloading()
protected boolean filesNeedReloadingBasedOnContents()
protected abstract String getMainConfigClasspath()
protected abstract String getHierarchyConfigKey()
protected abstract String getMainExampleConfigClasspath()
public boolean propertyValueBoolean(String key, boolean defaultValue)
key
- defaultValue
- public boolean containsKey(String key)
key
- public Boolean propertyValueBoolean(String key)
key
- protected Boolean propertyValueBoolean(String key, Boolean defaultValue, boolean required)
key
- defaultValue
- required
- protected Integer propertyValueInt(String key, Integer defaultValue, boolean required)
key
- defaultValue
- required
- public boolean propertyValueBooleanRequired(String key)
key
- public int propertyValueIntRequired(String key)
key
- public int propertyValueInt(String key, int defaultValue)
key
- defaultValue
- public Integer propertyValueInt(String key)
key
- protected static Properties propertiesFromResourceName(String resourceName, boolean exceptionIfNotExist)
resourceName
- exceptionIfNotExist
- public boolean assertPropertyValueRequired(String key)
key
- public boolean assertPropertyValueBoolean(String key, boolean required)
key
- required
- public boolean assertPropertyValueClass(String key, Class<?> classType, boolean required)
key
- classType
- required
- Copyright © 2016 Internet2. All rights reserved.