org.apache.tools.ant.taskdefs.condition
Class Os

java.lang.Object
  extended by org.apache.tools.ant.taskdefs.condition.Os
All Implemented Interfaces:
Condition

public class Os
extends java.lang.Object
implements Condition

Condition that tests the OS type.

Since:
Ant 1.4

Field Summary
static java.lang.String FAMILY_9X
          OS family that can be tested for.
static java.lang.String FAMILY_DOS
          OS family that can be tested for.
static java.lang.String FAMILY_MAC
          OS family that can be tested for.
static java.lang.String FAMILY_NETWARE
          OS family that can be tested for.
static java.lang.String FAMILY_NT
          OS family that can be tested for.
static java.lang.String FAMILY_OS2
          OS family that can be tested for.
static java.lang.String FAMILY_OS400
          OS family that can be tested for.
static java.lang.String FAMILY_TANDEM
          OS family that can be tested for.
static java.lang.String FAMILY_UNIX
          OS family that can be tested for.
static java.lang.String FAMILY_VMS
          OS family that can be tested for.
static java.lang.String FAMILY_WINDOWS
          OS family that can be tested for.
static java.lang.String FAMILY_ZOS
          OS family that can be tested for.
 
Constructor Summary
Os()
          Default constructor
Os(java.lang.String family)
          Constructor that sets the family attribute
 
Method Summary
 boolean eval()
          Determines if the OS on which Ant is executing matches the type of that set in setFamily.
static boolean isArch(java.lang.String arch)
          Determines if the OS on which Ant is executing matches the given OS architecture.
static boolean isFamily(java.lang.String family)
          Determines if the OS on which Ant is executing matches the given OS family.
static boolean isName(java.lang.String name)
          Determines if the OS on which Ant is executing matches the given OS name.
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
static boolean isVersion(java.lang.String version)
          Determines if the OS on which Ant is executing matches the given OS version.
 void setArch(java.lang.String arch)
          Sets the desired OS architecture
 void setFamily(java.lang.String f)
          Sets the desired OS family type
 void setName(java.lang.String name)
          Sets the desired OS name
 void setVersion(java.lang.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 Detail

FAMILY_WINDOWS

public static final java.lang.String FAMILY_WINDOWS
OS family that can be tested for. "windows"

See Also:
Constant Field Values

FAMILY_9X

public static final java.lang.String FAMILY_9X
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_VMS

public static final java.lang.String FAMILY_VMS
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
Constructor Detail

Os

public Os()
Default constructor


Os

public Os(java.lang.String family)
Constructor that sets the family attribute

Parameters:
family - a String value
Method Detail

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

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 BuildException
Determines if the OS on which Ant is executing matches the type of that set in setFamily.

Specified by:
eval in interface Condition
Returns:
true if the os matches.
Throws:
BuildException - if there is an error.
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
Since:
1.5

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
Since:
1.7

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
Since:
1.7

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
Since:
1.7

isOs

public 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 family
name - The OS name
arch - The OS architecture
version - The OS version
Returns:
true if the OS matches
Since:
1.7