List of usage examples for java.lang Boolean parseBoolean
public static boolean parseBoolean(String s)
From source file:com.navercorp.pinpoint.common.server.bo.thrift.SpanFactory.java
private static boolean fastAsyncIdGen() { final String fastAsyncIdGen = System.getProperty("collector.spanfactory.fastasyncidgen", "true"); return Boolean.parseBoolean(fastAsyncIdGen); }
From source file:com.whizzosoftware.hobson.rest.v1.resource.task.TasksResource.java
/** * @api {get} /api/v1/users/:userId/hubs/:hubId/tasks Get all tasks * @apiVersion 0.1.3// w w w. java 2 s. c o m * @apiParam {Boolean} properties If true, include any properties associated with the task * @apiName GetAllTasks * @apiDescription Retrieves a list of all tasks (regardless of provider). * @apiGroup Tasks * @apiSuccessExample {json} Success Response: * [ * { * "name": "My Task", * "type": "EVENT", * "links": { * "self": "/api/v1/users/local/hubs/local/tasks/com.whizzosoftware.hobson.server-rules/efc02d7a-d0e0-46fb-9cc3-2ca70a66dc05" * }, * } * ] */ @Override protected Representation get() { HobsonRestContext ctx = HobsonRestContext.createContext(this, getRequest()); return new JsonRepresentation( JSONMarshaller.createTaskListJSON(ctx, taskManager.getAllTasks(ctx.getUserId(), ctx.getHubId()), Boolean.parseBoolean(getQueryValue("properties")))); }
From source file:dk.alexandra.fresco.suite.spdz.configuration.SpdzConfiguration.java
static SpdzConfiguration fromCmdLine(SCEConfiguration sceConf, CommandLine cmd) throws ParseException { Properties p = cmd.getOptionProperties("D"); //TODO: Figure out a meaningful default for the below final int maxBitLength = Integer.parseInt(p.getProperty("spdz.maxBitLength", "64")); if (maxBitLength < 2) { throw new ParseException("spdz.maxBitLength must be > 1"); }//from w w w . j a v a 2 s. co m final String triplePath = p.getProperty("spdz.triplePath", "/triples"); final boolean useDummyData = Boolean.parseBoolean(p.getProperty("spdz.useDummyData", "False")); return new SpdzConfiguration() { @Override public String getTriplePath() { return triplePath; } @Override public int getMaxBitLength() { return maxBitLength; } @Override public boolean useDummyData() { return useDummyData; } }; }
From source file:com.stratelia.silverpeas.silverpeasinitialize.ProcessInitialize.java
/** * Method declaration/*from w w w . j av a 2s . co m*/ * @see */ private void processInitializeSettingsFile() { try { Properties p = getPropertiesOfFile(initConfiguration); String initialize = p.getProperty("Initialize"); if (initialize != null && Boolean.parseBoolean(initialize)) { String initClassName = p.getProperty("InitializeClass"); Class<?> initClass = Class.forName(initClassName); IInitialize init = (IInitialize) initClass.newInstance(); if (!init.Initialize()) { logMessage(this, "processInitializeSettingsFile", initClassName + ".Initialize() failed.", null); } } if (Boolean.parseBoolean(p.getProperty("CallBack"))) { String CallBackClass = p.getProperty("CallBackClass"); Class<?> callBackClass = Class.forName(CallBackClass); CallBack callBack = (CallBack) callBackClass.newInstance(); if (!(CallBack.class.isInstance(callBack))) { throw new Exception("Class " + CallBackClass + " isn't a CallBack."); } callBack.subscribe(); } } catch (Exception e) { logMessage(this, "processInitializeSettingsFile", e.getMessage(), e); } }
From source file:com.microsoft.alm.plugin.idea.common.ui.common.tabs.TabModelImpl.java
public TabModelImpl(@NotNull final Project project, @NotNull T viewModel, String propertyStoragePrefix) { this.project = project; this.viewForModel = viewModel; // Make sure the prefix isn't null this.propertyStoragePrefix = StringUtil.isNullOrEmpty(propertyStoragePrefix) ? StringUtil.EMPTY : propertyStoragePrefix;//from ww w .j a va 2s .co m // Get the value of auto refresh from the property service // If the value is found, use it. Otherwise default to true; String autoRefreshText = PropertyServiceImpl.getInstance() .getProperty(propertyStoragePrefix + PROP_AUTO_REFRESH); autoRefresh = StringUtils.isEmpty(autoRefreshText) ? true : Boolean.parseBoolean(autoRefreshText); // need to create data provider after calling parent class since it passes the class to the provider createDataProvider(); }
From source file:com.redhat.coolstore.api_gateway.ReviewGateway.java
@Override public void configure() throws Exception { try {/*from w w w.j a v a 2s . c o m*/ getContext().setTracing(Boolean.parseBoolean(env.getProperty("ENABLE_TRACER", "false"))); } catch (Exception e) { LOG.error("Failed to parse the ENABLE_TRACER value: {}", env.getProperty("ENABLE_TRACER", "false")); } restConfiguration().component("servlet").bindingMode(RestBindingMode.auto).apiContextPath("/api-docs") .contextPath("/api").apiProperty("host", "") .apiProperty("api.title", "CoolStore Microservice Review API Gateway") .apiProperty("api.version", "1.0.0") .apiProperty("api.description", "The API of the gateway which fronts the various backend microservices in the CoolStore") .apiProperty("api.contact.name", "Red Hat Developers") .apiProperty("api.contact.email", "developers@redhat.com") .apiProperty("api.contact.url", "https://developers.redhat.com"); JacksonDataFormat reviewFormatter = new ListJacksonDataFormat(); reviewFormatter.setUnmarshalType(Review.class); rest("/review").description("Product Review Service").produces(MediaType.APPLICATION_JSON_VALUE) .get("/{itemId}").description("Get Product Reviews").param().name("itemId").type(RestParamType.path) .description("The ID of the item to process").dataType("string").endParam().outType(Review.class) .route().id("getReviewRoute").hystrix().id("Review Service (Get Review for Product)") .hystrixConfiguration().executionTimeoutInMilliseconds(hystrixExecutionTimeout) .groupKey(hystrixGroupKey).circuitBreakerEnabled(hystrixCircuitBreakerEnabled).end() .removeHeaders("CamelHttp*").setBody(simple("null")) .setHeader(Exchange.HTTP_METHOD, HttpMethods.GET) .setHeader(Exchange.HTTP_URI, simple("http://{{env:REVIEW_ENDPOINT:review:8080}}/api/review/${header.itemId}")) .to("http4://DUMMY").onFallback().setHeader(Exchange.CONTENT_TYPE, constant("application/json")) .to("direct:getReviewFallback").end() .setHeader("CamelJacksonUnmarshalType", simple(Review.class.getName())).unmarshal(reviewFormatter) .endRest(); // Provide a response from("direct:getReviewFallback").routeId("getreviewfallback").description("Get Review Fall back response") .process(exchange -> exchange.getIn().setBody(Collections.singletonList(new Review()))).marshal() .json(JsonLibrary.Jackson); }
From source file:cn.edu.suda.core.ProcessTask.java
@Override protected Integer call() throws Exception { Manager ma = Manager.getInstance();//w w w. j a v a2 s.c o m long t1 = System.currentTimeMillis(); updateMessage("Processing..."); ma.putResult(Manager.Result.Analyzed, 1); //step 1 updateMessage("step1"); int testMethod = Integer.parseInt(ma.getParam(Manager.Keyword.Test_Method)); int g1n = Integer.parseInt(ma.getParam(Manager.Keyword.GeneGroup1Num)); int g2n = Integer.parseInt(ma.getParam(Manager.Keyword.GeneGroup2Num)); int r1n = Integer.parseInt(ma.getParam(Manager.Keyword.RNAGroup1Num)); int r2n = Integer.parseInt(ma.getParam(Manager.Keyword.RNAGroup2Num)); double LSOSSR = Double.parseDouble(ma.getParam(Manager.Keyword.LSOSS_R)); double corR = Double.parseDouble(ma.getParam(Manager.Keyword.cor_R)); DataMatrix geneM = MatrixBuilder.readDouble(Manager.getInstance().getParam(Manager.Keyword.Input_Gene), Boolean.parseBoolean(Manager.getInstance().getParam(Manager.Keyword.Gene_hasRowname)), Boolean.parseBoolean(Manager.getInstance().getParam(Manager.Keyword.Gene_hasColname)), Boolean.parseBoolean(Manager.getInstance().getParam(Manager.Keyword.Gene_hasName))); DataMatrix miRNAM = MatrixBuilder.readDouble(Manager.getInstance().getParam(Manager.Keyword.Input_miRNA), Boolean.parseBoolean(Manager.getInstance().getParam(Manager.Keyword.miRNA_hasRowname)), Boolean.parseBoolean(Manager.getInstance().getParam(Manager.Keyword.miRNA_hasColname)), Boolean.parseBoolean(Manager.getInstance().getParam(Manager.Keyword.miRNA_hasName))); for (int i = 0; i < miRNAM.getDrow(); i++) { miRNAM.setRowname(i, Utils.trimMiRNAName(miRNAM.getRowname(i))); } ma.putResult(Manager.Result.Gene_Num_All, geneM.getDrow()); ma.putResult(Manager.Result.MiRNA_Num_All, miRNAM.getDrow()); if (testMethod == 0) { updateMessage("T Test..."); geneM = StatsUtils.addTTest(geneM, g1n, g2n); miRNAM = StatsUtils.addTTest(miRNAM, r1n, r2n); geneM = geneM.sort(g1n + g2n + 1, true).top(0.3f); miRNAM = miRNAM.sort(r1n + r2n + 1, true).top(0.3f); ma.putResult(Manager.Result.Gene_Matrix, geneM); ma.putResult(Manager.Result.MiRNA_Matrix, miRNAM); ma.putResult(Manager.Result.Gene_Num_Select, geneM.getDrow()); ma.putResult(Manager.Result.MiRNA_Num_Select, miRNAM.getDrow()); } else if (testMethod == 1) { updateMessage("LSOSS Test"); geneM = StatsUtils.LSOSSTest(geneM, g1n, g2n, LSOSSR); miRNAM = StatsUtils.LSOSSTest(miRNAM, r1n, r2n, LSOSSR); ma.putResult(Manager.Result.Gene_Matrix, geneM); ma.putResult(Manager.Result.MiRNA_Matrix, miRNAM); ma.putResult(Manager.Result.Gene_Num_Select, geneM.getDrow()); ma.putResult(Manager.Result.MiRNA_Num_Select, miRNAM.getDrow()); } //step 2 updateMessage("Correlation Test..."); StringMatrix corM = StatsUtils.pearsonCor(miRNAM, geneM, r1n + r2n, g1n + g2n, corR); ma.putResult(Manager.Result.Cor_Matrix, corM); ma.putResult(Manager.Result.Cor_Num, corM.getDrow()); //step 3 updateMessage("Overlapping..."); List<Pair> overlap; if (ma.containParam(Manager.Keyword.Input_interaction) && !ma.getParam(Manager.Keyword.Input_interaction).isEmpty()) { List<Pair> p1 = PairUtils.fromStringMatrix(corM, 0, 1); StringMatrix interaction = MatrixBuilder.readString(ma.getParam(Manager.Keyword.Input_interaction), false, false, false); ma.putResult(Manager.Result.Interaction_Matrix, interaction); List<Pair> p2 = PairUtils.fromStringMatrix(interaction, 0, 1); overlap = PairUtils.overlap(p1, p2); } else { overlap = PairUtils.fromStringMatrix(corM, 0, 1); } ma.putResult(Manager.Result.Overlap, overlap); ma.putResult(Manager.Result.Overlap_Num, overlap.size()); //step 4 updateMessage("Calculating NOD..."); List<Triplet> nods = PairUtils.countNOD(overlap, PairUtils.count(overlap, false), false); ma.putResult(Manager.Result.NOD, nods); //step 5 updateMessage("Wilcox Test..."); double[] data1 = new double[nods.size()]; int i = 0; for (Triplet p : nods) { data1[i++] = Double.parseDouble(p.getT2()); } double max = StatUtils.max(data1); double[] wilcox = new double[(int) Math.ceil(max) + 1]; for (int j = 0; j < max + 1; j++) { wilcox[j] = StatsUtils.wilcoxTest(data1, j); } ma.putResult(Manager.Result.WilcoxTest, wilcox); long t2 = System.currentTimeMillis(); float time = Utils.formatNumber((t2 - t1) / 1000.0, 3); Manager.LOG.info("Finished! Time: " + time + " s"); return 0; }
From source file:com.taobao.tddl.common.util.TDDLMBeanServer.java
private TDDLMBeanServer() { // MBServer// ww w . j a v a2s . com String hostName = null; try { InetAddress addr = InetAddress.getLocalHost(); hostName = addr.getHostName(); } catch (IOException e) { log.error(LogPrefix + "Get HostName Error", e); hostName = "localhost"; } String host = System.getProperty("hostName", hostName); try { boolean useJmx = Boolean.parseBoolean(System.getProperty("tddl.useJMX", "true")); if (useJmx) { mbs = ManagementFactory.getPlatformMBeanServer(); int port = Integer.parseInt(System.getProperty("tddl.rmi.port", "6679")); String rmiName = System.getProperty("tddl.rmi.name", "tddlJmxServer"); Registry reg = null; try { reg = LocateRegistry.getRegistry(port); reg.list(); } catch (Exception e) { reg = null; } if (null == reg) { reg = LocateRegistry.createRegistry(port); } reg.list(); String serverURL = "service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/" + rmiName; JMXServiceURL url = new JMXServiceURL(serverURL); final JMXConnectorServer connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); connectorServer.start(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { System.err.println("JMXConnector stop"); connectorServer.stop(); } catch (IOException e) { log.error(LogPrefix + e); } } }); log.warn(LogPrefix + "jmx url: " + serverURL); } } catch (Exception e) { log.error(LogPrefix + "create MBServer error", e); } }
From source file:com.igrow.mall.common.util.Struts2Utils.java
/** * ./* w w w .j av a 2s. c o m*/ * eg. * render("text/plain", "hello", "encoding:GBK"); * render("text/plain", "hello", "no-cache:false"); * render("text/plain", "hello", "encoding:GBK", "no-cache:false"); * * @param headers ??header??"encoding:""no-cache:",UTF-8true. */ public static void render(final String contentType, final String content, final String... headers) { try { //?headers? String encoding = ENCODING_DEFAULT; boolean noCache = NOCACHE_DEFAULT; for (String header : headers) { String headerName = StringUtils.substringBefore(header, ":"); String headerValue = StringUtils.substringAfter(header, ":"); if (StringUtils.equalsIgnoreCase(headerName, ENCODING_PREFIX)) { encoding = headerValue; } else if (StringUtils.equalsIgnoreCase(headerName, NOCACHE_PREFIX)) { noCache = Boolean.parseBoolean(headerValue); } else throw new IllegalArgumentException(headerName + "??header"); } HttpServletResponse response = ServletActionContext.getResponse(); //headers? String fullContentType = contentType + ";charset=" + encoding; response.setContentType(fullContentType); if (noCache) { response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 0); } response.getWriter().write(content); response.getWriter().flush(); } catch (IOException e) { logger.error(e.getMessage(), e); } }
From source file:com.mobiaware.util.PropertyManager.java
public boolean getBoolean(final String key) { return Boolean.parseBoolean(_configuration.getString(key)); }