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:org.apache.stratos.nginx.extension.NginxContext.java

private NginxContext() {
    this.nginxPrivateIp = System.getProperty(Constants.NGINX_PRIVATE_IP);
    this.executableFilePath = System.getProperty(Constants.EXECUTABLE_FILE_PATH);
    this.templatePath = System.getProperty(Constants.TEMPLATES_PATH);
    this.templateName = System.getProperty(Constants.TEMPLATES_NAME);
    this.scriptsPath = System.getProperty(Constants.SCRIPTS_PATH);
    this.confFilePath = System.getProperty(Constants.CONF_FILE_PATH);
    this.statsSocketFilePath = System.getProperty(Constants.STATS_SOCKET_FILE_PATH);
    this.cepStatsPublisherEnabled = Boolean.getBoolean(Constants.CEP_STATS_PUBLISHER_ENABLED);
    this.thriftReceiverIp = System.getProperty(Constants.THRIFT_RECEIVER_IP);
    this.thriftReceiverPort = System.getProperty(Constants.THRIFT_RECEIVER_PORT);
    this.networkPartitionId = System.getProperty(Constants.NETWORK_PARTITION_ID);
    this.clusterId = System.getProperty(Constants.CLUSTER_ID);
    this.serviceName = System.getProperty(Constants.SERVICE_NAME);

    if (log.isDebugEnabled()) {
        log.debug(Constants.NGINX_PRIVATE_IP + " = " + nginxPrivateIp);
        log.debug(Constants.EXECUTABLE_FILE_PATH + " = " + executableFilePath);
        log.debug(Constants.TEMPLATES_PATH + " = " + templatePath);
        log.debug(Constants.TEMPLATES_NAME + " = " + templateName);
        log.debug(Constants.SCRIPTS_PATH + " = " + scriptsPath);
        log.debug(Constants.CONF_FILE_PATH + " = " + confFilePath);
        log.debug(Constants.STATS_SOCKET_FILE_PATH + " = " + statsSocketFilePath);
        log.debug(Constants.CEP_STATS_PUBLISHER_ENABLED + " = " + cepStatsPublisherEnabled);
        log.debug(Constants.THRIFT_RECEIVER_IP + " = " + thriftReceiverIp);
        log.debug(Constants.THRIFT_RECEIVER_PORT + " = " + thriftReceiverPort);
        log.debug(Constants.NETWORK_PARTITION_ID + " = " + networkPartitionId);
        log.debug(Constants.CLUSTER_ID + " = " + clusterId);
    }//from   w  ww. ja  v a  2 s.com
}

From source file:com.seajas.search.codex.service.task.ExpirationNotifierTask.java

/**
 * Send out the actual notification e-mails.
 *///from  w w w  .ja va2s  . c om
public void send() {
    if (Boolean.getBoolean("com.seajas.search.codex.notifications.disabled")) {
        logger.info(
                "Notifications have been explicitly disabled using 'com.seajas.search.codex.notifications.disabled=true'. Skipping notification expiration checks.");

        return;
    }

    logger.info("Started expiration notifier task");

    // Also use a regular date for reference, to pass to the search engine

    final Date currentDate = new Date();

    // Retrieve the list of profile profiles to attend to

    List<Identity> identities = codexService.getNotifiableIdentities(currentDate);

    if (identities.size() == 0) {
        logger.info("No notifiable identities found - finishing expiration notifier task");

        return;
    }

    // Now process the profiles using a thread-pool of at most threadMaximum threads

    ExecutorService threadPool = Executors.newFixedThreadPool(Math.min(identities.size(), threadMaximum));

    for (final Identity identity : identities)
        threadPool.submit(new Runnable() {
            @Override
            public void run() {
                List<IdentityAccount> accounts = codexService.getNotifiableAccounts(currentDate,
                        identity.getAccounts());

                for (IdentityAccount account : accounts) {
                    // Retrieve the most recently expired unreported token

                    IdentityAccountToken relevantToken = null;

                    for (IdentityAccountToken token : account.getTokens())
                        if (token.getExpireTime() > currentDate.getTime() && !token.getIsReported()) {
                            relevantToken = token;

                            break;
                        }

                    if (relevantToken == null) {
                        logger.error(
                                "No relevant token could be found - despite this account having been found to be notifiable");

                        break;
                    }

                    // Take the subject in the given language, or resort to the default language if it doesn't exist (yet)

                    String subject = null;

                    try {
                        subject = messageSource.getMessage("mail.result.subject.token.expired", null,
                                new Locale(identity.getNotifierLanguage()));
                    } catch (NoSuchMessageException e) {
                        logger.warn("Could not retrieve results message subject header in language "
                                + identity.getNotifierLanguage() + ", resorting to the default language "
                                + codexService.getDefaultApplicationLanguage());

                        subject = messageSource.getMessage("mail.confirmation.subject", null,
                                new Locale(codexService.getDefaultApplicationLanguage()));
                    }

                    // And send out the actual e-mail

                    if (!mailService.sendMessage(identity.getNotifierEmail(), subject, "TODO"))
                        logger.error(
                                "Could not e-mail the notification expiration message - attender failed to send message.");

                    // Update the processed subscribers' lastNotification indicator

                    codexService.markAccountNotified(account);
                }
            }
        });

    logger.info("Finishing expiration notifier task");
}

From source file:org.jenkinsci.remoting.protocol.impl.NetworkLayerTest.java

@DataPoints
public static BatchSendBufferingFilterLayer[] batchSizes() {
    List<BatchSendBufferingFilterLayer> result = new ArrayList<BatchSendBufferingFilterLayer>();
    if (Boolean.getBoolean("fullTests")) {
        int length = 16;
        while (length < 65536) {
            result.add(new BatchSendBufferingFilterLayer(length));
            if (length < 16) {
                length = length * 2;/*from   w ww  .  j a v  a 2  s.c o m*/
            } else {
                length = length * 3 / 2;
            }
        }
    } else {
        result.add(new BatchSendBufferingFilterLayer(16));
        result.add(new BatchSendBufferingFilterLayer(4096));
        result.add(new BatchSendBufferingFilterLayer(65536));
    }
    return result.toArray(new BatchSendBufferingFilterLayer[result.size()]);
}

From source file:org.sakaiproject.importer.impl.translators.Bb6AnnouncementTranslator.java

public Importable translate(Node resourceNode, Document descriptor, String contextPath,
        String archiveBasePath) {
    // create a new generic object to return
    Announcement item = new Announcement();

    // this sets the display category of this item apparently (the one the user will see)
    item.setLegacyGroup(item.getDisplayType());

    // Dates from Bb are formatted like '2007-05-08 23:45:00 EDT'
    DateFormat df = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss zzz");
    String bbid = XPathHelper.getNodeValue("/ANNOUNCEMENT/@id", descriptor);

    // populate the generic object fields
    item.setTitle(XPathHelper.getNodeValue("/ANNOUNCEMENT/TITLE/@value", descriptor));
    item.setDescription(XPathHelper.getNodeValue("/ANNOUNCEMENT/DESCRIPTION/TEXT", descriptor));

    item.setHtml(Boolean.getBoolean(XPathHelper.getNodeValue("/ANNOUNCEMENT/FLAGS/ISHTML/@value", descriptor)));
    item.setLiternalNewline(Boolean
            .getBoolean(XPathHelper.getNodeValue("/ANNOUNCEMENT/FLAGS/ISNEWLINELITERAL/@value", descriptor)));
    item.setPermanent(//from www  .  jav a2 s.  c  o  m
            Boolean.getBoolean(XPathHelper.getNodeValue("/ANNOUNCEMENT/ISPERMANENT/@value", descriptor)));

    // attempt to parse the start date
    try {
        Date d = df.parse(XPathHelper.getNodeValue("/ANNOUNCEMENT/DATES/RESTRICTSTART/@value", descriptor));
        item.setStart(d);
    } catch (ParseException e) {
        // report it but continue
        log.warn("Could not parse date startdate for " + bbid + ": " + e.toString());
    }

    // attempt to parse the end date
    try {
        Date d = df.parse(XPathHelper.getNodeValue("/ANNOUNCEMENT/DATES/RESTRICTEND/@value", descriptor));
        item.setEnd(d);
    } catch (ParseException e) {
        // report it but continue
        log.warn("Could not parse date enddate for " + bbid + ": " + e.toString());
    }

    log.info("Translation complete for BB6 announcement item:" + bbid);
    log.debug("Announcement item: " + item.toString());
    item.setLegacyGroup(Blackboard6FileParser.ANNOUNCEMENT_GROUP);
    return item;
}

From source file:org.codehaus.castor.maven.xmlctf.AbstractTestSuiteMojo.java

public void execute() throws MojoExecutionException, MojoFailureException {

    boolean skipMavenTests = Boolean.getBoolean("maven.test.skip");
    skipMavenTests |= Boolean.getBoolean("skipTests");
    skipMavenTests |= Boolean.getBoolean("skipITs");

    if (skipMavenTests) {
        if (getLog().isInfoEnabled()) {
            getLog().info("Skipping XML CTF tests as per configuration.");
        }/*from  w w  w . j a  va  2  s . c o  m*/
        return;
    }

    getLog().info("Starting Castor Mastertestsuite");

    // testRoot checks
    getLog().info("testRoot = " + testRoot);
    String testRootToUse = System.getProperty(TEST_ROOT_PROPERTY);
    if (testRootToUse == null) {
        testRootToUse = testRoot;
    }

    if (testRootToUse == null) {
        throw new MojoExecutionException("No testroot found, please specify property -Dcastor.xmlctf.root");
    }

    if (testRootToUse.equals(".") || testRootToUse.equals("..")) {
        // -- convert relative directories "." and ".." to a Canonical path
        File tmp = new File(testRootToUse);
        try {
            testRootToUse = tmp.getCanonicalPath();
        } catch (java.io.IOException iox) {

        }
    } else if (testRootToUse.startsWith("./") || testRootToUse.startsWith(".\\")) {
        // -- Remove leading ./ or .\ -- URLClassLoader can't handle such
        // file URLs
        testRoot = testRoot.substring(2);
    }

    File testRootFile = new File(testRootToUse);
    getLog().info("using testRoot: " + testRootFile.getAbsolutePath());

    if (!testRootFile.exists()) {
        throw new MojoExecutionException("Root not found:" + testRoot);
    }

    // set classpath for testcompiler
    // TODO
    String dirSeparator = System.getProperty("file.separator");
    StringBuilder classpath = new StringBuilder();
    String pathSeparator = System.getProperty("path.separator");
    for (@SuppressWarnings("unchecked")
    Iterator<Artifact> iter = project.getArtifacts().iterator(); iter.hasNext();) {
        classpath.append(((Artifact) iter.next()).getFile().getAbsolutePath());
        classpath.append(pathSeparator);
    }

    classpath.append(project.getBuild().getTestOutputDirectory());
    classpath.append(pathSeparator);

    if (pathToTools != null) {
        getLog().info("Usage of -DpathToTools !");
        classpath.append(pathToTools + pathSeparator + "tools.jar");
    } else {
        String javaHome = System.getProperty("java.home");
        classpath.append(javaHome);
        classpath.append(dirSeparator);
        classpath.append("lib");
        classpath.append(dirSeparator);
        classpath.append("tools.jar");
        classpath.append(pathSeparator);
        classpath.append(javaHome.substring(0, javaHome.lastIndexOf("/jre")) + dirSeparator + "lib"
                + dirSeparator + "tools.jar");
        classpath.append(pathSeparator);
    }

    // set system proerties for
    System.setProperty("xmlctf.classpath.override", classpath.toString());
    if (getLog().isDebugEnabled()) {
        System.setProperty(TestCaseAggregator.VERBOSE_PROPERTY, "true");
        System.setProperty(TestCaseAggregator.PRINT_STACK_TRACE, "true");
    }

    getLog().info("classpath for sourcegenerator is: " + classpath);
    String[] classpathEntries = StringUtils.split(classpath.toString(), ';');
    for (String classpathEntry : classpathEntries) {
        getLog().info(classpathEntry);
    }

    // run testCase
    TestCaseAggregator aggregator = new TestCaseAggregator(testRootFile, outputRoot);
    // aggregator.
    runJUnit(aggregator.suite());
}

From source file:com.hypersocket.repository.AbstractRepositoryImpl.java

private void checkDemoMode() {
    if (Boolean.getBoolean("hypersocket.demo") && !requiresDemoWrite) {
        throw new IllegalStateException(
                "This is a demo. No changes to resources or settings can be persisted.");
    }//  www  .  j  av a 2  s .c  o  m
}

From source file:org.apache.stratos.lvs.extension.LVSContext.java

private LVSContext() {
    this.lvsPrivateIp = System.getProperty(Constants.LVS_PRIVATE_IP);
    this.executableFilePath = System.getProperty(Constants.EXECUTABLE_FILE_PATH);
    this.templatePath = System.getProperty(Constants.TEMPLATES_PATH);
    this.templateName = System.getProperty(Constants.TEMPLATES_NAME);
    this.scriptsPath = System.getProperty(Constants.SCRIPTS_PATH);
    this.confFilePath = System.getProperty(Constants.CONF_FILE_PATH);
    this.statsSocketFilePath = System.getProperty(Constants.STATS_SOCKET_FILE_PATH);
    this.cepStatsPublisherEnabled = Boolean.getBoolean(Constants.CEP_STATS_PUBLISHER_ENABLED);
    this.thriftReceiverIp = System.getProperty(Constants.THRIFT_RECEIVER_IP);
    this.thriftReceiverPort = System.getProperty(Constants.THRIFT_RECEIVER_PORT);
    this.networkPartitionId = System.getProperty(Constants.NETWORK_PARTITION_ID);
    this.clusterId = System.getProperty(Constants.CLUSTER_ID);
    this.serviceName = System.getProperty(Constants.SERVICE_NAME);
    this.virtualIPsForServices = System.getProperty(Constants.VIRTUALIPS_FOR_SERVICES);
    this.keepAlivedStartCommand = Constants.KEEPALIVED_START_COMMAND;
    this.serverState = System.getProperty(Constants.SERVER_STATE);
    this.lvsScheduleAlgo = System.getProperty(Constants.LVS_SCHEDULE_ALGO);

    if (log.isDebugEnabled()) {
        log.debug(Constants.LVS_PRIVATE_IP + " = " + lvsPrivateIp);
        log.debug(Constants.EXECUTABLE_FILE_PATH + " = " + executableFilePath);
        log.debug(Constants.TEMPLATES_PATH + " = " + templatePath);
        log.debug(Constants.TEMPLATES_NAME + " = " + templateName);
        log.debug(Constants.SCRIPTS_PATH + " = " + scriptsPath);
        log.debug(Constants.CONF_FILE_PATH + " = " + confFilePath);
        log.debug(Constants.STATS_SOCKET_FILE_PATH + " = " + statsSocketFilePath);
        log.debug(Constants.CEP_STATS_PUBLISHER_ENABLED + " = " + cepStatsPublisherEnabled);
        log.debug(Constants.THRIFT_RECEIVER_IP + " = " + thriftReceiverIp);
        log.debug(Constants.THRIFT_RECEIVER_PORT + " = " + thriftReceiverPort);
        log.debug(Constants.NETWORK_PARTITION_ID + " = " + networkPartitionId);
        log.debug(Constants.CLUSTER_ID + " = " + clusterId);
        log.debug(Constants.VIRTUALIPS_FOR_SERVICES + " = " + virtualIPsForServices);
        log.debug(Constants.LVS_SCHEDULE_ALGO + " = " + lvsScheduleAlgo);
    }/*  w  w w  .  j  a va2  s .co  m*/
}

From source file:no.abmu.finances.domain.BoolPostData.java

public void setValueAsString(String value) {
    setValue(Boolean.valueOf(Boolean.getBoolean(value)));
}

From source file:com.twinsoft.convertigo.beans.statements.CookiesAddStatement.java

protected void addCookie(HttpState httpState, String cook) {
    String name = "";
    String domain = "";
    String path = "";
    String value = "";
    boolean secure = false;
    Date expires = new Date(Long.MAX_VALUE);

    String[] fields = cook.split(";");
    for (int i = 0; i < fields.length; i++) {
        String[] half = fields[i].trim().split("=");
        if (half.length == 2) {
            if (fields[i].startsWith("$")) {
                if (half[0].equals("$Domain"))
                    domain = half[1];//  w  ww .  j  a  va 2  s.c om
                else if (half[0].equals("$Path"))
                    path = half[1];
                else if (half[0].equals("$Secure"))
                    secure = Boolean.getBoolean(half[1]);
                else if (half[0].equals("$Date"))
                    try {
                        expires = DateFormat.getDateTimeInstance().parse(half[1]);
                    } catch (ParseException e) {
                    }
            } else {
                name = half[0];
                value = half[1];
            }
        }
    }

    Cookie cookie = null;
    try {
        cookie = new Cookie(domain, name, value, path, expires, secure);
        if (cookie != null)
            httpState.addCookie(cookie);
    } catch (Exception e) {
        Engine.logBeans.debug("(CookiesAdd) failed to parse those cookies : " + cook);
    }
}

From source file:org.sbs.goodcrawler.fetcher.FailedPageBackup.java

public void init() {
    ignoreFailedPage = Boolean.getBoolean(config.getString(GlobalConstants.ignoreFailedPages, "true"));
    if (!ignoreFailedPage) {
        Queue = new LinkedBlockingDeque<Page>(config.getInt(GlobalConstants.failedPagesQueueSize, 2000));
        // //from w  w w . ja v a  2 s . com
        BackupFailedPages backup = new BackupFailedPages();
        Thread failedPagesBackupThread = new Thread(backup, "failed-pages-backup-thread");
        ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
        scheduler.scheduleAtFixedRate(failedPagesBackupThread, 60, 60, TimeUnit.SECONDS);
    }
}