Class EnvUtil


  • public class EnvUtil
    extends Object
    • 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.
      • applyKettleProperties

        public static void applyKettleProperties​(Map<?,​?> kettleProperties)
      • applyKettleProperties

        public static void applyKettleProperties​(Map<?,​?> kettleProperties,
                                                 boolean override)
      • addInternalVariables

        public static void addInternalVariables​(Properties prop)
        Add a number of internal variables to the Kettle Variables at the root.
        Parameters:
        prop -
      • 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.
      • clearSystemProperty

        public static final String clearSystemProperty​(String key)
        Parameters:
        key - The key, the name of the environment variable to clear
        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.
      • createTimeZone

        public static TimeZone createTimeZone​(String timeZoneId)
      • getTimeZones

        public static String[] getTimeZones()
      • getLocaleList

        public static String[] getLocaleList()