Class Os
java.lang.Object
org.codehaus.plexus.interpolation.os.Os
NOTE: This class was copied from plexus-utils, to allow this library to stand completely self-contained.
Condition that tests the OS type.
- Since:
- 1.0
- Author:
- Stefan Bodewig, Magesh Umasankar, Brian Fox
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
eval()
Determines if the current OS matches the type of that set in setFamily.static boolean
Determines if the current OS matches the given OS architecture.static boolean
Determines if the current OS matches the given OS family.static boolean
Determines if the current OS matches the given OS name.static boolean
Determines if the current OS matches the given OS family, name, architecture and version.static boolean
isValidFamily
(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 boolean
Determines if the current OS matches the given OS version.void
Sets the desired OS architecturevoid
Sets the desired OS family typevoid
Sets the desired OS namevoid
setVersion
(String version) Sets the desired OS version
-
Field Details
-
FAMILY_DOS
- See Also:
-
FAMILY_MAC
- See Also:
-
FAMILY_NETWARE
- See Also:
-
FAMILY_OS2
- See Also:
-
FAMILY_TANDEM
- See Also:
-
FAMILY_UNIX
- See Also:
-
FAMILY_WINDOWS
- See Also:
-
FAMILY_WIN9X
- See Also:
-
FAMILY_ZOS
- See Also:
-
FAMILY_OS400
- See Also:
-
FAMILY_OPENVMS
- See Also:
-
OS_NAME
-
OS_ARCH
-
OS_VERSION
-
OS_FAMILY
-
-
Constructor Details
-
Os
public Os()Default constructor -
Os
Constructor that sets the family attribute- Parameters:
family
- a String value
-
-
Method Details
-
setFamily
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
Sets the desired OS name- Parameters:
name
- The OS name
-
setArch
Sets the desired OS architecture- Parameters:
arch
- The OS architecture
-
setVersion
Sets the desired OS version- Parameters:
version
- The OS version
-
eval
Determines if the current OS matches the type of that set in setFamily.- Returns:
- true/false.
- Throws:
Exception
- in case of an error.- See Also:
-
isFamily
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
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
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
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
Determines if the current OS matches the given OS family, name, architecture and version. The name, archictecture 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
-
isValidFamily
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
- Returns:
- a copy of the valid families
- Since:
- 1.4.2
-