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.openscore.worker.management.services.SimpleExecutionRunnable.java

public SimpleExecutionRunnable(ExecutionService executionService, OutboundBuffer outBuffer, InBuffer inBuffer,
        ExecutionMessageConverter converter, EndExecutionCallback endExecutionCallback,
        QueueStateIdGeneratorService queueStateIdGeneratorService, String workerUUID,
        WorkerConfigurationService workerConfigurationService) {
    this.executionService = executionService;
    this.outBuffer = outBuffer;
    this.inBuffer = inBuffer;
    this.converter = converter;
    this.endExecutionCallback = endExecutionCallback;
    this.queueStateIdGeneratorService = queueStateIdGeneratorService;
    this.workerUUID = workerUUID;
    this.workerConfigurationService = workerConfigurationService;

    this.isRecoveryDisabled = Boolean.getBoolean("is.recovery.disabled");
}

From source file:com.unboundid.scim.marshal.json.JsonParser.java

/**
 * Read a SCIM resource from the specified JSON object.
 *
 * @param <R> The type of resource instance.
 * @param jsonObject  The JSON object to be read.
 * @param resourceDescriptor The descriptor of the SCIM resource to be read.
 * @param resourceFactory The resource factory to use to create the resource
 *                        instance.// ww  w.j  a v  a  2 s  .  co m
 * @param defaultSchemas  The set of schemas used by attributes of the
 *                        resource, or {@code null} if the schemas must be
 *                        provided in the resource object.
 *
 * @return  The SCIM resource that was read.
 *
 * @throws JSONException If an error occurred.
 * @throws InvalidResourceException if a schema error occurs.
 */
protected <R extends BaseResource> R unmarshal(final JSONObject jsonObject,
        final ResourceDescriptor resourceDescriptor, final ResourceFactory<R> resourceFactory,
        final JSONArray defaultSchemas) throws JSONException, InvalidResourceException {
    try {
        final SCIMObject scimObject = new SCIMObject();
        final boolean implicitSchemaChecking = Boolean
                .getBoolean(SCIMConstants.IMPLICIT_SCHEMA_CHECKING_PROPERTY);

        // The first keyed object ought to be a schemas array, but it may not be
        // present if 1) the attrs are all core and 2) the client decided to omit
        // the schema declaration.
        final JSONArray schemas;
        if (jsonObject.has(SCIMConstants.SCHEMAS_ATTRIBUTE_NAME)) {
            schemas = jsonObject.getJSONArray(SCIMConstants.SCHEMAS_ATTRIBUTE_NAME);
        } else if (defaultSchemas != null) {
            schemas = defaultSchemas;
        } else {
            String[] schemaArray = new String[1];
            schemaArray[0] = resourceDescriptor.getSchema();
            schemas = new JSONArray(schemaArray);
        }

        final Set<String> schemaSet = new HashSet<String>(schemas.length());
        if (implicitSchemaChecking) {
            schemaSet.addAll(resourceDescriptor.getAttributeSchemas());
        }
        for (int i = 0; i < schemas.length(); i++) {
            schemaSet.add(toLowerCase(schemas.getString(i)));
        }

        final Iterator k = jsonObject.keys();
        while (k.hasNext()) {
            final String attributeKey = (String) k.next();
            final String attributeKeyLower = toLowerCase(attributeKey);

            if (SCIMConstants.SCHEMAS_ATTRIBUTE_NAME.equals(attributeKeyLower)) {
                continue;
            }

            if (schemaSet.contains(attributeKeyLower)) {
                //This key is a container for some extended schema
                JSONObject schemaAttrs = jsonObject.getJSONObject(attributeKey);
                final Iterator keys = schemaAttrs.keys();
                while (keys.hasNext()) {
                    final String attributeName = (String) keys.next();
                    final AttributeDescriptor attributeDescriptor = resourceDescriptor
                            .getAttribute(attributeKey, attributeName);
                    final Object jsonAttribute = schemaAttrs.get(attributeName);
                    scimObject.addAttribute(create(attributeDescriptor, jsonAttribute));
                }
            } else {
                final Object jsonAttribute = jsonObject.get(attributeKey);
                if (implicitSchemaChecking) {
                    //Try to determine the schema for this attribute
                    final String attributeName = attributeKey;
                    final String schema = resourceDescriptor.findAttributeSchema(attributeName);
                    final AttributeDescriptor attributeDescriptor = resourceDescriptor.getAttribute(schema,
                            attributeName);
                    if (CoreSchema.META_DESCRIPTOR.equals(attributeDescriptor)) {
                        try {
                            // Special implicit schema processing for meta.attributes
                            // which contains the names of the attributes to remove from
                            // the Resource during a PATCH operation.  These each should be
                            // fully qualified with schema urn by the client, but if they
                            // are not we can try to determine the schema here.
                            JSONObject jsonMetaObj = ((JSONObject) jsonAttribute);
                            JSONArray metaAttrs = null;
                            final Iterator keys = jsonMetaObj.keys();
                            while (keys.hasNext()) {
                                final String key = (String) keys.next();
                                if ("attributes".equals(key.toLowerCase())) {
                                    Object attrObj = jsonMetaObj.get(key);
                                    if (attrObj instanceof JSONArray) {
                                        metaAttrs = (JSONArray) attrObj;
                                    }
                                    break;
                                }
                            }
                            if (metaAttrs != null) {
                                JSONArray newMetaAttrs = new JSONArray();
                                for (int i = 0; i < metaAttrs.length(); i++) {
                                    String metaAttr = (String) metaAttrs.get(i);
                                    String metaSchema = resourceDescriptor.findAttributeSchema(metaAttr);
                                    // The schema returned will be null if attribute value was
                                    // already fully qualified.
                                    if (metaSchema != null) {
                                        metaAttr = metaSchema + SCIMConstants.SEPARATOR_CHAR_QUALIFIED_ATTRIBUTE
                                                + metaAttr;
                                    }
                                    newMetaAttrs.put(metaAttr);
                                }
                                jsonMetaObj.put("attributes", newMetaAttrs);
                            }
                        } catch (Exception ignore) {
                            // Don't fail because of implicit schema checking
                        }
                    }
                    scimObject.addAttribute(create(attributeDescriptor, jsonAttribute));
                } else {
                    if (!schemaSet.contains(SCIMConstants.SCHEMA_URI_CORE)) {
                        throw new Exception("'" + SCIMConstants.SCHEMA_URI_CORE
                                + "' must be declared in the schemas attribute.");
                    }
                    final AttributeDescriptor attributeDescriptor = resourceDescriptor
                            .getAttribute(SCIMConstants.SCHEMA_URI_CORE, attributeKey);
                    scimObject.addAttribute(create(attributeDescriptor, jsonAttribute));
                }
            }
        }

        return resourceFactory.createResource(resourceDescriptor, scimObject);
    } catch (Exception e) {
        throw new InvalidResourceException(
                "Resource '" + resourceDescriptor.getName() + "' is malformed: " + e.getMessage(), e);
    }
}

From source file:com.seajas.search.attender.service.task.SubscriberSenderTask.java

/**
 * Send out the actual profile e-mails.// www .jav  a 2s. c o  m
 */
public void send() {
    if (Boolean.getBoolean("attender.attending.disabled")) {
        logger.info(
                "Attending has been explicitly disabled using 'attender.attending.disabled=true'. Skipping subscriber checks.");

        return;
    }

    logger.info("Started subscriber job");

    // Create a new UTC-based calendar to base ourselves on

    final Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
    final Date utcDate = calendar.getTime();

    // 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<Profile> profiles = attenderService.getNotifiableProfiles(calendar);

    if (profiles.size() == 0) {
        logger.info("No notifiable profiles found - finishing subscriber job");

        return;
    }

    // Re-initialize the mail-server, if needed

    mailService.updateWorkingMailServer();

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

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

    for (final Profile profile : profiles)
        threadPool.submit(new Runnable() {
            @Override
            public void run() {
                List<ProfileSubscriber> subscribers = attenderService.getNotifiableSubscribers(calendar,
                        profile.getSubscribers());

                for (ProfileSubscriber subscriber : subscribers) {
                    try {
                        // Round up the search parameters and taxonomies into a concise parameter list

                        Map<String, String> searchParameters = InterfaceQueryUtils
                                .combineParametersAndTaxonomies(profile.getSearchParametersMap(),
                                        profile.getTaxonomyIdentifierNumbers());

                        String searchQuery = InterfaceQueryUtils.createQueryFromParameters(profile.getQuery(),
                                searchParameters);

                        // Determine the start date depending on the user's last notification date, and retrieve the results

                        List<SearchResult> searchResults = searchService.performSearch(profile.getQuery(),
                                subscriber.getLastNotification(), currentDate, searchParameters,
                                mailService.getResultsPerMessage(), subscriber.getEmailLanguage());

                        if (logger.isInfoEnabled())
                            logger.info("Found " + searchResults.size() + " result(s) for profile with ID "
                                    + profile.getId() + " and query '" + profile.getQuery() + "'");

                        // Now create a template result based on the search results

                        TemplateResult templateResult = templateService.createResults(
                                subscriber.getEmailLanguage(), searchQuery, profile.getQuery(),
                                subscriber.getUniqueId(), profile.getUniqueId(), searchResults);

                        // 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.results.subject."
                                            + subscriber.getNotificationType().toString().toLowerCase(),
                                    new Object[] { profile.getQuery() },
                                    new Locale(subscriber.getEmailLanguage()));
                        } catch (NoSuchMessageException e) {
                            logger.warn("Could not retrieve results message subject header in language "
                                    + subscriber.getEmailLanguage() + ", resorting to the default language "
                                    + attenderService.getDefaultApplicationLanguage());

                            subject = messageSource.getMessage("mail.confirmation.subject",
                                    new Object[] { profile.getQuery() },
                                    new Locale(attenderService.getDefaultApplicationLanguage()));
                        }

                        // And send out the actual e-mail

                        if (mailService.hasWorkingMailServer())
                            mailService.sendMessage(subscriber.getEmail(), subject,
                                    templateResult.getTextResult(), templateResult.getHtmlResult());
                        else
                            logger.error(
                                    "Could not e-mail the results message - no mail server has been configured. Users may retrieve results using the RSS feed.");

                        // Update the processed subscribers' lastNotification indicator

                        attenderService.updateProfileSubscriberLastNotification(subscriber.getId(), utcDate);
                    } catch (ScriptException e) {
                        logger.error("Could not create a template result", e);
                    }
                }
            }
        });

    logger.info("Finishing subscriber job");
}

From source file:org.eclipse.epp.internal.logging.aeri.ide.Startup.java

@Override
public void earlyStartup() {
    if (Boolean.getBoolean(SYSPROP_DISABLE_AERI)) {
        return;//ww  w .j  a v  a 2 s .  c o  m
    }
    // XXX: we need to initialize the active window in Shells
    Shells.isUIThread();

    new Job("Initializing Error Reporting System") {

        @Override
        protected IStatus run(IProgressMonitor monitor) {
            SubMonitor progress = SubMonitor.convert(monitor, "Initializing error reporting", 10);
            try {
                progress.subTask("history");
                initializeHistory();
                progress.worked(1);

                progress.subTask("expiring history");
                initializeExpiringHistory();
                progress.worked(1);

                progress.subTask("problem database");
                initializeProblemsDatabase();
                progress.worked(1);

                progress.subTask("settings");
                initalizeSettings();
                progress.worked(1);

                progress.subTask("server");
                initializeServerAndConfiguration(monitor);
                progress.worked(1);

                progress.subTask("eventbus");
                initalizeEventBus();
                progress.worked(1);

                progress.subTask("controller");
                initalizeController();
                progress.worked(1);

                progress.subTask("log listener");
                initalizeLogListener();
                progress.worked(1);

                progress.subTask("jobs");
                scheduleJobs();
                progress.worked(1);

                monitor.done();
            } catch (UnknownHostException | SocketException e) {
                if (DEBUG) {
                    log(WARN_STARTUP_FAILED, e);
                }
                settings.setAction(SendAction.IGNORE);
                settings.setRememberSendAction(RememberSendAction.RESTART);
            } catch (Exception e) {
                log(WARN_STARTUP_FAILED, e);
                settings.setAction(SendAction.IGNORE);
                settings.setRememberSendAction(RememberSendAction.RESTART);
            }
            return Status.OK_STATUS;
        }

    }.schedule();
}

From source file:org.apache.tomcat.maven.it.AbstractWarProjectIT.java

@Before
public void setUp() throws Exception {
    httpClient = new DefaultHttpClient();

    final HttpParams params = httpClient.getParams();
    HttpConnectionParams.setConnectionTimeout(params, getTimeout());
    HttpConnectionParams.setSoTimeout(params, getTimeout());

    webappHome = ResourceExtractor.simpleExtractResources(getClass(), "/" + getWarArtifactId());
    verifier = new Verifier(webappHome.getAbsolutePath());

    boolean debugVerifier = Boolean.getBoolean("verifier.maven.debug");

    verifier.setMavenDebug(debugVerifier);
    verifier.setDebugJvm(Boolean.getBoolean("verifier.debugJvm"));
    verifier.displayStreamBuffers();/*from   www.  j  av  a2 s .c o  m*/

    verifier.deleteArtifact("org.apache.tomcat.maven.it", getWarArtifactId(), "1.0-SNAPSHOT", "war");
}

From source file:com.dominion.salud.mpr.configuration.MPRJpaConfiguration.java

@Bean
@Autowired//  ww  w.ja va 2 s . co m
public EntityManagerFactory entityManagerFactory() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setGenerateDdl(Boolean.getBoolean(environment.getRequiredProperty("hibernate.generate_ddl")));
    adapter.setShowSql(Boolean.getBoolean(environment.getRequiredProperty("hibernate.show_sql")));
    adapter.setDatabasePlatform(environment.getRequiredProperty("hibernate.dialect"));

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setDataSource(dataSource());
    factory.setJpaVendorAdapter(adapter);
    factory.setPackagesToScan("com.dominion.salud.mpr.negocio.entities");
    factory.afterPropertiesSet();
    factory.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());

    return factory.getObject();
}

From source file:org.openconcerto.sql.model.SQLSchema.java

static SQLCreateMoveableTable getCreateMetadata(final SQLSyntax syntax) throws SQLException {
    if (Boolean.getBoolean(NOAUTO_CREATE_METADATA))
        return null;
    final SQLCreateMoveableTable create = new SQLCreateMoveableTable(syntax, METADATA_TABLENAME);
    create.addVarCharColumn("NAME", 100).addVarCharColumn("VALUE", 250);
    create.setPrimaryKey("NAME");
    create.addOutsideClause(new DeferredClause() {
        @Override/*from   w ww.  j  ava  2  s .  c  o  m*/
        public String asString(ChangeTable<?> ct, SQLName tableName) {
            return syntax.getInsertOne(tableName, Arrays.asList("NAME", "VALUE"),
                    SQLBase.quoteStringStd(VERSION_MDKEY), getVersionSQL(syntax));
        }

        @Override
        public ClauseType getType() {
            return ClauseType.OTHER;
        }
    });
    return create;
}

From source file:edu.umd.cs.buildServer.BuildServerTestHarness.java

@Override
public void initConfig() throws IOException {
    if (System.getenv("PMD_HOME") != null)
        getConfig().setProperty(PMD_HOME, System.getenv("PMD_HOME"));
    getConfig().setProperty(LOG_DIRECTORY, "console");

    // FIXME: this is also wrong in general, but might allow me to do some
    // testing//from   w ww .ja va2 s .  c o  m
    getConfig().setProperty(SUPPORTED_COURSE_LIST, "CMSC433");

    getConfig().setProperty(DEBUG_VERBOSE, "true");
    getConfig().setProperty(DEBUG_DO_NOT_LOOP, "true");
    getConfig().setProperty(DEBUG_PRESERVE_SUBMISSION_ZIPFILES, "true");

    if (Boolean.getBoolean("debug.security"))
        getConfig().setProperty(DEBUG_SECURITY, "true");

    if (Boolean.getBoolean("runStudentTests"))
        getConfig().setProperty(RUN_STUDENT_TESTS, "true");

    String tools = System.getenv("tools.java");
    if (tools != null)
        getConfig().setProperty(ConfigurationKeys.INSPECTION_TOOLS_PFX + "java", tools);

    String performCodeCoverage = System.getenv("PERFORM_CODE_COVERAGE");
    if ("true".equals(performCodeCoverage))
        getConfig().setProperty(CODE_COVERAGE, "true");

    // TODO move the location of the Clover DB to the build directory.
    // NOTE: This requires changing the security.policy since Clover needs
    // to be able
    // to read, write and create files in the directory.
    String cloverDBPath = "/tmp/myclover.db." + Long.toHexString(nextRandomLong());
    getConfig().setProperty(CLOVER_DB, cloverDBPath);
}

From source file:org.openqa.jetty.xml.XmlParser.java

/**
 * Construct//from  w w w .j a v  a 2 s  . c  o  m
 */
public XmlParser() {
    try {
        SAXParserFactory factory = SAXParserFactory.newInstance();
        boolean notValidating = Boolean.getBoolean("org.openqa.jetty.xml.XmlParser.NotValidating");
        factory.setValidating(!notValidating);
        _parser = factory.newSAXParser();
        try {
            if (!notValidating)
                _parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/schema", true);
        } catch (Exception e) {
            log.warn("Schema validation may not be supported");
            log.debug("", e);
            notValidating = true;
        }
        _parser.getXMLReader().setFeature("http://xml.org/sax/features/validation", !notValidating);
        _parser.getXMLReader().setFeature("http://xml.org/sax/features/namespaces", !notValidating);
        _parser.getXMLReader().setFeature("http://xml.org/sax/features/namespace-prefixes", !notValidating);
    } catch (Exception e) {
        log.warn(LogSupport.EXCEPTION, e);
        throw new Error(e.toString());
    }
}

From source file:org.apigw.monitoring.config.PersistenceConfig.java

@Bean
@DependsOn("flyway")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    log.debug("Setting up entityManagerFactory");
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setShowSql(Boolean.getBoolean(hibernateShowSql));
    vendorAdapter.setDatabasePlatform("org.hibernate.dialect." + hibernateDialect);
    factory.setDataSource(dataSource());
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("org.apigw.monitoring.types.domain");
    Properties jpaProperties = new Properties();
    factory.setJpaProperties(jpaProperties);
    factory.afterPropertiesSet();//from   w  w  w.j a va2  s.  co m
    factory.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());
    return factory;
}