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:io.cloudslang.worker.management.services.SimpleExecutionRunnable.java

public SimpleExecutionRunnable(ExecutionService executionService, OutboundBuffer outBuffer, InBuffer inBuffer,
        ExecutionMessageConverter converter, EndExecutionCallback endExecutionCallback,
        QueueStateIdGeneratorService queueStateIdGeneratorService, String workerUUID,
        WorkerConfigurationService workerConfigurationService, WorkerManager workerManager) {
    this.executionService = executionService;
    this.outBuffer = outBuffer;
    this.inBuffer = inBuffer;
    this.converter = converter;
    this.endExecutionCallback = endExecutionCallback;
    this.queueStateIdGeneratorService = queueStateIdGeneratorService;
    this.workerUUID = workerUUID;
    this.workerConfigurationService = workerConfigurationService;
    this.workerManager = workerManager;
    this.isRecoveryDisabled = Boolean.getBoolean("is.recovery.disabled");
}

From source file:org.onehippo.repository.testutils.RepositoryTestCase.java

@AfterClass
public static void tearDownClass() throws Exception {
    if (!Boolean.getBoolean(KEEPSERVER_SYSPROP)) {
        clearRepository();/*  ww w .  j a  v a  2 s . co  m*/
    }
}

From source file:org.opensaml.DefaultBootstrap.java

/**
 *  Initializes the Apache Commons HttpClient library.
 *///from  w ww.  ja  va 2s .  c  om
protected static void initializeHttpClient() {
    if (!Boolean.getBoolean(SYSPROP_HTTPCLIENT_HTTPS_DISABLE_HOSTNAME_VERIFICATION)) {
        ProtocolSocketFactory socketFactory = new TLSProtocolSocketFactory(null, null,
                new StrictHostnameVerifier());
        Protocol.registerProtocol("https", new Protocol("https", socketFactory, 443));
    }
}

From source file:org.apache.camel.component.cxf.mtom.MtomTestHelper.java

static boolean isAwtHeadless(org.apache.commons.logging.Log log, org.slf4j.Logger logger) {
    Assert.assertFalse("Both loggers are not allowed to be null!", log == null && logger == null);
    boolean headless = Boolean.getBoolean("java.awt.headless");
    if (headless) {
        // having the conversion characters %c{1} inside log4j.properties will reveal us the
        // test class currently running as we make use of it's logger to warn about skipping!
        String warning = "Running headless. Skipping test as Images may not work.";
        if (log != null) {
            log.warn(warning);//from  www. j a va2s .  com
        }

        if (logger != null) {
            logger.warn("Running headless. Skipping test as Images may not work.");
        }
    }

    return headless;
}

From source file:org.jahia.modules.serversettings.flow.CacheManagerHandler.java

/**
 * Returns <code>true</code> if Jahia cluster is activated.
 * /*w w  w  .j  av  a 2 s . c o m*/
 * @return <code>true</code> if Jahia cluster is activated
 */
public boolean getClusterActivated() {
    return Boolean.getBoolean("cluster.activated");
}

From source file:elasticsearch.ElasticSearchPlugin.java

/**
 * Checks if is local mode.//from w  w  w .  j av  a  2  s.co m
 * 
 * @return true, if is local mode
 */
private boolean isLocalMode() {
    try {
        final String client = Play.configuration.getProperty("elasticsearch.client");
        final Boolean local = Boolean.getBoolean(Play.configuration.getProperty("elasticsearch.local", "true"));

        if (client == null) {
            return true;
        }
        if (client.equalsIgnoreCase("false") || client.equalsIgnoreCase("true")) {
            return true;
        }

        return local;
    } catch (final Exception e) {
        Logger.error("Error! Starting in Local Model: %s", ExceptionUtil.getStackTrace(e));
        return true;
    }
}

From source file:org.rhq.modules.plugins.jbossas7.ASConnection.java

/**
 * Construct an ASConnection object. The real "physical" connection is done in
 * #executeRaw./*  w  w w.  ja v a2  s .co  m*/
 * @param host Host of the DomainController or standalone server
 * @param port Port of the JSON api.
 * @param user user needed for authentication
 * @param password password needed for authentication
 */
public ASConnection(String host, int port, String user, String password) {
    this.host = host;
    this.port = port;

    try {
        url = new URL("http", host, port, MANAGEMENT);
        urlString = url.toString();

    } catch (MalformedURLException e) {
        throw new IllegalArgumentException(e.getMessage());
    }

    passwordAuthenticator = new AS7Authenticator(user, password);
    Authenticator.setDefault(passwordAuthenticator);

    // read system property "as7plugin.verbose"
    verbose = Boolean.getBoolean("as7plugin.verbose");

    mapper = new ObjectMapper();
    mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);

}

From source file:ai.grakn.migration.base.MigrationOptions.java

public boolean getRetry() {
    return command.hasOption("r") && Boolean.getBoolean(command.getOptionValue("r"));
}

From source file:fr.gael.dhus.server.http.webapp.solr.SolrWebapp.java

@Override
public void afterPropertiesSet() throws Exception {
    try {// w  w  w . j av  a2  s. co m
        SolrConfiguration solr = configurationManager.getSolrConfiguration();

        File solrroot = new File(solr.getPath());
        System.setProperty("solr.solr.home", solrroot.getAbsolutePath());

        if (Boolean.getBoolean("dhus.solr.reindex")) {
            // reindexing
            try {
                LOGGER.info("Reindex: deleting " + solrroot);
                FileUtils.deleteDirectory(solrroot);
            } catch (IllegalArgumentException | IOException ex) {
                LOGGER.error("Cannot delete solr root directory " + ex.getMessage());
            }
        }

        File libdir = new File(solrroot, "lib");
        libdir.mkdirs();
        File coredir = new File(solrroot, "dhus");
        coredir.mkdirs();
        File confdir = new File(coredir, "conf");

        // Move old data/conf dirs if any
        File olddata = new File(solrroot, "data/dhus");
        if (olddata.exists()) {
            File newdata = new File(coredir, "data");
            olddata.renameTo(newdata);
        }
        File oldconf = new File(solrroot, "conf");
        if (oldconf.exists()) {
            oldconf.renameTo(confdir);
        }
        confdir.mkdirs();

        // Rename old `schema.xml` file to `managed-schema`
        File schemafile = new File(confdir, "managed-schema");
        File oldschema = new File(confdir, "schema.xml");
        if (oldschema.exists()) {
            oldschema.renameTo(schemafile);
        }

        // solr.xml
        InputStream input = ClassLoader
                .getSystemResourceAsStream("fr/gael/dhus/server/http/webapp/solr/cfg/solr.xml");
        OutputStream output = new FileOutputStream(new File(solrroot, "solr.xml"));
        IOUtils.copy(input, output);
        output.close();
        input.close();

        // dhus/core.properties
        input = ClassLoader
                .getSystemResourceAsStream("fr/gael/dhus/server/http/webapp/solr/cfg/core.properties");
        File core_props = new File(coredir, "core.properties");
        output = new FileOutputStream(core_props);
        IOUtils.copy(input, output);
        output.close();
        input.close();

        // dhus/solrconfig.xml
        input = ClassLoader
                .getSystemResourceAsStream("fr/gael/dhus/server/http/webapp/solr/cfg/solrconfig.xml");
        File solrconfigfile = new File(confdir, "solrconfig.xml");
        output = new FileOutputStream(solrconfigfile);
        IOUtils.copy(input, output);
        output.close();
        input.close();

        // dhus/schema.xml
        if (!schemafile.exists()) {
            String schemapath = solr.getSchemaPath();
            if ((schemapath == null) || ("".equals(schemapath)) || (!(new File(schemapath)).exists())) {
                input = ClassLoader
                        .getSystemResourceAsStream("fr/gael/dhus/server/http/webapp/solr/cfg/schema.xml");
            } else {
                input = new FileInputStream(new File(schemapath));
            }
            output = new FileOutputStream(schemafile);
            IOUtils.copy(input, output);
            output.close();
            input.close();
        }

        // dhus/stopwords.txt
        input = ClassLoader.getSystemResourceAsStream("fr/gael/dhus/server/http/webapp/solr/cfg/stopwords.txt");
        output = new FileOutputStream(new File(confdir, "stopwords.txt"));
        IOUtils.copy(input, output);
        output.close();
        input.close();

        // dhus/synonyms.txt
        String synonympath = solr.getSynonymPath();
        if ((synonympath == null) || ("".equals(synonympath)) || (!(new File(synonympath)).exists())) {
            input = ClassLoader
                    .getSystemResourceAsStream("fr/gael/dhus/server/http/webapp/solr/cfg/synonyms.txt");
        } else {
            input = new FileInputStream(new File(synonympath));
        }
        output = new FileOutputStream(new File(confdir, "synonyms.txt"));
        IOUtils.copy(input, output);
        output.close();
        input.close();

        // dhus/xslt/opensearch_atom.xsl
        input = ClassLoader
                .getSystemResourceAsStream("fr/gael/dhus/server/http/webapp/solr/cfg/xslt/opensearch_atom.xsl");
        if (input != null) {
            File xslt_dir = new File(confdir, "xslt");
            if (!xslt_dir.exists()) {
                xslt_dir.mkdirs();
            }
            output = new FileOutputStream(new File(xslt_dir, "opensearch_atom.xsl"));
            IOUtils.copy(input, output);
            output.close();
            input.close();
        } else {
            LOGGER.warn("Cannot file opensearch xslt file. " + "Opensearch interface is not available.");
        }

        // dhus/conf/suggest.dic
        try (InputStream in = ClassLoader.getSystemResourceAsStream("suggest.dic")) {
            File suggest_dict = new File(confdir, "suggest.dic");
            if (in != null) {
                LOGGER.info("Solr config file `suggest.dic` found");
                try (OutputStream out = new FileOutputStream(suggest_dict)) {
                    IOUtils.copy(in, out);
                }
            } else {
                LOGGER.warn("Solr config file `suggest.dic` not found");
                suggest_dict.createNewFile();
            }
        }

        solrInitializer.createSchema(coredir.toPath(), schemafile.getAbsolutePath());

    } catch (IOException e) {
        throw new UnsupportedOperationException("Cannot initialize Solr service.", e);
    }
}

From source file:org.sonar.plugins.php.phpunit.sensor.PhpUnitSensorTest.java

/**
 * Sould not launch on non php project.//from   ww w. ja  v  a2 s. c  om
 */
@Test
public void shouldNotLaunchWhenConfiguredSoOnPhpProject() {
    init();
    when(project.getLanguage()).thenReturn(Php.INSTANCE);
    when(configuration.getBoolean(PhpUnitConfiguration.SHOULD_RUN_PROPERTY_KEY,
            Boolean.getBoolean(PhpUnitConfiguration.DEFAULT_SHOULD_RUN))).thenReturn(false);
    ProjectFileSystem fs = mock(ProjectFileSystem.class);
    when(project.getFileSystem()).thenReturn(fs);
    when(fs.getBuildDir()).thenReturn(new File(PhpUnitConfiguration.DEFAULT_REPORT_FILE_PATH));
    assertEquals(false, sensor.shouldExecuteOnProject(project));
}