List of usage examples for java.lang Boolean valueOf
public static Boolean valueOf(String s)
From source file:com.redhat.rcm.nexus.security.NxSecConfiguration.java
public void load() throws ConfigurationException { File configFile = new File(appConfiguration.getConfigurationDirectory(), NX_SEC_CONFIG_FILE); if (configFile.exists() && configFile.canRead()) { FileInputStream fis = null; try {//www .j av a 2 s . com fis = new FileInputStream(configFile); Properties props = new Properties(); props.load(fis); autoCreateEnabled = Boolean.valueOf( props.getProperty(KEY_AUTOCREATE_ENABLED, Boolean.toString(DEFAULT_AUTOCREATE_ENABLED))); autoCreateEmailDomain = props.getProperty(KEY_AUTOCREATE_EMAIL_DOMAIN, DEFAULT_AUTOCREATE_EMAIL_DOMAIN); templateUserId = props.getProperty(KEY_TEMPLATE_USER_ID); if (isBlank(autoCreateEmailDomain)) { autoCreateEmailDomain = DEFAULT_AUTOCREATE_EMAIL_DOMAIN; } loaded = true; } catch (IOException e) { loaded = false; throw new ConfigurationException("Cannot read " + configFile + ". Reason: " + e.getMessage(), e); } finally { closeQuietly(fis); } } }
From source file:io.s4.comm.Module.java
@Override protected void configure() { if (config == null) loadProperties(binder());/*from w w w . ja v a 2 s . c om*/ int numHosts = config.getList("cluster.hosts").size(); boolean isCluster = numHosts > 1 ? true : false; bind(Boolean.class).annotatedWith(Names.named("isCluster")).toInstance(Boolean.valueOf(isCluster)); bind(Cluster.class); /* Configure static assignment using a configuration file. */ bind(Assignment.class).to(AssignmentFromFile.class); /* Configure a static cluster topology using a configuration file. */ bind(Topology.class).to(TopologyFromFile.class); // bind(Emitter.class).annotatedWith(Names.named("ll")).to(NettyEmitter.class); // bind(Listener.class).annotatedWith(Names.named("ll")).to(NettyListener.class); // // bind(Emitter.class).to(QueueingEmitter.class); // bind(Listener.class).to(QueueingListener.class); /* Use the Netty comm layer implementation. */ // bind(Emitter.class).to(NettyEmitter.class); // bind(Listener.class).to(NettyListener.class); /* Use a simple UDP comm layer implementation. */ bind(Emitter.class).to(UDPEmitter.class); bind(Listener.class).to(UDPListener.class); /* The hashing function to map keys top partitions. */ bind(Hasher.class).to(DefaultHasher.class); /* Use Kryo to serialize events. */ bind(SerializerDeserializer.class).to(KryoSerDeser.class); }
From source file:com.exxonmobile.ace.hybris.storefront.controllers.pages.AbstractSearchPageController.java
protected Boolean calculateShowAll(final SearchPageData<?> searchPageData, final ShowMode showMode) { return Boolean.valueOf((showMode != ShowMode.All && searchPageData.getPagination() .getTotalNumberOfResults() > searchPageData.getPagination().getPageSize()) && isShowAllAllowed(searchPageData)); }
From source file:com.jaspersoft.jasperserver.war.tags.ParametersFormTag.java
protected void setAttributes() { ServletRequest request = pageContext.getRequest(); if (onInputChange != null && onInputChange.length() > 0) { request.setAttribute(ATTRIBUTE_ON_INPUT_CHANGE, onInputChange); }//w ww . j a v a 2 s. c om request.setAttribute(ATTRIBUTE_INPUT_NAME_PREFIX, getInputNamePrefix()); request.setAttribute(ATTRIBUTE_READ_ONLY, Boolean.valueOf(isReadOnly())); }
From source file:com.mirth.connect.server.servlets.ChannelStatisticsServlet.java
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // MIRTH-1745 response.setCharacterEncoding("UTF-8"); if (!isUserLoggedIn(request)) { response.sendError(HttpServletResponse.SC_FORBIDDEN); } else {//from w w w . ja v a 2 s. c o m try { ChannelStatisticsController statisticsController = ControllerFactory.getFactory() .createChannelStatisticsController(); ObjectXMLSerializer serializer = new ObjectXMLSerializer(); PrintWriter out = response.getWriter(); Operation operation = Operations.getOperation(request.getParameter("op")); String channelId = request.getParameter("id"); Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("channelId", channelId); if (operation.equals(Operations.CHANNEL_STATS_GET)) { if (!isUserAuthorized(request, parameterMap)) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } else { response.setContentType(APPLICATION_XML); serializer.toXML(statisticsController.getStatistics(channelId), out); } } else if (operation.equals(Operations.CHANNEL_STATS_CLEAR)) { if (!isUserAuthorized(request, parameterMap)) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } else { boolean deleteReceived = Boolean.valueOf(request.getParameter("deleteReceived")); boolean deleteFiltered = Boolean.valueOf(request.getParameter("deleteFiltered")); boolean deleteQueued = Boolean.valueOf(request.getParameter("deleteQueued")); boolean deleteSent = Boolean.valueOf(request.getParameter("deleteSent")); boolean deleteErrored = Boolean.valueOf(request.getParameter("deleteErrored")); boolean deleteAlerted = Boolean.valueOf(request.getParameter("deleteAlerted")); statisticsController.clearStatistics(channelId, deleteReceived, deleteFiltered, deleteQueued, deleteSent, deleteErrored, deleteAlerted); } } } catch (RuntimeIOException rio) { logger.debug(rio); } catch (Throwable t) { logger.error(ExceptionUtils.getStackTrace(t)); throw new ServletException(t); } } }
From source file:com.fredhopper.core.connector.index.DefaultIndexerTest.java
/** * *//*from w ww. j av a 2 s. c o m*/ @Before public void setUp() throws Exception { mockPublishingService = mock(DefaultPublishingService.class); when(Boolean.valueOf(mockPublishingService.publishZip(any(), any()))).thenReturn(Boolean.TRUE); newFolder = tmpFolder.newFolder(); final FileSystemResource dataDirResource = new FileSystemResource(newFolder); final CollectorFactory collectorFactory = mock(CollectorFactory.class); mockCategoryCollector = mock(CategoryDataCollector.class); when(collectorFactory.getCategoryCollector(DEFAULT_INSTANCE_CONFIG)).thenReturn(mockCategoryCollector); mockProductCollector = mock(ProductDataCollector.class); when(collectorFactory.getProductCollector(DEFAULT_INSTANCE_CONFIG)).thenReturn(mockProductCollector); mockMetaAttributeCollector = mock(MetaAttributeCollector.class); when(collectorFactory.getMetaAttributeCollector(DEFAULT_INSTANCE_CONFIG)) .thenReturn(mockMetaAttributeCollector); generator = mock(Generator.class); newFile = tmpFolder.newFile(); when(generator.generate(eq(mockMetaAttributeCollector), eq(mockCategoryCollector), eq(mockProductCollector), any())).thenReturn(newFile); defaultFhIndexer = new DefaultIndexer(); defaultFhIndexer.setDataDirectoryResource(dataDirResource); defaultFhIndexer.setPublishingService(mockPublishingService); defaultFhIndexer.setCollectorFactory(collectorFactory); defaultFhIndexer.setGenerator(generator); defaultFhIndexer.setInstanceConfigService(instanceConfigService); }
From source file:org.apache.ftpserver.config.spring.CommandFactoryBeanDefinitionParser.java
/** * {@inheritDoc}//from www.j a va 2 s . c o m */ @Override protected void doParse(final Element element, final ParserContext parserContext, final BeanDefinitionBuilder builder) { BeanDefinitionBuilder factoryBuilder = BeanDefinitionBuilder .genericBeanDefinition(CommandFactoryFactory.class); ManagedMap commands = new ManagedMap(); List<Element> childs = SpringUtil.getChildElements(element); for (Element commandElm : childs) { String name = commandElm.getAttribute("name"); Object bean = SpringUtil.parseSpringChildElement(commandElm, parserContext, builder); commands.put(name, bean); } factoryBuilder.addPropertyValue("commandMap", commands); if (StringUtils.hasText(element.getAttribute("use-default"))) { factoryBuilder.addPropertyValue("useDefaultCommands", Boolean.valueOf(element.getAttribute("use-default"))); } BeanDefinition factoryDefinition = factoryBuilder.getBeanDefinition(); String factoryId = parserContext.getReaderContext().generateBeanName(factoryDefinition); BeanDefinitionHolder factoryHolder = new BeanDefinitionHolder(factoryDefinition, factoryId); registerBeanDefinition(factoryHolder, parserContext.getRegistry()); // set the factory on the listener bean builder.getRawBeanDefinition().setFactoryBeanName(factoryId); builder.getRawBeanDefinition().setFactoryMethodName("createCommandFactory"); }
From source file:org.apache.maven.wagon.providers.http.ConfigurationUtils.java
public static void copyConfig(HttpMethodConfiguration config, RequestConfig.Builder builder) { if (config.getConnectionTimeout() > 0) { builder.setConnectTimeout(config.getConnectionTimeout()); }//ww w. j av a2 s. c om if (config.getReadTimeout() > 0) { builder.setSocketTimeout(config.getReadTimeout()); } Properties params = config.getParams(); if (params != null) { Pattern coercePattern = Pattern.compile(COERCE_PATTERN); for (Map.Entry entry : params.entrySet()) { String key = (String) entry.getKey(); String value = (String) entry.getValue(); Matcher matcher = coercePattern.matcher(value); if (matcher.matches()) { value = matcher.group(2); } if (key.equals(SO_TIMEOUT)) { builder.setSocketTimeout(Integer.parseInt(value)); } else if (key.equals(STALE_CONNECTION_CHECK)) { builder.setStaleConnectionCheckEnabled(Boolean.valueOf(value)); } else if (key.equals(CONNECTION_TIMEOUT)) { builder.setConnectTimeout(Integer.parseInt(value)); } else if (key.equals(USE_EXPECT_CONTINUE)) { builder.setExpectContinueEnabled(Boolean.valueOf(value)); } else if (key.equals(DEFAULT_PROXY)) { builder.setProxy(new HttpHost(value)); } else if (key.equals(LOCAL_ADDRESS)) { try { builder.setLocalAddress(InetAddress.getByName(value)); } catch (UnknownHostException ignore) { } } else if (key.equals(PROXY_AUTH_PREF)) { builder.setProxyPreferredAuthSchemes(Arrays.asList(value.split(","))); } else if (key.equals(TARGET_AUTH_PREF)) { builder.setTargetPreferredAuthSchemes(Arrays.asList(value.split(","))); } else if (key.equals(HANDLE_AUTHENTICATION)) { builder.setAuthenticationEnabled(Boolean.valueOf(value)); } else if (key.equals(ALLOW_CIRCULAR_REDIRECTS)) { builder.setCircularRedirectsAllowed(Boolean.valueOf(value)); } else if (key.equals(CONN_MANAGER_TIMEOUT)) { builder.setConnectionRequestTimeout(Integer.parseInt(value)); } else if (key.equals(COOKIE_POLICY)) { builder.setCookieSpec(value); } else if (key.equals(MAX_REDIRECTS)) { builder.setMaxRedirects(Integer.parseInt(value)); } else if (key.equals(HANDLE_REDIRECTS)) { builder.setRedirectsEnabled(Boolean.valueOf(value)); } else if (key.equals(REJECT_RELATIVE_REDIRECT)) { builder.setRelativeRedirectsAllowed(!Boolean.valueOf(value)); } } } }
From source file:be.fedict.eid.idp.sp.protocol.saml2.AbstractAuthenticationResponseServlet.java
/** * {@inheritDoc}//from ww w. java 2 s . c o m */ @Override public void init(ServletConfig config) throws ServletException { String requiresResponseSignatureString = config.getInitParameter(REQUIRES_RESPONSE_SIGNATURE_INIT_PARAM); if (null != requiresResponseSignatureString) { requiresResponseSignature = Boolean.valueOf(requiresResponseSignatureString); } this.responseSessionAttribute = getRequiredInitParameter(RESPONSE_SESSION_ATTRIBUTE_INIT_PARAM, config); this.redirectPage = getRequiredInitParameter(REDIRECT_PAGE_INIT_PARAM, config); this.errorPage = config.getInitParameter(ERROR_PAGE_INIT_PARAM); this.errorMessageSessionAttribute = config.getInitParameter(ERROR_MESSAGE_SESSION_ATTRIBUTE_INIT_PARAM); initialize(config); }
From source file:com.devicehive.model.oauth.GoogleAuthProvider.java
@Override public boolean isIdentityProviderAllowed() { return Boolean.valueOf(configurationService.get(Constants.GOOGLE_IDENTITY_ALLOWED)); }