Class DefaultProcessingEnvironment

  • Direct Known Subclasses:
    OpenVmsProcessingEnvironment

    public class DefaultProcessingEnvironment
    extends java.lang.Object
    Helper class to determine the environment variable for the OS. Depending on the JDK the environment variables can be either retrieved directly from the JVM or requires starting a process to get them running an OS command line.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.String,​java.lang.String> procEnvironment
      The environment variables of the process
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private java.util.Map<java.lang.String,​java.lang.String> createEnvironmentMap()
      Creates a map that obeys the casing rules of the current platform for key lookup.
      protected java.util.Map<java.lang.String,​java.lang.String> createProcEnvironment()
      Creates the list of environment variables for this process.
      protected CommandLine getProcEnvCommand()
      Deprecated.
      No longer needed.
      java.util.Map<java.lang.String,​java.lang.String> getProcEnvironment()
      Gets the list of environment variables for this process.
      protected java.io.BufferedReader runProcEnvCommand()
      Deprecated.
      No longer needed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • procEnvironment

        protected java.util.Map<java.lang.String,​java.lang.String> procEnvironment
        The environment variables of the process
    • Constructor Detail

      • DefaultProcessingEnvironment

        public DefaultProcessingEnvironment()
        Constructs a new instance.
    • Method Detail

      • createEnvironmentMap

        private java.util.Map<java.lang.String,​java.lang.String> createEnvironmentMap()
        Creates a map that obeys the casing rules of the current platform for key lookup. E.g. on a Windows platform, the map keys will be case-insensitive.
        Returns:
        The map for storage of environment variables, never null.
      • createProcEnvironment

        protected java.util.Map<java.lang.String,​java.lang.String> createProcEnvironment()
                                                                                        throws java.io.IOException
        Creates the list of environment variables for this process.
        Returns:
        a map containing the environment variables.
        Throws:
        java.io.IOException - the operation failed.
      • getProcEnvCommand

        @Deprecated
        protected CommandLine getProcEnvCommand()
        Deprecated.
        No longer needed.
        Determine the OS specific command line to get a list of environment variables.
        Returns:
        the command line.
      • getProcEnvironment

        public java.util.Map<java.lang.String,​java.lang.String> getProcEnvironment()
                                                                                  throws java.io.IOException
        Gets the list of environment variables for this process.
        Returns:
        a map containing the environment variables.
        Throws:
        java.io.IOException - obtaining the environment variables failed.
      • runProcEnvCommand

        @Deprecated
        protected java.io.BufferedReader runProcEnvCommand()
                                                    throws java.io.IOException
        Deprecated.
        No longer needed.
        Runs a process to list the environment variables.
        Returns:
        a reader containing the output of the process.
        Throws:
        java.io.IOException - starting the process failed.