List of usage examples for java.util Properties putAll
@Override public synchronized void putAll(Map<?, ?> t)
From source file:org.apache.falcon.recipe.RecipeTool.java
@Override public int run(String[] arguments) throws Exception { Map<RecipeToolArgs, String> argMap = setupArgs(arguments); if (argMap == null || argMap.isEmpty()) { throw new Exception("Arguments passed to recipe is null"); }/* w ww. j a va2s .c om*/ Configuration conf = getConf(); String recipePropertiesFilePath = argMap.get(RecipeToolArgs.RECIPE_PROPERTIES_FILE_ARG); Properties recipeProperties = loadProperties(recipePropertiesFilePath); validateProperties(recipeProperties); String recipeOperation = argMap.get(RecipeToolArgs.RECIPE_OPERATION_ARG); Recipe recipeType = RecipeFactory.getRecipeToolType(recipeOperation); if (recipeType != null) { recipeType.validate(recipeProperties); Properties props = recipeType.getAdditionalSystemProperties(recipeProperties); if (props != null && !props.isEmpty()) { recipeProperties.putAll(props); } } createWindowsLocalPaths(recipeProperties); String processFilename; FileSystem fs = getFileSystemForHdfs(recipeProperties, conf); validateArtifacts(recipeProperties, fs); String recipeName = recipeProperties.getProperty(RecipeToolOptions.RECIPE_NAME.getName()); copyFilesToHdfsIfRequired(recipeProperties, fs, recipeName); processFilename = RecipeProcessBuilderUtils.createProcessFromTemplate( argMap.get(RecipeToolArgs.RECIPE_FILE_ARG), recipeProperties, argMap.get(RecipeToolArgs.RECIPE_PROCESS_XML_FILE_PATH_ARG)); System.out.println("Generated process file to be scheduled: "); System.out.println(FileUtils.readFileToString(new File(processFilename))); System.out.println("Completed recipe processing"); return 0; }
From source file:io.renren.modules.test.jmeter.report.LocalReportGenerator.java
/** * Instantiates a new report generator./*w ww . ja v a 2s . c om*/ * * @param resultsFile * the test results file * @param resultCollector * Can be null, used if generation occurs at end of test * @throws ConfigurationException when loading configuration from file fails */ public LocalReportGenerator(String resultsFile, ResultCollector resultCollector) throws ConfigurationException { if (!CSV_OUTPUT_FORMAT) { throw new IllegalArgumentException( "Report generation requires csv output format, check 'jmeter.save.saveservice.output_format' property"); } log.info("ReportGenerator will use for Parsing the separator: '{}'", CSV_DEFAULT_SEPARATOR); File file = new File(resultsFile); if (resultCollector == null) { if (!(file.isFile() && file.canRead())) { throw new IllegalArgumentException(String.format("Cannot read test results file : %s", file)); } log.info("Will only generate report from results file: {}", resultsFile); } else { if (file.exists() && file.length() > 0) { throw new IllegalArgumentException("Results file:" + resultsFile + " is not empty"); } log.info("Will generate report at end of test from results file: {}", resultsFile); } this.resultCollector = resultCollector; this.testFile = file; final Properties merged = new Properties(); File rgp = new File(JMeterUtils.getJMeterBinDir(), REPORTGENERATOR_PROPERTIES); if (log.isInfoEnabled()) { log.info("Reading report generator properties from: {}", rgp.getAbsolutePath()); } merged.putAll(loadProps(rgp)); log.info("Merging with JMeter properties"); merged.putAll(JMeterUtils.getJMeterProperties()); configuration = ReportGeneratorConfiguration.loadFromProperties(merged); }
From source file:org.apache.maven.cli.DefaultMavenExecutionRequestBuilder.java
static void populateProperties(CommandLine commandLine, Properties systemProperties, Properties userProperties) { EnvironmentUtils.addEnvVars(systemProperties); // ---------------------------------------------------------------------- // Options that are set on the command line become system properties // and therefore are set in the session properties. System properties // are most dominant. // ---------------------------------------------------------------------- if (commandLine.hasOption(CLIManager.SET_SYSTEM_PROPERTY)) { String[] defStrs = commandLine.getOptionValues(CLIManager.SET_SYSTEM_PROPERTY); if (defStrs != null) { for (String defStr : defStrs) { setCliProperty(defStr, userProperties); }/* w w w . ja v a 2s. c o m*/ } } systemProperties.putAll(System.getProperties()); // ---------------------------------------------------------------------- // Properties containing info about the currently running version of Maven // These override any corresponding properties set on the command line // ---------------------------------------------------------------------- Properties buildProperties = CLIReportingUtils.getBuildProperties(); String mavenVersion = buildProperties.getProperty(CLIReportingUtils.BUILD_VERSION_PROPERTY); systemProperties.setProperty("maven.version", mavenVersion); String mavenBuildVersion = CLIReportingUtils.createMavenVersionString(buildProperties); systemProperties.setProperty("maven.build.version", mavenBuildVersion); }
From source file:org.apache.gobblin.metrics.GobblinMetrics.java
/** * Starts metric reporting and appends the given metrics file suffix to the current value of * {@link ConfigurationKeys#METRICS_FILE_SUFFIX}. */// w ww .j av a 2s. c o m public void startMetricReportingWithFileSuffix(State state, String metricsFileSuffix) { Properties metricsReportingProps = new Properties(); metricsReportingProps.putAll(state.getProperties()); String oldMetricsFileSuffix = state.getProp(ConfigurationKeys.METRICS_FILE_SUFFIX, ConfigurationKeys.DEFAULT_METRICS_FILE_SUFFIX); if (Strings.isNullOrEmpty(oldMetricsFileSuffix)) { oldMetricsFileSuffix = metricsFileSuffix; } else { oldMetricsFileSuffix += "." + metricsFileSuffix; } metricsReportingProps.setProperty(ConfigurationKeys.METRICS_FILE_SUFFIX, oldMetricsFileSuffix); startMetricReporting(metricsReportingProps); }
From source file:edu.isi.wings.portal.classes.domains.Domain.java
public Properties getProperties() { // Handle legacy domains if (this.isLegacy) { PropertiesHelper.resetProperties(); PropertiesHelper.loadWingsProperties(this.domainDirectory + "/wings.properties"); Properties props = TemplateFactory.createLegacyConfiguration(); props.putAll(ComponentFactory.createLegacyConfiguration()); props.putAll(DataFactory.createLegacyConfiguration()); //props.putAll(ExecutionFactory.createLegacyConfiguration()); return props; }//from w w w. j a va 2s .c o m Properties domainProps = new Properties(); String domurl = this.domainUrl + usep; String domdir = new File(this.domainDirectory).getAbsolutePath() + fsep; domainProps.setProperty("lib.domain.workflow.url", domurl + this.templateLibrary.getUrl()); domainProps.setProperty("domain.workflows.dir.url", domurl + this.newTemplateDirectory.getUrl()); domainProps.setProperty("lib.domain.execution.url", domurl + this.executionLibrary.getUrl()); domainProps.setProperty("domain.executions.dir.url", domurl + this.newExecutionDirectory.getUrl()); domainProps.setProperty("lib.domain.data.url", domurl + this.dataLibrary.getUrl()); domainProps.setProperty("ont.domain.data.url", domurl + this.dataOntology.getUrl()); domainProps.setProperty("lib.abstract.url", domurl + this.abstractComponentLibrary.getUrl()); domainProps.setProperty("lib.concrete.url", domurl + this.concreteComponentLibrary.getUrl()); domainProps.setProperty("ont.domain.component.ns", domurl + this.componentLibraryNamespace); domainProps.setProperty("lib.domain.data.storage", domdir + this.dataLibrary.getStorageDirectory()); domainProps.setProperty("lib.domain.code.storage", domdir + this.concreteComponentLibrary.getStorageDirectory()); if (!this.getUseSharedTripleStore()) { String furl = "file:"; domainProps.setProperty("lib.domain.workflow.map", furl + domdir + this.templateLibrary.getMapping()); domainProps.setProperty("domain.workflows.dir.map", furl + domdir + this.newTemplateDirectory.getMapping()); domainProps.setProperty("lib.domain.execution.map", furl + domdir + this.executionLibrary.getMapping()); domainProps.setProperty("domain.executions.dir.map", furl + domdir + this.newExecutionDirectory.getMapping()); domainProps.setProperty("lib.domain.data.map", furl + domdir + this.dataLibrary.getMapping()); domainProps.setProperty("ont.domain.data.map", furl + domdir + this.dataOntology.getMapping()); domainProps.setProperty("lib.abstract.map", furl + domdir + this.abstractComponentLibrary.getMapping()); domainProps.setProperty("lib.concrete.map", furl + domdir + this.concreteComponentLibrary.getMapping()); } return domainProps; }
From source file:com.google.code.pentahoflashcharts.charts.PentahoOFC4JChartHelper.java
@SuppressWarnings("unchecked") private static Map createChartFactoryMap() { Properties chartFactories = new Properties(); // First, get known chart factories... try {// ww w . jav a 2s . co m ResourceBundle pluginBundle = ResourceBundle.getBundle(PLUGIN_BUNDLE_NAME); if (pluginBundle != null) { // Copy the bundle here... Enumeration keyEnum = pluginBundle.getKeys(); String bundleKey = null; while (keyEnum.hasMoreElements()) { bundleKey = (String) keyEnum.nextElement(); chartFactories.put(bundleKey, pluginBundle.getString(bundleKey)); } } } catch (Exception ex) { logger.warn(Messages.getString("PentahoOFC4JChartHelper.WARN_NO_CHART_FACTORY_PROPERTIES_BUNDLE")); //$NON-NLS-1$ } // Get overrides... // // Note - If the override wants to remove an existing "known" plugin, // simply adding an empty value will cause the "known" plugin to be removed. // if (PentahoSystem.getObjectFactory() == null || !PentahoSystem.getObjectFactory().objectDefined(ISolutionRepository.class.getSimpleName())) { // this is ok return chartFactories; } ISolutionRepository solutionRepository = PentahoSystem.get(ISolutionRepository.class, new StandaloneSession("system")); //$NON-NLS-1$ try { if (solutionRepository.resourceExists(SOLUTION_PROPS)) { InputStream is = solutionRepository.getResourceInputStream(SOLUTION_PROPS, false); Properties overrideChartFactories = new Properties(); overrideChartFactories.load(is); chartFactories.putAll(overrideChartFactories); // load over the top of the known properties } } catch (FileNotFoundException ignored) { logger.warn(Messages.getString("PentahoOFC4JChartHelper.WARN_NO_CHART_FACTORY_PROPERTIES")); //$NON-NLS-1$ } catch (IOException ignored) { logger.warn(Messages.getString("PentahoOFC4JChartHelper.WARN_BAD_CHART_FACTORY_PROPERTIES"), ignored); //$NON-NLS-1$ } return chartFactories; }
From source file:io.lavagna.service.MailTicketService.java
private MailReceiver getPop3MailReceiver(ProjectMailTicketConfigData config) { String sanitizedUsername = sanitizeUsername(config.getInboundUser()); String inboxFolder = getInboxFolder(config); String url = "pop3://" + sanitizedUsername + ":" + config.getInboundPassword() + "@" + config.getInboundServer() + "/" + inboxFolder.toUpperCase(); Pop3MailReceiver receiver = new Pop3MailReceiver(url); Properties mailProperties = new Properties(); mailProperties.setProperty("mail.pop3.port", Integer.toString(config.getInboundPort())); if (config.getInboundProtocol().equals("pop3s")) { mailProperties.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); mailProperties.setProperty("mail.pop3.socketFactory.fallback", "false"); mailProperties.setProperty("mail.pop3.socketFactory.port", Integer.toString(config.getInboundPort())); }/* w w w . j ava 2 s . c om*/ mailProperties.putAll(config.generateInboundProperties()); receiver.setJavaMailProperties(mailProperties); return receiver; }
From source file:org.ngrinder.infra.config.Config.java
/** * Load database related properties. (database.conf) *///ww w .ja v a 2 s . c om protected void loadDatabaseProperties() { checkNotNull(home); Properties properties = home.getProperties("database.conf"); properties.put("NGRINDER_HOME", home.getDirectory().getAbsolutePath()); properties.putAll(System.getProperties()); databaseProperties = new PropertiesWrapper(properties, databasePropertiesKeyMapper); }
From source file:org.cesecore.keys.token.CryptoTokenManagementSessionBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRED) @Override/* w ww . j av a2 s . c om*/ public void removeKeyPairPlaceholder(final AuthenticationToken authenticationToken, final int cryptoTokenId, final String alias) throws AuthorizationDeniedException, InvalidKeyException { assertAuthorization(authenticationToken, cryptoTokenId, CryptoTokenRules.REMOVE_KEYS.resource() + "/" + cryptoTokenId); final CryptoToken cryptoToken = getCryptoTokenAndAssertExistence(cryptoTokenId); boolean removed = false; final Properties props = new Properties(); props.putAll(cryptoToken.getProperties()); final String placeholdersString = props.getProperty(CryptoToken.KEYPLACEHOLDERS_PROPERTY, ""); final List<String> entries = new ArrayList<String>( Arrays.asList(placeholdersString.split("[" + CryptoToken.KEYPLACEHOLDERS_OUTER_SEPARATOR + "]"))); final Iterator<String> iter = entries.iterator(); while (iter.hasNext()) { final String entry = iter.next(); if (entry.startsWith(alias + CryptoToken.KEYPLACEHOLDERS_INNER_SEPARATOR)) { iter.remove(); removed = true; } } if (removed) { final String newValue = StringUtils.join(entries, CryptoToken.KEYPLACEHOLDERS_OUTER_SEPARATOR); props.setProperty(CryptoToken.KEYPLACEHOLDERS_PROPERTY, newValue); cryptoToken.setProperties(props); } // Check if alias is in use if (!removed) { throw new InvalidKeyException("Alias " + alias + " is not in use"); } try { cryptoTokenSession.mergeCryptoToken(cryptoToken); } catch (CryptoTokenNameInUseException e) { throw new IllegalStateException(e); // We have not changed the name of the CrytpoToken here, so this should never happen } final Map<String, Object> details = new LinkedHashMap<String, Object>(); details.put("msg", "Deleted key pair placeholder from CryptoToken " + cryptoTokenId); details.put("keyAlias", alias); securityEventsLoggerSession.log(EventTypes.CRYPTOTOKEN_DELETE_ENTRY, EventStatus.SUCCESS, ModuleTypes.CRYPTOTOKEN, ServiceTypes.CORE, authenticationToken.toString(), String.valueOf(cryptoTokenId), null, null, details); }
From source file:org.apache.falcon.oozie.process.NativeOozieProcessWorkflowBuilder.java
@Override public java.util.Properties build(Cluster cluster, Path buildPath, Properties suppliedProps) throws FalconException { Properties elProps = new Properties(); DateTimeFormatter fmt = DateTimeFormat.forPattern(INSTANCE_FORMAT); elProps.put(WorkflowExecutionArgs.NOMINAL_TIME.getName(), fmt.print(getNominalTime())); elProps.put(WorkflowExecutionArgs.TIMESTAMP.getName(), fmt.print(getNominalTime())); elProps.put(WorkflowExecutionArgs.USER_JMS_NOTIFICATION_ENABLED.getName(), "true"); elProps.put(WorkflowExecutionArgs.SYSTEM_JMS_NOTIFICATION_ENABLED.getName(), "false"); //check true or false DateUtil.setTimeZone(entity.getTimezone().getID()); ExpressionHelper.setReferenceDate(new Date(getNominalTime().getMillis())); elProps.putAll(getInputProps(cluster)); elProps.putAll(getOutputProps());/*w w w . ja va 2s . c om*/ elProps.putAll(evalProperties()); Properties buildProps = build(cluster, buildPath); buildProps.putAll(elProps); copyPropsWithoutOverride(buildProps, suppliedProps); return buildProps; }