Example usage for java.lang Boolean getBoolean

List of usage examples for java.lang Boolean getBoolean

Introduction

In this page you can find the example usage for java.lang Boolean getBoolean.

Prototype

public static boolean getBoolean(String name) 

Source Link

Document

Returns true if and only if the system property named by the argument exists and is equal to, ignoring case, the string "true" .

Usage

From source file:org.apache.asterix.api.common.AsterixHyracksIntegrationUtil.java

/**
 * main method to run a simple 2 node cluster in-process
 * suggested VM arguments: <code>-enableassertions -Xmx2048m -Dfile.encoding=UTF-8</code>
 *
 * @param args//from   ww w .j  av a2  s. c o m
 *            unused
 */
public static void main(String[] args) throws Exception {
    AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil();
    try {
        integrationUtil.run(Boolean.getBoolean("cleanup.start"), Boolean.getBoolean("cleanup.shutdown"));
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "Unexpected exception", e);
        System.exit(1);
    }
}

From source file:Main.java

public static boolean parse(String string) {
    if (string.equals("0")) {
        return false;
    } else if (string.equals("1")) {
        return true;
    } else {//from   w ww.  j a  v  a2 s .  c om
        return Boolean.getBoolean(string);
    }
}

From source file:Main.java

public static boolean getBooleanAttribute(Element el, String name) {
    String s = el.getAttribute(name);
    if (s == null || "0".equals(s)) {
        return false;
    }/*from   w w  w . ja  v a2  s  .  c o  m*/
    if ("1".equals(s)) {
        return true;
    }
    return Boolean.getBoolean(s);
}

From source file:Main.java

/**
 * Gets a boolean property as a privileged action.
 *///from ww w. j  a v a 2 s .  c o m
public static boolean getPrivilegedBoolean(final String property_name) {
    return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
        public Boolean run() {
            return Boolean.getBoolean(property_name);
        }
    });
}

From source file:Main.java

/**
 * Looks to the org.jboss.byteman.sample.helper.debug system property to
 * set the class DEBUG mode flag.//www. ja  v a  2 s . c o m
 */
public static void activated() {
    DEBUG = Boolean.getBoolean("org.jboss.byteman.sample.helper.debug");
    if (DEBUG)
        System.err.println("ThreadHistoryMonitorHelper.activated, ");
}

From source file:cn.ctyun.amazonaws.util.StringUtils.java

public static Boolean toBoolean(StringBuilder value) {
    return Boolean.getBoolean(value.toString());
}

From source file:com.tc.config.Directories.java

/**
 * Get installation root directory.//ww  w  . j av  a2 s . c o m
 * 
 * @return Installation root directory or null if TC_INSTALL_ROOT_IGNORE_CHECKS_PROPERTY_NAME is set and
 *         TC_INSTALL_ROOT_PROPERTY_NAME is not.
 * @throws FileNotFoundException If {@link #TC_INSTALL_ROOT_PROPERTY_NAME} has not been set. If
 *         {@link #TC_INSTALL_ROOT_IGNORE_CHECKS_PROPERTY_NAME} has not been set, this exception may be thrown if the
 *         installation root directory has not been set, is not a directory
 */
public static File getInstallationRoot() throws FileNotFoundException {
    boolean ignoreCheck = Boolean.getBoolean(TC_INSTALL_ROOT_IGNORE_CHECKS_PROPERTY_NAME);
    if (ignoreCheck) {
        // XXX hack to have enterprise system tests to find license key under <ee-branch>/code/base
        String baseDir = System.getProperty("tc.base-dir");
        return new File(baseDir != null ? baseDir : ".", "../../../code/base");
    } else {
        String path = System.getProperty(TC_INSTALL_ROOT_PROPERTY_NAME);
        if (StringUtils.isBlank(path)) {
            // formatting
            throw new FileNotFoundException("The system property '" + TC_INSTALL_ROOT_PROPERTY_NAME
                    + "' has not been set. As such, the Terracotta installation directory cannot be located.");
        }

        File rootPath = new File(path).getAbsoluteFile();
        if (!rootPath.isDirectory()) {
            // formatting
            throw new FileNotFoundException("The specified Terracotta installation directory, '" + rootPath
                    + "', located via the value of the system property '" + TC_INSTALL_ROOT_PROPERTY_NAME
                    + "', does not actually exist.");
        }
        return rootPath;
    }
}

From source file:jenkins.plugins.jclouds.compute.MigrationTest.java

private void saveMigrationResult(final String targetPath) throws Exception {
    if (Boolean.getBoolean(SAVE_MIGRATION_PROPERTY)) {
        File target = new File(targetPath);
        File src = Jenkins.getInstance().root;
        target.mkdirs();//from w ww  .  ja  v a  2  s. c  o m
        new FilePath(src).copyRecursiveTo("**/*", new FilePath(target));
    }
}

From source file:com.netflix.conductor.server.ConductorConfig.java

@Override
public boolean disableSweep() {
    String disable = getProperty("decider.sweep.disable", "false");
    return Boolean.getBoolean(disable);
}

From source file:org.codice.ddf.test.common.options.DebugOptions.java

/**
 * Enables ports for debugging. Setting the `waitForDebug` property to true will cause the test to
 * halt and wait for a remote debugger to attach before executing tests.
 *
 * @return//from  w ww. j  a  va  2 s  .co m
 */
public static Option enableRemoteDebugging() {
    String port = getPortFinder().getPortAsString(DEBUG_PORT_KEY);
    recordConfiguration(DEBUG_PORT_KEY, port);
    final String DEBUG_OPTS = format("-Xrunjdwp:transport=dt_socket,server=y,suspend=%s,address=%s",
            Boolean.getBoolean(WAIT_FOR_DEBUG_FLAG) ? "y" : "n", port);

    // Since DDF uses a different start script than what pax exam expects karaf to use, we must set
    // our own debug env variables
    return new DefaultCompositeOption(
            CoreOptions.environment("KARAF_DEBUG=true", "JAVA_DEBUG_OPTS=" + DEBUG_OPTS));
}