public abstract class ConfigPropertiesCascadeBase extends Object
Modifier and Type | Class and Description |
---|---|
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
|
static void |
assignInitted()
assign that things are initted, so database config is ok to use and errors should be thrown
|
static void |
clearCache() |
abstract void |
clearCachedCalculatedValues()
if there are things that are calculated, clear them out (e.g.
|
static void |
clearCacheThisOnly() |
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.
|
String |
getMainConfigFileName() |
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
|
boolean |
hasExpressionLanguage(String propertyName) |
protected Properties |
internalProperties()
help subclasses manipulate properties.
|
List<ConfigPropertiesCascadeBase.ConfigFile> |
internalRetrieveConfigFiles()
get the underlying properties for the config ui
|
static boolean |
isInDatabase()
is in database
|
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 static Properties |
propertiesFromResourceName(String resourceName,
boolean exceptionIfNotExist,
Class<?> classInSiblingJar)
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.grouperClient.config.ConfigPropertiesCascadeBase.PropertyValueResult |
propertyValueString(String key,
String defaultValue,
boolean required)
get the property value as a string
|
protected edu.internet2.middleware.grouperClient.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
|
String |
rawExpressionLanguage(String propertyName) |
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
|
ConfigPropertiesCascadeBase |
retrieveFromConfigFiles(boolean includeBaseConfig)
get the config object from config files.
|
protected static String |
substituteCommonVars(String string)
substitute common vars like $space$ and $newline$
|
protected void |
substituteLocalReferences(Properties result)
you can refer to other properties with $$propertyName$$
|
protected String |
substituteLocalReferencesOneField(Object thePropertiesOrConfigPropertiesCascadeBase,
String value) |
protected String |
substituteLocalReferencesOneSubstitution(Object thePropertiesOrConfigPropertiesCascadeBase,
String value) |
public static void assignInitted()
protected Properties internalProperties()
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 static void clearCache()
public static void clearCacheThisOnly()
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 areprotected void substituteLocalReferences(Properties result)
result
- public String propertyValueStringRequired(String key)
key
- public String propertyValueString(String key, String defaultValue)
key
- defaultValue
- public String propertyValueString(String key)
key
- protected edu.internet2.middleware.grouperClient.config.ConfigPropertiesCascadeBase.PropertyValueResult propertyValueString(String key, String defaultValue, boolean required)
key
- defaultValue
- required
- true if required, if doesnt exist, throw exceptionprotected edu.internet2.middleware.grouperClient.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()
public static boolean isInDatabase()
protected ConfigPropertiesCascadeBase retrieveFromConfigFiles()
public ConfigPropertiesCascadeBase retrieveFromConfigFiles(boolean includeBaseConfig)
includeBaseConfig
- true if we include base configpublic List<ConfigPropertiesCascadeBase.ConfigFile> internalRetrieveConfigFiles()
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()
public String getMainConfigFileName()
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
- protected static Properties propertiesFromResourceName(String resourceName, boolean exceptionIfNotExist, Class<?> classInSiblingJar)
resourceName
- exceptionIfNotExist
- classInSiblingJar
- if also looking for config next to a jarpublic 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
- public Map<String,String> propertiesMap(Pattern pattern)
pattern
- protected String substituteLocalReferencesOneField(Object thePropertiesOrConfigPropertiesCascadeBase, String value)
thePropertiesOrConfigPropertiesCascadeBase
- to get data fromvalue
- protected String substituteLocalReferencesOneSubstitution(Object thePropertiesOrConfigPropertiesCascadeBase, String value)
thePropertiesOrConfigPropertiesCascadeBase
- to get data from. either Properties or ConfigPropertiesCascadeBAsevalue
- public boolean hasExpressionLanguage(String propertyName)
Copyright © 2016 Internet2. All rights reserved.