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 Details Link icon

  • Constructor Details Link icon

    • Os Link icon

      public Os()
      Default constructor
    • Os Link icon

      public Os(String family)
      Constructor that sets the family attribute
      Parameters:
      family - a String value
  • Method Details Link icon

    • setFamily Link icon

      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 Link icon

      public void setName(String name)
      Sets the desired OS name
      Parameters:
      name - The OS name
    • setArch Link icon

      public void setArch(String arch)
      Sets the desired OS architecture
      Parameters:
      arch - The OS architecture
    • setVersion Link icon

      public void setVersion(String version)
      Sets the desired OS version
      Parameters:
      version - The OS version
    • eval Link icon

      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:
    • isFamily Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      public static Set<String> getValidFamilies()
      Returns:
      a copy of the valid families
      Since:
      1.4.2