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.springframework.shell.core.JLineShell.java

public void run() {
    reader = createConsoleReader();//from  w  w w.  ja  va  2  s. c o  m

    setPromptPath(null);

    JLineLogHandler handler = new JLineLogHandler(reader, this);
    JLineLogHandler.prohibitRedraw(); // Affects this thread only
    Logger mainLogger = Logger.getLogger("");
    removeHandlers(mainLogger);
    mainLogger.addHandler(handler);

    reader.addCompletor(new JLineCompletorAdapter(getParser()));

    reader.setBellEnabled(true);
    if (Boolean.getBoolean("jline.nobell")) {
        reader.setBellEnabled(false);
    }

    // reader.setDebug(new PrintWriter(new FileWriter("writer.debug", true)));

    openFileLogIfPossible();
    this.reader.getHistory().setMaxSize(getHistorySize());
    // Try to build previous command history from the project's log
    String[] filteredLogEntries = filterLogEntry();
    for (String logEntry : filteredLogEntries) {
        reader.getHistory().addToHistory(logEntry);
    }

    flashMessageRenderer();
    flash(Level.FINE, this.getProductName() + " " + this.getVersion(), Shell.WINDOW_TITLE_SLOT);
    printBannerAndWelcome();

    String startupNotifications = getStartupNotifications();
    if (StringUtils.hasText(startupNotifications)) {
        logger.info(startupNotifications);
    }

    setShellStatus(Status.STARTED);

    try {
        // Monitor CTRL+C initiated shutdowns (ROO-1599)
        Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
            public void run() {
                shutdownHookFired = true;
            }
        }, getProductName() + " JLine Shutdown Hook"));
    } catch (Throwable t) {
    }

    // Handle any "execute-then-quit" operation

    String rooArgs = System.getProperty("roo.args");
    if (rooArgs != null && !"".equals(rooArgs)) {
        setShellStatus(Status.USER_INPUT);
        boolean success = executeCommand(rooArgs);
        if (exitShellRequest == null) {
            // The command itself did not specify an exit shell code, so we'll fall back to something sensible here
            executeCommand("quit"); // ROO-839
            exitShellRequest = success ? ExitShellRequest.NORMAL_EXIT : ExitShellRequest.FATAL_EXIT;
        }
        setShellStatus(Status.SHUTTING_DOWN);
    } else {
        // Normal RPEL processing
        promptLoop();
    }

}

From source file:org.sejda.core.context.XmlConfigurationStrategy.java

private void initializeSchemaValidation(DocumentBuilderFactory factory) throws SAXException {
    if (Boolean.getBoolean(Sejda.PERFORM_SCHEMA_VALIDATION_PROPERTY_NAME)) {
        SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

        factory.setSchema(schemaFactory.newSchema(new Source[] { new StreamSource(
                Thread.currentThread().getContextClassLoader().getResourceAsStream(DEFAULT_SEJDA_CONFIG)) }));

        factory.setNamespaceAware(true);
    }//from  ww w .  jav  a2s . com
}

From source file:net.nan21.dnet.core.presenter.descriptor.DsDefinitions.java

/**
 * Helper method to create the definition for a single given data-source.
 * /*  w  ww  .  j a  va  2s  .com*/
 * @param name
 * @param factory
 * @return
 * @throws Exception
 */
private DsDefinition createDefinition(String name, ConfigurableListableBeanFactory factory) throws Exception {

    BeanDefinition beanDef = factory.getBeanDefinition(name);

    DsDefinition definition = new DsDefinition();
    definition.setName(name);

    String modelClass = null;
    String filterClass = null;
    String paramClass = null;

    String readOnly = null;

    MutablePropertyValues mpv = beanDef.getPropertyValues();

    // model class

    modelClass = ((TypedStringValue) mpv.getPropertyValue("modelClass").getValue()).getValue();
    definition.setModelClass(this.applicationContext.getClassLoader().loadClass(modelClass));

    // filter class

    if (mpv.getPropertyValue("filterClass") != null) {
        filterClass = ((TypedStringValue) mpv.getPropertyValue("filterClass").getValue()).getValue();
        definition.setFilterClass(this.applicationContext.getClassLoader().loadClass(filterClass));
    } else {
        definition.setFilterClass(this.applicationContext.getClassLoader().loadClass(modelClass));
    }

    // param-class
    if (mpv.getPropertyValue("paramClass") != null) {
        paramClass = ((TypedStringValue) mpv.getPropertyValue("paramClass").getValue()).getValue();
        definition.setParamClass(this.applicationContext.getClassLoader().loadClass(paramClass));
    }

    // other attributes

    if (mpv.contains("readOnly")) {
        readOnly = ((TypedStringValue) mpv.getPropertyValue("readOnly").getValue()).getValue();
        definition.setReadOnly(Boolean.getBoolean(readOnly));
    }

    // RPC methods

    if (mpv.contains("rpcData")) {
        @SuppressWarnings("unchecked")
        ManagedMap<TypedStringValue, Object> rpcData = (ManagedMap<TypedStringValue, Object>) mpv
                .getPropertyValue("rpcData").getValue();

        List<String> services = new ArrayList<String>();
        for (TypedStringValue tsv : rpcData.keySet()) {
            services.add(tsv.getValue());
        }
        definition.setServiceMethods(services);
    }

    if (mpv.contains("rpcFilter")) {
        @SuppressWarnings("unchecked")
        ManagedMap<TypedStringValue, Object> rpcFilter = (ManagedMap<TypedStringValue, Object>) mpv
                .getPropertyValue("rpcFilter").getValue();
        List<String> services = new ArrayList<String>();
        for (TypedStringValue tsv : rpcFilter.keySet()) {
            services.add(tsv.getValue());
        }
        definition.setServiceMethods(services);
    }
    return definition;
}

From source file:org.opennms.ng.services.collectd.DefaultCollectionAgent.java

/**
 * <p>isStoreByForeignSource</p>
 *
 * @return a {@link Boolean} object.//  w  w w . j  a  va2 s .c o  m
 */
@Override
public Boolean isStoreByForeignSource() {
    return Boolean.getBoolean("org.opennms.rrd.storeByForeignSource");
}

From source file:com.adeptj.runtime.core.Launcher.java

private static void shutdownJvm() {
    Logger logger = LoggerFactory.getLogger(Launcher.class);
    // Check if OSGi Framework was already started, try to stop the framework gracefully.
    Optional.ofNullable(BundleContextHolder.getInstance().getBundleContext()).ifPresent(context -> {
        logger.warn("Server startup failed but OSGi Framework already started, stopping it gracefully!!");
        FrameworkManager.getInstance().stopFramework();
    });/*from   w ww  . j a  va  2  s . c o  m*/
    // Let the LOGBACK cleans up it's state.
    LogbackManager.getInstance().getLoggerContext().stop();
    if (Boolean.getBoolean(SYS_PROP_ENABLE_SYSTEM_EXIT)) {
        System.exit(-1);
    }
}

From source file:com.dominion.salud.pedicom.configuration.PEDICOMJpaConfiguration.java

@Bean(name = "MainEM")
@Autowired/*from  w w w.j  a v a2s . c  o  m*/
public EntityManagerFactory entityManagerFactory() throws Exception {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setGenerateDdl(
            Boolean.getBoolean(StringUtils.trim(environment.getRequiredProperty("hibernate.generate_ddl"))));
    adapter.setShowSql(
            Boolean.getBoolean(StringUtils.trim(environment.getRequiredProperty("hibernate.show_sql"))));
    adapter.setDatabasePlatform(StringUtils.trim(environment.getRequiredProperty("hibernate.dialect")));
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setDataSource(routingDataSource());
    factory.setJpaVendorAdapter(adapter);
    factory.setPackagesToScan("com.dominion.salud.pedicom.negocio.entities");
    factory.setPersistenceUnitName("MainEM");
    factory.afterPropertiesSet();
    factory.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());
    return factory.getObject();
}

From source file:com.hypersocket.server.HypersocketServerImpl.java

@Override
public boolean isPlainPort(InetSocketAddress localAddress) {
    if (Boolean.getBoolean("hypersocket.development")) {
        return localAddress.getPort() == 8080;
    } else {//from w ww .ja va 2 s  .co  m
        if (configurationService.getIntValue("http.port") > 0) {
            return localAddress.getPort() == configurationService.getIntValue("http.port");
        }
        return true;
    }
}

From source file:org.apache.cassandra.utils.JMXServerUtils.java

private static Map<String, Object> configureJmxAuthentication() {
    Map<String, Object> env = new HashMap<>();
    if (!Boolean.getBoolean("com.sun.management.jmxremote.authenticate"))
        return env;

    // If authentication is enabled, initialize the appropriate JMXAuthenticator
    // and stash it in the environment settings.
    // A JAAS configuration entry takes precedence. If one is supplied, use
    // Cassandra's own custom JMXAuthenticator implementation which delegates
    // auth to the LoginModules specified by the JAAS configuration entry.
    // If no JAAS entry is found, an instance of the JDK's own
    // JMXPluggableAuthenticator is created. In that case, the admin may have
    // set a location for the JMX password file which must be added to env
    // before creating the authenticator. If no password file has been
    // explicitly set, it's read from the default location
    // $JAVA_HOME/lib/management/jmxremote.password
    String configEntry = System.getProperty("cassandra.jmx.remote.login.config");
    if (configEntry != null) {
        env.put(JMXConnectorServer.AUTHENTICATOR, new AuthenticationProxy(configEntry));
    } else {/* ww w.  ja  v a 2s.c  o m*/
        String passwordFile = System.getProperty("com.sun.management.jmxremote.password.file");
        if (passwordFile != null) {
            // stash the password file location where JMXPluggableAuthenticator expects it
            env.put("jmx.remote.x.password.file", passwordFile);
        }

        env.put(JMXConnectorServer.AUTHENTICATOR, new JMXPluggableAuthenticatorWrapper(env));
    }

    return env;
}

From source file:org.opennms.ng.dao.support.ResourceTypeUtils.java

/**
 * <p>isStoreByGroup</p>//  w w w  .  j  ava 2s  . c  om
 *
 * @return a boolean.
 */
public static boolean isStoreByGroup() {
    return Boolean.getBoolean("org.opennms.rrd.storeByGroup");
}

From source file:br.ufpa.gercom.mtuldp.store.HostStorageMgm.java

public boolean exist(Host host) throws RuntimeException {

    checkNotNull(host, "Host Object cannot be null");

    String EXIST = "MATCH (a:%s{id:'%s'}) " + "RETURN " + "a IS NOT NULL as result";

    String type = Host.class.getSimpleName();
    String id = getId(host);/*from  w ww  .j a v a 2 s  .  c o  m*/

    String query = String.format(EXIST, type, id);

    StatementResult result = driver.executeCypherQuery(query);

    if (result.list().isEmpty()) {
        return false;
    }

    Record record = result.single();
    return Boolean.getBoolean(record.get("result").asString());
}