Package org.codehaus.plexus.util

# Class Os

java.lang.Object
org.codehaus.plexus.util.Os

public class Os extends Object
Condition that tests the OS type.

Since:
  1.0
Author:
  Stefan Bodewig, Magesh Umasankar, Brian Fox

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`FAMILY_DOS`
`static final String`
`FAMILY_MAC`
`static final String`
`FAMILY_NETWARE`
`static final String`
`FAMILY_OPENVMS`
`static final String`
`FAMILY_OS2`
`static final String`
`FAMILY_OS400`
`static final String`
`FAMILY_TANDEM`
`static final String`
`FAMILY_UNIX`
`static final String`
`FAMILY_WIN9X`
`static final String`
`FAMILY_WINDOWS`
`static final String`
`FAMILY_ZOS`
`static final String`
`OS_ARCH`
`static final String`
`OS_FAMILY`
`static final String`
`OS_NAME`
`static final String`
`OS_VERSION`

## Constructor Summary

Constructors
Constructor
Description
`Os()`
Default constructor
`Os(String family)`
Constructor that sets the family attribute

## Method Summary

Modifier and Type
Method
Description
`boolean`
`eval()`
`static Set<String>`
`getValidFamilies()`
`static boolean`
`isArch(String arch)`
Determines if the current OS matches the given OS architecture.
`static boolean`
`isFamily(String family)`
Determines if the current OS matches the given OS family.
`static boolean`
`isName(String name)`
Determines if the current OS matches the given OS name.
`static boolean`
`isOs(String family, String name, String arch, String version)`
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 openvms
`static boolean`
`isVersion(String version)`
Determines if the current OS matches the given OS version.
`void`
`setArch(String arch)`
Sets the desired OS architecture
`void`
`setFamily(String f)`
Sets the desired OS family type
`void`
`setName(String name)`
Sets the desired OS name
`void`
`setVersion(String version)`
Sets the desired OS version

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### FAMILY_DOS

public static final String FAMILY_DOS

See Also:
  - Constant Field Values

### FAMILY_MAC

public static final String FAMILY_MAC

See Also:
  - Constant Field Values

### FAMILY_NETWARE

public static final String FAMILY_NETWARE

See Also:
  - Constant Field Values

### FAMILY_OS2

public static final String FAMILY_OS2

See Also:
  - Constant Field Values

### FAMILY_TANDEM

public static final String FAMILY_TANDEM

See Also:
  - Constant Field Values

### FAMILY_UNIX

public static final String FAMILY_UNIX

See Also:
  - Constant Field Values

### FAMILY_WINDOWS

public static final String FAMILY_WINDOWS

See Also:
  - Constant Field Values

### FAMILY_WIN9X

public static final String FAMILY_WIN9X

See Also:
  - Constant Field Values

### FAMILY_ZOS

public static final String FAMILY_ZOS

See Also:
  - Constant Field Values

### FAMILY_OS400

public static final String FAMILY_OS400

See Also:
  - Constant Field Values

### FAMILY_OPENVMS

public static final String FAMILY_OPENVMS

See Also:
  - Constant Field Values

### OS_NAME

public static final String OS_NAME

### OS_ARCH

public static final String OS_ARCH

### OS_VERSION

public static final String OS_VERSION

### OS_FAMILY

public static final String OS_FAMILY

## Constructor Details

### Os

public Os()
Default constructor

### Os

public Os(String family)
Constructor that sets the family attribute

Parameters:
  `family` - a String value

## Method Details

### setFamily

public void setFamily(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(String name)
Sets the desired OS name

Parameters:
  `name` - The OS name

### setArch

public void setArch(String arch)
Sets the desired OS architecture

Parameters:
  `arch` - The OS architecture

### setVersion

public void setVersion(String version)
Sets the desired OS version

Parameters:
  `version` - The OS version

### eval

public boolean eval() throws Exception

Returns:
  Determines if the current OS matches the type of that set in setFamily.
Throws:
  `Exception` - any errir
See Also:
  - `setFamily(String)`

### isFamily

public static boolean isFamily(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(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(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(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(String family, String name, String arch, 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 family
  `name` - The OS name
  `arch` - The OS architecture
  `version` - The OS version
Returns:
  true if the OS matches
Since:
  1.0

### isValidFamily

public 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
- openvms

Parameters:
  `theFamily` - the family to check.
Returns:
  true if one of the valid families.
Since:
  1.4.2

### getValidFamilies

public static Set<String> getValidFamilies()

Returns:
  a copy of the valid families
Since:
  1.4.2