edu.internet2.middleware.grouperClient.config
Class ConfigPropertiesCascadeBase

java.lang.Object
  extended by edu.internet2.middleware.grouperClient.config.ConfigPropertiesCascadeBase
Direct Known Subclasses:
GrouperClientConfig

public abstract class ConfigPropertiesCascadeBase
extends java.lang.Object

Base class for a cascaded config. Extend this class to have a config based on a certain file.

Author:
mchyzer

Constructor Summary
ConfigPropertiesCascadeBase()
           
 
Method Summary
 boolean assertPropertyValueBoolean(java.lang.String key, boolean required)
          make sure a value is boolean in properties
 boolean assertPropertyValueClass(java.lang.String key, java.lang.Class<?> classType, boolean required)
          make sure a property is a class of a certain type
 boolean assertPropertyValueRequired(java.lang.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(java.lang.String key)
          if the key is there, whether or not the value is blank
 java.util.Properties properties()
          get the properties object for this config file
 java.util.Map<java.lang.String,java.lang.String> propertiesMap(java.util.regex.Pattern pattern)
          find all keys/values with a certain pattern in a properties file.
 java.util.Map<java.lang.String,java.lang.String> propertiesOverrideMap()
          override map for properties for testing
 java.util.Map<java.lang.String,java.lang.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
 java.util.Set<java.lang.String> propertyNames()
           
 java.lang.Boolean propertyValueBoolean(java.lang.String key)
          get a boolean and validate from grouper.client.properties or null if not there
 boolean propertyValueBoolean(java.lang.String key, boolean defaultValue)
          get a boolean and validate from grouper.client.properties
 boolean propertyValueBooleanRequired(java.lang.String key)
          get a boolean and validate from grouper.client.properties
 java.lang.Integer propertyValueInt(java.lang.String key)
          get a boolean and validate from grouper.client.properties
 int propertyValueInt(java.lang.String key, int defaultValue)
          get a boolean and validate from grouper.client.properties
 int propertyValueIntRequired(java.lang.String key)
          get a boolean and validate from grouper.client.properties
 java.lang.String propertyValueString(java.lang.String key)
          get the property value as a string or null if not there
 java.lang.String propertyValueString(java.lang.String key, java.lang.String defaultValue)
          get the property value as a string
 java.lang.String propertyValueStringRequired(java.lang.String key)
          get the property value as a string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigPropertiesCascadeBase

public ConfigPropertiesCascadeBase()
Method Detail

clearCachedCalculatedValues

public abstract void clearCachedCalculatedValues()
if there are things that are calculated, clear them out (e.g. if an override is set)


propertiesThreadLocalOverrideMap

public java.util.Map<java.lang.String,java.lang.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

Returns:
the override map

propertyNames

public java.util.Set<java.lang.String> propertyNames()
Returns:
the set of names

propertiesOverrideMap

public java.util.Map<java.lang.String,java.lang.String> propertiesOverrideMap()
override map for properties for testing

Returns:
the override map

properties

public java.util.Properties properties()
get the properties object for this config file

Returns:
the properties

propertyValueStringRequired

public java.lang.String propertyValueStringRequired(java.lang.String key)
get the property value as a string

Parameters:
key -
Returns:
the property value

propertyValueString

public java.lang.String propertyValueString(java.lang.String key,
                                            java.lang.String defaultValue)
get the property value as a string

Parameters:
key -
defaultValue -
Returns:
the property value

propertyValueString

public java.lang.String propertyValueString(java.lang.String key)
get the property value as a string or null if not there

Parameters:
key -
Returns:
the property value

propertyValueBoolean

public boolean propertyValueBoolean(java.lang.String key,
                                    boolean defaultValue)
get a boolean and validate from grouper.client.properties

Parameters:
key -
defaultValue -
Returns:
the string

containsKey

public boolean containsKey(java.lang.String key)
if the key is there, whether or not the value is blank

Parameters:
key -
Returns:
true or false

propertyValueBoolean

public java.lang.Boolean propertyValueBoolean(java.lang.String key)
get a boolean and validate from grouper.client.properties or null if not there

Parameters:
key -
Returns:
the boolean or null

propertyValueBooleanRequired

public boolean propertyValueBooleanRequired(java.lang.String key)
get a boolean and validate from grouper.client.properties

Parameters:
key -
Returns:
the string

propertyValueIntRequired

public int propertyValueIntRequired(java.lang.String key)
get a boolean and validate from grouper.client.properties

Parameters:
key -
Returns:
the string

propertyValueInt

public int propertyValueInt(java.lang.String key,
                            int defaultValue)
get a boolean and validate from grouper.client.properties

Parameters:
key -
defaultValue -
Returns:
the string

propertyValueInt

public java.lang.Integer propertyValueInt(java.lang.String key)
get a boolean and validate from grouper.client.properties

Parameters:
key -
Returns:
the int or null if there

assertPropertyValueRequired

public boolean assertPropertyValueRequired(java.lang.String key)
make sure a value exists in properties

Parameters:
key -
Returns:
true if ok, false if not

assertPropertyValueBoolean

public boolean assertPropertyValueBoolean(java.lang.String key,
                                          boolean required)
make sure a value is boolean in properties

Parameters:
key -
required -
Returns:
true if ok, false if not

assertPropertyValueClass

public boolean assertPropertyValueClass(java.lang.String key,
                                        java.lang.Class<?> classType,
                                        boolean required)
make sure a property is a class of a certain type

Parameters:
key -
classType -
required -
Returns:
true if ok

propertiesMap

public java.util.Map<java.lang.String,java.lang.String> propertiesMap(java.util.regex.Pattern pattern)
find all keys/values with a certain pattern in a properties file. return the keys. if none, will return the empty set, not null set

Parameters:
pattern -
Returns:
the keys. if none, will return the empty set, not null set