org.mule.util
Class SystemUtils

java.lang.Object
  extended by org.apache.commons.lang.SystemUtils
      extended by org.mule.util.SystemUtils

public class SystemUtils
extends org.apache.commons.lang.SystemUtils


Field Summary
static boolean IS_JAVA_1_7
           
protected static Log logger
           
 
Fields inherited from class org.apache.commons.lang.SystemUtils
AWT_TOOLKIT, FILE_ENCODING, FILE_SEPARATOR, IS_JAVA_1_1, IS_JAVA_1_2, IS_JAVA_1_3, IS_JAVA_1_4, IS_JAVA_1_5, IS_JAVA_1_6, IS_OS_AIX, IS_OS_HP_UX, IS_OS_IRIX, IS_OS_LINUX, IS_OS_MAC, IS_OS_MAC_OSX, IS_OS_OS2, IS_OS_SOLARIS, IS_OS_SUN_OS, IS_OS_UNIX, IS_OS_WINDOWS, IS_OS_WINDOWS_2000, IS_OS_WINDOWS_95, IS_OS_WINDOWS_98, IS_OS_WINDOWS_ME, IS_OS_WINDOWS_NT, IS_OS_WINDOWS_VISTA, IS_OS_WINDOWS_XP, JAVA_AWT_FONTS, JAVA_AWT_GRAPHICSENV, JAVA_AWT_HEADLESS, JAVA_AWT_PRINTERJOB, JAVA_CLASS_PATH, JAVA_CLASS_VERSION, JAVA_COMPILER, JAVA_ENDORSED_DIRS, JAVA_EXT_DIRS, JAVA_HOME, JAVA_IO_TMPDIR, JAVA_LIBRARY_PATH, JAVA_RUNTIME_NAME, JAVA_RUNTIME_VERSION, JAVA_SPECIFICATION_NAME, JAVA_SPECIFICATION_VENDOR, JAVA_SPECIFICATION_VERSION, JAVA_UTIL_PREFS_PREFERENCES_FACTORY, JAVA_VENDOR, JAVA_VENDOR_URL, JAVA_VERSION, JAVA_VERSION_FLOAT, JAVA_VERSION_INT, JAVA_VERSION_TRIMMED, JAVA_VM_INFO, JAVA_VM_NAME, JAVA_VM_SPECIFICATION_NAME, JAVA_VM_SPECIFICATION_VENDOR, JAVA_VM_SPECIFICATION_VERSION, JAVA_VM_VENDOR, JAVA_VM_VERSION, LINE_SEPARATOR, OS_ARCH, OS_NAME, OS_VERSION, PATH_SEPARATOR, USER_COUNTRY, USER_DIR, USER_HOME, USER_LANGUAGE, USER_NAME, USER_TIMEZONE
 
Constructor Summary
SystemUtils()
           
 
Method Summary
static String getCommandLineOption(String option, String[] args, String[][] opts)
          Returns the value corresponding to the given option from the command line, for example if the options are "-config mule-config.xml" getCommandLineOption("config") would return "mule-config.xml"
static Map<String,Object> getCommandLineOptions(String[] args, String[][] opts)
          Returns a Map of all options in the command line.
static Map getenv()
          Get the operating system environment variables.
static String getenv(String name)
           
static boolean hasCommandLineOption(String option, String[] args, String[][] opts)
          Checks whether a command line option is set.
static boolean isAppleJDK()
           
static boolean isIbmJDK()
           
static boolean isSunJDK()
           
static String legalizeFileName(String name)
          Ensure a generated file name is legal.
static Map<String,String> parsePropertyDefinitions(String input)
          Returns a Map of all valid property definitions in -Dkey=value format.
 
Methods inherited from class org.apache.commons.lang.SystemUtils
getJavaHome, getJavaIoTmpDir, getJavaVersion, getUserDir, getUserHome, isJavaAwtHeadless, isJavaVersionAtLeast, isJavaVersionAtLeast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Log logger

IS_JAVA_1_7

public static final boolean IS_JAVA_1_7
Constructor Detail

SystemUtils

public SystemUtils()
Method Detail

getenv

public static Map getenv()
Get the operating system environment variables. This should work for Windows and Linux.

Returns:
Map or an empty map if there was an error.

getenv

public static String getenv(String name)

isSunJDK

public static boolean isSunJDK()

isAppleJDK

public static boolean isAppleJDK()

isIbmJDK

public static boolean isIbmJDK()

getCommandLineOption

public static String getCommandLineOption(String option,
                                          String[] args,
                                          String[][] opts)
                                   throws DefaultMuleException
Returns the value corresponding to the given option from the command line, for example if the options are "-config mule-config.xml" getCommandLineOption("config") would return "mule-config.xml"

Throws:
DefaultMuleException

hasCommandLineOption

public static boolean hasCommandLineOption(String option,
                                           String[] args,
                                           String[][] opts)
                                    throws DefaultMuleException
Checks whether a command line option is set. This is useful for command line options that don't have an argument, like "-cluster", which means that this Mule instance is part of a cluster.

Throws:
DefaultMuleException

getCommandLineOptions

public static Map<String,Object> getCommandLineOptions(String[] args,
                                                       String[][] opts)
                                                throws DefaultMuleException
Returns a Map of all options in the command line. The Map is keyed off the option name. The value will be whatever is present on the command line. Options that don't have an argument will have the String "true".

Throws:
DefaultMuleException

parsePropertyDefinitions

public static Map<String,String> parsePropertyDefinitions(String input)
Returns a Map of all valid property definitions in -Dkey=value format. -Dkey is interpreted as -Dkey=true, everything else is ignored. Whitespace in values is properly handled but needs to be quoted properly: -Dkey="some value".

Parameters:
input - String with property definitionn
Returns:
a Map of property String keys with their defined values (Strings). If no valid key-value pairs can be parsed, the map is empty.

legalizeFileName

public static String legalizeFileName(String name)
Ensure a generated file name is legal.



Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.