List of usage examples for java.lang Boolean getBoolean
public static boolean getBoolean(String name)
From source file:org.protempa.backend.dsb.relationaldb.RelationalDbDataSourceBackend.java
public RelationalDbDataSourceBackend() { this.databaseAPI = DatabaseAPI.DRIVERMANAGER; this.dryRun = Boolean.getBoolean(SQLGenUtil.SYSTEM_PROPERTY_SKIP_EXECUTION); }
From source file:org.apache.geode.admin.jmx.internal.AgentImpl.java
/** Enables mx4j tracing if Agent debugging is enabled. */ private static void checkDebug() { try {// w w w .j a v a 2 s .co m if (Boolean.getBoolean("gfAgentDebug")) { mx4j.log.Log.setDefaultPriority(mx4j.log.Logger.TRACE); // .DEBUG } } catch (VirtualMachineError err) { SystemFailure.initiateFailure(err); // If this ever returns, rethrow the error. We're poisoned // now, so don't let this thread continue. throw err; } catch (Throwable t) { // Whenever you catch Error or Throwable, you must also // catch VirtualMachineError (see above). However, there is // _still_ a possibility that you are dealing with a cascading // error condition, so you also need to check to see if the JVM // is still usable: SystemFailure.checkFailure(); /* ignore */ } }
From source file:com.adeptj.runtime.tools.logging.LogbackManager.java
public RollingFileAppender<ILoggingEvent> createRollingFileAppender(LogbackConfig logbackConfig) { RollingFileAppender<ILoggingEvent> fileAppender = new RollingFileAppender<>(); fileAppender.setName(logbackConfig.getAppenderName()); fileAppender.setFile(logbackConfig.getLogFile()); fileAppender.setAppend(true);/*from w w w . j av a2 s . c om*/ fileAppender.setImmediateFlush(Boolean.getBoolean(SYS_PROP_LOG_IMMEDIATE_FLUSH)); if (!fileAppender.isImmediateFlush()) { fileAppender.setImmediateFlush(logbackConfig.isImmediateFlush()); } fileAppender.setEncoder(this.createLayoutEncoder(logbackConfig.getPattern())); fileAppender.setContext(this.loggerContext); SizeAndTimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new SizeAndTimeBasedRollingPolicy<>(); rollingPolicy.setMaxFileSize(FileSize.valueOf(logbackConfig.getLogMaxSize())); rollingPolicy.setContext(this.loggerContext); rollingPolicy.setFileNamePattern(logbackConfig.getRolloverFile()); rollingPolicy.setMaxHistory(logbackConfig.getLogMaxHistory()); rollingPolicy.setParent(fileAppender); rollingPolicy.start(); fileAppender.setRollingPolicy(rollingPolicy); fileAppender.setTriggeringPolicy(rollingPolicy); fileAppender.start(); return fileAppender; }
From source file:com.redhat.victims.VictimsConfig.java
/** * Is a force database update required./*from w ww .j a v a2 s . c o m*/ * * @return */ public static boolean forcedUpdate() { return Boolean.getBoolean(Key.DB_PURGE); }
From source file:org.apache.taverna.commandline.data.InputsHandler.java
public Bundle registerInputs(Map<String, InputWorkflowPort> portMap, CommandLineOptions options) throws InvalidOptionException, ReadInputException, IOException { Bundle inputDataBundle = openInputBundle(options); if (Boolean.getBoolean("debug.bundle")) { inputDataBundle.setDeleteOnClose(false); System.out.println("Bundle: " + inputDataBundle.getSource()); }/*from w w w . j a v a 2 s .c o m*/ Path inputs = DataBundles.getInputs(inputDataBundle); URL url; try { url = new URL("file:"); } catch (MalformedURLException e1) { // Should never happen, but just in case: throw new ReadInputException( "The was an internal error setting up the URL to open the inputs. You should contact Taverna support.", e1); } if (options.hasInputFiles()) { regesterInputsFromFiles(portMap, options, inputs, url); } if (options.hasInputValues()) { registerInputsFromValues(portMap, options, inputs); } return inputDataBundle; }
From source file:org.eclipse.gyrex.junit.internal.GyrexStarter.java
/** * Ensures the server is started an online. * <p>//from ww w . j av a 2 s . c o m * The caller will block until the server is fully started and online. * </p> * * @return <code>true</code> if the server has been started, * <code>false</code> otherwise */ public synchronized boolean ensureStartedAndOnline() throws Exception { shutdownJob.cancel(); if (applicationHandle != null) { LOG.debug("Gyrex already running!"); return false; } LOG.debug("Starting Gyrex"); bootstrapBundles(); // test for bogus system properties if (Boolean.getBoolean("gyrex.preferences.instancebased")) { LOG.warn( "Overriding system propert 'gyrex.preferences.instancebased' in order to force ZooKeeper based cloud preferences!"); System.setProperty("gyrex.preferences.instancebased", Boolean.FALSE.toString()); } // hook event listener to listen for the node to become online final CountDownLatch cloudOnlineWatch = new CountDownLatch(1); final EventHandler cloudOnlineHandler = new EventHandler() { @Override public void handleEvent(final Event event) { cloudOnlineWatch.countDown(); } }; final Hashtable<String, Object> properties = new Hashtable<String, Object>(1); properties.put(EventConstants.EVENT_TOPIC, ICloudEventConstants.TOPIC_NODE_ONLINE); context.registerService(EventHandler.class, cloudOnlineHandler, properties); // get hold of application handle and start application final Collection<ServiceReference<ApplicationDescriptor>> refs = context .getServiceReferences(ApplicationDescriptor.class, "(service.pid=org.eclipse.gyrex.boot.server)"); assertEquals("Unable to find proper Gyrex Server application to start!", 1, refs.size()); final ServiceReference<ApplicationDescriptor> sr = refs.iterator().next(); final ApplicationDescriptor service = context.getService(sr); try { applicationHandle = service.launch(null); } finally { context.ungetService(sr); } // wait for node becoming online final long timeout = Long.getLong("gyrex.servertestapp.timeout", 60000l); LOG.info("Waiting {}ms for node to become online...", timeout); if (!cloudOnlineWatch.await(timeout, TimeUnit.MILLISECONDS)) { LOG.error("Timeout waiting for node to become online."); throw new IllegalStateException( "Timeout while waiting for node to establish connection with ZooKeeper. Unable to initialize cloud environment."); } return true; }
From source file:com.hypersocket.server.HypersocketServerImpl.java
@Override public boolean isSSLPort(InetSocketAddress localAddress) { if (Boolean.getBoolean("hypersocket.development")) { return localAddress.getPort() == 8443; } else {//from www . ja v a 2s .c o m return localAddress.getPort() == configurationService.getIntValue("https.port"); } }
From source file:org.mili.core.properties.Props.java
static <T> T get(Properties p, String k, Usage u, Class<T> c, T dv) { Validate.notNull(u);/* w w w . java2 s .c o m*/ Validate.notNull(c); Validate.notEmpty(k); String s = p != null ? p.getProperty(k) : null; if (Boolean.getBoolean(PROP_LOGPROPS)) { PropLogger.INSTANCE.log(k, u, c, dv); } switch (u) { case REQUIRED_NOT_NULL: if (s == null) { throw new IllegalArgumentException(String.format(MSG, k, "null", "null", k, c.getName())); } break; case REQUIRED_NOT_NULL_AND_NOT_EMPTY: if (s == null || s.length() == 0) { throw new IllegalArgumentException( String.format(MSG, k, "null or empty", "null or empty", k, c.getName())); } break; case OPTIONAL: if (s == null || s.length() == 0) { if (dv != null && dv.toString().length() > 0) { s = dv.toString(); } } default: break; } return getValue(k, s, c); }
From source file:org.rhq.plugins.mobicents.servlet.sip.jboss5.ApplicationServerDiscoveryComponent.java
public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) { log.trace("Discovering " + resourceDiscoveryContext.getResourceType().getName() + " Resources..."); Set<DiscoveredResourceDetails> servers = new HashSet<DiscoveredResourceDetails>(); ProfileService profileService = ProfileServiceFactory.getProfileService(); Collection<ProfileKey> profileKeys = profileService.getActiveProfileKeys(); if (profileKeys.isEmpty()) throw new IllegalStateException("No active profiles found."); log.trace("Found the following active profiles: " + profileKeys); ProfileServiceFactory.refreshCurrentProfileView(); ManagedComponent serverConfigComponent = ManagedComponentUtils .getSingletonManagedComponent(new ComponentType("MCBean", "ServerConfig")); String serverName = (String) ManagedComponentUtils.getSimplePropertyValue(serverConfigComponent, "serverName"); // TODO: Figure out if the instance is AS or EAP, and reflect that in the Resource name. String resourceName = "JBoss AS 5 (" + serverName + ")"; String resourceKey = (String) ManagedComponentUtils.getSimplePropertyValue(serverConfigComponent, "serverHomeDir"); String version = (String) ManagedComponentUtils.getSimplePropertyValue(serverConfigComponent, "specificationVersion"); Configuration pluginConfig = resourceDiscoveryContext.getDefaultPluginConfiguration(); pluginConfig.put(new PropertySimple(ApplicationServerComponent.SERVER_NAME_PROPERTY, serverName)); DiscoveredResourceDetails server = new DiscoveredResourceDetails(resourceDiscoveryContext.getResourceType(), resourceKey, resourceName, version, DEFAULT_RESOURCE_DESCRIPTION, pluginConfig, null); servers.add(server);/*from ww w . j ava 2s . c o m*/ /* } catch (NoSuchProfileException e) { LOG.error("No Active Profile found", e); } */ // Implementation to find all profiles /* Collection<ProfileKey> profileKeys = profileService.getProfileKeys(); for (ProfileKey key: profileKeys) { String resourceKey = "Jboss AS 5:" + key.getName(); // @TODO when the Profile Service gives more AS info, replace hardcoded strings DiscoveredResourceDetails server = new DiscoveredResourceDetails( context.getResourceType(), resourceKey, resourceKey, "5.0", "JBoss App Server"); servers.add( server ); } */ ResourceType resourceType = resourceDiscoveryContext.getResourceType(); log.trace("Discovered " + servers.size() + " " + resourceType.getName() + " Resources."); boolean debug = Boolean.getBoolean(JBMANCON_DEBUG_SYSPROP); if (debug) { //new UnitTestRunner().runUnitTests(); generatePluginDescriptor(resourceDiscoveryContext); } return servers; }