org.pentaho.di.core.util
Class EnvUtil

java.lang.Object
  extended by org.pentaho.di.core.util.EnvUtil

public class EnvUtil
extends Object


Constructor Summary
EnvUtil()
           
 
Method Summary
static void addInternalVariables(Properties prop)
          Add a number of internal variables to the Kettle Variables at the root.
static Locale createLocale(String localeCode)
          Returns an available java.util.Locale object for the given localeCode.
static void environmentInit()
          Adds the kettle properties the the global system properties.
static String[] getEnvironmentVariablesForRuntimeExec()
           
static String getSystemProperty(String key)
           
static String getSystemProperty(String key, String def)
          This method is written especially for weird JVM's like
static String getSystemPropertyStripQuotes(String key, String def)
          This method is written especially for weird JVM's like IBM's on AIX and OS/400.
static Properties readProperties(String fileName)
          Returns the properties from the users kettle home directory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvUtil

public EnvUtil()
Method Detail

readProperties

public static Properties readProperties(String fileName)
                                 throws KettleException
Returns the properties from the users kettle home directory.

Parameters:
fileName - the relative name of the properties file in the users kettle directory.
Returns:
the map of properties.
Throws:
KettleException

environmentInit

public static void environmentInit()
                            throws KettleException
Adds the kettle properties the the global system properties.

Throws:
KettleException - in case the properties file can't be read.

addInternalVariables

public static void addInternalVariables(Properties prop)
Add a number of internal variables to the Kettle Variables at the root.

Parameters:
variables -

getEnvironmentVariablesForRuntimeExec

public static final String[] getEnvironmentVariablesForRuntimeExec()
Returns:
an array of strings, made up of all the environment variables available in the VM, format var=value. To be used for Runtime.exec(cmd, envp)

getSystemPropertyStripQuotes

public static final String getSystemPropertyStripQuotes(String key,
                                                        String def)
This method is written especially for weird JVM's like IBM's on AIX and OS/400. On these platforms, we notice that environment variables have an extra double quote around it... This is messing up the ability to specify things.

Parameters:
key - The key, the name of the environment variable to return
def - The default value to return in case the key can't be found
Returns:
The value of a System environment variable in the java virtual machine. If the key is not present, the variable is not defined and the default value is returned.

getSystemProperty

public static final String getSystemProperty(String key,
                                             String def)
This method is written especially for weird JVM's like

Parameters:
key - The key, the name of the environment variable to return
def - The default value to return in case the key can't be found
Returns:
The value of a System environment variable in the java virtual machine. If the key is not present, the variable is not defined and the default value is returned.

getSystemProperty

public static final String getSystemProperty(String key)
Parameters:
key - The key, the name of the environment variable to return
Returns:
The value of a System environment variable in the java virtual machine. If the key is not present, the variable is not defined and null returned.

createLocale

public static Locale createLocale(String localeCode)
Returns an available java.util.Locale object for the given localeCode. The localeCode code can be case insensitive, if it is available the method will find it and return it.

Parameters:
localeCode -
Returns:
java.util.Locale.