Package org.codehaus.plexus.util
Class Os
- java.lang.Object
-
- org.codehaus.plexus.util.Os
-
public class Os extends java.lang.ObjectCondition that tests the OS type.- Since:
- 1.0
- Version:
- $Revision$
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringarchprivate java.lang.Stringfamilystatic java.lang.StringFAMILY_DOSstatic java.lang.StringFAMILY_MACstatic java.lang.StringFAMILY_NETWAREstatic java.lang.StringFAMILY_OPENVMSstatic java.lang.StringFAMILY_OS2static java.lang.StringFAMILY_OS400static java.lang.StringFAMILY_TANDEMstatic java.lang.StringFAMILY_UNIXstatic java.lang.StringFAMILY_WIN9Xstatic java.lang.StringFAMILY_WINDOWSstatic java.lang.StringFAMILY_ZOSprivate java.lang.Stringnamestatic java.lang.StringOS_ARCHstatic java.lang.StringOS_FAMILYstatic java.lang.StringOS_NAMEstatic java.lang.StringOS_VERSIONprivate static java.lang.StringPATH_SEPprivate static java.util.Set<java.lang.String>validFamiliesprivate java.lang.Stringversion
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleaneval()Determines if the current OS 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()static booleanisArch(java.lang.String arch)Determines if the current OS matches the given OS architecture.static booleanisFamily(java.lang.String family)Determines if the current OS matches the given OS family.static booleanisName(java.lang.String name)Determines if the current OS matches the given OS name.static booleanisOs(java.lang.String family, java.lang.String name, java.lang.String arch, java.lang.String version)Determines if the current OS matches the given OS family, name, architecture and version.static booleanisValidFamily(java.lang.String theFamily)Helper method to check if the given family is in the following list: dos mac netware os/2 tandem unix windows win9x z/os os/400 openvmsstatic booleanisVersion(java.lang.String version)Determines if the current OS matches the given OS version.voidsetArch(java.lang.String arch)Sets the desired OS architecturevoidsetFamily(java.lang.String f)Sets the desired OS family typevoidsetName(java.lang.String name)Sets the desired OS nameprivate static java.util.Set<java.lang.String>setValidFamilies()Initializes the set of valid families.voidsetVersion(java.lang.String version)Sets the desired OS version
-
-
-
Field Detail
-
FAMILY_DOS
public static final java.lang.String FAMILY_DOS
- See Also:
- Constant Field Values
-
FAMILY_MAC
public static final java.lang.String FAMILY_MAC
- See Also:
- Constant Field Values
-
FAMILY_NETWARE
public static final java.lang.String FAMILY_NETWARE
- See Also:
- Constant Field Values
-
FAMILY_OS2
public static final java.lang.String FAMILY_OS2
- See Also:
- Constant Field Values
-
FAMILY_TANDEM
public static final java.lang.String FAMILY_TANDEM
- See Also:
- Constant Field Values
-
FAMILY_UNIX
public static final java.lang.String FAMILY_UNIX
- See Also:
- Constant Field Values
-
FAMILY_WINDOWS
public static final java.lang.String FAMILY_WINDOWS
- See Also:
- Constant Field Values
-
FAMILY_WIN9X
public static final java.lang.String FAMILY_WIN9X
- See Also:
- Constant Field Values
-
FAMILY_ZOS
public static final java.lang.String FAMILY_ZOS
- See Also:
- Constant Field Values
-
FAMILY_OS400
public static final java.lang.String FAMILY_OS400
- See Also:
- Constant Field Values
-
FAMILY_OPENVMS
public static final java.lang.String FAMILY_OPENVMS
- See Also:
- Constant Field Values
-
validFamilies
private static final java.util.Set<java.lang.String> validFamilies
-
PATH_SEP
private static final java.lang.String PATH_SEP
-
OS_NAME
public static final java.lang.String OS_NAME
-
OS_ARCH
public static final java.lang.String OS_ARCH
-
OS_VERSION
public static final java.lang.String OS_VERSION
-
OS_FAMILY
public static final java.lang.String OS_FAMILY
-
family
private java.lang.String family
-
name
private java.lang.String name
-
version
private java.lang.String version
-
arch
private java.lang.String arch
-
-
Method Detail
-
setValidFamilies
private static java.util.Set<java.lang.String> setValidFamilies()
Initializes the set of valid families.
-
setFamily
public 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
- openvms
-
setName
public void setName(java.lang.String name)
Sets the desired OS name- Parameters:
name- The OS name
-
setArch
public void setArch(java.lang.String arch)
Sets the desired OS architecture- Parameters:
arch- The OS architecture
-
setVersion
public void setVersion(java.lang.String version)
Sets the desired OS version- Parameters:
version- The OS version
-
eval
public boolean eval() throws java.lang.ExceptionDetermines if the current OS matches the type of that set in setFamily.- Throws:
java.lang.Exception- See Also:
setFamily(String)
-
isFamily
public static boolean isFamily(java.lang.String family)
Determines if the current OS matches the given OS family.- Parameters:
family- the family to check for- Returns:
- true if the OS matches
- Since:
- 1.0
-
isName
public static boolean isName(java.lang.String name)
Determines if the current OS matches the given OS name.- Parameters:
name- the OS name to check for- Returns:
- true if the OS matches
- Since:
- 1.0
-
isArch
public static boolean isArch(java.lang.String arch)
Determines if the current OS matches the given OS architecture.- Parameters:
arch- the OS architecture to check for- Returns:
- true if the OS matches
- Since:
- 1.0
-
isVersion
public static boolean isVersion(java.lang.String version)
Determines if the current OS matches the given OS version.- Parameters:
version- the OS version to check for- Returns:
- true if the OS matches
- Since:
- 1.0
-
isOs
public static boolean isOs(java.lang.String family, java.lang.String name, java.lang.String arch, java.lang.String version)Determines if the current OS matches the given OS family, name, architecture and version. The name, architecture and version are compared to the System properties os.name, os.version and os.arch in a case-independent way.- Parameters:
family- The OS familyname- The OS namearch- The OS architectureversion- The OS version- Returns:
- true if the OS matches
- Since:
- 1.0
-
getOsFamily
private static java.lang.String getOsFamily()
Helper method to determine the current OS family.- Returns:
- name of current OS family.
- Since:
- 1.4.2
-
isValidFamily
public static boolean isValidFamily(java.lang.String theFamily)
Helper method to check if the given family is in the following list:- dos
- mac
- netware
- os/2
- tandem
- unix
- windows
- win9x
- z/os
- os/400
- openvms
- Parameters:
theFamily- the family to check.- Returns:
- true if one of the valid families.
- Since:
- 1.4.2
-
getValidFamilies
public static java.util.Set<java.lang.String> getValidFamilies()
- Returns:
- a copy of the valid families
- Since:
- 1.4.2
-
-