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:gov.va.isaac.mojos.profileSync.ProfilesMojoBase.java

protected boolean skipRun() {
    if (Boolean.getBoolean(PROFILE_SYNC_DISABLE)) {
        return true;
    }/*from w  w w  . ja v  a 2 s.  co  m*/
    if (StringUtils.isBlank(config_.getChangeSetUrl())) {
        getLog().info("No SCM configuration will be done - no 'changeSetUrl' parameter was provided");
        return true;
    } else {
        return false;
    }
}

From source file:com.redhat.victims.VictimsConfig.java

/**
 * A client option to check if it's cache has to be purged.
 * //  w  w w.  j a v a2  s.c  o  m
 * @return
 */
public static boolean purgeCache() {
    return Boolean.getBoolean(Key.PURGE_CACHE);
}

From source file:org.testeditor.dsl.common.util.MavenExecutor.java

private List<String> createMavenExecCommand(String parameters, String testParam) {
    List<String> command = new ArrayList<String>();
    command.addAll(getExecuteMavenScriptCommand(getPathToMavenHome(), parameters, testParam,
            SystemUtils.IS_OS_WINDOWS));
    if (Boolean.getBoolean("te.workOffline")) {
        command.add("-o");
    }//ww  w  .ja va2  s . c  om
    return command;
}

From source file:com.netflix.curator.ConnectionState.java

private synchronized void checkTimeouts() throws Exception {
    long elapsed = System.currentTimeMillis() - connectionStartMs;
    if (elapsed >= Math.min(sessionTimeoutMs, connectionTimeoutMs)) {
        if (zooKeeper.hasNewConnectionString()) {
            handleNewConnectionString();
        } else if (elapsed > sessionTimeoutMs) {
            if (!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES)) {
                log.warn(String.format(
                        "Connection attempt unsuccessful after %d (greater than session timeout of %d). Resetting connection and trying again with a new connection.",
                        elapsed, sessionTimeoutMs));
            }/*  w ww  .  j av  a 2 s .  c  om*/
            reset();
        } else {
            KeeperException.ConnectionLossException connectionLossException = new KeeperException.ConnectionLossException();
            if (!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES)) {
                log.error(String.format(
                        "Connection timed out for connection string (%s) and timeout (%d) / elapsed (%d)",
                        zooKeeper.getConnectionString(), connectionTimeoutMs, elapsed),
                        connectionLossException);
            }
            tracer.get().addCount("connections-timed-out", 1);
            throw connectionLossException;
        }
    }
}

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

private void init() {
    project = mock(Project.class);
    config = mock(Configuration.class);

    when(config.getString(REPORT_FILE_NAME_PROPERTY_KEY, DEFAULT_REPORT_FILE_NAME))
            .thenReturn("punit.summary.xml");
    when(config.getString(REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY,
            PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_PATH)).thenReturn("/log");
    String file = "phpunit.coverage.xml";
    when(config.getString(COVERAGE_REPORT_FILE_PROPERTY_KEY,
            PhpUnitConfiguration.PHPUNIT_DEFAULT_COVERAGE_REPORT_FILE)).thenReturn(file);
    when(config.getBoolean(SHOULD_RUN_PROPERTY_KEY,
            Boolean.getBoolean(PhpUnitConfiguration.PHPUNIT_DEFAULT_SHOULD_RUN))).thenReturn(true);
    when(project.getConfiguration()).thenReturn(config);
    MavenProject mavenProject = mock(MavenProject.class);
    ProjectFileSystem fs = mock(ProjectFileSystem.class);
    when(project.getFileSystem()).thenReturn(fs);
    when(fs.getBuildDir()).thenReturn(new File(PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_PATH));
    when(project.getPom()).thenReturn(mavenProject);
    when(project.getFileSystem()).thenReturn(fs);
    when(fs.getSourceDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\main")));
    when(fs.getTestDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\test")));
}

From source file:models.Search.java

private Pair<List<Document>, Long> doSearch() {
    validateSearchParameters();//w w w.jav  a 2 s  .c  o m

    final QueryBuilder queryBuilder = createQuery();
    Logger.trace("Using query: " + queryBuilder);
    final SearchResponse response = search(queryBuilder,
            Boolean.getBoolean(parameters.get(Parameter.SCROLL)) ? SearchType.SCAN
                    : SearchType.DFS_QUERY_THEN_FETCH);
    Logger.trace("Got response: " + response);
    final SearchHits hits = response.getHits();
    final List<Document> docs = asDocuments(hits, fields(parameters));
    final Pair<List<Document>, Long> result = new ImmutablePair<>(docs, hits.getTotalHits());
    Logger.debug(
            String.format("Got %s hits overall, created %s matching docs", hits.getTotalHits(), docs.size()));
    return result;
}

From source file:nl.strohalm.cyclos.setup.Setup.java

public boolean execute() {
    checkBundle();/*  w w w  .j a  v a  2s .c  o  m*/

    if (!isValid()) {
        throw new IllegalStateException("Nothing to execute");
    }

    // Prompt for confirmation if not forced
    if (!force && !promptConfirm()) {
        return false;
    }

    // Configure Hibernate if necessary
    if (configuration == null || sessionFactory == null) {
        throw new IllegalStateException("Persistence not configured");
    }
    // Execute the actions
    session = sessionFactory.openSession();
    final Transaction transaction = session.beginTransaction();
    try {
        if (createDataBase) {
            new CreateDataBase(this).run();
        }
        if (exportScriptTo != null) {
            new ExportScript(this, exportScriptTo).run();
        }
        if (createSetupData) {
            new CreateBasicData(this, true).run();
        }
        if (createBasicData) {
            new CreateBasicData(this, false).run();
        }
        if (createInitialData) {
            new CreateInitialData(this).run();
        }
        if (createSmsData) {
            new CreateSmsData(this).run();
        }
        transaction.commit();
        out.println(bundle.getString("setup.end"));

        if (Boolean.getBoolean("cyclos.standalone")) {
            System.out.println(bundle.getString("setup.standalone.starting"));
        }

        return true;
    } catch (final Exception e) {
        transaction.rollback();
        e.printStackTrace(out);
        return false;
    } finally {
        try {
            session.close();
        } catch (final Exception e) {
            out.println("Error closing session: " + e);
        }
    }
}

From source file:org.artifactory.webapp.servlet.ArtifactoryContextConfigListener.java

@Override
public void contextInitialized(ServletContextEvent event) {
    final ServletContext servletContext = event.getServletContext();

    setSessionTrackingMode(servletContext);

    final Thread initThread = new Thread("art-init") {
        boolean success = true;

        @SuppressWarnings({ "unchecked" })
        @Override//from  ww  w.  j a v  a2  s.co m
        public void run() {
            try {
                //Use custom logger
                String contextId = HttpUtils.getContextId(servletContext);
                //Build a partial config, since we expect the logger-context to exit in the selector cache by only contextId
                LoggerConfigInfo configInfo = new LoggerConfigInfo(contextId);
                LogbackContextSelector.bindConfig(configInfo);
                //No log field since needs to lazy initialize only after logback customization listener has run
                Logger log = getLogger();
                configure(servletContext, log);

                LogbackContextSelector.unbindConfig();
            } catch (Exception e) {
                getLogger().error(
                        "Application could not be initialized: " + ExceptionUtils.getRootCause(e).getMessage(),
                        e);
                success = false;
            } finally {
                if (success) {
                    //Run the waiting filters
                    BlockingQueue<DelayedInit> waitingFiltersQueue = (BlockingQueue<DelayedInit>) servletContext
                            .getAttribute(DelayedInit.APPLICATION_CONTEXT_LOCK_KEY);
                    List<DelayedInit> waitingInits = new ArrayList<>();
                    waitingFiltersQueue.drainTo(waitingInits);
                    for (DelayedInit filter : waitingInits) {
                        try {
                            filter.delayedInit();
                        } catch (ServletException e) {
                            getLogger().error("Could not init {}.", filter.getClass().getName(), e);
                            success = false;
                            break;
                        }
                    }
                }
                //Remove the lock and open the app to requests
                servletContext.removeAttribute(DelayedInit.APPLICATION_CONTEXT_LOCK_KEY);
            }
        }
    };
    initThread.setDaemon(true);
    servletContext.setAttribute(DelayedInit.APPLICATION_CONTEXT_LOCK_KEY,
            new LinkedBlockingQueue<DelayedInit>());
    initThread.start();
    if (Boolean.getBoolean("artifactory.init.useServletContext")) {
        try {
            getLogger().info("Waiting for servlet context initialization ...");
            initThread.join();
        } catch (InterruptedException e) {
            getLogger().error("Artifactory initialization thread got interrupted", e);
        }
    }
}

From source file:com.hypersocket.server.HypersocketServerImpl.java

@Override
public int getHttpPort() {
    return Boolean.getBoolean("hypersocket.development") ? 8080 : configurationService.getIntValue("http.port");
}

From source file:org.openengsb.ports.jms.JMSIncomingPort.java

private FilterChain getFilterChainToUse() {
    if (Boolean.getBoolean(DISABLE_ENCRYPTION)) {
        return unsecureFilterChain;
    }
    return filterChain;
}