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.eclipse.gemini.blueprint.extender.internal.support.ExtenderConfiguration.java

private boolean getProcessAnnotations(Properties properties) {
    return Boolean.valueOf(properties.getProperty(PROCESS_ANNOTATIONS_KEY))
            || Boolean.getBoolean(AUTO_ANNOTATION_PROCESSING);
}

From source file:org.xerela.server.birt.ReportJob.java

private void setupEmail(JobExecutionContext executionContext, String emailTo, String emailCc, Email email)
        throws AddressException, EmailException {
    InternetAddress[] toAddrs = InternetAddress.parse(emailTo);
    email.setTo(Arrays.asList(toAddrs));

    if (emailCc != null && emailCc.trim().length() > 0) {
        InternetAddress[] ccAddrs = InternetAddress.parse(emailCc);
        email.setCc(Arrays.asList(ccAddrs));
    }//from  w w w  .ja v  a  2 s  . c  o  m

    email.setCharset("utf-8"); //$NON-NLS-1$
    email.setHostName(System.getProperty(MAIL_HOST_PROP, "mail")); //$NON-NLS-1$
    String authUser = System.getProperty(MAIL_AUTH_USER_PROP);
    if (authUser != null) {
        email.setAuthentication(authUser, System.getProperty(MAIL_AUTH_PASSWORD_PROP));
    }
    email.setFrom(System.getProperty(MAIL_FROM_PROP), System.getProperty(MAIL_FROM_NAME_PROP));
    email.setSubject(
            Messages.bind(Messages.ReportJob_emailSubject, executionContext.getJobDetail().getFullName()));
    email.addHeader("X-Mailer", "Xerela Mailer"); //$NON-NLS-1$ //$NON-NLS-2$
    email.setDebug(Boolean.getBoolean("org.xerela.mail.debug")); //$NON-NLS-1$
}

From source file:org.apache.cassandra.db.SystemKeyspace.java

public static void forceBlockingFlush(String cfname) {
    if (!Boolean.getBoolean("cassandra.unsafesystem"))
        FBUtilities.waitOnFuture(Keyspace.open(Keyspace.SYSTEM_KS).getColumnFamilyStore(cfname).forceFlush());
}

From source file:org.springframework.osgi.extender.internal.support.ExtenderConfiguration.java

private boolean getProcessAnnotations(Properties properties) {
    return Boolean.valueOf(properties.getProperty(PROCESS_ANNOTATIONS_KEY)).booleanValue()
            || Boolean.getBoolean(AUTO_ANNOTATION_PROCESSING);
}

From source file:org.rhq.helpers.rtfilter.filter.RtFilter.java

/**
 * Initialize parameters from the web.xml filter init-params
 *
 * @param conf the filter configuration//from  w w  w . j  a  va 2s.c  o m
 */
private void initializeParameters(FilterConfig conf) throws UnavailableException {
    String chop = conf.getInitParameter(InitParams.CHOP_QUERY_STRING);
    if (chop != null) {
        this.chopUrl = Boolean.valueOf(chop.trim()).booleanValue();
    }

    String logDirectoryPath = conf.getInitParameter(InitParams.LOG_DIRECTORY);
    if (logDirectoryPath != null) {
        this.logDirectory = new File(logDirectoryPath.trim());
    } else {
        /*
         * If this is a JBossAS deployed container, or a Standalone TC container, use a logical
         * default (so those plugins can be written in a compatible way).
         * First, try to default to "${JBOSS_SERVER_HOME_DIR_SYSPROP}/JBOSSAS_SERVER_LOG_SUBDIR/rt";
         * If not set try "${TOMCAT_SERVER_HOME_DIR_SYSPROP}/TOMCAT_SERVER_LOG_SUBDIR/rt";
         * If, for some reason, neither property is set, fall back to "${java.io.tmpdir}/rhq/rt".
         */
        File serverLogDir = null;
        String serverHomeDirPath = System.getProperty(JBOSSAS_SERVER_HOME_DIR_SYSPROP);

        if (null != serverHomeDirPath) {
            serverLogDir = new File(serverHomeDirPath, JBOSSAS_SERVER_LOG_SUBDIR);
        } else {
            serverHomeDirPath = System.getProperty(TOMCAT_SERVER_HOME_DIR_SYSPROP);
            if (serverHomeDirPath != null) {
                serverLogDir = new File(serverHomeDirPath, TOMCAT_SERVER_LOG_SUBDIR);
            }
        }

        if (null != serverLogDir) {
            this.logDirectory = new File(serverLogDir, "rt");
        } else {
            this.logDirectory = new File(System.getProperty(JAVA_IO_TMPDIR_SYSPROP), "rhq/rt");
            log.warn(
                    "The 'logDirectory' filter init param was not set. Also, the standard system properties were not set ("
                            + JBOSSAS_SERVER_HOME_DIR_SYSPROP + ", " + TOMCAT_SERVER_HOME_DIR_SYSPROP
                            + "); defaulting RT log directory to '" + this.logDirectory + "'.");
        }
    }

    if (this.logDirectory.exists()) {
        if (!this.logDirectory.isDirectory()) {
            throw new UnavailableException(
                    "Log directory '" + this.logDirectory + "' exists but is not a directory.");
        }
    } else {
        try {
            this.logDirectory.mkdirs();
        } catch (Exception e) {
            throw new UnavailableException(
                    "Unable to create log directory '" + this.logDirectory + "' - cause: " + e);
        }

        if (!logDirectory.exists()) {
            throw new UnavailableException("Unable to create log directory '" + this.logDirectory + "'.");
        }
    }

    String logFilePrefixString = conf.getInitParameter(InitParams.LOG_FILE_PREFIX);
    if (logFilePrefixString != null) {
        this.logFilePrefix = logFilePrefixString.trim();
    }

    String dontLog = conf.getInitParameter(InitParams.DONT_LOG_REG_EX);
    if (dontLog != null) {
        this.dontLogPattern = Pattern.compile(dontLog.trim());
    }

    String flushTimeout = conf.getInitParameter(InitParams.TIME_BETWEEN_FLUSHES_IN_SEC);
    if (flushTimeout != null) {
        try {
            timeBetweenFlushes = Long.parseLong(flushTimeout.trim()) * 1000;
        } catch (NumberFormatException nfe) {
            timeBetweenFlushes = DEFAULT_FLUSH_TIMEOUT;
        }
    }

    String uriOnly = conf.getInitParameter(InitParams.MATCH_ON_URI_ONLY);
    if (uriOnly != null) {
        matchOnUriOnly = Boolean.getBoolean(uriOnly.trim());
    }

    String lines = conf.getInitParameter(InitParams.FLUSH_AFTER_LINES);
    if (lines != null) {
        try {
            flushAfterLines = Long.parseLong(lines.trim());
            if (flushAfterLines <= 0) {
                throw new NumberFormatException();
            }
        } catch (NumberFormatException nfe) {
            log.error("Invalid '" + InitParams.FLUSH_AFTER_LINES + "' init parameter: " + lines
                    + " (value must be a positive integer) - using default.");
            flushAfterLines = DEFAULT_FLUSH_AFTER_LINES;
        }
    }

    String maxLogFileSizeString = conf.getInitParameter(InitParams.MAX_LOG_FILE_SIZE);
    if (maxLogFileSizeString != null) {
        try {
            this.maxLogFileSize = Long.parseLong(maxLogFileSizeString.trim());
            if (this.maxLogFileSize <= 0) {
                throw new NumberFormatException();
            }
        } catch (NumberFormatException e) {
            log.error("Invalid '" + InitParams.MAX_LOG_FILE_SIZE + "' init parameter: " + maxLogFileSizeString
                    + " (value must be a positive integer) - using default.");
            this.maxLogFileSize = DEFAULT_MAX_LOG_FILE_SIZE;
        }
    }

    /*
     * Read mappings from a vhost mapping file in the format of a properties file
     * inputhost = mapped host
     * This file needs to live in the search path - e.g. in server/<config>/conf/
     * The name of it must be passed as init-param to the filter. Otherwise the mapping
     * will not be used.
     *  <param-name>vHostMappingFile</param-name>
     */
    String vhostMappingFileString = conf.getInitParameter(InitParams.VHOST_MAPPING_FILE);
    if (vhostMappingFileString != null) {
        InputStream stream = getClass().getClassLoader().getResourceAsStream(vhostMappingFileString);
        if (stream != null) {
            try {
                vhostMappings.load(stream);
            } catch (IOException e) {
                log.warn("Can't read vhost mappings from " + vhostMappingFileString + " :" + e.getMessage());
            } finally {
                if (stream != null)
                    try {
                        stream.close();
                    } catch (Exception e) {
                        log.debug(e);
                    }
            }
        } else {
            log.warn("Can't read vhost mappings from " + vhostMappingFileString);
        }
    }
}

From source file:fr.paris.lutece.plugins.directory.modules.rest.service.DirectoryRestService.java

/**
 * {@inheritDoc}//from   w  w  w.  ja  v  a 2  s  . c om
 */
@Override
public MultipartHttpServletRequest convertRequest(HttpServletRequest request)
        throws SizeLimitExceededException, FileUploadException {
    int nSizeThreshold = AppPropertiesService
            .getPropertyInt(DirectoryRestConstants.PROPERTY_MULTIPART_SIZE_THRESHOLD, -1);
    boolean bActivateNormalizeFileName = Boolean.getBoolean(
            AppPropertiesService.getProperty(DirectoryRestConstants.PROPERTY_MULTIPART_NORMALIZE_FILE_NAME));
    String strRequestSizeMax = AppPropertiesService
            .getProperty(DirectoryRestConstants.PROPERTY_MULTIPART_REQUEST_SIZE_MAX);
    long nRequestSizeMax = 0;

    if (StringUtils.isNotBlank(strRequestSizeMax) && StringUtils.isNumeric(strRequestSizeMax)) {
        nRequestSizeMax = Long.parseLong(strRequestSizeMax);
    }

    return MultipartUtil.convert(nSizeThreshold, nRequestSizeMax, bActivateNormalizeFileName, request);
}

From source file:org.craftercms.cstudio.alfresco.dm.script.DmWorkflowServiceScript.java

/**
 * get a submitted item from a JSON item
 *
 * @param site/* w  w  w. j  a v a2  s . co  m*/
 * @param item
 * @param format
 * @return
 * @throws net.sf.json.JSONException
 */
protected DmDependencyTO getSubmittedItem(String site, JSONObject item, SimpleDateFormat format,
        String globalSchDate) throws JSONException {
    PersistenceManagerService persistenceManagerService = getServicesManager()
            .getService(PersistenceManagerService.class);
    DmDependencyTO submittedItem = new DmDependencyTO();
    String uri = item.getString(JSON_KEY_URI);
    submittedItem.setUri(uri);
    boolean deleted = (item.containsKey(JSON_KEY_DELETED)) ? item.getBoolean(JSON_KEY_DELETED) : false;
    submittedItem.setDeleted(deleted);
    boolean isNow = (item.containsKey(JSON_KEY_IS_NOW)) ? item.getBoolean(JSON_KEY_IS_NOW) : false;
    submittedItem.setNow(isNow);
    boolean submittedForDeletion = (item.containsKey(JSON_KEY_SUBMITTED_FOR_DELETION))
            ? item.getBoolean(JSON_KEY_SUBMITTED_FOR_DELETION)
            : false;
    boolean submitted = (item.containsKey(JSON_KEY_SUBMITTED)) ? item.getBoolean(JSON_KEY_SUBMITTED) : false;
    boolean inProgress = (item.containsKey(JSON_KEY_IN_PROGRESS)) ? item.getBoolean(JSON_KEY_IN_PROGRESS)
            : false;
    boolean isReference = (item.containsKey(JSON_KEY_IN_REFERENCE)) ? item.getBoolean(JSON_KEY_IN_REFERENCE)
            : false;
    submittedItem.setReference(isReference);
    // boolean submittedForDeletion =
    // (item.containsKey(JSON_KEY_SUBMITTED_FOR_DELETION)) ?
    // item.getBoolean(JSON_KEY_SUBMITTED_FOR_DELETION) : false;
    submittedItem.setSubmittedForDeletion(submittedForDeletion);
    submittedItem.setSubmitted(submitted);
    submittedItem.setInProgress(inProgress);
    // TODO: check scheduled date to make sure it is not null when isNow =
    // true and also it is not past
    Date scheduledDate = null;
    if (globalSchDate != null && !StringUtils.isEmpty(globalSchDate)) {
        scheduledDate = getScheduledDate(site, format, globalSchDate);
    } else {
        if (item.containsKey(JSON_KEY_SCHEDULED_DATE)) {
            String dateStr = item.getString(JSON_KEY_SCHEDULED_DATE);
            if (!StringUtils.isEmpty(dateStr)) {
                scheduledDate = getScheduledDate(site, format, dateStr);
            }
        }
    }
    if (scheduledDate == null && isNow == false) {
        submittedItem.setNow(true);
    }
    submittedItem.setScheduledDate(scheduledDate);
    JSONArray components = (item.containsKey(JSON_KEY_COMPONENTS)) ? item.getJSONArray(JSON_KEY_COMPONENTS)
            : null;
    List<DmDependencyTO> submittedComponents = getSubmittedItems(site, components, format, globalSchDate);
    submittedItem.setComponents(submittedComponents);

    JSONArray documents = (item.containsKey(JSON_KEY_DOCUMENTS)) ? item.getJSONArray(JSON_KEY_DOCUMENTS) : null;
    List<DmDependencyTO> submittedDocuments = getSubmittedItems(site, documents, format, globalSchDate);

    submittedItem.setDocuments(submittedDocuments);
    JSONArray assets = (item.containsKey(JSON_KEY_ASSETS)) ? item.getJSONArray(JSON_KEY_ASSETS) : null;
    List<DmDependencyTO> submittedAssets = getSubmittedItems(site, assets, format, globalSchDate);
    submittedItem.setAssets(submittedAssets);

    JSONArray templates = (item.containsKey(JSON_KEY_RENDERING_TEMPLATES))
            ? item.getJSONArray(JSON_KEY_RENDERING_TEMPLATES)
            : null;
    List<DmDependencyTO> submittedTemplates = getSubmittedItems(site, templates, format, globalSchDate);
    submittedItem.setRenderingTemplates(submittedTemplates);

    JSONArray deletedItems = (item.containsKey(JSON_KEY_DELETED_ITEMS))
            ? item.getJSONArray(JSON_KEY_DELETED_ITEMS)
            : null;
    List<DmDependencyTO> deletes = getSubmittedItems(site, deletedItems, format, globalSchDate);
    submittedItem.setDeletedItems(deletes);

    JSONArray children = (item.containsKey(JSON_KEY_CHILDREN)) ? item.getJSONArray(JSON_KEY_CHILDREN) : null;
    List<DmDependencyTO> submittedChidren = getSubmittedItems(site, children, format, globalSchDate);
    submittedItem.setChildren(submittedChidren);

    DmDependencyService dmDependencyService = getServicesManager().getService(DmDependencyService.class);

    if (uri.endsWith(DmConstants.XML_PATTERN)) {
        /**
         * Get dependent pages
         */
        DmDependencyTO dmDependencyTo = dmDependencyService.getDependencies(site, null,
                item.getString(JSON_KEY_URI), false, true);
        List<DmDependencyTO> dependentPages = dmDependencyTo.getPages();
        submittedItem.setPages(dependentPages);

        /**
         * Get Dependent Documents
         */
        if (submittedItem.getDocuments() == null) {
            List<DmDependencyTO> dependentDocuments = dmDependencyTo.getDocuments();
            submittedItem.setDocuments(dependentDocuments);
        }

        /**
         * get sendEmail property if it is there
         */
        try {
            String fullPath = getFullPath(site, submittedItem);
            // PropertyValue sendEmailValue =
            // _avmService.getNodeProperty(-1, fullPath,
            // CStudioContentModel.PROP_WEB_WF_SEND_EMAIL);
            Serializable sendEmailValue = persistenceManagerService.getProperty(
                    persistenceManagerService.getNodeRef(fullPath), CStudioContentModel.PROP_WEB_WF_SEND_EMAIL);
            boolean sendEmail = (sendEmailValue != null) ? Boolean.getBoolean(sendEmailValue.toString())
                    : false;
            submittedItem.setSendEmail(sendEmail);

            String user = item.getString(JSON_KEY_USER);
            submittedItem.setSubmittedBy(user);
        } catch (Exception e) {
            e.printStackTrace(); // To change body of catch statement use
            // File | Settings | File Templates.
        }
    }

    return submittedItem;
}

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

private void checkGenerateServiceMain() {
    String s = this.properties.getProperty(GENERATE_SERVICE_MAIN_SYSTEM_PROPERTY);
    if (s != null) {
        setGenerateServiceMain(Boolean.getBoolean(GENERATE_SERVICE_MAIN_SYSTEM_PROPERTY));
    }/*w  ww.jav a 2 s  . c  o m*/
}

From source file:org.codice.ddf.itests.common.AbstractIntegrationTest.java

protected Option[] configurePaxExam() {
    return options(logLevel(LogLevelOption.LogLevel.WARN), useOwnExamBundlesStartLevel(100),
            // increase timeout for CI environment
            systemTimeout(GENERIC_TIMEOUT_MILLISECONDS),
            when(Boolean.getBoolean("keepRuntimeFolder")).useOptions(keepRuntimeFolder()), cleanCaches(true));
}

From source file:fr.ens.biologie.genomique.eoulsan.it.ITFactory.java

/**
 * Get a Boolean object from a Java System property.
 * @param property the key of the property to get
 * @return a Boolean object or false if the property does not exists
 *//*from   w  w w. j a  v  a 2 s.co  m*/
private static Boolean getBooleanFromSystemProperty(final String property) {

    return (property != null) && Boolean.getBoolean(property);
}