Example usage for org.apache.commons.lang SystemUtils IS_OS_AIX

List of usage examples for org.apache.commons.lang SystemUtils IS_OS_AIX

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils IS_OS_AIX.

Prototype

boolean IS_OS_AIX

To view the source code for org.apache.commons.lang SystemUtils IS_OS_AIX.

Click Source Link

Document

Is true if this is AIX.

The field will return false if OS_NAME is null.

Usage

From source file:org.apache.maven.plugin.jar.JarSignMojo.java

private static File getJDKCommandExe(String command) {
    String fullCommand = command + (SystemUtils.IS_OS_WINDOWS ? ".exe" : "");

    File exe;//from  w  ww .j  av a 2  s.c om

    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        exe = new File(SystemUtils.getJavaHome() + "/../sh", fullCommand);
    } else if (SystemUtils.IS_OS_MAC_OSX) {
        exe = new File(SystemUtils.getJavaHome() + "/bin", fullCommand);
    } else {
        exe = new File(SystemUtils.getJavaHome() + "/../bin", fullCommand);
    }

    return exe;
}

From source file:org.apache.maven.plugin.javadoc.AbstractJavadocMojo.java

/**
 * Get the path of the Javadoc tool executable depending the user entry or try to find it depending the OS
 * or the <code>java.home</code> system property or the <code>JAVA_HOME</code> environment variable.
 *
 * @return the path of the Javadoc tool// w w  w .ja v  a2s . c  o m
 * @throws IOException if not found
 */
private String getJavadocExecutable() throws IOException {
    Toolchain tc = getToolchain();

    if (tc != null) {
        getLog().info("Toolchain in javadoc-plugin: " + tc);
        if (javadocExecutable != null) {
            getLog().warn(
                    "Toolchains are ignored, 'javadocExecutable' parameter is set to " + javadocExecutable);
        } else {
            javadocExecutable = tc.findTool("javadoc");
        }
    }

    String javadocCommand = "javadoc" + (SystemUtils.IS_OS_WINDOWS ? ".exe" : "");

    File javadocExe;

    // ----------------------------------------------------------------------
    // The javadoc executable is defined by the user
    // ----------------------------------------------------------------------
    if (StringUtils.isNotEmpty(javadocExecutable)) {
        javadocExe = new File(javadocExecutable);

        if (javadocExe.isDirectory()) {
            javadocExe = new File(javadocExe, javadocCommand);
        }

        if (SystemUtils.IS_OS_WINDOWS && javadocExe.getName().indexOf('.') < 0) {
            javadocExe = new File(javadocExe.getPath() + ".exe");
        }

        if (!javadocExe.isFile()) {
            throw new IOException("The javadoc executable '" + javadocExe
                    + "' doesn't exist or is not a file. Verify the <javadocExecutable/> parameter.");
        }

        return javadocExe.getAbsolutePath();
    }

    // ----------------------------------------------------------------------
    // Try to find javadocExe from System.getProperty( "java.home" )
    // By default, System.getProperty( "java.home" ) = JRE_HOME and JRE_HOME
    // should be in the JDK_HOME
    // ----------------------------------------------------------------------
    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        javadocExe = new File(SystemUtils.getJavaHome() + File.separator + ".." + File.separator + "sh",
                javadocCommand);
    } else if (SystemUtils.IS_OS_MAC_OSX) {
        javadocExe = new File(SystemUtils.getJavaHome() + File.separator + "bin", javadocCommand);
    } else {
        javadocExe = new File(SystemUtils.getJavaHome() + File.separator + ".." + File.separator + "bin",
                javadocCommand);
    }

    // ----------------------------------------------------------------------
    // Try to find javadocExe from JAVA_HOME environment variable
    // ----------------------------------------------------------------------
    if (!javadocExe.exists() || !javadocExe.isFile()) {
        Properties env = CommandLineUtils.getSystemEnvVars();
        String javaHome = env.getProperty("JAVA_HOME");
        if (StringUtils.isEmpty(javaHome)) {
            throw new IOException("The environment variable JAVA_HOME is not correctly set.");
        }
        if ((!new File(javaHome).getCanonicalFile().exists())
                || (new File(javaHome).getCanonicalFile().isFile())) {
            throw new IOException("The environment variable JAVA_HOME=" + javaHome
                    + " doesn't exist or is not a valid directory.");
        }

        javadocExe = new File(javaHome + File.separator + "bin", javadocCommand);
    }

    if (!javadocExe.getCanonicalFile().exists() || !javadocExe.getCanonicalFile().isFile()) {
        throw new IOException("The javadoc executable '" + javadocExe
                + "' doesn't exist or is not a file. Verify the JAVA_HOME environment variable.");
    }

    return javadocExe.getAbsolutePath();
}

From source file:org.apache.maven.plugin.jdeps.AbstractJDepsMojo.java

private String getJDepsExecutable() throws IOException {
    Toolchain tc = getToolchain();/*from  w ww . j a  v a 2s  .co  m*/

    String jdepsExecutable = null;
    if (tc != null) {
        jdepsExecutable = tc.findTool("jdeps");
    }

    String jdepsCommand = "jdeps" + (SystemUtils.IS_OS_WINDOWS ? ".exe" : "");

    File jdepsExe;

    if (StringUtils.isNotEmpty(jdepsExecutable)) {
        jdepsExe = new File(jdepsExecutable);

        if (jdepsExe.isDirectory()) {
            jdepsExe = new File(jdepsExe, jdepsCommand);
        }

        if (SystemUtils.IS_OS_WINDOWS && jdepsExe.getName().indexOf('.') < 0) {
            jdepsExe = new File(jdepsExe.getPath() + ".exe");
        }

        if (!jdepsExe.isFile()) {
            throw new IOException("The jdeps executable '" + jdepsExe + "' doesn't exist or is not a file.");
        }
        return jdepsExe.getAbsolutePath();
    }

    // ----------------------------------------------------------------------
    // Try to find jdepsExe from System.getProperty( "java.home" )
    // By default, System.getProperty( "java.home" ) = JRE_HOME and JRE_HOME
    // should be in the JDK_HOME
    // ----------------------------------------------------------------------
    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        jdepsExe = new File(SystemUtils.getJavaHome() + File.separator + ".." + File.separator + "sh",
                jdepsCommand);
    }
    // For Apple's JDK 1.6.x (and older?) on Mac OSX
    // CHECKSTYLE_OFF: MagicNumber
    else if (SystemUtils.IS_OS_MAC_OSX && SystemUtils.JAVA_VERSION_FLOAT < 1.7f)
    // CHECKSTYLE_ON: MagicNumber
    {
        jdepsExe = new File(SystemUtils.getJavaHome() + File.separator + "bin", jdepsCommand);
    } else {
        jdepsExe = new File(SystemUtils.getJavaHome() + File.separator + ".." + File.separator + "bin",
                jdepsCommand);
    }

    // ----------------------------------------------------------------------
    // Try to find jdepsExe from JAVA_HOME environment variable
    // ----------------------------------------------------------------------
    if (!jdepsExe.exists() || !jdepsExe.isFile()) {
        Properties env = CommandLineUtils.getSystemEnvVars();
        String javaHome = env.getProperty("JAVA_HOME");
        if (StringUtils.isEmpty(javaHome)) {
            throw new IOException("The environment variable JAVA_HOME is not correctly set.");
        }
        if ((!new File(javaHome).getCanonicalFile().exists())
                || (new File(javaHome).getCanonicalFile().isFile())) {
            throw new IOException("The environment variable JAVA_HOME=" + javaHome
                    + " doesn't exist or is not a valid directory.");
        }

        jdepsExe = new File(javaHome + File.separator + "bin", jdepsCommand);
    }

    if (!jdepsExe.getCanonicalFile().exists() || !jdepsExe.getCanonicalFile().isFile()) {
        throw new IOException("The jdeps executable '" + jdepsExe
                + "' doesn't exist or is not a file. Verify the JAVA_HOME environment variable.");
    }

    return jdepsExe.getAbsolutePath();
}

From source file:org.apache.maven.plugin.jdiff.JavadocBean.java

private String getJavadocPath() {
    final String javadocCommand = "javadoc" + (SystemUtils.IS_OS_WINDOWS ? ".exe" : "");
    // For IBM's JDK 1.2
    final File javadocExe = (SystemUtils.IS_OS_AIX
            ? new File(SystemUtils.getJavaHome() + "/../sh", javadocCommand)
            : new File(SystemUtils.getJavaHome() + "/../bin", javadocCommand));

    //return javadocExe.getAbsolutePath();

    return "javadoc";
}

From source file:org.codehaus.mojo.keytool.GenkeyMojo.java

private static File getJDKCommandExe(String command) {
    String fullCommand = command + (SystemUtils.IS_OS_WINDOWS ? ".exe" : "");

    File exe;/*from  w w w.  j  a va2s.  c o  m*/

    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        exe = new File(SystemUtils.getJavaHome() + "/../sh", fullCommand);
    } else if (SystemUtils.IS_OS_MAC_OSX) // what about IS_OS_MAC_OS ??
    {
        exe = new File(SystemUtils.getJavaHome() + "/bin", fullCommand);
    } else {
        exe = new File(SystemUtils.getJavaHome() + "/../bin", fullCommand);
    }

    return exe;
}

From source file:org.codehaus.mojo.keytool.KeyToolMojoSupport.java

/**
 * Constructs the operating system specific File path of the JDK command given the specified command name.
 * @param command the executable name //from   w w  w  . j a  v a 2  s. c o m
 * @return a File representing the path to the command.
 */
public static File getJDKCommandExe(String command) {
    String fullCommand = command + (SystemUtils.IS_OS_WINDOWS ? ".exe" : "");

    File exe;

    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        exe = new File(SystemUtils.getJavaHome() + "/../sh", fullCommand);
    } else if (SystemUtils.IS_OS_MAC_OSX) // what about IS_OS_MAC_OS ??
    {
        exe = new File(SystemUtils.getJavaHome() + "/bin", fullCommand);
    } else {
        exe = new File(SystemUtils.getJavaHome() + "/../bin", fullCommand);
    }

    return exe;
}

From source file:org.codehaus.mojo.keytool.KeyToolMojoSupport.java

/**
 * Constructs the operating system specific File path of the JRE cacerts file.
 * @param command the executable name //from w w w  .  j a  v  a  2  s.c  o m
 * @return a File representing the path to the command.
 */
public static File getJRECACerts() {

    File cacertsFile = null;

    String cacertsFilepath = "lib/security/cacerts";

    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    } else if (SystemUtils.IS_OS_MAC_OSX) // what about IS_OS_MAC_OS ??
    {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    } else {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    }

    return cacertsFile;

}

From source file:org.codehaus.mojo.keytool.KeyToolUtil.java

/**
 * Constructs the operating system specific File path of the JRE cacerts file.
 *
 * @return a File representing the path to the command.
 *///w ww  .j  a v a 2 s . c o m
public static File getJRECACerts() {

    File cacertsFile;

    String cacertsFilepath = "lib" + File.separator + "security" + File.separator + "cacerts";

    // For IBM's JDK 1.2
    if (SystemUtils.IS_OS_AIX) {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    } else if (SystemUtils.IS_OS_MAC_OSX) // what about IS_OS_MAC_OS ??
    {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    } else {
        cacertsFile = new File(SystemUtils.getJavaHome() + "/", cacertsFilepath);
    }

    return cacertsFile;
}

From source file:util.PosixComplianceUtil.java

private boolean isFullyPosixCompliant() {
    return SystemUtils.IS_OS_AIX || SystemUtils.IS_OS_HP_UX || SystemUtils.IS_OS_IRIX
            || SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_SOLARIS;
}