Example usage for java.lang Boolean toString

List of usage examples for java.lang Boolean toString

Introduction

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

Prototype

public static String toString(boolean b) 

Source Link

Document

Returns a String object representing the specified boolean.

Usage

From source file:Main.java

public static void main(String[] args) {

    System.out.println(Boolean.toString(true));

}

From source file:com.thoughtworks.go.server.util.GoLauncher.java

public static void main(String[] args) {
    assertVMVersion();//  w  w w  . j  av a2  s  .  c  om
    SystemEnvironment systemEnvironment = new SystemEnvironment();
    systemEnvironment.setProperty(GoConstants.USE_COMPRESSED_JAVASCRIPT, Boolean.toString(true));
    LogConfigurator logConfigurator = new LogConfigurator(DEFAULT_LOGBACK_CONFIGURATION_FILE);
    logConfigurator.initialize();

    try {
        cleanupTempFiles();
        new GoServer().go();
    } catch (Exception e) {
        System.err.println("ERROR: Failed to start GoCD server. Please check the logs.");
        e.printStackTrace();
        System.exit(1);
    }
}

From source file:com.bluexml.tools.miscellaneous.PrepareSIDEModulesMigration.java

/**
 * @param args/* w w w .j a v  a2s  .c  o  m*/
 */
public static void main(String[] args) {
    boolean inplace = false;

    String workspace = "/Users/davidabad/workspaces/SIDE-Modules/";
    String frameworkmodulesPath = "/Volumes/Data/SVN/side/HEAD/S-IDE/FrameworksModules/trunk/";
    String classifier_base = "enterprise";
    String version_base = "3.4.6";
    String classifier_target = "enterprise";
    String version_target = "3.4.11";
    String frameworkmodulesInplace = "/Volumes/Data/SVN/projects/Ifremer/IfremerV5/src/modules/mavenProjects";

    Properties props = new Properties();
    try {
        InputStream resourceAsStream = PrepareSIDEModulesMigration.class
                .getResourceAsStream("config.properties");
        if (resourceAsStream != null) {
            props.load(resourceAsStream);

            inplace = Boolean.parseBoolean(props.getProperty("inplace", Boolean.toString(inplace)));
            workspace = props.getProperty("workspace", workspace);
            frameworkmodulesPath = props.getProperty("frameworkmodulesPath", frameworkmodulesPath);
            classifier_base = props.getProperty("classifier_base", classifier_base);
            version_base = props.getProperty("version_base", version_base);
            classifier_target = props.getProperty("classifier_target", classifier_target);
            version_target = props.getProperty("version_target", version_target);
            frameworkmodulesInplace = props.getProperty("frameworkmodulesInplace", frameworkmodulesInplace);
        } else {
            System.out.println("no configuration founded in classpath config.properties");
        }

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return;
    }

    System.out.println("properties :");
    Enumeration<?> propertyNames = props.propertyNames();
    while (propertyNames.hasMoreElements()) {
        String nextElement = propertyNames.nextElement().toString();
        System.out.println("\t " + nextElement + " : " + props.getProperty(nextElement));
    }

    File workspaceFile = new File(workspace);

    File targetHome = new File(workspaceFile, MIGRATION_FOLDER);
    if (targetHome.exists()) {
        try {
            FileUtils.deleteDirectory(targetHome);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }

    final String versionInProjectName = getVersionInProjectName(classifier_base, version_base);
    String versionInProjectName2 = getVersionInProjectName(classifier_target, version_target);

    if (frameworkmodulesPath.contains(",")) {
        // this is a list of paths
        String[] split = frameworkmodulesPath.split(",");
        for (String string : split) {
            if (StringUtils.trimToNull(string) != null) {
                executeInpath(inplace, string, classifier_base, version_base, classifier_target, version_target,
                        frameworkmodulesInplace, workspaceFile, versionInProjectName, versionInProjectName2);
            }
        }
    } else {
        executeInpath(inplace, frameworkmodulesPath, classifier_base, version_base, classifier_target,
                version_target, frameworkmodulesInplace, workspaceFile, versionInProjectName,
                versionInProjectName2);
    }

    System.out.println("Job's done !");
    System.out.println("Please check " + MIGRATION_FOLDER);
    System.out.println(
            "If all is ok you can use commit.sh in a terminal do : cd " + MIGRATION_FOLDER + "; sh commit.sh");
    System.out.println(
            "This script will create new svn projet and commit resources, add 'target' to svn:ignore ...");

}

From source file:com.thoughtworks.go.server.DevelopmentServer.java

public static void main(String[] args) throws Exception {
    LogConfigurator logConfigurator = new LogConfigurator(DEFAULT_LOGBACK_CONFIGURATION_FILE);
    logConfigurator.initialize();//  w  ww .  j  a  va  2  s.co  m
    copyDbFiles();
    copyPluginAssets();
    File webApp = new File("webapp");
    if (!webApp.exists()) {
        throw new RuntimeException("No webapp found in " + webApp.getAbsolutePath());
    }

    assertActivationJarPresent();
    SystemEnvironment systemEnvironment = new SystemEnvironment();
    systemEnvironment.setProperty(GENERATE_STATISTICS, "true");

    systemEnvironment.setProperty(SystemEnvironment.PARENT_LOADER_PRIORITY, "true");
    systemEnvironment.setProperty(SystemEnvironment.CRUISE_SERVER_WAR_PROPERTY, webApp.getAbsolutePath());
    systemEnvironment.set(SystemEnvironment.PLUGIN_LOCATION_MONITOR_INTERVAL_IN_SECONDS, 5);

    systemEnvironment.set(SystemEnvironment.DEFAULT_PLUGINS_ZIP, "/plugins.zip");
    systemEnvironment.set(SystemEnvironment.PLUGIN_ACTIVATOR_JAR_PATH, "go-plugin-activator.jar");
    systemEnvironment.set(SystemEnvironment.FAIL_STARTUP_ON_DATA_ERROR, true);
    systemEnvironment.setProperty(GoConstants.I18N_CACHE_LIFE, "0"); //0 means reload when stale
    systemEnvironment.set(SystemEnvironment.GO_SERVER_MODE, "development");
    setupPeriodicGC(systemEnvironment);
    assertPluginsZipExists();
    GoServer server = new GoServer();
    systemEnvironment.setProperty(GoConstants.USE_COMPRESSED_JAVASCRIPT, Boolean.toString(false));
    try {
        server.startServer();

        String hostName = systemEnvironment.getListenHost();
        if (hostName == null) {
            hostName = "localhost";
        }

        System.out.println("GoCD server dashboard started on http://" + hostName + ":"
                + systemEnvironment.getServerPort());
        System.out.println("* credentials: \"admin\" / \"badger\"");
    } catch (Exception e) {
        System.err.println("Failed to start GoCD server. Exception:");
        e.printStackTrace();
    }
}

From source file:Main.java

public static void setBooleanAttribute(Element el, String attr, boolean value) {
    el.setAttribute(attr, Boolean.toString(value));
}

From source file:Main.java

public static Element writeBooleanElement(Document document, String name, boolean value,
        Element parentElement) {/*from  w ww .  j  a va 2s  .co  m*/
    Element element = document.createElement(name);
    Text text = document.createTextNode(Boolean.toString(value));
    element.appendChild(text);
    parentElement.appendChild(element);
    return element;
}

From source file:Main.java

public static boolean read_setting_boolean(String key, boolean default_value) {
    try {// w  w  w .  j  a  va 2  s  . c  o m
        return global_setting.getBoolean(key, default_value);
    } catch (ClassCastException e) {
        return Boolean.parseBoolean(global_setting.getString(key, Boolean.toString(default_value)));
    }
}

From source file:Main.java

public static String getGpsEnabled(Context context) {
    if (PackageManager.PERMISSION_GRANTED == context
            .checkCallingOrSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)) {
        final LocationManager manager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        return Boolean.toString(manager.isProviderEnabled(LocationManager.GPS_PROVIDER));
    } else {/*from  ww  w  . j  a  v  a 2 s . c om*/
        return null;
    }
}

From source file:Main.java

/**
 * Add a child element, whose text contents are the given boolean value.
 * //from w  w  w .  j  a  va  2s  .  c om
 * @param doc Document object, used to build new elements.
 * @param elem Element to append new child to.
 * @param childName Name of the new child element.
 * @param childValue Value of the new child element.
 */
public static void addChildBoolean(Document doc, Element elem, String childName, boolean childValue) {
    addChildText(doc, elem, childName, Boolean.toString(childValue));
}

From source file:Main.java

/**
 * Set smart revalidate to true to incur less overhead when the method
 * {@link Component#revalidate()} is called.
 * <br>Revalidate calls {@link Container#isValidateRoot()} which 
 * normally results in calling {@link Component#validate()} for the top Windows/Frame/Dialog container.
 * With smart revalidate the "validate root" can be a scroll-pane for example
 * (see also {@link JComponent#isValidateRoot()}.
 */// w  ww.  jav  a  2s  .  c  o  m
public static void smartRevalidate(boolean beSmart) {
    System.setProperty("java.awt.smartInvalidate", Boolean.toString(beSmart));
}