List of usage examples for java.lang Boolean getBoolean
public static boolean getBoolean(String name)
From source file:org.josso.gateway.protocol.handler.NtlmProtocolHandler.java
public void setLoadBalance(String loadBalance) { this.setLoadBalance(Boolean.getBoolean(loadBalance)); }
From source file:org.apache.ode.jbi.OdeLifeCycle.java
public void init(ComponentContext context) throws JBIException { try {// www . j a v a 2 s .c o m _ode = OdeContext.getInstance(); _ode.setContext(context); // Use system property to determine if DeliveryChannel.sendSync or DeliveryChannel.send is used. if (Boolean.getBoolean("org.apache.ode.jbi.sendSynch")) _ode._consumer = new OdeConsumerSync(_ode); else _ode._consumer = new OdeConsumerAsync(_ode); if (_ode.getContext().getWorkspaceRoot() != null) TempFileManager.setWorkingDirectory(new File(_ode.getContext().getWorkspaceRoot())); if (_config == null) { __log.debug("Loading properties."); initProperties(); } else { __log.debug("Applying properties."); _ode._config = _config; } __log.debug("Initializing message mappers."); initMappers(); __log.debug("Creating data source."); initDataSource(); __log.debug("Starting Dao."); initDao(); __log.debug("Starting BPEL server."); initBpelServer(); // Register BPEL event listeners configured in ode-jbi.properties. registerEventListeners(); registerMexInterceptors(); registerMBean(); __log.debug("Starting JCA connector."); initConnector(); __log.debug("Register ProcessManagement APIs"); _ode.activatePMAPIs(); _suManager = new OdeSUManager(_ode); _initSuccess = true; __log.info(__msgs.msgOdeInitialized()); } catch (Throwable t) { __log.fatal("", t); throw new JBIException("Fatal error", t); } }
From source file:com.ning.billing.recurly.RecurlyClient.java
/** * Checks a system property to see if debugging output is * required. Used internally by the client to decide whether to * generate debug output/*from www . ja v a 2 s . c om*/ */ private static boolean debug() { return Boolean.getBoolean(RECURLY_DEBUG_KEY); }
From source file:org.apache.ode.axis2.deploy.ProcessComponentManager.java
@Override protected boolean isDeploymentFromODEFileSystemAllowed() { return !Boolean.getBoolean("org.intalio.pxe.disable.oldfsdeploy"); }
From source file:org.sonar.server.charts.deprecated.SparkLinesChart.java
private void applyParams() { applyCommonParams();//from www . j a v a 2 s .c om configureColors(params.get(CHART_PARAM_COLORS), renderer); addMeasures(params.get(CHART_PARAM_VALUES)); // -- Plot XYPlot plot = (XYPlot) jfreechart.getPlot(); plot.setOutlineVisible(isParamValueValid(params.get(CHART_PARAM_OUTLINE_VISIBLE)) && Boolean.getBoolean(params.get(CHART_PARAM_OUTLINE_VISIBLE))); }
From source file:org.rhq.plugins.perftest.PerfTestRogueDiscoveryComponent.java
/** * Ensure we sleep for the full amount of millis, even if interrupted. * If the thread is interrupted, but our sysprop {@link #SYSPROP_DISCOVERY_INT} is set * to true, this method will abort./*from w ww.ja va 2 s .co m*/ * * @param ms millis to sleep */ private void sleep(long ms) { long start = System.currentTimeMillis(); long finish = start + ms; while (System.currentTimeMillis() < finish) { try { Thread.sleep(finish - System.currentTimeMillis()); } catch (InterruptedException e) { log.warn("The rogue discovery component was interrupted during its sleep", e); if (Boolean.getBoolean(SYSPROP_DISCOVERY_INT)) { log.warn("The rogue discovery component will abort its sleep due to the interrupt"); return; } } } }
From source file:org.sonar.plugins.php.phpunit.PhpUnitSensorTest.java
/** * Sould not launch on non php project.//w ww . ja va 2s . c om */ @Test public void shouldNotLaunchWhenConfiguredSoOnPhpProject() { init(); when(project.getLanguage()).thenReturn(Php.PHP); when(config.getBoolean(SHOULD_RUN_PROPERTY_KEY, Boolean.getBoolean(PhpUnitConfiguration.PHPUNIT_DEFAULT_SHOULD_RUN))).thenReturn(false); ProjectFileSystem fs = mock(ProjectFileSystem.class); when(project.getFileSystem()).thenReturn(fs); when(fs.getBuildDir()).thenReturn(new File(PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_PATH)); PhpUnitExecutor executor = mock(PhpUnitExecutor.class); PhpUnitResultParser parser = mock(PhpUnitResultParser.class); PhpUnitCoverageResultParser parser2 = mock(PhpUnitCoverageResultParser.class); PhpUnitSensor sensor = new PhpUnitSensor(executor, parser, parser2); PhpUnitConfiguration configuration = mock(PhpUnitConfiguration.class); when(executor.getConfiguration()).thenReturn(configuration); assertEquals(false, sensor.shouldExecuteOnProject(project)); }
From source file:au.com.borner.salesforce.jps.SalesForceModuleLevelBuilder.java
public ExitCode compileUsingApexAPI(final CompileContext context, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder) throws ProjectBuildException, IOException { // Step 1: log into Salesforce context.processMessage(new CompilerMessage(EMPTY, BuildMessage.Kind.PROGRESS, "Logging into Salesforce")); InstanceCredentials instanceCredentials = new InstanceCredentials("Compile"); instanceCredentials.setUsername(System.getProperty("username")); instanceCredentials.setPassword(System.getProperty("password")); instanceCredentials.setSecurityToken(System.getProperty("securityToken")); instanceCredentials.setEnvironment(System.getProperty("environment")); SoapClient soapClient = new SoapClient(); soapClient.login(instanceCredentials, Boolean.getBoolean(System.getProperty("traceMessages"))); // Step 2: get all source final Map<String, String> fileNameToUrlMap = new HashMap<String, String>(); final List<String> classes = new ArrayList<String>(); final List<String> triggers = new ArrayList<String>(); dirtyFilesHolder.processDirtyFiles(new FileProcessor<JavaSourceRootDescriptor, ModuleBuildTarget>() { @Override//from ww w.j a v a 2s . co m public boolean apply(ModuleBuildTarget target, File file, JavaSourceRootDescriptor root) throws IOException { fileNameToUrlMap.put(FileUtilities.filenameWithoutExtension(file.getName()), file.getAbsolutePath()); if (file.getName().endsWith(".cls")) { classes.add(FileUtils.readFileToString(file)); } else if (file.getName().endsWith(".trigger")) { triggers.add(FileUtils.readFileToString(file)); } return true; } }); // Step 3: compile context.processMessage(new CompilerMessage(EMPTY, BuildMessage.Kind.PROGRESS, "Compiling")); CompileAndTestResult compileAndTestResult = soapClient.compile(classes, triggers); soapClient.logoff(); // Step 4: check results if (compileAndTestResult.getSuccess()) { context.processMessage( new CompilerMessage(EMPTY, BuildMessage.Kind.INFO, "Compilation was successful")); RunTestsResult runTestsResult = compileAndTestResult.getRunTestsResult(); for (CodeCoverageResult codeCoverageResult : runTestsResult.getCodeCoverage()) { if (codeCoverageResult.getNumLocationsNotCovered() == 0) { context.processMessage(new CompilerMessage(EMPTY, BuildMessage.Kind.INFO, codeCoverageResult.getName() + " coverage: 100%")); } else { double percentNotCovered = codeCoverageResult.getNumLocations() / codeCoverageResult.getNumLocationsNotCovered(); double percentCovered = 1 - percentNotCovered; context.processMessage(new CompilerMessage(EMPTY, BuildMessage.Kind.INFO, codeCoverageResult.getName() + " coverage: " + String.format("%.2f", percentCovered))); } } for (CodeCoverageWarning codeCoverageWarning : runTestsResult.getCodeCoverageWarnings()) { String fileName = fileNameToUrlMap.get(codeCoverageWarning.getName()); context.processMessage(new CompilerMessage(EMPTY, BuildMessage.Kind.WARNING, codeCoverageWarning.getMessage(), fileName, -1, -1, -1, -1, -1)); } return ExitCode.OK; } else { for (CompileClassResult compileClassResult : compileAndTestResult.getClasses()) { String filePath = fileNameToUrlMap.get(compileClassResult.getName()); if (!compileClassResult.isSuccess()) { context.processMessage(new CompilerMessage(EMPTY, BuildMessage.Kind.ERROR, compileClassResult.getProblem(), filePath, -1, -1, -1, compileClassResult.getLine(), compileClassResult.getColumn())); } for (String warning : compileClassResult.getWarnings()) { context.processMessage(new CompilerMessage(EMPTY, BuildMessage.Kind.WARNING, warning, filePath, -1, -1, -1, 1, 0)); } } for (CompileTriggerResult compileTriggerResult : compileAndTestResult.getTriggers()) { String filePath = fileNameToUrlMap.get(compileTriggerResult.getName()); if (!compileTriggerResult.isSuccess()) { context.processMessage(new CompilerMessage(EMPTY, BuildMessage.Kind.ERROR, compileTriggerResult.getProblem(), filePath, -1, -1, -1, compileTriggerResult.getLine(), compileTriggerResult.getColumn())); } } return ExitCode.ABORT; } }
From source file:org.rhq.modules.plugins.jbossas7.SubsystemDiscovery.java
public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<BaseComponent<?>> context) throws Exception { Set<DiscoveredResourceDetails> details = new HashSet<DiscoveredResourceDetails>(); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(DeserializationConfig.Feature.READ_ENUMS_USING_TO_STRING, true); BaseComponent parentComponent = context.getParentResourceComponent(); ASConnection connection = parentComponent.getASConnection(); Configuration config = context.getDefaultPluginConfiguration(); String confPath = config.getSimpleValue("path", ""); if (confPath == null || confPath.isEmpty()) { log.error("Path plugin config is null for ResourceType [" + context.getResourceType().getName() + "]."); return details; }//from w w w . ja v a 2s .co m boolean lookForChildren = false; if (!confPath.contains("=")) { // NO = -> no sub path, but a type lookForChildren = true; } // Construct the full path including the parent String path; String parentPath = parentComponent.getPath(); if (parentPath == null || parentPath.isEmpty()) path = ""; else path = parentPath; if (Boolean.getBoolean("as7plugin.verbose")) log.info("total path: [" + path + "]"); if (lookForChildren) { // Looking for multiple resource of type 'childType' // check if there are multiple types are present List<String> subTypes = new ArrayList<String>(); if (confPath.contains("|")) { subTypes.addAll(Arrays.asList(confPath.split("\\|"))); } else subTypes.add(confPath); for (String cpath : subTypes) { Address addr = new Address(parentPath); Result result = connection.execute(new ReadChildrenNames(addr, cpath)); if (result.isSuccess()) { @SuppressWarnings("unchecked") List<String> subsystems = (List<String>) result.getResult(); // There may be multiple children of the given type for (String val : subsystems) { String newPath = cpath + "=" + val; Configuration config2 = context.getDefaultPluginConfiguration(); String resKey; if (path == null || path.isEmpty()) resKey = newPath; else { if (path.startsWith(",")) path = path.substring(1); resKey = path + "," + cpath + "=" + val; } PropertySimple pathProp = new PropertySimple("path", resKey); config2.put(pathProp); DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), // DataType resKey, // Key val, // Name null, // Version context.getResourceType().getDescription(), // subsystem.description config2, null); details.add(detail); } } } } else { // Single subsystem path += "," + confPath; if (path.startsWith(",")) path = path.substring(1); Result result = connection.execute(new ReadResource(new Address(path))); if (result.isSuccess()) { String resKey = path; String name = resKey.substring(resKey.lastIndexOf("=") + 1); Configuration config2 = context.getDefaultPluginConfiguration(); PropertySimple pathProp = new PropertySimple("path", path); config2.put(pathProp); DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), // DataType path, // Key name, // Name null, // Version context.getResourceType().getDescription(), // Description config2, null); details.add(detail); } } return details; }
From source file:com.tc.management.JMXConnectorProxy.java
private void determineConnector() throws Exception { JMXServiceURL url = new JMXServiceURL(getSecureJMXConnectorURL(m_host, m_port)); if (m_secured) { RMIClientSocketFactory csf; if (Boolean.getBoolean("tc.ssl.trustAllCerts")) { csf = new TSASSLSocketFactory(); } else {/* www . ja va 2 s. c o m*/ csf = new SslRMIClientSocketFactory(); } SslRMIServerSocketFactory ssf = new SslRMIServerSocketFactory(); m_env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf); m_env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf); // Needed to avoid "non-JRMP server at remote endpoint" error m_env.put("com.sun.jndi.rmi.factory.socket", csf); m_serviceURL = new JMXServiceURL("service:jmx:rmi://" + m_host + ":" + m_port + "/jndi/rmi://" + m_host + ":" + m_port + "/jmxrmi"); m_connector = JMXConnectorFactory.connect(url, m_env); } else { try { m_connector = JMXConnectorFactory.connect(url, m_env); m_serviceURL = url; } catch (IOException ioe) { if (isConnectException(ioe)) { throw ioe; } if (isAuthenticationException(ioe)) { throw new SecurityException("Invalid login name or credentials"); } url = new JMXServiceURL(getJMXConnectorURL(m_host, m_port)); m_connector = JMXConnectorFactory.connect(url, m_env); m_serviceURL = url; } } }