Example usage for java.lang Boolean parseBoolean

List of usage examples for java.lang Boolean parseBoolean

Introduction

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

Prototype

public static boolean parseBoolean(String s) 

Source Link

Document

Parses the string argument as a boolean.

Usage

From source file:com.kijes.ela.common.JSONSerializers.java

public static EnterLeaveArea enterLeaveAreaFromJson(JSONObject jsonEnterLeaveArea) throws InvalidDataException {
    String enterLeaveAreaStr = jsonEnterLeaveArea.getString(ElaUser.PROPERTY_ENTERED_AREA);
    if (enterLeaveAreaStr == null) {
        throw new InvalidDataException("Invalid " + ElaUser.PROPERTY_ENTERED_AREA);
    }/*from w w  w  .j a  va2 s .co  m*/
    return new EnterLeaveArea(Boolean.parseBoolean(enterLeaveAreaStr));
}

From source file:com.haulmont.cuba.gui.xml.layout.loaders.SideMenuLoader.java

protected void loadMenuConfigIfNeeded(SideMenu component, Element element) {
    String loadMenuConfig = element.attributeValue("loadMenuConfig");
    if (StringUtils.isEmpty(loadMenuConfig) || Boolean.parseBoolean(loadMenuConfig)) {
        component.loadMenuConfig();/* w  ww . ja  va2 s.  c  om*/
    }
}

From source file:datafu.hourglass.test.TestBase.java

public TestBase(int taskTrackers, int dataNodes) throws IOException {
    if (System.getProperty("testlocal") != null && Boolean.parseBoolean(System.getProperty("testlocal"))) {
        localMR = true;//  www  . j a va2  s.c  o m
        localFS = true;
        _confDir = System.getProperty("confdir");
    }

    if (taskTrackers < 1) {
        throw new IllegalArgumentException("Invalid taskTrackers value, must be greater than 0");
    }
    if (dataNodes < 1) {
        throw new IllegalArgumentException("Invalid dataNodes value, must be greater than 0");
    }
    this.taskTrackers = taskTrackers;
    this.dataNodes = dataNodes;
}

From source file:org.auraframework.integration.test.configuration.JettyTestServletConfig.java

public JettyTestServletConfig() throws Exception {
    String host;/*from   ww  w  . j  ava2 s. c  o m*/
    int port;
    boolean spawnJetty = Boolean.parseBoolean(System.getProperty("jetty.spawn", "false"));
    if (spawnJetty) {
        Server server = AuraJettyServer.getInstance();
        Connector connector = server.getConnectors()[0];
        port = connector.getPort();
        host = connector.getHost();
        if (host == null) {
            try {
                host = getHost();
            } catch (UnknownHostException e) {
                LOG.log(Level.WARNING, e.toString(), e);
                host = "localhost";
            }
        }
        LOG.info(String.format("Starting Jetty on %s:%s", host, port));
        server.start();
    } else {
        port = Integer.parseInt(System.getProperty("jetty.port", "9090"));
        host = System.getProperty("jetty.host");
        if (host == null) {
            try {
                host = getHost();
            } catch (UnknownHostException e) {
                LOG.log(Level.WARNING, e.toString(), e);
                host = "localhost";
            }
        }
    }
    baseUrl = new URL("http", host, port, "/");
    LOG.info("BaseUrl: " + baseUrl);
}

From source file:at.alladin.rmbt.db.fields.BooleanField.java

@Override
public void setString(final String string) {
    value = Boolean.parseBoolean(string);
}

From source file:eu.fbk.utils.lsa.util.AnvurDev.java

public static void main(String[] args) throws Exception {
    String logConfig = System.getProperty("log-config");
    if (logConfig == null) {
        logConfig = "log-config.txt";
    }/*from w ww. ja v a 2 s .co m*/

    PropertyConfigurator.configure(logConfig);

    if (args.length != 8) {
        System.out.println(args.length);
        System.out.println(
                "Usage: java -mx2G eu.fbk.utils.lsa.util.AnvurDev root-lsa-en root-lsa-it threshold-lsa size-lsa dim-lsa idf-lsa in-file-tsv fields-tsv\n\n");
        System.exit(1);
    }

    //
    DecimalFormat dec = new DecimalFormat("#.00");

    File enUt = new File(args[0] + "-Ut");
    File enSk = new File(args[0] + "-S");
    File enr = new File(args[0] + "-row");
    File enc = new File(args[0] + "-col");
    File endf = new File(args[0] + "-df");
    File itUt = new File(args[1] + "-Ut");
    File itSk = new File(args[1] + "-S");
    File itr = new File(args[1] + "-row");
    File itc = new File(args[1] + "-col");
    File itdf = new File(args[1] + "-df");

    double threshold = Double.parseDouble(args[2]);
    int size = Integer.parseInt(args[3]);
    int dim = Integer.parseInt(args[4]);
    boolean rescaleIdf = Boolean.parseBoolean(args[5]);

    LSM enLsm = new LSM(enUt, enSk, enr, enc, endf, dim, rescaleIdf);
    LSM itLsm = new LSM(itUt, itSk, itr, itc, itdf, dim, rescaleIdf);

    File in = new File(args[6]);

    if (in.isFile()) {
        run(enLsm, itLsm, args[6], args[7]);
    } else if (in.isDirectory()) {
        FolderScanner fs = new FolderScanner(in);
        fs.setFiler(new TsvFilter());
        int count = 0;
        while (fs.hasNext()) {
            Object[] files = fs.next();
            System.out.println((count++) + " : " + files.length);
            for (int i = 0; i < files.length; i++) {

                String name = ((File) files[i]).getAbsolutePath();
                System.out.println(name);
                run(enLsm, itLsm, name, args[7]);
            } // end for i
        } // end while
    }

}

From source file:com.haulmont.cuba.gui.xml.layout.loaders.ContainerLoader.java

protected void loadSpacing(Component.Spacing layout, Element element) {
    String spacing = element.attributeValue("spacing");
    if (StringUtils.isNotEmpty(spacing)) {
        layout.setSpacing(Boolean.parseBoolean(spacing));
    }/*from   w ww. j  a  v a 2s.  co m*/
}

From source file:com.netflix.priam.cassandra.extensions.PriamStartupAgent.java

private void setPriamProperties() {
    String token = null;/*from  w w w .j  a  va2 s  .  co  m*/
    String seeds = null;
    boolean isReplace = false;
    String replacedIp = "";
    String extraEnvParams = null;

    while (true) {
        try {
            token = DataFetcher.fetchData("http://127.0.0.1:8080/Priam/REST/v1/cassconfig/get_token");
            seeds = DataFetcher.fetchData("http://127.0.0.1:8080/Priam/REST/v1/cassconfig/get_seeds");
            isReplace = Boolean.parseBoolean(
                    DataFetcher.fetchData("http://127.0.0.1:8080/Priam/REST/v1/cassconfig/is_replace_token"));
            replacedIp = DataFetcher
                    .fetchData("http://127.0.0.1:8080/Priam/REST/v1/cassconfig/get_replaced_ip");
            extraEnvParams = DataFetcher
                    .fetchData("http://127.0.0.1:8080/Priam/REST/v1/cassconfig/get_extra_env_params");

        } catch (Exception e) {
            System.out
                    .println("Failed to obtain startup data from priam, can not start yet. will retry shortly");
            e.printStackTrace();
        }

        if (token != null && seeds != null)
            break;
        try {
            Thread.sleep(5 * 1000);
        } catch (InterruptedException e1) {
            // do nothing.
        }
    }

    System.setProperty("cassandra.initial_token", token);

    setExtraEnvParams(extraEnvParams);

    if (isReplace) {
        System.out.println("Detect cassandra version : " + FBUtilities.getReleaseVersionString());
        if (FBUtilities.getReleaseVersionString().compareTo(REPLACED_ADDRESS_MIN_VER) < 0) {
            System.setProperty("cassandra.replace_token", token);
        } else {
            System.setProperty("cassandra.replace_address", replacedIp);
        }
    }

}

From source file:uk.ac.ebi.eva.pipeline.jobs.deciders.SkipStepDecider.java

@Override
public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) {
    if (Boolean.parseBoolean(pipelineOptions.getString(skipStep))) {
        logger.info("Skipping step because {} is enabled", skipStep);
        return new FlowExecutionStatus(SKIP_STEP);
    }//from w  w w  .  j  a v  a  2  s  .c o  m

    logger.info("Running step because {} is disabled", skipStep);
    return new FlowExecutionStatus(DO_STEP);
}

From source file:org.jolokia.support.spring.config.AgentBeanDefinitionParser.java

@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    Element config = DomUtils.getChildElementByTagName(element, "config");
    if (config != null) {
        builder.addPropertyValue("config",
                parserContext.getDelegate().parseCustomElement(config, builder.getRawBeanDefinition()));
    }/*www.  ja v  a2s . c  om*/
    Element log = DomUtils.getChildElementByTagName(element, "log");
    if (log != null) {
        LogBeanDefinitionParser logParser = new LogBeanDefinitionParser();
        builder.addPropertyValue("logHandler", logParser.parseInternal(log, parserContext));
    }
    for (String lookupKey : new String[] { "lookupConfig", "lookupServices" }) {
        String lookup = element.getAttribute(lookupKey);
        builder.addPropertyValue(lookupKey, StringUtils.hasLength(lookup) && Boolean.parseBoolean(lookup));
    }
    String systemPropertiesMode = element.getAttribute("systemPropertiesMode");
    if (StringUtils.hasLength(systemPropertiesMode)) {
        builder.addPropertyValue("systemPropertiesMode", systemPropertiesMode);
    }
    String exposeApplicationContext = element.getAttribute("exposeApplicationContext");
    if (StringUtils.hasLength(exposeApplicationContext)) {
        builder.addPropertyValue("exposeApplicationContext", exposeApplicationContext);
    }
}