|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.util.RTConfig
public class RTConfig
Provides static support for hierarchical runtime properties
Nested Class Summary | |
---|---|
static interface |
RTConfig.PropertyGetter
PropertyGetter interface |
static interface |
RTConfig.PropertySetter
PropertySetter interface |
Constructor Summary | |
---|---|
RTConfig()
|
Method Summary | |
---|---|
protected static java.net.URL |
_getConfigURL()
Searches for, and returns the URL of the runtime configuration file |
static java.lang.String |
_getString(java.lang.String[] key,
java.lang.String dft,
boolean dftOK)
Gets a String value for one of the specified keys |
static java.lang.String |
_getString(java.lang.String key,
java.lang.String dft,
boolean dftOK)
Gets the String value for the specified key |
static java.lang.String |
_insertKeyValues(java.lang.Object mainKey,
java.lang.String text)
Replaces ${key} variable references in the specified text
with values from the runtime properties. |
protected static boolean |
_isWebApp_1()
|
protected static boolean |
_isWebApp_2()
|
static void |
_setServletContextProperties(RTProperties props)
Sets the Servlet context properties. |
protected static void |
_startupInit(boolean allowChangeSystemProperties)
Runtime config initialization |
static void |
clearServletContextProperties(java.lang.Object servlet)
Clears the runtime Servlet context properties This is intended to be called when the Servlet context is destroyed |
static java.lang.String |
findPropertiesForKey(java.lang.String key)
Returns the name of the RTProperties location for the specified key |
static java.lang.String |
findPropertiesForKey(java.lang.String[] key)
Returns the name of the RTProperties location for the specified key |
static java.math.BigInteger |
getBigInteger(java.lang.String key)
Gets a BigInteger property at the specified key |
static java.math.BigInteger |
getBigInteger(java.lang.String[] key,
java.math.BigInteger dft)
Gets a BigInteger property at the specified key |
static java.math.BigInteger |
getBigInteger(java.lang.String[] key,
java.math.BigInteger dft,
boolean dftOK)
Gets a BigInteger property at the specified key |
static java.math.BigInteger |
getBigInteger(java.lang.String key,
java.math.BigInteger dft)
Gets a BigInteger property at the specified key |
static java.math.BigInteger |
getBigInteger(java.lang.String key,
java.math.BigInteger dft,
boolean dftOK)
Gets a BigInteger property at the specified key |
static boolean |
getBoolean(java.lang.String key)
Gets a boolean property at the specified key |
static boolean |
getBoolean(java.lang.String[] key,
boolean dft)
Gets a boolean property at the specified key |
static boolean |
getBoolean(java.lang.String[] key,
boolean dft,
boolean dftOK)
Gets a boolean property at the specified key |
static boolean |
getBoolean(java.lang.String key,
boolean dft)
Gets a boolean property at the specified key |
static boolean |
getBoolean(java.lang.String key,
boolean dft,
boolean dftOK)
Gets a boolean property at the specified key |
static java.lang.Class |
getClass(java.lang.String key)
Gets a Class property at the specified key |
static java.lang.Class |
getClass(java.lang.String[] key,
java.lang.Class dft)
Gets a Class property from a specified array of keys |
static java.lang.Class |
getClass(java.lang.String[] key,
java.lang.Class dft,
boolean dftOK)
Gets a Class property from a specified array of keys |
static java.lang.Class |
getClass(java.lang.String key,
java.lang.Class dft)
Gets a Class property at the specified key |
static java.lang.Class |
getClass(java.lang.String key,
java.lang.Class dft,
boolean dftOK)
Gets a Class property from a specified array of keys |
static java.net.URL |
getClassResourceURL(java.lang.Class C)
Gets the resource location of the specified class |
static RTProperties |
getCommandLineProperties()
Gets the command line properties RTProperties instance |
static RTProperties |
getConfigFileProperties()
Gets the RTProperties instance from the config file |
static java.lang.String |
getConfigPropertiesIndexName(int ndx)
Gets the configuration properties index name assocaited with the specified index |
protected static java.net.URL |
getConfigURL()
Returns the config file URL |
static java.lang.String |
getContextName()
Gets the RTKey.CONTEXT_NAME property value. Typically this returns the name of the parent package directory (ie. |
static java.lang.String |
getContextName(java.lang.String dftName)
Gets the RTKey.CONTEXT_NAME property value. Typically this returns the name of the parent package directory (ie. |
static java.lang.String |
getContextPath()
Gets the RTKey.CONTEXT_PATH property value. |
static java.lang.String |
getContextPath(java.lang.String dftPath)
Gets the RTKey.CONTEXT_PATH property value. |
static double |
getDouble(java.lang.String key)
Gets a double property at the specified key |
static double |
getDouble(java.lang.String[] key,
double dft)
Gets a dobule property at the specified key |
static double |
getDouble(java.lang.String[] key,
double dft,
boolean dftOK)
Gets a dobule property at the specified key |
static double |
getDouble(java.lang.String key,
double dft)
Gets a double property at the specified key |
static double |
getDouble(java.lang.String key,
double dft,
boolean dftOK)
Gets a double property at the specified key |
static double[] |
getDoubleArray(java.lang.String key)
Gets a double array property at the specified key |
static double[] |
getDoubleArray(java.lang.String[] key,
double[] dft)
Gets a double array property from a specified array of keys |
static double[] |
getDoubleArray(java.lang.String[] key,
double[] dft,
boolean dftOK)
Gets a double array property from a specified array of keys |
static double[] |
getDoubleArray(java.lang.String key,
double[] dft)
Gets a double array property from a specified array of keys |
static double[] |
getDoubleArray(java.lang.String key,
double[] dft,
boolean dftOK)
Gets a double array property from a specified array of keys |
static boolean |
getEnvironmentVariablesEnabled()
Gets if system environment variables should be loaded |
static java.io.File |
getFile(java.lang.String key)
Gets a File property at the specified key |
static java.io.File |
getFile(java.lang.String[] key,
java.io.File dft)
Gets a File property from a specified array of keys |
static java.io.File |
getFile(java.lang.String[] key,
java.io.File dft,
boolean dftOK)
Gets a File property from a specified array of keys |
static java.io.File |
getFile(java.lang.String key,
java.io.File dft)
Gets a File property at the specified key |
static java.io.File |
getFile(java.lang.String key,
java.io.File dft,
boolean dftOK)
Gets a File property from a specified array of keys |
static float |
getFloat(java.lang.String key)
Gets a float property at the specified key |
static float |
getFloat(java.lang.String[] key,
float dft)
Gets a float property at the specified key |
static float |
getFloat(java.lang.String[] key,
float dft,
boolean dftOK)
Gets a float property at the specified key |
static float |
getFloat(java.lang.String key,
float dft)
Gets a float property at the specified key |
static float |
getFloat(java.lang.String key,
float dft,
boolean dftOK)
Gets a float property at the specified key |
static java.lang.String |
getHostName()
Lookup and return the local host name |
static int |
getInt(java.lang.String key)
Gets a int property at the specified key |
static int |
getInt(java.lang.String[] key,
int dft)
Gets a int property at the specified key |
static int |
getInt(java.lang.String[] key,
int dft,
boolean dftOK)
Gets a int property at the specified key |
static int |
getInt(java.lang.String key,
int dft)
Gets a int property at the specified key |
static int |
getInt(java.lang.String key,
int dft,
boolean dftOK)
Gets a int property at the specified key |
static int[] |
getIntArray(java.lang.String key)
Gets a int array property at the specified key |
static int[] |
getIntArray(java.lang.String[] key,
int[] dft)
Gets a int array property from a specified array of keys |
static int[] |
getIntArray(java.lang.String[] key,
int[] dft,
boolean dftOK)
Gets a int array property from a specified array of keys |
static int[] |
getIntArray(java.lang.String key,
int[] dft)
Gets a int array property from a specified array of keys |
static int[] |
getIntArray(java.lang.String key,
int[] dft,
boolean dftOK)
Gets a int array property from a specified array of keys |
static java.io.File |
getLoadedConfigDir()
Returns the File instance of the loaded config file directory, or null if the runtime config was not loaded from a file. |
static java.io.File |
getLoadedConfigFile()
Returns the File instance of the loaded config file, or null if the runtime config was not loaded from a file. |
static java.net.URL |
getLoadedConfigURL()
Returns the URL of the loaded config file |
static long |
getLong(java.lang.String key)
Gets a long property at the specified key |
static long |
getLong(java.lang.String[] key,
long dft)
Gets a long property at the specified key |
static long |
getLong(java.lang.String[] key,
long dft,
boolean dftOK)
Gets a long property at the specified key |
static long |
getLong(java.lang.String key,
long dft)
Gets a long property at the specified key |
static long |
getLong(java.lang.String key,
long dft,
boolean dftOK)
Gets a long property at the specified key |
static long[] |
getLongArray(java.lang.String key)
Gets a long array property at the specified key |
static long[] |
getLongArray(java.lang.String[] key,
long[] dft)
Gets a long array property from a specified array of keys |
static long[] |
getLongArray(java.lang.String[] key,
long[] dft,
boolean dftOK)
Gets a long array property from a specified array of keys |
static long[] |
getLongArray(java.lang.String key,
long[] dft)
Gets a long array property from a specified array of keys |
static long[] |
getLongArray(java.lang.String key,
long[] dft,
boolean dftOK)
Gets a long array property from a specified array of keys |
static java.lang.Class<?> |
getMainClass()
Gets the main entry point class |
static RTProperties |
getProperties(java.lang.String startsWith,
boolean inclDft)
Returns a new RTProeprties instance populated with all keys starting with the specified value |
static RTProperties |
getPropertiesForKey(java.lang.String[] key,
boolean dftOk)
Returns the RTProperties instance in which the key is defined |
static RTProperties |
getPropertiesForKey(java.lang.String key,
boolean dftOk)
Returns the RTProperties for the specified key |
static java.lang.Object |
getProperty(java.lang.String key)
Gets the property value of a key |
static java.lang.Object |
getProperty(java.lang.String[] key)
Gets the property value of a key |
static java.lang.Object |
getProperty(java.lang.String[] key,
java.lang.Object dft)
Gets the property value of a key |
static java.lang.Object |
getProperty(java.lang.String[] key,
java.lang.Object dft,
boolean dftOk)
Gets the property value of a key |
static java.lang.Object |
getProperty(java.lang.String key,
java.lang.Object dft)
Gets the property value of a key |
static java.lang.Object |
getProperty(java.lang.String key,
java.lang.Object dft,
boolean dftOk)
Gets the property value of a key |
static RTConfig.PropertyGetter |
getPropertyGetter()
Returns a PropertyGetter for RTConfig |
static java.util.Set<java.lang.String> |
getPropertyKeys(java.lang.String startsWith)
Returns a set of property keys which start with the specified String |
static java.util.Set<java.lang.String> |
getPropertyKeys(java.lang.String startsWith,
boolean inclDft)
Returns a set of property keys which start with the specified String. |
static RTConfig.PropertySetter |
getPropertySetter()
Returns a PropertySetter for RTConfig |
static RTProperties |
getRuntimeConstantProperties()
Gets the runtime constant properties RTProperties instance |
static java.lang.Class<?> |
getServletClass()
Gets the servelet class if this application is running as a servelet |
static java.lang.String |
getServletClassName()
Returns the Servlet class name |
static java.io.File |
getServletContextPath()
Returns the Servlet context path. |
static RTProperties |
getServletContextProperties()
Gets the serverlet context properties RTProperties instance |
static java.lang.String |
getString(java.lang.String key)
Gets a String value for one of the specified keys |
static java.lang.String |
getString(java.lang.String[] key)
Gets a String value for one of the specified keys |
static java.lang.String |
getString(java.lang.String[] key,
java.lang.String dft)
Gets a String value for one of the specified keys |
static java.lang.String |
getString(java.lang.String[] key,
java.lang.String dft,
boolean dftOK)
Gets a String value for one of the specified keys |
static java.lang.String |
getString(java.lang.String key,
java.lang.String dft)
Gets the String value for the specified key |
static java.lang.String |
getString(java.lang.String key,
java.lang.String dft,
boolean dftOK)
Gets the String value for the specified key |
static java.lang.String[] |
getStringArray(java.lang.String key)
Gets a string array property at the specified key |
static java.lang.String[] |
getStringArray(java.lang.String[] key,
java.lang.String[] dft)
Gets a string array property from a specified array of keys |
static java.lang.String[] |
getStringArray(java.lang.String[] key,
java.lang.String[] dft,
boolean dftOK)
Gets a string array property from a specified array of keys |
static java.lang.String[] |
getStringArray(java.lang.String key,
java.lang.String[] dft)
Gets a string array property from a specified array of keys |
static java.lang.String[] |
getStringArray(java.lang.String key,
java.lang.String[] dft,
boolean dftOK)
Gets a string array property from a specified array of keys |
static RTProperties |
getSystemProperties()
Gets the RTProperties instance representing the system
properties. |
static RTProperties |
getTemporaryProperties(java.lang.String key)
Returns the temporary RTProperties instance that contains
the specified key |
static int |
getTemporaryPropertiesStackSize()
Gets the temporary RTProperties stack size (for current
thread) |
static RTProperties |
getThreadProperties()
Gets the thread local RTProperties instance |
static boolean |
hasContextName()
Returns true if the RTKey.CONTEXT_NAME property is defined and non-blank |
static boolean |
hasContextPath()
Returns true if the RTKey.CONTEXT_PATH property is defined and non-blank |
static boolean |
hasProperty(java.lang.String key)
Returns true if there is a value associated with the specified key. |
static boolean |
hasProperty(java.lang.String[] key)
Returns true if any of the keys in the specified string array have a value associated with them. |
static boolean |
hasProperty(java.lang.String[] key,
boolean dftOk)
Returns true if any of the keys in the specified string array have a value associated with them. |
static boolean |
hasProperty(java.lang.String key,
boolean dftOk)
Returns true if there is a value associated with the specified key. |
static java.lang.String |
insertKeyValues(java.lang.String text)
Replaces ${key} variable references in the specified text
with values from the runtime properties. |
static java.lang.String |
insertKeyValues(java.lang.String text,
java.util.Map<java.lang.String,java.lang.String> customMap)
Replaces ${key} variable references in the specified text
with values from the runtime properties. |
static java.lang.String |
insertKeyValues(java.lang.String text,
java.lang.String startDelim,
java.lang.String endDelim,
java.lang.String dftDelim)
Replaces key variable references in the specified text with values from the runtime properties. |
static java.lang.String |
insertKeyValues(java.lang.String text,
java.lang.String startDelim,
java.lang.String endDelim,
java.lang.String dftDelim,
java.util.Map<java.lang.String,java.lang.String> customMap)
Replaces key variable references in the specified text with values from the runtime properties. |
static boolean |
isAdminMode()
Returns true if running in administrative mode |
static boolean |
isCommandLine()
Returns true if the command-line properties have been defined |
static boolean |
isDebugMode()
Returns true if debug mode is enabled |
static boolean |
isInitialized()
Returns true if the Runtime config has been initialized |
static boolean |
isInitializing()
Returns true if the Runtime config is in the process of being initialized |
static boolean |
isTestMode()
Returns true if test mode is enabled |
static boolean |
isTrueServlet()
Returns true if the current context is likely a servlet |
static boolean |
isWebApp()
Returns true if this instance is running as a webapp |
static void |
main(java.lang.String[] argv)
Command-line entry point (testing/debugging purposes) |
static void |
popAllTemporaryProperties()
Clears the temporary RTProperties stack for the
current thread |
static void |
popTemporaryProperties(RTProperties props)
Pops the last temporary RTProperties instance for the
current thread |
static void |
printAllProperties(boolean merge)
|
static void |
printTemporaryProperties(java.lang.String msg)
Prints the temporary RTProperties instances to stdout |
static void |
pushTemporaryProperties(RTProperties props)
Pushes the RTProperties instance onto a temporary stack
for the current thread |
static void |
reload()
Reloads all runtime config properties |
static void |
setAdminMode(boolean admin)
Sets the administrative mode |
static void |
setBigInteger(java.lang.String key,
java.math.BigInteger value)
Sets the property value for the specified key |
static void |
setBoolean(java.lang.String key,
boolean value)
Sets the boolean property value for the specified key |
static void |
setClass(java.lang.String key,
java.lang.Class value)
Sets the Class property value for the specified key |
static void |
setCommandLineArgs(RTProperties cmdLineProps)
Sets the command line properties and initializes RTConfig
if it hasn't been. |
static void |
setCommandLineArgs(RTProperties cmdLineProps,
boolean testMode)
Sets the command line properties and initializes RTConfig
if it hasn't been. |
static int |
setCommandLineArgs(java.lang.String[] argv)
Sets the command line properties and initializes RTConfig
if it hasn't been. |
static int |
setCommandLineArgs(java.lang.String[] argv,
boolean testMode)
Sets the command line properties and initializes RTConfig
if it hasn't been. |
static int |
setCommandLineArgs(java.lang.String[] argv,
java.lang.String[] keyAttr)
Sets the command line properties and initializes RTConfig
if it hasn't been. |
static void |
setContextName(java.lang.String name)
Sets the RTKey.CONTEXT_NAME property Typically this is set to the name of the parent package directory (ie. |
static void |
setContextPath(java.lang.String path)
Sets the RTKey.CONTEXT_PATH property value. |
static void |
setDebugMode(boolean debug)
Sets if debug mode is enabled or not |
static void |
setDouble(java.lang.String key,
double value)
Sets the property value for the specified key |
static void |
setDoubleArray(java.lang.String key,
double[] val)
Sets the long array property value for the specified key |
static void |
setEnvironmentVariablesEnabled(boolean enable)
Sets if system environment variables will be loaded on next initialization/reload |
static void |
setFile(java.lang.String key,
java.io.File value)
Sets the File property value for the specified key |
static void |
setFloat(java.lang.String key,
float value)
Sets the property value for the specified key |
static void |
setInt(java.lang.String key,
int value)
Sets the property value for the specified key |
static void |
setIntArray(java.lang.String key,
int[] val)
Sets the int array property value for the specified key |
static void |
setLong(java.lang.String key,
long value)
Sets the property value for the specified key |
static void |
setLongArray(java.lang.String key,
long[] val)
Sets the long array property value for the specified key |
static void |
setProperties(java.util.Properties props)
Adds the properties in the specified Properties to the config
file properties |
static void |
setProperties(RTProperties rtprops)
Adds the properties in the specified RTProperties to the config
file properties |
static void |
setProperty(java.lang.String key,
java.lang.Object value)
Sets the value for the specified key |
static void |
setQuiet(boolean q)
Set Quiet |
static void |
setServletContextProperties(java.util.Map<java.lang.Object,java.lang.Object> props)
Sets the runtime mode to 'WebApp' and initializes the Servlet context properties. |
static void |
setString(java.lang.String key,
java.lang.String value)
Sets the property value for the specified key |
static void |
setStringArray(java.lang.String key,
java.lang.String[] val)
Sets the string array property value for the specified key |
static void |
setTestMode(boolean test)
Sets if test mode is enabled |
static void |
setVerbose(boolean v)
Set Verbose |
static void |
setWebApp(boolean webapp)
Sets if this instance is running as a webapp |
static java.lang.String[] |
validateCommandLineArgs(java.lang.Object argv)
Validates the command line arguments in RTConfig against
a single string or array of strings listing valid arguments |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RTConfig()
Method Detail |
---|
public static RTConfig.PropertySetter getPropertySetter()
public static RTConfig.PropertyGetter getPropertyGetter()
public static void setEnvironmentVariablesEnabled(boolean enable)
enable
- True if environment variables should be loadedpublic static boolean getEnvironmentVariablesEnabled()
public static void setVerbose(boolean v)
public static void setQuiet(boolean q)
public static java.lang.String getHostName()
public static java.lang.String getConfigPropertiesIndexName(int ndx)
ndx
- The configuration properties index name
public static void printTemporaryProperties(java.lang.String msg)
RTProperties
instances to stdout
msg
- Displayed message headerpublic static RTProperties getTemporaryProperties(java.lang.String key)
RTProperties
instance that contains
the specified key
RTProperties
instance that contains
the specified keypublic static void pushTemporaryProperties(RTProperties props)
RTProperties
instance onto a temporary stack
for the current thread
props
- The RTProperties
instancepublic static void popTemporaryProperties(RTProperties props)
RTProperties
instance for the
current thread
props
- The RTProperties
instance that is the
expected entry on the top of the stackpublic static void popAllTemporaryProperties()
RTProperties
stack for the
current thread
public static int getTemporaryPropertiesStackSize()
RTProperties
stack size (for current
thread)
RTProperties
stack sizepublic static RTProperties getThreadProperties()
RTProperties
instance
RTProperties
public static RTProperties getRuntimeConstantProperties()
RTProperties
instance
public static RTProperties getServletContextProperties()
RTProperties
instance
public static RTProperties getCommandLineProperties()
RTProperties
instance
public static RTProperties getConfigFileProperties()
RTProperties
instance from the config file
public static RTProperties getSystemProperties()
RTProperties
instance representing the system
properties. Values obtained from System.getProperties()
RTProperties
instance representing the system
properties.System.getProperties()
public static boolean isCommandLine()
public static boolean isTrueServlet()
public static RTProperties getPropertiesForKey(java.lang.String key, boolean dftOk)
key
- The keydftOk
- True to check defaults, if not found elsewhere
public static RTProperties getPropertiesForKey(java.lang.String[] key, boolean dftOk)
key
- The key arraydftOk
- True to check defaults, if not found elsewhere
public static java.lang.String findPropertiesForKey(java.lang.String key)
key
- The key
public static java.lang.String findPropertiesForKey(java.lang.String[] key)
key
- The key
public static int setCommandLineArgs(java.lang.String[] argv)
RTConfig
if it hasn't been. Initialization is held off untill this method is
called so 'configFile'
can be overridden on the command line.
- Parameters:
argv
- The command line arguments
public static int setCommandLineArgs(java.lang.String[] argv, java.lang.String[] keyAttr)
RTConfig
if it hasn't been. Initialization is held off untill this method is
called so 'configFile'
can be overridden on the command line.
- Parameters:
argv
- The command line argumentskeyAttr
- A list of expected keys and attributes. See
RTProperties.validateKeyAttributes(java.lang.String[], boolean)
- Throws:
java.lang.RuntimeException
- If invalid arguments are specified
public static void setCommandLineArgs(RTProperties cmdLineProps)
RTConfig
if it hasn't been. Initialization is held off untill this method is
called so 'configFile'
can be overridden on the command line.
- Parameters:
cmdLineProps
- The command line properties
public static int setCommandLineArgs(java.lang.String[] argv, boolean testMode)
RTConfig
if it hasn't been. Initialization is held off untill this method is
called so 'configFile'
can be overridden on the command line.
- Parameters:
argv
- The command line argumentstestMode
- does nothing, ignored? [CHECK] [ASK]
- Returns:
- The next command-line argument, or '-1' if there are no additional
command-line arguments. See
RTProperties.getNextCommandLineArgumentIndex()
public static void setCommandLineArgs(RTProperties cmdLineProps, boolean testMode)
RTConfig
if it hasn't been. Initialization is held off untill this method is
called so 'configFile'
can be overridden on the command line.
- Parameters:
cmdLineProps
- The command line propertiestestMode
- does nothing, ignored? [CHECK] [ASK]
public static java.lang.String[] validateCommandLineArgs(java.lang.Object argv)
RTConfig
against
a single string or array of strings listing valid arguments
argv
- A single or array of valid arguments
public static void _setServletContextProperties(RTProperties props)
props
- A map containing the Servlet context propertiespublic static void setServletContextProperties(java.util.Map<java.lang.Object,java.lang.Object> props)
props
- A map containing the Servlet context propertiespublic static void clearServletContextProperties(java.lang.Object servlet)
servlet
- The servlet instance (not currently used)public static boolean isInitializing()
public static boolean isInitialized()
public static java.net.URL getLoadedConfigURL()
public static java.io.File getLoadedConfigFile()
public static java.io.File getLoadedConfigDir()
protected static java.net.URL getConfigURL()
protected static java.net.URL _getConfigURL() throws java.net.MalformedURLException
java.net.MalformedURLException
public static void reload()
protected static void _startupInit(boolean allowChangeSystemProperties)
allowChangeSystemProperties
- True to allow System properties update, false for read-onlypublic static java.net.URL getClassResourceURL(java.lang.Class C)
C
- The class
public static void printAllProperties(boolean merge)
public static java.lang.String insertKeyValues(java.lang.String text)
${key}
variable references in the specified text
with values from the runtime properties. Default key delimiters will be
used.
text
- The target String
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])
public static java.lang.String insertKeyValues(java.lang.String text, java.util.Map<java.lang.String,java.lang.String> customMap)
${key}
variable references in the specified text
with values from the runtime properties. Default key delimiters will
be used
text
- The target StringcustomMap
- A custom map to try to get the key value from before
checking RTConfig
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])
public static java.lang.String insertKeyValues(java.lang.String text, java.lang.String startDelim, java.lang.String endDelim, java.lang.String dftDelim)
text
- The target StringstartDelim
- The pattern used to determine the start of a key variableendDelim
- The pattern used to determine the end of a key variabledftDelim
- The pattern used to delimit a default value for the key
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])
public static java.lang.String insertKeyValues(java.lang.String text, java.lang.String startDelim, java.lang.String endDelim, java.lang.String dftDelim, java.util.Map<java.lang.String,java.lang.String> customMap)
text
- The target StringstartDelim
- The pattern used to determine the start of a key variableendDelim
- The pattern used to determine the end of a key variabledftDelim
- The pattern used to delimit a default value for the keycustomMap
- A custom map to try to get the key value from before
checking RTConfig
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])
public static java.lang.String _insertKeyValues(java.lang.Object mainKey, java.lang.String text)
${key}
variable references in the specified text
with values from the runtime properties. Default key delimiters will be
used.
mainKey
- The main keytext
- The target String
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])
public static java.util.Set<java.lang.String> getPropertyKeys(java.lang.String startsWith)
startsWith
- Searth string
public static java.util.Set<java.lang.String> getPropertyKeys(java.lang.String startsWith, boolean inclDft)
startsWith
- Searth stringinclDft
- True to include default keys
public static RTProperties getProperties(java.lang.String startsWith, boolean inclDft)
startsWith
- Searth stringinclDft
- True to include default keys
public static boolean hasProperty(java.lang.String key)
key
- The key
public static boolean hasProperty(java.lang.String key, boolean dftOk)
key
- The keydftOk
- True if default values count
public static boolean hasProperty(java.lang.String[] key)
key
- The key
public static boolean hasProperty(java.lang.String[] key, boolean dftOk)
key
- The keydftOk
- True if default values count
public static java.lang.Object getProperty(java.lang.String key)
key
- The key to get the property value of
RTProperties.getProperty(java.lang.Object, java.lang.Object)
public static java.lang.Object getProperty(java.lang.String[] key)
key
- The key list to get the property value of
RTProperties.getProperty(java.lang.Object, java.lang.Object)
public static java.lang.Object getProperty(java.lang.String key, java.lang.Object dft)
key
- The key to get the property value ofdft
- The default value to return if none found
RTProperties.getProperty(java.lang.Object, java.lang.Object)
public static java.lang.Object getProperty(java.lang.String[] key, java.lang.Object dft)
key
- The key list to get the property value ofdft
- The default value to return if none found
RTProperties.getProperty(java.lang.Object, java.lang.Object)
public static java.lang.Object getProperty(java.lang.String key, java.lang.Object dft, boolean dftOk)
key
- The key to get the property value ofdft
- The default value to return if none founddftOk
- True to check defaults, if not found elsewhere
RTProperties.getProperty(java.lang.Object, java.lang.Object)
public static java.lang.Object getProperty(java.lang.String[] key, java.lang.Object dft, boolean dftOk)
key
- The key list to get the property value ofdft
- The default value to return if none founddftOk
- True to check defaults, if not found elsewhere
RTProperties.getProperty(java.lang.Object, java.lang.Object)
public static void setProperty(java.lang.String key, java.lang.Object value)
key
- The property keyvalue
- The value to associate with the specified keypublic static void setProperties(java.util.Properties props)
Properties
to the config
file properties
props
- The Properties instance from which properties will be loadedpublic static void setProperties(RTProperties rtprops)
RTProperties
to the config
file properties
rtprops
- The RTProperties instance from which properties will be loadedpublic static java.lang.String _getString(java.lang.String key, java.lang.String dft, boolean dftOK)
key
- The property keydft
- The default value return if the key is not founddftOK
- True to check defaults, if not found elsewhere
public static java.lang.String _getString(java.lang.String[] key, java.lang.String dft, boolean dftOK)
key
- The property keysdft
- The default value return if the key is not founddftOK
- True to check defaults, if not found elsewhere
public static java.lang.String getString(java.lang.String key)
key
- The property key
public static java.lang.String getString(java.lang.String[] key)
key
- The property keys
public static java.lang.String getString(java.lang.String key, java.lang.String dft)
key
- The property keydft
- The default value return if the key is not found
public static java.lang.String getString(java.lang.String key, java.lang.String dft, boolean dftOK)
key
- The property keydft
- The default value return if the key is not founddftOK
- True to check defaults, if not found elsewhere
public static java.lang.String getString(java.lang.String[] key, java.lang.String dft)
key
- The property keysdft
- The default value return if the key is not found
public static java.lang.String getString(java.lang.String[] key, java.lang.String dft, boolean dftOK)
key
- The property keysdft
- The default value return if the key is not founddftOK
- True to check defaults, if not found elsewhere
public static void setString(java.lang.String key, java.lang.String value)
key
- The property keyvalue
- The property value to set.public static java.lang.String[] getStringArray(java.lang.String key)
key
- The key of the property
StringTools.parseArray(String s, char arrayDelim)
public static java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] dft)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
StringTools.parseArray(String s, char arrayDelim)
public static java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] dft, boolean dftOK)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
StringTools.parseArray(String s, char arrayDelim)
public static java.lang.String[] getStringArray(java.lang.String[] key, java.lang.String[] dft)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
StringTools.parseArray(String s, char arrayDelim)
public static java.lang.String[] getStringArray(java.lang.String[] key, java.lang.String[] dft, boolean dftOK)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
StringTools.parseArray(String s, char arrayDelim)
public static void setStringArray(java.lang.String key, java.lang.String[] val)
key
- The property keyval
- The property value to set.public static java.lang.Class getClass(java.lang.String key)
Class
property at the specified key
key
- The key of the property
Class
value of the propertypublic static java.lang.Class getClass(java.lang.String key, java.lang.Class dft)
Class
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
Class
value of the propertypublic static java.lang.Class getClass(java.lang.String key, java.lang.Class dft, boolean dftOK)
Class
property from a specified array of keys
key
- A property key.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
Class
value of the propertypublic static java.lang.Class getClass(java.lang.String[] key, java.lang.Class dft)
Class
property from a specified array of keys
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
Class
value of the propertypublic static java.lang.Class getClass(java.lang.String[] key, java.lang.Class dft, boolean dftOK)
Class
property from a specified array of keys
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
Class
value of the propertypublic static void setClass(java.lang.String key, java.lang.Class value)
Class property value for the specified key
- Parameters:
key
- The property keyvalue
- The property value to set.
public static java.io.File getFile(java.lang.String key)
File
property at the specified key
key
- The key of the property
File
value of the propertypublic static java.io.File getFile(java.lang.String key, java.io.File dft)
File
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
File
value of the propertypublic static java.io.File getFile(java.lang.String key, java.io.File dft, boolean dftOK)
File
property from a specified array of keys
key
- A property key.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
File
value of the propertypublic static java.io.File getFile(java.lang.String[] key, java.io.File dft)
File
property from a specified array of keys
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
File
value of the propertypublic static java.io.File getFile(java.lang.String[] key, java.io.File dft, boolean dftOK)
File
property from a specified array of keys
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
File
value of the propertypublic static void setFile(java.lang.String key, java.io.File value)
File property value for the specified key
- Parameters:
key
- The property keyvalue
- The property value to set.
public static double getDouble(java.lang.String key)
double
property at the specified key
key
- The key of the property
double
value of the propertypublic static double getDouble(java.lang.String key, double dft)
double
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
double
value of the propertypublic static double getDouble(java.lang.String key, double dft, boolean dftOK)
double
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
double
value of the propertypublic static double getDouble(java.lang.String[] key, double dft)
dobule
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
double
value of the propertypublic static double getDouble(java.lang.String[] key, double dft, boolean dftOK)
dobule
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
double
value of the propertypublic static void setDouble(java.lang.String key, double value)
key
- The property keyvalue
- The property value to set.public static float getFloat(java.lang.String key)
float
property at the specified key
key
- The key of the property
float
value of the propertypublic static float getFloat(java.lang.String key, float dft)
float
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
float
value of the propertypublic static float getFloat(java.lang.String key, float dft, boolean dftOK)
float
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
float
value of the propertypublic static float getFloat(java.lang.String[] key, float dft)
float
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
float
value of the propertypublic static float getFloat(java.lang.String[] key, float dft, boolean dftOK)
float
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
float
value of the propertypublic static void setFloat(java.lang.String key, float value)
key
- The property keyvalue
- The property value to set.public static java.math.BigInteger getBigInteger(java.lang.String key)
BigInteger
property at the specified key
key
- The key of the property
BigInteger
value of the propertypublic static java.math.BigInteger getBigInteger(java.lang.String key, java.math.BigInteger dft)
BigInteger
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
BigInteger
value of the propertypublic static java.math.BigInteger getBigInteger(java.lang.String key, java.math.BigInteger dft, boolean dftOK)
BigInteger
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
BigInteger
value of the propertypublic static java.math.BigInteger getBigInteger(java.lang.String[] key, java.math.BigInteger dft)
BigInteger
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
BigInteger
value of the propertypublic static java.math.BigInteger getBigInteger(java.lang.String[] key, java.math.BigInteger dft, boolean dftOK)
BigInteger
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
BigInteger
value of the propertypublic static void setBigInteger(java.lang.String key, java.math.BigInteger value)
key
- The property keyvalue
- The property value to set.public static long getLong(java.lang.String key)
long
property at the specified key
key
- The key of the property
long
value of the propertypublic static long getLong(java.lang.String key, long dft)
long
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
long
value of the propertypublic static long getLong(java.lang.String key, long dft, boolean dftOK)
long
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
long
value of the propertypublic static long getLong(java.lang.String[] key, long dft)
long
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
long
value of the propertypublic static long getLong(java.lang.String[] key, long dft, boolean dftOK)
long
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
long
value of the propertypublic static void setLong(java.lang.String key, long value)
key
- The property keyvalue
- The property value to set.public static int getInt(java.lang.String key)
int
property at the specified key
key
- The key of the property
int
value of the propertypublic static int getInt(java.lang.String key, int dft)
int
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
int
value of the propertypublic static int getInt(java.lang.String key, int dft, boolean dftOK)
int
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
int
value of the propertypublic static int getInt(java.lang.String[] key, int dft)
int
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
int
value of the propertypublic static int getInt(java.lang.String[] key, int dft, boolean dftOK)
int
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
int
value of the propertypublic static void setInt(java.lang.String key, int value)
key
- The property keyvalue
- The property value to set.public static int[] getIntArray(java.lang.String key)
key
- The key of the property
StringTools.parseArray(String s, char arrayDelim)
public static int[] getIntArray(java.lang.String key, int[] dft)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
StringTools.parseArray(String s, char arrayDelim)
public static int[] getIntArray(java.lang.String key, int[] dft, boolean dftOK)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
StringTools.parseArray(String s, char arrayDelim)
public static int[] getIntArray(java.lang.String[] key, int[] dft)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
StringTools.parseArray(String s, char arrayDelim)
public static int[] getIntArray(java.lang.String[] key, int[] dft, boolean dftOK)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
public static void setIntArray(java.lang.String key, int[] val)
key
- The property keyval
- The property value to set.public static long[] getLongArray(java.lang.String key)
key
- The key of the property
StringTools.parseArray(String s, char arrayDelim)
public static long[] getLongArray(java.lang.String key, long[] dft)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
StringTools.parseArray(String s, char arrayDelim)
public static long[] getLongArray(java.lang.String key, long[] dft, boolean dftOK)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
StringTools.parseArray(String s, char arrayDelim)
public static long[] getLongArray(java.lang.String[] key, long[] dft)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
StringTools.parseArray(String s, char arrayDelim)
public static long[] getLongArray(java.lang.String[] key, long[] dft, boolean dftOK)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
public static void setLongArray(java.lang.String key, long[] val)
key
- The property keyval
- The property value to set.public static double[] getDoubleArray(java.lang.String key)
key
- The key of the property
StringTools.parseArray(String s, char arrayDelim)
public static double[] getDoubleArray(java.lang.String key, double[] dft)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
StringTools.parseArray(String s, char arrayDelim)
public static double[] getDoubleArray(java.lang.String key, double[] dft, boolean dftOK)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
StringTools.parseArray(String s, char arrayDelim)
public static double[] getDoubleArray(java.lang.String[] key, double[] dft)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
StringTools.parseArray(String s, char arrayDelim)
public static double[] getDoubleArray(java.lang.String[] key, double[] dft, boolean dftOK)
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
public static void setDoubleArray(java.lang.String key, double[] val)
key
- The property keyval
- The property value to set.public static boolean getBoolean(java.lang.String key)
boolean
property at the specified key
key
- The key of the property
boolean
value of the propertypublic static boolean getBoolean(java.lang.String key, boolean dft)
boolean
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
boolean
value of the propertypublic static boolean getBoolean(java.lang.String key, boolean dft, boolean dftOK)
boolean
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
boolean
value of the propertypublic static boolean getBoolean(java.lang.String[] key, boolean dft)
boolean
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not found
boolean
value of the propertypublic static boolean getBoolean(java.lang.String[] key, boolean dft, boolean dftOK)
boolean
property at the specified key
key
- An array of property keys. The value of the first matching
key will be returned.dft
- The default value to return if an entry was not founddftOK
- True to check defaults, if not found elsewhere
boolean
value of the propertypublic static void setBoolean(java.lang.String key, boolean value)
boolean
property value for the specified key
key
- The property keyvalue
- The property value to set.public static void setAdminMode(boolean admin)
admin
- True to set administrative modepublic static boolean isAdminMode()
public static void setDebugMode(boolean debug)
debug
- True to enable debug modepublic static boolean isDebugMode()
public static void setTestMode(boolean test)
test
- True to enabled test modepublic static boolean isTestMode()
public static void setContextName(java.lang.String name)
name
- The CONTEXT_NAME value.public static java.lang.String getContextName(java.lang.String dftName)
dftName
- The default path to return if CONTEXT_NAME is undefined/blank
public static java.lang.String getContextName()
public static boolean hasContextName()
public static void setContextPath(java.lang.String path)
path
- The CONTEXT_PATH value.public static java.lang.String getContextPath(java.lang.String dftPath)
dftPath
- The default path to return if CONTEXT_PATH is undefined/blank
public static java.lang.String getContextPath()
public static boolean hasContextPath()
public static java.io.File getServletContextPath()
public static void setWebApp(boolean webapp)
webapp
- True if this instance is running as a webapppublic static boolean isWebApp()
protected static boolean _isWebApp_1()
protected static boolean _isWebApp_2()
public static java.lang.Class<?> getMainClass()
public static java.lang.Class<?> getServletClass()
public static java.lang.String getServletClassName()
public static void main(java.lang.String[] argv)
argv
- The command-line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |