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:ddf.test.itests.AbstractIntegrationTest.java

protected Option[] configureSystemSettings() {
    return options(
            when(System.getProperty(AdminConfig.TEST_LOGLEVEL_PROPERTY) != null)
                    .useOptions(systemProperty(AdminConfig.TEST_LOGLEVEL_PROPERTY)
                            .value(System.getProperty(AdminConfig.TEST_LOGLEVEL_PROPERTY, ""))),
            when(Boolean.getBoolean("isDebugEnabled"))
                    .useOptions(vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")),
            when(System.getProperty("maven.repo.local") != null)
                    .useOptions(systemProperty("org.ops4j.pax.url.mvn.localRepository")
                            .value(System.getProperty("maven.repo.local", ""))));
}

From source file:com.streamsets.datacollector.cluster.BaseClusterProvider.java

@Override
public ApplicationState startPipeline(File outputDir, Map<String, String> sourceInfo,
        PipelineConfiguration pipelineConfiguration, PipelineConfigBean pipelineConfigBean,
        StageLibraryTask stageLibrary, CredentialStoresTask credentialStoresTask, File etcDir,
        File resourcesDir, File staticWebDir, File bootstrapDir, URLClassLoader apiCL,
        URLClassLoader containerCL, long timeToWaitForFailure, RuleDefinitions ruleDefinitions, Acl acl,
        InterceptorCreatorContextBuilder interceptorCreatorContextBuilder, List<String> blobStoreResources)
        throws IOException, TimeoutException, StageException {
    File stagingDir = new File(outputDir, "staging");
    if (!stagingDir.mkdirs() || !stagingDir.isDirectory()) {
        String msg = Utils.format("Could not create staging directory: {}", stagingDir);
        throw new IllegalStateException(msg);
    }//from  w ww  .jav a  2  s  .c  om
    try {
        return startPipelineInternal(outputDir, sourceInfo, pipelineConfiguration, pipelineConfigBean,
                stageLibrary, credentialStoresTask, etcDir, resourcesDir, staticWebDir, bootstrapDir, apiCL,
                containerCL, timeToWaitForFailure, stagingDir, ruleDefinitions, acl,
                interceptorCreatorContextBuilder, blobStoreResources);
    } finally {
        // in testing mode the staging dir is used by yarn
        // tasks and thus cannot be deleted
        if (!Boolean.getBoolean("sdc.testing-mode") && !FileUtils.deleteQuietly(stagingDir)) {
            getLog().warn("Unable to cleanup: {}", stagingDir);
        }
    }
}

From source file:com.streamsets.datacollector.cluster.ClusterProviderImpl.java

@Override
public ApplicationState startPipeline(SystemProcessFactory systemProcessFactory, File clusterManager,
        File outputDir, Map<String, String> environment, Map<String, String> sourceInfo,
        PipelineConfiguration pipelineConfiguration, StageLibraryTask stageLibrary, File etcDir,
        File resourcesDir, File staticWebDir, File bootstrapDir, URLClassLoader apiCL,
        URLClassLoader containerCL, long timeToWaitForFailure, RuleDefinitions ruleDefinitions)
        throws IOException, TimeoutException {
    File stagingDir = new File(outputDir, "staging");
    if (!stagingDir.mkdirs() || !stagingDir.isDirectory()) {
        String msg = Utils.format("Could not create staging directory: {}", stagingDir);
        throw new IllegalStateException(msg);
    }/*from w w  w.  ja v a  2s.co m*/
    try {
        return startPipelineInternal(systemProcessFactory, clusterManager, outputDir, environment, sourceInfo,
                pipelineConfiguration, stageLibrary, etcDir, resourcesDir, staticWebDir, bootstrapDir, apiCL,
                containerCL, timeToWaitForFailure, stagingDir, ruleDefinitions);
    } finally {
        // in testing mode the staging dir is used by yarn
        // tasks and thus cannot be deleted
        if (!Boolean.getBoolean("sdc.testing-mode") && !FileUtils.deleteQuietly(stagingDir)) {
            LOG.warn("Unable to cleanup: {}", stagingDir);
        }
    }
}

From source file:org.fao.geonet.util.XslUtil.java

public static String reprojectCoords(Object minx, Object miny, Object maxx, Object maxy, Object fromEpsg) {
    String ret = "";
    try {//  w ww.j ava  2  s.  co  m
        Double minxf = new Double((String) minx);
        Double minyf = new Double((String) miny);
        Double maxxf = new Double((String) maxx);
        Double maxyf = new Double((String) maxy);
        CoordinateReferenceSystem fromCrs = CRS.decode((String) fromEpsg);
        CoordinateReferenceSystem toCrs = CRS.decode("EPSG:4326");

        ReferencedEnvelope env = new ReferencedEnvelope(minxf, maxxf, minyf, maxyf, fromCrs);
        ReferencedEnvelope reprojected = env.transform(toCrs, true);

        ret = reprojected.getMinX() + "," + reprojected.getMinY() + "," + reprojected.getMaxX() + ","
                + reprojected.getMaxY();

        Element elemRet = new Element("EX_GeographicBoundingBox", ISO19139Namespaces.GMD);

        boolean forceXY = Boolean.getBoolean(System.getProperty("org.geotools.referencing.forceXY", "false"));
        Element elemminx, elemmaxx, elemminy, elemmaxy;
        if (forceXY) {
            elemminx = new Element("westBoundLongitude", ISO19139Namespaces.GMD).addContent(
                    new Element("Decimal", ISO19139Namespaces.GCO).setText("" + reprojected.getMinX()));
            elemmaxx = new Element("eastBoundLongitude", ISO19139Namespaces.GMD).addContent(
                    new Element("Decimal", ISO19139Namespaces.GCO).setText("" + reprojected.getMaxX()));
            elemminy = new Element("southBoundLatitude", ISO19139Namespaces.GMD).addContent(
                    new Element("Decimal", ISO19139Namespaces.GCO).setText("" + reprojected.getMinY()));
            elemmaxy = new Element("northBoundLatitude", ISO19139Namespaces.GMD).addContent(
                    new Element("Decimal", ISO19139Namespaces.GCO).setText("" + reprojected.getMaxY()));
        } else {
            elemminx = new Element("westBoundLongitude", ISO19139Namespaces.GMD).addContent(
                    new Element("Decimal", ISO19139Namespaces.GCO).setText("" + reprojected.getMinY()));
            elemmaxx = new Element("eastBoundLongitude", ISO19139Namespaces.GMD).addContent(
                    new Element("Decimal", ISO19139Namespaces.GCO).setText("" + reprojected.getMaxY()));
            elemminy = new Element("southBoundLatitude", ISO19139Namespaces.GMD).addContent(
                    new Element("Decimal", ISO19139Namespaces.GCO).setText("" + reprojected.getMinX()));
            elemmaxy = new Element("northBoundLatitude", ISO19139Namespaces.GMD).addContent(
                    new Element("Decimal", ISO19139Namespaces.GCO).setText("" + reprojected.getMaxX()));
        }
        elemRet.addContent(elemminx);
        elemRet.addContent(elemmaxx);
        elemRet.addContent(elemminy);
        elemRet.addContent(elemmaxy);

        ret = Xml.getString(elemRet);

    } catch (Throwable e) {
    }

    return ret;
}

From source file:org.apache.geode.cache.client.internal.PoolImpl.java

public void destroy(boolean keepAlive) {
    int cnt = getAttachCount();
    this.keepAlive = keepAlive;
    boolean SPECIAL_DURABLE = Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "SPECIAL_DURABLE");
    if (cnt > 0) {
        // special case to allow closing durable client pool under the keep alive flag
        // closing regions prior to closing pool can cause them to unregister interest
        if (SPECIAL_DURABLE) {
            synchronized (simpleLock) {
                try {
                    if (!CacheFactory.getAnyInstance().isClosed()
                            && this.getPoolOrCacheCancelInProgress() == null) {
                        Set<Region<?, ?>> regions = CacheFactory.getInstance(dsys).rootRegions();
                        for (Region<?, ?> roots : regions) {
                            Set<Region<?, ?>> subregions = roots.subregions(true);
                            for (Region<?, ?> subroots : subregions) {
                                if (!subroots.isDestroyed() && subroots.getAttributes().getPoolName() != null
                                        && subroots.getAttributes().getPoolName().equals(this.name)) {
                                    if (logger.isDebugEnabled()) {
                                        logger.debug(
                                                "PoolImpl.destroy[ Region connected count:{} Region subroot closing:{} Pool Name:{} ]",
                                                cnt, subroots.getName(), this.name);
                                    }//from  w  w w .j  av  a  2s  .c o  m
                                    subroots.close();
                                }
                            }

                            if (!roots.isDestroyed() && roots.getAttributes().getPoolName() != null
                                    && roots.getAttributes().getPoolName().equals(this.name)) {
                                if (logger.isDebugEnabled()) {
                                    logger.debug(
                                            "PoolImpl.destroy[ Region connected count:{} Region root closing:{} Pool Name:{} ]",
                                            cnt, roots.getName(), this.name);
                                }
                                roots.close();
                            }
                        }
                    }
                } catch (CacheClosedException ccex) {
                    if (logger.isDebugEnabled()) {
                        logger.debug(ccex.getMessage(), ccex);
                    }
                } catch (Exception ex) {
                    if (logger.isDebugEnabled()) {
                        logger.debug(ex.getMessage(), ex);
                    }
                }
            }
        } // end special case

        cnt = getAttachCount();
        if (cnt > 0) {
            throw new IllegalStateException(
                    LocalizedStrings.PoolImpl_POOL_COULD_NOT_BE_DESTROYED_BECAUSE_IT_IS_STILL_IN_USE_BY_0_REGIONS
                            .toLocalizedString(cnt));
        }
    }
    if (this.pm.unregister(this)) {
        basicDestroy(keepAlive);
    }
}

From source file:info.mikaelsvensson.devtools.sitesearch.SiteSearchPlugin.java

private Predicate getWordFilters() {
    Collection<Predicate> predicates = new LinkedList<Predicate>();

    predicates.add(new WordEntryNotNullFilter());

    try {//from   w  w  w  . ja  v  a  2s.  c o m
        int minWordLength = Integer.parseInt(getProperties().get(PROPERTY_SEARCHBOX_INDEX_MINWORDLENGTH));
        if (minWordLength > 0) {
            predicates.add(new WordEntryLengthFilter(minWordLength));
        }
    } catch (NumberFormatException e) {
        getLog().info("Could not convert value of " + PROPERTY_SEARCHBOX_INDEX_MINWORDLENGTH + " to a number.",
                e);
    }

    boolean excludeNumbers = Boolean.getBoolean(getProperties().get(PROPERTY_SEARCHBOX_INDEX_EXCLUDENUMBERS));
    if (excludeNumbers) {
        predicates.add(new WordEntryNoNumbersFilter());
    }

    String excludeCommonWords = getProperties().get(PROPERTY_SEARCHBOX_INDEX_EXCLUDECOMMONWORDS);
    if (!StringUtils.isEmpty(excludeCommonWords)) {
        String[] localeNames = StringUtils.split(excludeCommonWords, ',');
        predicates.add(new WordEntryBlackListFilter(localeNames));
    }

    return new AllPredicate(predicates.toArray(new Predicate[predicates.size()]));
}

From source file:com.linkedin.cubert.pig.piggybank.storage.avro.AvroStorage.java

/**
 * build a property map from a string list
 *
 * @param parts  input string list/*w  w w .java2  s . com*/
 * @return a property map
 * @throws IOException
 * @throws ParseException
 */
protected Map<String, Object> parseStringList(String[] parts) throws IOException {

    Map<String, Object> map = new HashMap<String, Object>();

    for (int i = 0; i < parts.length;) {
        String name = parts[i].trim();
        if (name.equalsIgnoreCase(NO_SCHEMA_CHECK)) {
            checkSchema = false;
            /* parameter only, so increase iteration counter by 1 */
            i += 1;
        } else if (name.equalsIgnoreCase(IGNORE_BAD_FILES)) {
            ignoreBadFiles = true;
            /* parameter only, so increase iteration counter by 1 */
            i += 1;
        } else if (name.equalsIgnoreCase(MULTIPLE_SCHEMAS)) {
            useMultipleSchemas = true;
            /* parameter only, so increase iteration counter by 1 */
            i += 1;
        } else {
            String value = parts[i + 1].trim();
            if (name.equalsIgnoreCase("debug") || name.equalsIgnoreCase("index")) {
                /* store value as integer */
                map.put(name, Integer.parseInt(value));
            } else if (name.equalsIgnoreCase("data") || name.equalsIgnoreCase("same")
                    || name.equalsIgnoreCase("schema") || name.equalsIgnoreCase("schema_file")
                    || name.equalsIgnoreCase("schema_uri") || name.matches("field\\d+")) {
                /* store value as string */
                map.put(name, value);
            } else if (name.equalsIgnoreCase("nullable")) {
                /* store value as boolean */
                map.put(name, Boolean.getBoolean(value));
            } else {
                throw new IOException("Invalid parameter:" + name);
            }
            /* parameter/value pair, so increase iteration counter by 2 */
            i += 2;
        }
    }
    return map;
}

From source file:org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.java

@Override
public CompletableFuture<Either<List<CompletionItem>, CompletionList>> completion(CompletionParams position) {
    logInfo(">> document/completion");
    CompletionHandler handler = new CompletionHandler();
    final IProgressMonitor[] monitors = new IProgressMonitor[1];
    CompletableFuture<Either<List<CompletionItem>, CompletionList>> result = computeAsync((monitor) -> {
        monitors[0] = monitor;/*from w  w  w . j  a v  a 2 s.  com*/
        if (Boolean.getBoolean(JAVA_LSP_JOIN_ON_COMPLETION)) {
            waitForLifecycleJobs(monitor);
        }
        return handler.completion(position, monitor);
    });
    result.join();
    if (monitors[0].isCanceled()) {
        result.cancel(true);
    }
    return result;
}

From source file:com.wavemaker.tools.data.ImportDB.java

private void checkGenerateHibernateConfig() {

    String s = this.properties.getProperty(GENERATE_HIBERNATE_CONFIG_SYSTEM_PROPERTY);

    if (s != null) {
        setGenerateHibernateCfg(Boolean.getBoolean(GENERATE_HIBERNATE_CONFIG_SYSTEM_PROPERTY));
    }/*  ww  w  .  ja  va2s  .co  m*/
}

From source file:com.wavemaker.tools.data.ImportDB.java

private void checkRegenerate() {

    String s = this.properties.getProperty(REGENERATE_SYSTEM_PROPERTY);

    if (s != null) {
        setRegenerate(Boolean.getBoolean(REGENERATE_SYSTEM_PROPERTY));
    }//from   w  w  w.  j  av  a 2s.  c om

}