List of usage examples for java.util Properties putAll
@Override public synchronized void putAll(Map<?, ?> t)
From source file:atg.tools.dynunit.test.util.FileUtil.java
/** * @see atg.tools.dynunit.util.ComponentUtil#newComponent(java.io.File, String, Class, java.util.Properties) */// ww w .jav a2 s. c o m @Deprecated public static void createPropertyFile(@NotNull final String componentName, @NotNull final File configurationStagingLocation, @Nullable final Class<?> clazz, @Nullable final Map<String, String> settings) throws IOException { logger.entry(componentName, configurationStagingLocation, clazz, settings); final Properties properties = new Properties(); properties.putAll(settings); ComponentUtil.newComponent(configurationStagingLocation, componentName, clazz, properties); logger.exit(); }
From source file:com.linkedin.cubert.ScriptExecutor.java
/** * Properties are collected in the following order-- * <p/>// w w w . jav a2s .com * 1. Azkaban (or other) executor params * 2. properties passed through -f argument (for multiple order in CLI order) * 3. properties passed as -D arguments directly on CLI * * @param cmdLine * @param executorProps * @return * @throws URISyntaxException * @throws IOException */ private static Properties getProperties(CommandLine cmdLine, Properties executorProps) throws URISyntaxException, IOException { Properties props = new Properties(); // 1. Substitute executor params if (executorProps != null) { props.putAll(extractCubertParams(executorProps)); } // 2. -f properties String[] propFiles = cmdLine.getOptionValues("f"); if (propFiles != null && propFiles.length > 0) { for (String propFile : propFiles) { URI uri = new URI(propFile); boolean isHDFS = (uri.getScheme() != null) && uri.getScheme().equalsIgnoreCase("hdfs"); String path = uri.getPath(); if (isHDFS) { props.load(new BufferedReader( new InputStreamReader(FileSystem.get(new JobConf()).open(new Path(path))))); } else { props.load(new BufferedReader(new FileReader(path))); } } } // 3. -D properties if (cmdLine.getOptionProperties("D").size() > 0) { props.putAll(cmdLine.getOptionProperties("D")); } return props; }
From source file:emp.cloud.pigutils.EmbeddedPigRunner.java
static int executeScript(Configuration hadoopConfig, PigProgressNotificationListener listener, String taskName, String script) throws Throwable { boolean verbose = false; boolean gruntCalled = false; String logFileName = null;/*from w ww . j a v a 2 s . c om*/ try { Properties properties = new Properties(); PropertiesUtil.loadDefaultProperties(properties); properties.putAll(ConfigurationUtil.toProperties(hadoopConfig)); HashSet<String> optimizerRules = new HashSet<String>(); ExecType execType = ExecType.MAPREDUCE; if (properties.getProperty("aggregate.warning") == null) { // by default warning aggregation is on properties.setProperty("aggregate.warning", "" + true); } if (properties.getProperty("opt.multiquery") == null) { // by default multiquery optimization is on properties.setProperty("opt.multiquery", "" + true); } if (properties.getProperty("stop.on.failure") == null) { // by default we keep going on error on the backend properties.setProperty("stop.on.failure", "" + false); } // set up client side system properties in UDF context UDFContext.getUDFContext().setClientSystemProps(properties); // create the context with the parameter PigContext pigContext = new PigContext(execType, properties); // create the static script state object ScriptState scriptState = ScriptState.start("", pigContext); if (listener != null) { scriptState.registerListener(listener); } if (!Boolean.valueOf(properties.getProperty(PROP_FILT_SIMPL_OPT, "false"))) { // turn off if the user has not explicitly turned on this // optimization optimizerRules.add("FilterLogicExpressionSimplifier"); } if (optimizerRules.size() > 0) { pigContext.getProperties().setProperty("pig.optimizer.rules", ObjectSerializer.serialize(optimizerRules)); } if (properties.get("udf.import.list") != null) PigContext.initializeImportList((String) properties.get("udf.import.list")); PigContext.setClassLoader(pigContext.createCl(null)); pigContext.getProperties().setProperty(PigContext.JOB_NAME, taskName); Grunt grunt = null; BufferedReader in; scriptState.setScript(script); in = new BufferedReader(new StringReader(script)); grunt = new Grunt(in, pigContext); gruntCalled = true; int results[] = grunt.exec(); return getReturnCodeForStats(results); // } catch (Exception e) { // if (e instanceof PigException) { // PigException pe = (PigException) e; // int rc = (pe.retriable()) ? ReturnCode.RETRIABLE_EXCEPTION // : ReturnCode.PIG_EXCEPTION; // PigStatsUtil.setErrorCode(pe.getErrorCode()); // } // PigStatsUtil.setErrorMessage(e.getMessage()); // // if (!gruntCalled) { // LogUtils.writeLog(e, logFileName, log, verbose, // "Error before Pig is launched"); // } // FileLocalizer.deleteTempFiles(); // // if (!gruntCalled) { // LogUtils.writeLog(e, logFileName, log, verbose, // "Error before Pig is launched"); // } // throw e; // } catch (Throwable e) { // PigStatsUtil.setErrorMessage(e.getMessage()); // throw new IllegalStateException(e); } finally { // clear temp files FileLocalizer.deleteTempFiles(); } }
From source file:net.roboconf.agent.internal.misc.UserDataUtils.java
/** * Reconfigures the messaging.// w w w .j a v a 2s . c om * @param etcDir the KARAF_ETC directory * @param msgData the messaging configuration parameters */ public static void reconfigureMessaging(String etcDir, Map<String, String> msgData) throws IOException { String messagingType = msgData.get(MessagingConstants.MESSAGING_TYPE_PROPERTY); Logger.getLogger(UserDataUtils.class.getName()) .fine("Messaging type for reconfiguration: " + messagingType); if (!Utils.isEmptyOrWhitespaces(etcDir)) { // Write the messaging configuration Properties props = new Properties(); props.putAll(msgData); props.remove(Constants.MESSAGING_TYPE); File f = new File(etcDir, "net.roboconf.messaging." + messagingType + ".cfg"); Utils.writePropertiesFile(props, f); // Set the messaging type f = new File(etcDir, CONF_FILE_AGENT); props = Utils.readPropertiesFileQuietly(f, Logger.getLogger(UserDataUtils.class.getName())); props.put(Constants.MESSAGING_TYPE, messagingType); Utils.writePropertiesFile(props, f); } }
From source file:de.hypoport.ep2.support.configuration.properties.PropertiesLoader.java
private static void mergePropertiesIntoSystemPropertiesWithoutOverwriting(Properties properties) { if (properties == null || properties.size() == 0) { return;/* w ww . j a va2 s . c om*/ } Properties systemProperties = System.getProperties(); properties.putAll(systemProperties); systemProperties.putAll(properties); }
From source file:com.addthis.hydra.kafka.consumer.ConsumerUtils.java
public static ConsumerConfig newConsumerConfig(String zookeeper, Map<String, String> overrides) { Properties config = new Properties(); config.put("zookeeper.connect", zookeeper); config.put("num.consumer.fetchers", "1"); config.putAll(overrides); return new ConsumerConfig(config); }
From source file:io.druid.query.extraction.namespace.TestKafkaExtractionCluster.java
private static final Properties makeProducerProperties() { final Properties kafkaProducerProperties = new Properties(); kafkaProducerProperties.putAll(kafkaProperties); kafkaProducerProperties.put("metadata.broker.list", String.format("127.0.0.1:%d", kafkaServer.socketServer().port())); kafkaProperties.put("request.required.acks", "1"); return kafkaProducerProperties; }
From source file:eu.eidas.auth.commons.EIDASUtil.java
@Nonnull static Properties toProperties(@Nonnull ImmutableMap<String, String> immutableMap) { Properties properties = new Properties(); //noinspection UseOfPropertiesAsHashtable properties.putAll(immutableMap); return properties; }
From source file:org.apache.wiki.TestEngine.java
License:asdf
public static final Properties getTestProperties() { if (combinedProperties == null) { combinedProperties = PropertyReader.getCombinedProperties(PropertyReader.CUSTOM_JSPWIKI_CONFIG); }// ww w. ja va 2 s. c o m // better to make a copy via putAll instead of Properties(properties) // constructor, see http://stackoverflow.com/a/2004900 Properties propCopy = new Properties(); propCopy.putAll(combinedProperties); return propCopy; }
From source file:com.glaf.core.util.CalendarUtils.java
public static boolean saveCalendarProperties(Map<String, String> dataMap) { Properties props = loadCalendarProperties(); props.putAll(dataMap); return saveCalendarProperties(props); }