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:it.greenvulcano.gvesb.j2ee.db.connections.impl.DriverPoolConnectionBuilder.java

public void init(Node node) throws GVDBException {
    try {//w  w  w.j  a v  a  2  s .  c  om
        name = XMLConfig.get(node, "@name");

        user = XMLConfig.get(node, "@user", null);
        password = XMLConfig.getDecrypted(node, "@password", null);
        url = XMLConfig.get(node, "@url");
        try {
            debugJDBCConn = Boolean.getBoolean(
                    "it.greenvulcano.gvesb.j2ee.db.connections.impl.ConnectionBuilder.debugJDBCConn");
        } catch (Exception exc) {
            debugJDBCConn = false;
        }

        Node poolNode = XMLConfig.getNode(node, "PoolParameters");
        connectionPool = new GenericObjectPool(null);
        connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
        connectionPool.setMaxWait(XMLConfig.getLong(poolNode, "@maxWait", 30) * 1000);

        connectionPool.setMinIdle(XMLConfig.getInteger(poolNode, "@minIdle", 5));
        connectionPool.setMaxIdle(XMLConfig.getInteger(poolNode, "@maxIdle", 10));
        connectionPool.setMaxActive(XMLConfig.getInteger(poolNode, "@maxActive", 15));
        connectionPool.setTimeBetweenEvictionRunsMillis(
                XMLConfig.getLong(poolNode, "@timeBetweenEvictionRuns", 300) * 1000);
        connectionPool.setMinEvictableIdleTimeMillis(
                XMLConfig.getLong(poolNode, "@minEvictableIdleTime", 300) * 1000);
        connectionPool.setNumTestsPerEvictionRun(XMLConfig.getInteger(poolNode, "@numTestsPerEvictionRun", 3));
        if (XMLConfig.exists(poolNode, "validationQuery")) {
            validationQuery = XMLConfig.get(poolNode, "validationQuery");
        }
    } catch (Exception exc) {
        throw new GVDBException("DriverPoolConnectionBuilder - Initialization error", exc);
    }

    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(url, user, password);
    new PoolableConnectionFactory(connectionFactory, connectionPool, null, validationQuery, false, true);

    dataSource = new PoolingDataSource(connectionPool);

    logger.debug("Crated DriverPoolConnectionBuilder(" + name + "). - user: " + user
            + " - password: ********* - url: " + url + " - Pool: [" + connectionPool.getMinIdle() + "/"
            + connectionPool.getMaxIdle() + "/" + connectionPool.getMaxActive() + "]");
}

From source file:org.wso2.carbon.analytics.dataservice.core.AnalyticsDataPurgingDeployer.java

@Override
public void deployArtifacts(CarbonApplication carbonApplication, AxisConfiguration axisConfiguration)
        throws DeploymentException {
    if (Boolean.getBoolean(Constants.DISABLE_ANALYTICS_DATA_PURGING_JVM_OPTION)) {
        if (log.isDebugEnabled()) {
            log.debug("Purging task not scheduling through CApp.");
        }/*from  www  . ja  v  a  2  s .c o  m*/
        return;
    }
    List<Artifact.Dependency> artifacts = carbonApplication.getAppConfig().getApplicationArtifact()
            .getDependencies();
    // loop through all artifacts
    for (Artifact.Dependency dep : artifacts) {
        Artifact artifact = dep.getArtifact();
        if (artifact == null) {
            continue;
        }
        if (TYPE.equals(artifact.getType())) {
            List<CappFile> files = artifact.getFiles();
            if (files.size() == 1) {
                String fileName = files.get(0).getName();
                String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
                try {
                    registerPurgingTasks(artifactPath);
                    artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED);
                } catch (DeploymentException e) {
                    artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
                    throw e;
                }
            } else if (files.size() != 0) {
                log.warn("Purging artifact must have a single XML file to be deployed. But " + files.size()
                        + " " + "files found");
            }
        }
    }
}

From source file:org.apache.stratos.common.concurrent.locks.ReadWriteLock.java

public ReadWriteLock(String name) {
    this.name = name;
    this.lock = new ReentrantReadWriteLock(true);
    this.threadToLockSetMap = new ConcurrentHashMap<Long, Map<LockType, LockMetadata>>();

    readWriteLockMonitorEnabled = Boolean.getBoolean("read.write.lock.monitor.enabled");
    if (readWriteLockMonitorEnabled) {
        // Schedule read write lock monitor
        readWriteLockMonitorInterval = Integer.getInteger("read.write.lock.monitor.interval", 30000);
        threadPoolSize = Integer.getInteger(READ_WRITE_LOCK_MONITOR_THREAD_POOL_SIZE_KEY, 10);

        ScheduledExecutorService scheduledExecutorService = StratosThreadPool
                .getScheduledExecutorService(READ_WRITE_LOCK_MONITOR_THREAD_POOL, threadPoolSize);
        scheduledExecutorService.scheduleAtFixedRate(new ReadWriteLockMonitor(this),
                readWriteLockMonitorInterval, readWriteLockMonitorInterval, TimeUnit.MILLISECONDS);
        if (log.isDebugEnabled()) {
            log.debug(String.format("Lock monitor scheduled: [lock-name] %s [interval] %d seconds", name,
                    (readWriteLockMonitorInterval / 1000)));
        }//from  www .ja  v  a2s  . c  om
    }
}

From source file:com.ericsson.eiffel.remrem.generate.cli.CLIOptions.java

/**
 * Wrapper to call system exit making class easier to test.
 * @param errorCode//w w w  .j a va  2 s.c  o  m
 */
public static void exit(int errorCode) {
    boolean testMode = Boolean.getBoolean(PropertiesConfig.TEST_MODE);
    if (testMode)
        addErrorCode(errorCode);
    else
        System.exit(errorCode);
}

From source file:org.apache.stratos.common.statistics.publisher.wso2.cep.WSO2CEPStatisticsPublisher.java

/**
 * Credential information stored inside thrift-client-config.xml file
 * is parsed and assigned into ip,port,username and password fields
 *
 * @param streamDefinition//from  w w w.j  a v a 2  s  .  c om
 */
public WSO2CEPStatisticsPublisher(StreamDefinition streamDefinition) {
    ThriftClientConfig thriftClientConfig = ThriftClientConfig.getInstance();
    thriftClientConfig.getThriftClientInfo();

    this.streamDefinition = streamDefinition;
    this.ip = thriftClientConfig.getThriftClientInfo().getIp();
    this.port = thriftClientConfig.getThriftClientInfo().getPort();
    this.username = thriftClientConfig.getThriftClientInfo().getUsername();
    this.password = thriftClientConfig.getThriftClientInfo().getPassword();

    enabled = Boolean.getBoolean("cep.stats.publisher.enabled");
    if (enabled) {
        init();
    }
}

From source file:com.hadoop.compression.fourmc.FourMcNativeCodeLoader.java

private static boolean useBinariesOnLibPath() {
    return Boolean.getBoolean(USE_BINARIES_ON_LIB_PATH);
}

From source file:org.geowebcache.storage.MetastoreRemover.java

public MetastoreRemover(DefaultStorageFinder finder) throws Exception {
    this.storageFinder = finder;
    File root = new File(storageFinder.getDefaultPath());
    Connection conn = null;//from w  ww.  j  av a 2s. c o m
    try {
        conn = getMetaStoreConnection(root);
        if (conn != null) {
            log.info("Migrating the old metastore to filesystem storage");
            SingleConnectionDataSource ds = new SingleConnectionDataSource(conn, false);
            JdbcTemplate template = new JdbcTemplate(ds);

            // maybe we should make this optional?
            boolean migrateCreationDates = Boolean.getBoolean("MIGRATE_CREATION_DATES");
            if (migrateCreationDates) {
                migrateTileDates(template, new FilePathGenerator(root.getPath()));
            }
            migrateParameters(template, root);
            // remove all the tiles from storage to avoid further migration attempts
            // in the future, but only if the old metastore was external to the data dir
            if (!defaultLocation) {
                removeTiles(template);
            }
        }
    } finally {
        if (conn != null) {
            conn.close();
        }
    }

    // wipe out the entire database if the db location is the default one
    if (defaultLocation) {
        File dbFile = getDefaultH2Path(root).getParentFile();
        if (dbFile.exists()) {
            log.info("Cleaning up the old H2 database");
            FileUtils.deleteDirectory(dbFile);
        }
    }

    // remove disk quota if necessary (this we have to do regardless as we changed the 
    // structure of the params from int to string)
    String path = root.getPath() + File.separator + "diskquota_page_store";
    File quotaRoot = new File(path);
    if (quotaRoot.exists()) {
        File version = new File(quotaRoot, "version.txt");
        if (!version.exists()) {
            log.warn("Old style DiskQuota database found, removing it.");
            FileUtils.deleteDirectory(quotaRoot);
        }
    }
}

From source file:com.iggroup.oss.restdoclet.doclet.type.builder.RequestParameterBuilder.java

/**
 * Initialises the required value of this parameter.
 * /*from w  w w  .j av a 2 s .c o  m*/
 * @param param the parameter's Java documentation object.
 * @param tags the Java documentation tags of the parameters of the method
 *           this parameter belongs to.
 */
private void initRequired(RequestParameter type, final Parameter param) {
    final AnnotationValue value = elementValue(param, RequestParam.class, "required");
    if (value != null) {
        type.setRequired(Boolean.getBoolean(value.value().toString().trim()));
    }

}

From source file:org.openconcerto.erp.utils.ActionDB.java

/**
 * Cration d'une socit  partir de la base GestionDefault
 * /*from   ww  w  .  ja  v a  2s  . c om*/
 * @param baseDefault nom de la base par dfaut
 * @param newBase nom de la nouvelle base
 */
public static void dupliqueDB(String baseDefault, String newBase, StatusListener l) {
    final DBSystemRoot sysRoot = Configuration.getInstance().getSystemRoot();

    // FIXME ADD TRIGGER TO UPDATE SOLDE COMPTE_PCE
    // ComptaPropsConfiguration instance = ComptaPropsConfiguration.create();
    // Configuration.setInstance(instance);

    try {
        log(l, "Cration du schma");
        if (!sysRoot.getChildrenNames().contains(baseDefault)) {
            sysRoot.addRootToMap(baseDefault);
            sysRoot.refetch(Collections.singleton(baseDefault));
        }
        final DBRoot baseSQLDefault = sysRoot.getRoot(baseDefault);
        log(l, "Traitement des " + baseSQLDefault.getChildrenNames().size() + " tables");

        final SQLCreateRoot createRoot = baseSQLDefault.getDefinitionSQL(sysRoot.getServer().getSQLSystem());
        final SQLDataSource ds = sysRoot.getDataSource();
        // be safe don't add DROP SCHEMA
        final List<String> sql = createRoot.asStringList(newBase, false, true,
                EnumSet.of(ConcatStep.ADD_FOREIGN));
        // create root
        ds.execute(sql.get(0));
        // create tables (without constraints)
        ds.execute(sql.get(1));
        sysRoot.addRootToMap(newBase);
        // TODO find a more functional way
        final boolean origVal = Boolean.getBoolean(SQLSchema.NOAUTO_CREATE_METADATA);
        if (!origVal)
            System.setProperty(SQLSchema.NOAUTO_CREATE_METADATA, "true");
        sysRoot.refetch(Collections.singleton(newBase));
        if (!origVal)
            System.setProperty(SQLSchema.NOAUTO_CREATE_METADATA, "false");
        final DBRoot baseSQLNew = sysRoot.getRoot(newBase);

        final Set<SQLTable> newTables = baseSQLNew.getTables();
        int i = 0;
        for (final SQLTable table : newTables) {
            String tableName = table.getName();

            log(l, "Copie de la table " + tableName + " " + (i + 1) + "/" + newTables.size());
            // Dump Table
            dumpTable(baseSQLDefault, table);
            log(l, "Table " + tableName + " " + (i + 1) + "/" + newTables.size() + " OK");
            i++;
        }
        // create constraints
        ds.execute(sql.get(2));
        assert sql.size() == 3;

        if (sysRoot.getServer().getSQLSystem() == SQLSystem.POSTGRESQL) {
            log(l, "Maj des squences des tables");
            new FixSerial(sysRoot).changeAll(baseSQLNew);
        }

        log(l, "Duplication termine");

    } catch (Throwable e) {
        e.printStackTrace();
        ExceptionHandler.handle("Erreur pendant la cration de la base!", e);
        log(l, "Erreur pendant la duplication");
    }

}

From source file:play.modules.elasticsearch.ElasticSearchPlugin.java

/**
 * Checks if is local mode.// w  w  w.  ja v  a 2s.  c  o m
 * 
 * @return true, if is local mode
 */
private boolean isLocalMode() {
    try {
        String client = Play.configuration.getProperty("elasticsearch.client");
        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 (Exception e) {
        Logger.error("Error! Starting in Local Model: %s", ExceptionUtil.getStackTrace(e));
        return true;
    }
}