org.jconfig
Class VariableManager

java.lang.Object
  extended byorg.jconfig.VariableManager

public class VariableManager
extends java.lang.Object

This class manages all variables for all log configurations. Every handler or formatter can use this class to replace any variables that are used inside of the parameters. Please refer to the specific handler or formatter to see which parameters support the use of variables.

Author:
Andreas Mecky, Terry Dye

Method Summary
 void addIncludedVariable(java.lang.String varName, java.lang.String varValue, java.lang.String configName)
           
 void addVariable(java.lang.String varName, java.lang.String varValue, java.lang.String configName)
          This method adds a variable for a given configuration.
static VariableManager getInstance()
          This method will return an instance of the VariableManager
 java.lang.String getVariable(java.lang.String configName, java.lang.String name)
          Returns the variable's value.
 java.util.HashMap getVariables(java.lang.String configName)
          Returns a Map of the variables associated to the given Configuration.
 void removeVariable(java.lang.String varName, java.lang.String configName)
          This method removes a variable for a given configuration.
protected  java.lang.String replaceEnvVar(java.lang.String text)
           
protected  java.lang.String replaceSystemVar(java.lang.String text)
           
 java.lang.String replaceVariables(java.lang.String text, java.lang.String configName)
          This method will replace all variables inside one String that are in this configuration.
 void setInheritance(java.lang.String configName, java.lang.String baseConfig)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static VariableManager getInstance()
This method will return an instance of the VariableManager

Returns:
the one and only instance of the VariableManager

getVariables

public java.util.HashMap getVariables(java.lang.String configName)
Returns a Map of the variables associated to the given Configuration.

Parameters:
configName -
Returns:

getVariable

public java.lang.String getVariable(java.lang.String configName,
                                    java.lang.String name)
Returns the variable's value.

Parameters:
configName -
name -
Returns:

setInheritance

public void setInheritance(java.lang.String configName,
                           java.lang.String baseConfig)

addVariable

public void addVariable(java.lang.String varName,
                        java.lang.String varValue,
                        java.lang.String configName)
This method adds a variable for a given configuration.

Parameters:
varName - name of the variable
varValue - the value for this variable
configName - the configuration to which this variable belongs

removeVariable

public void removeVariable(java.lang.String varName,
                           java.lang.String configName)
This method removes a variable for a given configuration.

Parameters:
varName - name of the variable
configName - the configuration to which this variable belongs

addIncludedVariable

public void addIncludedVariable(java.lang.String varName,
                                java.lang.String varValue,
                                java.lang.String configName)
Parameters:
varName -
varValue -
configName -

replaceVariables

public java.lang.String replaceVariables(java.lang.String text,
                                         java.lang.String configName)
This method will replace all variables inside one String that are in this configuration. A variable is used as ${name}. This occurance will be replaced with the specific value or will be left as is if the variable name is not found in the specific configuration.

Parameters:
text - the line of text which contains variables
configName - the name of the configuration
Returns:
a String where all variables are replaced with their values

replaceEnvVar

protected java.lang.String replaceEnvVar(java.lang.String text)

replaceSystemVar

protected java.lang.String replaceSystemVar(java.lang.String text)


Copyright © 2001-2005 Andreas Mecky, Terry Dye. All Rights Reserved.