List of usage examples for java.lang Boolean parseBoolean
public static boolean parseBoolean(String s)
From source file:io.galeb.router.configurations.UndertowConfiguration.java
@Bean public Undertow undertow() { return Undertow.builder().addHttpListener(port, "0.0.0.0", rootHandler) .setIoThreads(Integer.parseInt(SystemEnv.IO_THREADS.getValue())) .setWorkerThreads(Integer.parseInt(SystemEnv.WORKER_THREADS.getValue())) .setBufferSize(Integer.parseInt(SystemEnv.BUFFER_SIZE.getValue())) .setDirectBuffers(Boolean.parseBoolean(SystemEnv.DIRECT_BUFFER.getValue())) .setSocketOption(Options.BACKLOG, Integer.parseInt(SystemEnv.BACKLOG.getValue())) .setSocketOption(Options.KEEP_ALIVE, true).setSocketOption(Options.REUSE_ADDRESSES, true) .setSocketOption(Options.TCP_NODELAY, true) .setServerOption(UndertowOptions.RECORD_REQUEST_START_TIME, true) .setServerOption(UndertowOptions.ENABLE_STATISTICS, true).build(); }
From source file:code.google.nfs.rpc.netty.server.NettyServer.java
public NettyServer() { ThreadFactory serverBossTF = new NamedThreadFactory("NETTYSERVER-BOSS-"); ThreadFactory serverWorkerTF = new NamedThreadFactory("NETTYSERVER-WORKER-"); bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory( Executors.newCachedThreadPool(serverBossTF), Executors.newCachedThreadPool(serverWorkerTF))); bootstrap.setOption("tcpNoDelay", Boolean.parseBoolean(System.getProperty("nfs.rpc.tcp.nodelay", "true"))); bootstrap.setOption("reuseAddress", Boolean.parseBoolean(System.getProperty("nfs.rpc.tcp.reuseaddress", "true"))); }
From source file:com.clican.pluto.dataprocess.spring.parser.DplExecProcessorParser.java
@SuppressWarnings("unchecked") public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) { this.setBeanDefinitionStringProperty("resultName", beanDef, element); String dplStatement = element.getAttribute("dplStatement"); if (StringUtils.isEmpty(dplStatement)) { dplStatement = "dplStatement"; }//from ww w. j a v a 2s.co m String clazz = element.getAttribute("clazz"); if (StringUtils.isNotEmpty(clazz)) { try { Class c = Class.forName(clazz); beanDef.getPropertyValues().addPropertyValue("clazz", c); } catch (Exception e) { throw new RuntimeException(e); } } String singleRow = element.getAttribute("singleRow"); if (StringUtils.isNotEmpty(singleRow)) { beanDef.getPropertyValues().addPropertyValue("singleRow", Boolean.parseBoolean(singleRow)); } String traces = element.getAttribute("traces"); if (StringUtils.isNotEmpty(traces)) { List<String> traceList = new ArrayList<String>(); for (String trace : traces.split(",")) { traceList.add(trace.trim()); } beanDef.getPropertyValues().addPropertyValue("traces", traceList); } beanDef.getPropertyValues().addPropertyValue("dplStatement", new RuntimeBeanReference(dplStatement)); beanDef.getPropertyValues().addPropertyValue("dpl", element.getTextContent().trim()); }
From source file:com.photon.phresco.ldap.model.UserAttributesMapper.java
@Override protected Object doMapFromContext(DirContextOperations context) { User user = new User(); user.setId(context.getStringAttribute(LDAP_UID_ATTRIBUTE)); user.setName(context.getStringAttribute(LDAP_UID_ATTRIBUTE)); user.setEmail(context.getStringAttribute(LDAP_MAIL_ATTRIBUTE)); user.setDisplayName(context.getStringAttribute(LDAP_DISPLAY_NAME_ATTRIBUTE)); String phrescoEnabled = "true"; String stringAttribute = context.getStringAttribute(LDAP_PHRESCO_ENABLED); if (StringUtils.isNotEmpty(stringAttribute)) { phrescoEnabled = "true"; }//from w ww . j av a2 s .c o m user.setPhrescoEnabled(Boolean.parseBoolean(phrescoEnabled)); user.setAuthType(AuthType.AUTHSERVICE); user.setValidLogin(true); return user; }
From source file:com.sdapp.server.LoginServlet.java
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SdLogger.getInstance().getLogger().info("Post on LoginServlet"); /**//ww w . j a v a2s .c om * Get the parameters */ String username = request.getParameter("username"); String isDeviceString = request.getParameter("isDevice"); boolean isDevice = false; if (isDeviceString != null && isDeviceString.length() > 0) isDevice = Boolean.parseBoolean(isDeviceString); UserMsg user = null; /** * Sanity check */ if ((username != null) && (username.length() > 0) && (true == username.contains("@"))) { /** * See if the user object exists */ user = DAO.getUser(username, true); } /** Login failed */ if (null == user) { /** If login failed on device, return a 403 */ if (isDevice) { response.setStatus(HttpServletResponse.SC_FORBIDDEN); return; } else { /** Create the response */ response.setStatus(HttpServletResponse.SC_OK); response.setContentType("text/html"); PrintWriter out = response.getWriter(); String title = "Login Failure"; out.println(ServletUtilities.headWithTitle(title) + "<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1 ALIGN=CENTER>" + title + "</H1>\n" + "<TABLE BORDER=1 ALIGN=CENTER>\n"); /** End table */ out.println("</TABLE>\n</BODY></HTML>"); } } /** Login successful */ else { /** Login successful */ response.setStatus(HttpServletResponse.SC_OK); /** JSON response or html*/ if (createJSONRespone) { /** * TODO: Sid fix this. * Cant figure out how to deserialize JSON objects on client. * It keeps crashing. So extracting String and passing String object. */ String licensePlateString = ""; for (LicensePlateMsg msg : user.getLicensePlateList()) { licensePlateString += ";" + msg.getLicensePlateNumber(); } LicensePlateJsonObject msg = new LicensePlateJsonObject(); msg.setLicensePlateList(licensePlateString); /** JSONify the object and bundle it with the response*/ ObjectMapper objectMapper = new ObjectMapper(); String json = objectMapper.writeValueAsString(msg); response.setContentType("application/json"); PrintWriter out = response.getWriter(); out.write(json); out.close(); } else { createHTMLSuccessResponse(response, user); } } }
From source file:com.cloudera.flume.core.DigestDecorator.java
public static SinkDecoBuilder builder() { return new SinkDecoBuilder() { @Override//from w ww . j a v a 2 s . c o m public EventSinkDecorator<EventSink> build(Context context, String... argv) { Preconditions.checkArgument(argv.length == 2, "usage: digest(algorithm, attr, [base64=boolean])"); boolean encodeBase64 = false; String v = context.getValue("base64"); if (v != null) { encodeBase64 = Boolean.parseBoolean(v); } return new DigestDecorator<EventSink>(null, argv[0], argv[1], encodeBase64); } }; }
From source file:eu.delving.core.util.MongoFactory.java
public void setTestContext(String testContext) { this.testContext = Boolean.parseBoolean(testContext); }
From source file:io.werval.modules.metrics.Tools.java
private static ObjectWriter getJsonWriter() { final boolean prettyPrint = Boolean .parseBoolean(request().queryString().firstValueOptional("pretty").orElse("false")); if (prettyPrint) { return plugin(JSON.class).mapper().writerWithDefaultPrettyPrinter(); }/*w w w . j ava 2 s.co m*/ return plugin(JSON.class).mapper().writer(); }
From source file:org.openmrs.module.distrotools.metadata.MetadataManager.java
/** * @see ContentManager#refresh()/* w w w . jav a 2 s . com*/ */ @Override public synchronized void refresh() { // Allow skipping of metadata refresh - useful for developers if (Boolean.parseBoolean(System.getProperty(SYSTEM_PROPERTY_SKIP_REFRESH))) { log.warn("Skipping metadata refresh"); return; } // Install bundle components distroToolsService.installBundles(Context.getRegisteredComponents(MetadataBundle.class)); }
From source file:com.github.sakserv.minicluster.impl.HdfsLocalClusterIntegrationTest.java
@BeforeClass public static void setUp() throws Exception { dfsCluster = new HdfsLocalCluster.Builder() .setHdfsNamenodePort(//from w w w . j a v a2 s. co m Integer.parseInt(propertyParser.getProperty(ConfigVars.HDFS_NAMENODE_PORT_KEY))) .setHdfsNamenodeHttpPort( Integer.parseInt(propertyParser.getProperty(ConfigVars.HDFS_NAMENODE_HTTP_PORT_KEY))) .setHdfsTempDir(propertyParser.getProperty(ConfigVars.HDFS_TEMP_DIR_KEY)) .setHdfsNumDatanodes( Integer.parseInt(propertyParser.getProperty(ConfigVars.HDFS_NUM_DATANODES_KEY))) .setHdfsEnablePermissions( Boolean.parseBoolean(propertyParser.getProperty(ConfigVars.HDFS_ENABLE_PERMISSIONS_KEY))) .setHdfsFormat(Boolean.parseBoolean(propertyParser.getProperty(ConfigVars.HDFS_FORMAT_KEY))) .setHdfsEnableRunningUserAsProxyUser(Boolean.parseBoolean( propertyParser.getProperty(ConfigVars.HDFS_ENABLE_RUNNING_USER_AS_PROXY_USER))) .setHdfsConfig(new Configuration()).build(); dfsCluster.start(); }