Package org.apache.maven.shared.utils
Class Os
- java.lang.Object
-
- org.apache.maven.shared.utils.Os
-
public class Os extends java.lang.ObjectCondition that tests the OS type.
This class got copied over from Apache ANT. Even the version from plexus-utils was only an ANT fork! The last time it got copied was on 2011-08-12
When merging changes please take care of the special OS_FAMILY handling in this version of Os.java!
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringDARWINOpenJDK is reported to call MacOS X "Darwin"private java.lang.StringfamilyOS family to look forstatic java.lang.StringFAMILY_DOSOS family that can be tested for.static java.lang.StringFAMILY_MACOS family that can be tested for.static java.lang.StringFAMILY_NETWAREOS family that can be tested for.static java.lang.StringFAMILY_NTOS family that can be tested for.static java.lang.StringFAMILY_OPENVMSOS family that can be tested for.static java.lang.StringFAMILY_OS2OS family that can be tested for.static java.lang.StringFAMILY_OS400OS family that can be tested for.static java.lang.StringFAMILY_TANDEMOS family that can be tested for.static java.lang.StringFAMILY_UNIXOS family that can be tested for.static java.lang.StringFAMILY_WIN9XOS family that can be tested for.static java.lang.StringFAMILY_WINDOWSOS family that can be tested for.static java.lang.StringFAMILY_ZOSOS family that can be tested for.static java.lang.StringLINE_SEPsystem line separator , e.g.static java.lang.StringOS_ARCHThe OA architecture.static java.lang.StringOS_FAMILYOS Familystatic java.lang.StringOS_NAMEThe OS Name.static java.lang.StringOS_VERSIONThe OS version.static java.lang.StringPATH_SEPThe path separator.private static java.util.Set<java.lang.String>VALID_FAMILIES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) booleaneval()Determines if the OS on which Ant is executing matches the type of that set in setFamily.private static java.lang.StringgetOsFamily()Helper method to determine the current OS family.static java.util.Set<java.lang.String>getValidFamilies()The set of valid families.static booleanisArch(java.lang.String arch)Determines if the OS on which Ant is executing matches the given OS architecture.static booleanisFamily(java.lang.String family)Determines if the OS on which Ant is executing matches the given OS family.static booleanisName(java.lang.String name)Determines if the OS on which Ant is executing matches the given OS name.private static booleanisOs(java.lang.String family, java.lang.String name, java.lang.String arch, java.lang.String version)Determines if the OS on which Ant is executing matches the given OS family, name, architecture and versionstatic booleanisValidFamily(java.lang.String family)Test if the given family String represents a valid Familystatic booleanisVersion(java.lang.String version)Determines if the OS on which Ant is executing matches the given OS version.private voidsetFamily(java.lang.String f)Sets the desired OS family type
-
-
-
Field Detail
-
OS_NAME
public static final java.lang.String OS_NAME
The OS Name.
-
OS_ARCH
public static final java.lang.String OS_ARCH
The OA architecture.
-
OS_VERSION
public static final java.lang.String OS_VERSION
The OS version.
-
PATH_SEP
public static final java.lang.String PATH_SEP
The path separator.
-
LINE_SEP
public static final java.lang.String LINE_SEP
system line separator , e.g. "\n" on unixoid systems and "\r\n" on Windows
-
OS_FAMILY
public static final java.lang.String OS_FAMILY
OS Family
-
VALID_FAMILIES
private static final java.util.Set<java.lang.String> VALID_FAMILIES
-
family
private java.lang.String family
OS family to look for
-
FAMILY_WINDOWS
public static final java.lang.String FAMILY_WINDOWS
OS family that can be tested for. "windows"- See Also:
- Constant Field Values
-
FAMILY_WIN9X
public static final java.lang.String FAMILY_WIN9X
OS family that can be tested for. "win9x"- See Also:
- Constant Field Values
-
FAMILY_NT
public static final java.lang.String FAMILY_NT
OS family that can be tested for. "winnt"- See Also:
- Constant Field Values
-
FAMILY_OS2
public static final java.lang.String FAMILY_OS2
OS family that can be tested for. "os/2"- See Also:
- Constant Field Values
-
FAMILY_NETWARE
public static final java.lang.String FAMILY_NETWARE
OS family that can be tested for. "netware"- See Also:
- Constant Field Values
-
FAMILY_DOS
public static final java.lang.String FAMILY_DOS
OS family that can be tested for. "dos"- See Also:
- Constant Field Values
-
FAMILY_MAC
public static final java.lang.String FAMILY_MAC
OS family that can be tested for. "mac"- See Also:
- Constant Field Values
-
FAMILY_TANDEM
public static final java.lang.String FAMILY_TANDEM
OS family that can be tested for. "tandem"- See Also:
- Constant Field Values
-
FAMILY_UNIX
public static final java.lang.String FAMILY_UNIX
OS family that can be tested for. "unix"- See Also:
- Constant Field Values
-
FAMILY_OPENVMS
public static final java.lang.String FAMILY_OPENVMS
OS family that can be tested for. "openvms"- See Also:
- Constant Field Values
-
FAMILY_ZOS
public static final java.lang.String FAMILY_ZOS
OS family that can be tested for. "z/os"- See Also:
- Constant Field Values
-
FAMILY_OS400
public static final java.lang.String FAMILY_OS400
OS family that can be tested for. "os/400"- See Also:
- Constant Field Values
-
DARWIN
private static final java.lang.String DARWIN
OpenJDK is reported to call MacOS X "Darwin"- See Also:
- bugzilla issue, HADOOP-3318, Constant Field Values
-
-
Method Detail
-
getValidFamilies
public static java.util.Set<java.lang.String> getValidFamilies()
The set of valid families. This methods initializes the set until VALID_FAMILIES constant is set.- Returns:
- The set of families.
-
setFamily
private void setFamily(java.lang.String f)
Sets the desired OS family type- Parameters:
f- The OS family type desired
Possible values:
- dos
- mac
- netware
- os/2
- tandem
- unix
- windows
- win9x
- z/os
- os/400
-
eval
boolean eval()
Determines if the OS on which Ant is executing matches the type of that set in setFamily.- Returns:
- true if the os matches.
- See Also:
setFamily(String)
-
isFamily
public static boolean isFamily(java.lang.String family)
Determines if the OS on which Ant is executing matches the given OS family.- Parameters:
family- the family to check for- Returns:
- true if the OS matches
-
isName
public static boolean isName(java.lang.String name)
Determines if the OS on which Ant is executing matches the given OS name.- Parameters:
name- the OS name to check for- Returns:
- true if the OS matches
-
isArch
public static boolean isArch(java.lang.String arch)
Determines if the OS on which Ant is executing matches the given OS architecture.- Parameters:
arch- the OS architecture to check for- Returns:
- true if the OS matches
-
isVersion
public static boolean isVersion(java.lang.String version)
Determines if the OS on which Ant is executing matches the given OS version.- Parameters:
version- the OS version to check for- Returns:
- true if the OS matches
-
isOs
private static boolean isOs(java.lang.String family, java.lang.String name, java.lang.String arch, java.lang.String version)Determines if the OS on which Ant is executing matches the given OS family, name, architecture and version- Parameters:
family- The OS familyname- The OS namearch- The OS architectureversion- The OS version- Returns:
- true if the OS matches
-
getOsFamily
private static java.lang.String getOsFamily()
Helper method to determine the current OS family.- Returns:
- name of current OS family.
-
isValidFamily
public static boolean isValidFamily(java.lang.String family)
Test if the given family String represents a valid Family- Parameters:
family- the os family- Returns:
trueif 'family' represents a valid OS-Family,falseotherwise.
-
-