List of usage examples for org.apache.commons.configuration Configuration getBoolean
Boolean getBoolean(String key, Boolean defaultValue);
From source file:co.turnus.analysis.pipelining.SimplePipeliningCliLauncher.java
public static void main(String[] args) { try {/*from w ww . ja v a 2 s . co m*/ CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } // load trace project File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); SimplePipelining sp = new SimplePipelining(project); sp.setConfiguration(config); SimplePipelingData data = sp.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Simple Pipeling results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsSimplePipeliningDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(SimplePipeliningCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }
From source file:co.turnus.analysis.buffers.BoundedBufferSchedulingCliLauncher.java
public static void main(String[] args) { try {//from w w w .j a va 2s . c o m CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); BoundedBufferScheduling bbs = new BoundedBufferScheduling(project); bbs.setConfiguration(config); BufferMinimizationData data = bbs.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Bounded Buffer Scheduling results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsBufferMinimizationDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } String bxdfName = config.getString(BXDF, ""); if (!bxdfName.isEmpty()) { File bxdfFile = new File(outPath, bxdfName + ".bxdf"); new XmlBufferMinimizationDataWriter().write(data, bxdfFile); TurnusLogger.info("BXDF files (one for each configuration) " + "stored in " + outPath); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(BoundedBufferSchedulingCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getCause().toString()); } }
From source file:co.turnus.analysis.bottlenecks.AlgorithmicBottlenecksCliLauncher.java
public static void main(String[] args) { try {//from ww w.j a v a 2s .c o m CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } // load trace project File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); // load profiling weights File wFile = new File(config.getString(PROFILING_WEIGHTS)); ProfilingWeights weights = new XmlProfilingWeightsReader().read(project.getNetwork(), wFile); // build the trace weighter StatisticalTraceWeighter tw = new StatisticalTraceWeighter(); tw.configure(weights, ActionWeightsDistribution.class); // run the analysis AlgorithmicBottlenecks ab = new AlgorithmicBottlenecks(project, tw); ab.setConfiguration(config); AlgoBottlenecksData data = ab.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Algorithmic Bottlenecks results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsAlgoBottlenecksDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(AlgorithmicBottlenecksCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }
From source file:co.turnus.analysis.partitioning.CommunicationCostPartitioningCli.java
public static void main(String[] args) { try {/*from w ww . ja v a 2 s . c o m*/ CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } // load trace project File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); CommunicationCostPartitioning ccp = new CommunicationCostPartitioning(project); ccp.setConfiguration(config); PartitioningData data = ccp.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Communication cost partitioning results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsPartitioningDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } String bxdfName = config.getString(XCF, ""); if (!bxdfName.isEmpty()) { File xcfFile = new File(outPath, bxdfName + ".xcf"); new XmlPartitioningDataWriter().write(data, xcfFile); TurnusLogger.info("XCF files (one for each configuration) " + "stored in " + outPath); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(CommunicationCostPartitioningCli.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }
From source file:co.turnus.analysis.buffers.MpcBoundedSchedulingCliLauncher.java
public static void main(String[] args) { try {/* w w w . j ava 2s.c o m*/ CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); MpcBoundedScheduling mpc = new MpcBoundedScheduling(project); mpc.setConfiguration(config); BufferMinimizationData data = mpc.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Bounded Buffer Scheduling results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsBufferMinimizationDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } String bxdfName = config.getString(BXDF, ""); if (!bxdfName.isEmpty()) { File bxdfFile = new File(outPath, bxdfName + ".bxdf"); new XmlBufferMinimizationDataWriter().write(data, bxdfFile); TurnusLogger.info("BXDF files (one for each configuration) " + "stored in " + outPath); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(AlgorithmicBottlenecksCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }
From source file:com.manydesigns.mail.quartz.MailScheduler.java
public static void setupMailScheduler(MailQueueSetup mailQueueSetup, String group) { Configuration mailConfiguration = mailQueueSetup.getMailConfiguration(); if (mailConfiguration != null) { if (mailConfiguration.getBoolean(MailProperties.MAIL_QUARTZ_ENABLED, false)) { logger.info("Scheduling mail sends with Quartz job"); try { String serverUrl = mailConfiguration.getString(MailProperties.MAIL_SENDER_SERVER_URL); logger.info("Scheduling mail sends using URL: {}", serverUrl); Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler(); JobDetail job = JobBuilder.newJob(URLInvokeJob.class).withIdentity("mail.sender", group) .usingJobData(URLInvokeJob.URL_KEY, serverUrl).build(); int pollInterval = mailConfiguration.getInt(MailProperties.MAIL_SENDER_POLL_INTERVAL, DEFAULT_POLL_INTERVAL); Trigger trigger = TriggerBuilder.newTrigger().withIdentity("mail.sender.trigger", group) .startNow().withSchedule(SimpleScheduleBuilder.simpleSchedule() .withIntervalInMilliseconds(pollInterval).repeatForever()) .build();// w ww .j ava 2 s . c o m scheduler.scheduleJob(job, trigger); } catch (Exception e) { logger.error("Could not schedule mail sender job", e); } } else { logger.info("Mail scheduling using Quartz is disabled"); } } }
From source file:com.linkedin.pinot.minion.executor.BaseSegmentConversionExecutor.java
public static void init(Configuration uploaderConfig) { Configuration httpsConfig = uploaderConfig.subset(HTTPS_PROTOCOL); if (httpsConfig.getBoolean(CONFIG_OF_CONTROLLER_HTTPS_ENABLED, false)) { _sslContext = new ClientSSLContextGenerator(httpsConfig.subset(CommonConstants.PREFIX_OF_SSL_SUBSET)) .generate();//from w ww . ja va 2 s . c o m } }
From source file:at.gv.egiz.bku.online.webapp.MoccaParameterBean.java
public static void setP3PHeader(Configuration config, HttpServletResponse response) { if (config.getBoolean(ENABLE_P3P_HEADER, false)) { // Set P3P Policy Header response.addHeader("P3P", P3P_POLICY); }//from w ww .jav a 2 s . c o m }
From source file:cz.cas.lib.proarc.common.export.cejsh.CejshConfig.java
public static CejshConfig from(Configuration conf) { CejshConfig cc = new CejshConfig(); cc.setCejshXslUrl(conf.getString(PROP_MODS_XSL_URL, null)); // cc.setJournalUrl(conf.getString(PROP_JOURNALS_URL, null)); try {//from w ww . j a v a2 s .c o m boolean debug = conf.getBoolean(PROP_DEBUG, Boolean.FALSE); cc.setLogLevel(debug ? Level.INFO : Level.FINE); } catch (ConversionException ex) { LOG.log(Level.SEVERE, PROP_DEBUG, ex); } return cc; }
From source file:com.github.anba.test262.environment.Environments.java
/** * Creates a new Rhino environment// w w w . jav a 2 s . c o m */ public static <T extends GlobalObject> EnvironmentProvider<T> rhino(final Configuration configuration) { final int version = configuration.getInt("rhino.version", Context.VERSION_DEFAULT); final String compiler = configuration.getString("rhino.compiler.default"); List<?> enabledFeatures = configuration.getList("rhino.features.enabled", emptyList()); List<?> disabledFeatures = configuration.getList("rhino.features.disabled", emptyList()); final Set<Integer> enabled = intoCollection(filterMap(enabledFeatures, notEmptyString, toInteger), new HashSet<Integer>()); final Set<Integer> disabled = intoCollection(filterMap(disabledFeatures, notEmptyString, toInteger), new HashSet<Integer>()); /** * Initializes the global {@link ContextFactory} according to the * supplied configuration * * @see ContextFactory#initGlobal(ContextFactory) */ final ContextFactory factory = new ContextFactory() { @Override protected boolean hasFeature(Context cx, int featureIndex) { if (enabled.contains(featureIndex)) { return true; } else if (disabled.contains(featureIndex)) { return false; } return super.hasFeature(cx, featureIndex); } @Override protected Context makeContext() { Context context = super.makeContext(); context.setLanguageVersion(version); return context; } }; EnvironmentProvider<RhinoGlobalObject> provider = new EnvironmentProvider<RhinoGlobalObject>() { @Override public RhinoEnv<RhinoGlobalObject> environment(final String testsuite, final String sourceName, final Test262Info info) { Configuration c = configuration.subset(testsuite); final boolean strictSupported = c.getBoolean("strict", false); final String encoding = c.getString("encoding", "UTF-8"); final String libpath = c.getString("lib_path"); final Context cx = factory.enterContext(); final AtomicReference<RhinoGlobalObject> $global = new AtomicReference<>(); final RhinoEnv<RhinoGlobalObject> environment = new RhinoEnv<RhinoGlobalObject>() { @Override public RhinoGlobalObject global() { return $global.get(); } @Override protected String getEvaluator() { return compiler; } @Override protected String getCharsetName() { return encoding; } @Override public void exit() { Context.exit(); } }; @SuppressWarnings({ "serial" }) final RhinoGlobalObject global = new RhinoGlobalObject() { { cx.initStandardObjects(this, false); } @Override protected boolean isStrictSupported() { return strictSupported; } @Override protected String getDescription() { return info.getDescription(); } @Override protected void failure(String message) { failWith(message, sourceName); } @Override protected void include(Path path) throws IOException { // resolve the input file against the library path Path file = Paths.get(libpath).resolve(path); InputStream source = Files.newInputStream(file); environment.eval(file.getFileName().toString(), source); } }; $global.set(global); return environment; } }; @SuppressWarnings("unchecked") EnvironmentProvider<T> p = (EnvironmentProvider<T>) provider; return p; }