List of usage examples for java.lang Boolean parseBoolean
public static boolean parseBoolean(String s)
From source file:com.swdouglass.joid.consumer.OpenIdFilter.java
@Override public void init(FilterConfig filterConfig) throws ServletException { log.info("init OpenIdFilter"); String saveInCookie = filterConfig.getInitParameter("saveInCookie"); if (saveInCookie != null) { saveIdentityUrlAsCookie = Boolean.parseBoolean(saveInCookie); log.debug("saving identities in cookie: " + saveIdentityUrlAsCookie); }//from www. ja v a 2 s.c om cookieDomain = filterConfig.getInitParameter("cookieDomain"); String cookieMaxAgeString = filterConfig.getInitParameter("cookieMaxAge"); if (cookieMaxAgeString != null) { cookieMaxAge = Integer.valueOf(cookieMaxAgeString); } String _ignorePaths = filterConfig.getInitParameter("ignorePaths"); if (_ignorePaths != null) { String paths[] = _ignorePaths.split(","); for (int i = 0; i < paths.length; i++) { String path = paths[i].trim(); this.ignorePaths.add(path); } } configuredProperly = true; log.debug("end init OpenIdFilter"); }
From source file:org.apache.synapse.samples.framework.EchoHttpServerController.java
public EchoHttpServerController(OMElement element) { super(element); port = Integer.parseInt(SynapseTestUtils.getParameter(element, SampleConfigConstants.TAG_BE_SERVER_CONF_ECHO_HTTP_PORT, "9000")); echoHeaders = Boolean.parseBoolean(SynapseTestUtils.getParameter(element, SampleConfigConstants.TAG_BE_SERVER_CONF_ECHO_HEADERS, "false")); }
From source file:com.cedarsoft.app.MockApplicationHomeAccess.java
/** * <p>Constructor for MockApplicationHomeAccess.</p> *///from www . ja va2 s . c o m public MockApplicationHomeAccess() { projectHome = new File(new File(System.getProperty("java.io.tmpdir")), "." + APP_NAME); try { if (!Boolean.parseBoolean(System.getProperty(SKIP_DELETION))) { FileUtils.deleteDirectory(projectHome); } } catch (IOException ignore) { } projectHome.mkdirs(); if (!projectHome.isDirectory()) { throw new IllegalStateException("Could not create " + projectHome.getAbsolutePath()); } assert projectHome.exists(); }
From source file:azkaban.server.HttpRequestUtils.java
public static ExecutionOptions parseFlowOptions(HttpServletRequest req) throws ServletException { ExecutionOptions execOptions = new ExecutionOptions(); if (hasParam(req, "failureAction")) { String option = getParam(req, "failureAction"); if (option.equals("finishCurrent")) { execOptions.setFailureAction(FailureAction.FINISH_CURRENTLY_RUNNING); } else if (option.equals("cancelImmediately")) { execOptions.setFailureAction(FailureAction.CANCEL_ALL); } else if (option.equals("finishPossible")) { execOptions.setFailureAction(FailureAction.FINISH_ALL_POSSIBLE); }//from ww w . j a v a2s. c o m } if (hasParam(req, "failureEmailsOverride")) { boolean override = getBooleanParam(req, "failureEmailsOverride", false); execOptions.setFailureEmailsOverridden(override); } if (hasParam(req, "successEmailsOverride")) { boolean override = getBooleanParam(req, "successEmailsOverride", false); execOptions.setSuccessEmailsOverridden(override); } if (hasParam(req, "failureEmails")) { String emails = getParam(req, "failureEmails"); if (!emails.isEmpty()) { String[] emailSplit = emails.split("\\s*,\\s*|\\s*;\\s*|\\s+"); execOptions.setFailureEmails(Arrays.asList(emailSplit)); } } if (hasParam(req, "successEmails")) { String emails = getParam(req, "successEmails"); if (!emails.isEmpty()) { String[] emailSplit = emails.split("\\s*,\\s*|\\s*;\\s*|\\s+"); execOptions.setSuccessEmails(Arrays.asList(emailSplit)); } } if (hasParam(req, "notifyFailureFirst")) { execOptions.setNotifyOnFirstFailure(Boolean.parseBoolean(getParam(req, "notifyFailureFirst"))); } if (hasParam(req, "notifyFailureLast")) { execOptions.setNotifyOnLastFailure(Boolean.parseBoolean(getParam(req, "notifyFailureLast"))); } String concurrentOption = "skip"; if (hasParam(req, "concurrentOption")) { concurrentOption = getParam(req, "concurrentOption"); execOptions.setConcurrentOption(concurrentOption); if (concurrentOption.equals("pipeline")) { int pipelineLevel = getIntParam(req, "pipelineLevel"); execOptions.setPipelineLevel(pipelineLevel); } else if (concurrentOption.equals("queue")) { // Not yet implemented int queueLevel = getIntParam(req, "queueLevel", 1); execOptions.setPipelineLevel(queueLevel); } } String mailCreator = DefaultMailCreator.DEFAULT_MAIL_CREATOR; if (hasParam(req, "mailCreator")) { mailCreator = getParam(req, "mailCreator"); execOptions.setMailCreator(mailCreator); } Map<String, String> flowParamGroup = getParamGroup(req, "flowOverride"); execOptions.addAllFlowParameters(flowParamGroup); if (hasParam(req, "disabled")) { String disabled = getParam(req, "disabled"); if (!disabled.isEmpty()) { @SuppressWarnings("unchecked") List<Object> disabledList = (List<Object>) JSONUtils.parseJSONFromStringQuiet(disabled); execOptions.setDisabledJobs(disabledList); } } return execOptions; }
From source file:de.dal33t.powerfolder.util.ConfigurationLoader.java
private static boolean dropFolderSettings(Properties p) { boolean drop = Boolean.valueOf(ConfigurationEntry.CONFIG_DROP_FOLDER_SETTINGS.getDefaultValue()); String owStr = p.getProperty(ConfigurationEntry.CONFIG_DROP_FOLDER_SETTINGS.getConfigKey()); try {/*from w ww . ja v a 2 s.co m*/ drop = Boolean.parseBoolean(owStr); } catch (Exception e) { LOG.warning("Unable to parse pre-config drop folders settings value. Problem value: " + owStr + ". Now using: " + drop + ". " + e); } return drop; }
From source file:gsn.utils.KeyValueImp.java
/** * Converts the value inside the predicate object to boolean or returns * false./*w w w . ja v a 2s . co m*/ * * @return The boolean representation of the value or false if the conversion * fails. */ public boolean valueInBoolean() { boolean result = false; try { result = Boolean.parseBoolean(getValue()); } catch (Exception e) { logger.error(e.getMessage(), e); } return result; }
From source file:de.hybris.platform.servicelayer.config.ConfigServiceTest.java
/** * General testing whether delegating requests to hybris config works well. Test compares configuration values from * jalo with results of configuration values from servicelayer. *//* ww w . ja v a 2s .c o m*/ @Test public void testJaloVsCommons() { //take the jalo configuration as master (expected) final Map<String, String> values = Registry.getCurrentTenant().getConfig().getAllParameters(); //and compare with commons configuration (actual) for (final Map.Entry<String, String> entry : values.entrySet()) { final String key = entry.getKey(); final String expected = entry.getValue(); final String actual = this.configurationService.getConfiguration().getString(key); //assert as string Assert.assertEquals(expected, actual); //assert convenience methods (boolean) if ("true".equals(actual) || "false".equals(actual)) { final boolean bExpected = Boolean.parseBoolean(actual); final boolean bActual = this.configurationService.getConfiguration().getBoolean(key); Assert.assertEquals(Boolean.valueOf(bExpected), Boolean.valueOf(bActual)); } } }
From source file:com.netflix.paas.config.base.ConfigurationProxyUtils.java
static Supplier<?> getDynamicSupplier(Class<?> type, String key, String defaultValue, DynamicPropertyFactory propertyFactory) { if (type.isAssignableFrom(String.class)) { return new PropertyWrapperSupplier<String>(propertyFactory.getStringProperty(key, defaultValue)); } else if (type.isAssignableFrom(Integer.class)) { return new PropertyWrapperSupplier<Integer>( propertyFactory.getIntProperty(key, defaultValue == null ? 0 : Integer.parseInt(defaultValue))); } else if (type.isAssignableFrom(Double.class)) { return new PropertyWrapperSupplier<Double>(propertyFactory.getDoubleProperty(key, defaultValue == null ? 0.0 : Double.parseDouble(defaultValue))); } else if (type.isAssignableFrom(Long.class)) { return new PropertyWrapperSupplier<Long>( propertyFactory.getLongProperty(key, defaultValue == null ? 0L : Long.parseLong(defaultValue))); } else if (type.isAssignableFrom(Boolean.class)) { return new PropertyWrapperSupplier<Boolean>(propertyFactory.getBooleanProperty(key, defaultValue == null ? false : Boolean.parseBoolean(defaultValue))); }//from w ww .j av a 2 s .c o m throw new RuntimeException("Unsupported value type " + type.getCanonicalName()); }
From source file:com.jaeksoft.searchlib.scheduler.TaskProperties.java
public boolean getValueBoolean(TaskPropertyDef propertyDef, boolean defaultValue) { String s = getValue(propertyDef); return StringUtils.isEmpty(s) ? defaultValue : Boolean.parseBoolean(s); }
From source file:com.bazaarvoice.seo.sdk.validation.BVDefaultValidator.java
/** * Validator method to validate all the attributes in bvParameter object * /* w w w . j a v a2 s.c o m*/ * @return String if there are any errors for the attributes which are either null or invalid. */ public String validate(BVConfiguration bvConfiguration, BVParameters bvParams) { if (bvConfiguration == null) { errorMessages.append(BVMessageUtil.getMessage("ERR0007")); _logger.error(BVMessageUtil.getMessage("ERR0007")); return errorMessages.toString(); } if (bvParams == null) { errorMessages.append(BVMessageUtil.getMessage("ERR0011")); _logger.error(BVMessageUtil.getMessage("ERR0011")); return errorMessages.toString(); } boolean loadSeoFilesLocally = Boolean .parseBoolean(bvConfiguration.getProperty(BVClientConfig.LOAD_SEO_FILES_LOCALLY.getPropertyName())); if (loadSeoFilesLocally) { String localSeoFileRoot = bvConfiguration .getProperty(BVClientConfig.LOCAL_SEO_FILE_ROOT.getPropertyName()); if (StringUtils.isBlank(localSeoFileRoot)) { errorMessages.append(BVMessageUtil.getMessage("ERR0010")); } } else { String cloudKey = bvConfiguration.getProperty(BVClientConfig.CLOUD_KEY.getPropertyName()); if (StringUtils.isBlank(cloudKey)) { errorMessages.append(BVMessageUtil.getMessage("ERR0020")); } } String rootFolder = bvConfiguration.getProperty(BVClientConfig.BV_ROOT_FOLDER.getPropertyName()); if (StringUtils.isBlank(rootFolder)) { errorMessages.append(BVMessageUtil.getMessage("ERR0021")); } if (StringUtils.isBlank(bvParams.getUserAgent())) { errorMessages.append(BVMessageUtil.getMessage("ERR0017")); } URI uri = null; if (bvParams.getBaseURI() != null) { try { uri = new URI(bvParams.getBaseURI()); } catch (URISyntaxException e) { errorMessages.append(BVMessageUtil.getMessage("ERR0023")); } } if (bvParams.getPageURI() != null) { try { uri = new URI(bvParams.getPageURI()); } catch (URISyntaxException e) { errorMessages.append(BVMessageUtil.getMessage("ERR0022")); } } if (StringUtils.isBlank(bvParams.getPageURI()) || !bvParams.getPageURI().contains("bvpage")) { if (StringUtils.isBlank(bvParams.getSubjectId())) { errorMessages.append(BVMessageUtil.getMessage("ERR0014")); } if (bvParams.getSubjectType() == null) { errorMessages.append(BVMessageUtil.getMessage("ERR0016")); } if (bvParams.getContentType() == null) { errorMessages.append(BVMessageUtil.getMessage("ERR0015")); } } if (errorMessages.length() > 0) { _logger.error("There is an error : " + errorMessages.toString()); return errorMessages.toString(); } return null; }