Example usage for java.util Properties putAll

List of usage examples for java.util Properties putAll

Introduction

In this page you can find the example usage for java.util Properties putAll.

Prototype

@Override
    public synchronized void putAll(Map<?, ?> t) 

Source Link

Usage

From source file:com.amazonaws.services.logs.connectors.samples.AbstractConnectorExecutor.java

/**
 * Creates a new CloudWatchLogsSubscriptionsExecutor.
 *
 * @param configFile The name of the configuration file to look for on the classpath.
 *///  w ww.j  a  v  a2s.  c  om
public AbstractConnectorExecutor(String configFile) {
    InputStream configFileInputStream = Thread.currentThread().getContextClassLoader()
            .getResourceAsStream(configFile);

    if (configFileInputStream == null) {
        String msg = "Could not find resource " + configFile + " in the classpath";
        LOG.error(msg);
        throw new IllegalStateException(msg);
    }

    Properties propertiesFile = new Properties();
    Properties mergedProperties = new Properties();
    try {
        propertiesFile.load(configFileInputStream);

        mergedProperties.putAll(propertiesFile);
        mergedProperties.putAll(System.getProperties());

        configFileInputStream.close();

        this.config = new KinesisConnectorConfiguration(mergedProperties,
                new DefaultAWSCredentialsProviderChain());
    } catch (IOException e) {
        String msg = "Could not load properties file " + configFile + " from classpath";
        LOG.error(msg, e);
        throw new IllegalStateException(msg, e);
    }

    super.initialize(config, new NullMetricsFactory());
}

From source file:ws.salient.model.Settings.java

public Properties getProperties(Collection<String> profileIds) {
    Properties properties = new Properties();
    getProfiles(profileIds).forEach(profile -> {
        properties.putAll(profile.getProperties());
    });/* ww  w. java2  s. c o m*/
    return properties;
}

From source file:org.red5.spring.ExtendedPropertyPlaceholderConfigurer.java

@Override
protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
        throws BeansException {

    props.putAll(copyOfGlobalProperties());
    logger.debug("Placeholder props: {}", props.toString());

    this.mergedProperties = props;

    super.processProperties(beanFactoryToProcess, props);
}

From source file:org.openinfinity.core.spring.JdbcPropertyPlaceholderConfigurer.java

/**
 * Overrides the loadProperties method and adds properties found from the shared database and calls actual super classes method loadProperties with populated properties.
 *///from  www  .  j ava2 s  .  c o  m
@Override
protected void loadProperties(Properties props) throws IOException {
    properties = readPropertiesFromDataSource();
    if (properties.size() > 0) {
        props.putAll(properties);
    }
    super.loadProperties(props);
}

From source file:org.bizbundles.forward.ExcelToResourceBundle.java

/**
 * private method to copy the in memory map into a resource bundle using a Properties class
 * @param generated pointer to generated File object
 * @param sheetName the name of the sheet to name the resource bundle with.
 * @param props the map of all properties
 * @throws IOException any io operations issues while creating resource bundle
 *//*from www . ja  v a  2s .  co  m*/
private void storeMapAsResourceBundle(File generated, String sheetName, Map<String, String> props)
        throws IOException {
    Set<String> set = new TreeSet<String>(props.keySet());
    listOfKeys.add(set);
    Properties properties = new Properties();
    properties.putAll(props);
    if (sheetName.endsWith(PROPERTIES_EXTENSION)) {
        sheetName = StringUtils.remove(sheetName, PROPERTIES_EXTENSION);
    }
    properties.store(
            new FileOutputStream(
                    generated.getAbsolutePath() + File.separator + sheetName + PROPERTIES_EXTENSION),
            "Generated By org.bizbundles.ExcelToResourceBundle");
    metaInfo.add(sheetName, props.keySet());
}

From source file:com.hortonworks.streamline.streams.runtime.storm.bolt.notification.NotificationBolt.java

@Override
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
    if (!stormConf.containsKey(CATALOG_ROOT_URL)) {
        throw new IllegalArgumentException("conf must contain " + CATALOG_ROOT_URL);
    }/*from ww  w.  java 2s .  c  o m*/

    Map<String, Object> notificationConf = null;
    if (stormConf.get(NOTIFICATION_SERVICE_CONFIG_KEY) != null) {
        notificationConf = (Map<String, Object>) stormConf.get(NOTIFICATION_SERVICE_CONFIG_KEY);
    } else {
        notificationConf = Collections.emptyMap();
    }

    NotificationStore notificationStore = null;
    try {
        if (!StringUtils.isEmpty(notificationStoreClazz)) {
            Class<?> clazz = Class.forName(notificationStoreClazz);
            notificationStore = (NotificationStore) clazz.newInstance();
            Map<String, Object> config = (Map<String, Object>) stormConf.get(NOTIFICATION_STORE_CONFIG_KEY);
            if (config == null) {
                config = Collections.emptyMap();
            }
            notificationStore.init(config);
        }
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
        throw new RuntimeException(ex);
    }

    notificationService = new NotificationServiceImpl(notificationConf, notificationStore);

    String jarPath = "";
    if (stormConf.containsKey(LOCAL_NOTIFIER_JAR_PATH)) {
        jarPath = String.format("%s%s%s", stormConf.get(LOCAL_NOTIFIER_JAR_PATH).toString(), File.separator,
                notificationSink.getNotifierJarFileName());
    }

    Properties props = new Properties();
    props.putAll(convertMapValuesToString(notificationSink.getNotifierProperties()));
    NotifierConfig notifierConfig = new NotifierConfigImpl(props,
            convertMapValuesToString(notificationSink.getNotifierFieldValues()),
            notificationSink.getNotifierClassName(), jarPath);

    notificationContext = new BoltNotificationContext(collector, notifierConfig);
    notificationService.register(notificationSink.getNotifierName(), notificationContext);
}

From source file:com.adaptris.core.runtime.AdapterBuilder.java

public Properties getConfiguration() {
    Properties result = new Properties();
    result.putAll(config);
    return result;
}

From source file:com.migratebird.config.ConfigrationLoader.java

/**
 * Loads all properties as defined by the default configuration. Properties from the given properties
 * object override the default properties.
 *
 * @param customConfiguration custom configuration, may be null if there is no custom config
 * @return the settings, not null/*w  w w  . ja  va  2 s  .c  o  m*/
 */
public Config loadConfiguration(Properties customConfiguration) {
    Properties properties = new Properties();

    properties.putAll(loadDefaultConfiguration());

    if (customConfiguration != null) {
        properties.putAll(customConfiguration);
    }
    return new Config(properties);
}

From source file:org.apache.falcon.lifecycle.engine.oozie.utils.OozieBuilderUtils.java

public static Properties createCoordDefaultConfiguration(String coordName, Entity entity)
        throws FalconException {

    Properties props = new Properties();
    props.put(WorkflowExecutionArgs.NOMINAL_TIME.getName(), NOMINAL_TIME_EL);
    props.put(WorkflowExecutionArgs.TIMESTAMP.getName(), ACTUAL_TIME_EL);
    props.put(OozieClient.EXTERNAL_ID, new ExternalId(entity.getName(),
            EntityUtil.getWorkflowNameTag(coordName, entity), "${coord:nominalTime()}").getId());
    props.put(WorkflowExecutionArgs.USER_JMS_NOTIFICATION_ENABLED.getName(), "true");
    props.put(WorkflowExecutionArgs.SYSTEM_JMS_NOTIFICATION_ENABLED.getName(),
            RuntimeProperties.get().getProperty("falcon.jms.notification.enabled", "true"));
    //props in entity override the set props.
    props.putAll(EntityUtil.getEntityProperties(entity));
    return props;
}

From source file:com.cognifide.qa.bb.config.YamlConfig.java

/**
 * Loads Bobcat user configuration from {@code config.yaml} file.
 *
 * @return {@inheritDoc}/*from w w w  . j  a v  a2  s  .c  o  m*/
 */
@Override
public Properties loadConfig() {
    Properties config = new Properties();
    Config rawConfig = readUserYaml();
    config.putAll(rawConfig.getDefaultConfig().getProperties());
    config.putAll(getSelectedContexts(rawConfig));
    return config;
}