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:och.service.props.impl.FileProps.java

private synchronized void putObjVal(String key, String val) {

    Properties props = state;/*w w  w.  ja  v a 2 s.c  o m*/

    Properties newProps = new Properties();
    newProps.putAll(props);
    if (val == null)
        newProps.remove(key);
    else
        newProps.put(key, val);
    saveToFile(newProps);

    fireChangedEvent(singleton(key));
}

From source file:guru.qas.martini.jmeter.config.DefaultApplicationContextBuilder.java

protected Properties getProperties(Arguments arguments) {
    Properties properties = new Properties();
    Map<String, String> asMap = null == arguments ? Collections.emptyMap() : arguments.getArgumentsAsMap();
    properties.putAll(asMap);
    return properties;
}

From source file:arena.velocity.VelocityEngineBean.java

public void afterPropertiesSet() throws Exception {
    if (this.engine == null) {
        log.info("Initializing velocity engine");
        VelocityEngine engine = new VelocityEngine();
        engine.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM, this);
        Properties newProps = initialProperties();
        if (this.properties != null) {
            newProps.putAll(this.properties);
        }//from   w  w w  .  j  a v  a 2  s . c  om
        try {
            log.info("Initializing velocity with properties: " + newProps);
            engine.init(newProps);
            this.engine = engine;
        } catch (Exception err) {
            log.error("Error initializing velocity engine", err);
            throw new RuntimeException("Error initializing velocity engine", err);
        }
    }
}

From source file:com.ewcms.publication.freemarker.FreemarkerConfigurationFactory.java

public Configuration createConfiguration() throws IOException, TemplateException {
    Configuration config = new Configuration();
    Properties props = new Properties();

    if (freemarkerSettings != null) {
        props.putAll(freemarkerSettings);
    }//ww  w  .  j  a v a  2s.co m

    config.setSettings(props);
    config.setTemplateUpdateDelay(delay);
    config.setLocalizedLookup(localizedLookup);
    config.setCacheStorage(cacheStorage);
    config.setDefaultEncoding(defaultEncoding);
    if (freemarkerVariables == null) {
        freemarkerVariables = initFreemarkerVariables();
    }
    config.setAllSharedVariables(new SimpleHash(freemarkerVariables, config.getObjectWrapper()));
    if (templateLoaders == null) {
        templateLoaders = initTemplateLoader();
    }
    config.setTemplateLoader(new MultiTemplateLoader(templateLoaders));

    return config;
}

From source file:com.impetus.client.schemamanager.CassandraPropertiesTest.java

/**
 * Gets the entity manager factory.//from  w  w w.  ja va2  s  .  c o m
 * 
 * @param useLucene
 * @param property
 * 
 * @return the entity manager factory
 */
private EntityManagerFactoryImpl getEntityManagerFactory(String property) {
    ClientMetadata clientMetadata = new ClientMetadata();
    Map<String, Object> props = new HashMap<String, Object>();
    // String pu = pu;
    props.put(Constants.PERSISTENCE_UNIT_NAME, pu);
    props.put(PersistenceProperties.KUNDERA_CLIENT_FACTORY, PelopsClientFactory.class.getName());
    props.put(PersistenceProperties.KUNDERA_NODES, "localhost");
    props.put(PersistenceProperties.KUNDERA_PORT, "9160");
    props.put(PersistenceProperties.KUNDERA_KEYSPACE, keyspace);
    props.put(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE, property);

    props.put(PersistenceProperties.KUNDERA_CLIENT_PROPERTY, KUNDERA_CASSANDRA_PROPERTIES);

    if (useLucene) {
        props.put(PersistenceProperties.KUNDERA_INDEX_HOME_DIR, HOME_IMPADMIN_LUCENE);

        clientMetadata.setLuceneIndexDir(HOME_IMPADMIN_LUCENE);
    } else {

        clientMetadata.setLuceneIndexDir(null);
    }

    KunderaMetadata.INSTANCE.setApplicationMetadata(null);
    ApplicationMetadata appMetadata = KunderaMetadata.INSTANCE.getApplicationMetadata();
    PersistenceUnitMetadata puMetadata = new PersistenceUnitMetadata();
    puMetadata.setPersistenceUnitName(pu);
    Properties p = new Properties();
    p.putAll(props);
    puMetadata.setProperties(p);
    Map<String, PersistenceUnitMetadata> metadata = new HashMap<String, PersistenceUnitMetadata>();
    metadata.put(pu, puMetadata);
    appMetadata.addPersistenceUnitMetadata(metadata);

    Map<String, List<String>> clazzToPu = new HashMap<String, List<String>>();

    List<String> pus = new ArrayList<String>();
    pus.add(pu);
    clazzToPu.put(Doctor.class.getName(), pus);

    appMetadata.setClazzToPuMap(clazzToPu);

    EntityMetadata m = new EntityMetadata(Doctor.class);

    TableProcessor processor = new TableProcessor();
    processor.process(Doctor.class, m);

    m.setPersistenceUnit(pu);

    MetamodelImpl metaModel = new MetamodelImpl();
    metaModel.addEntityMetadata(Doctor.class, m);

    appMetadata.getMetamodelMap().put(pu, metaModel);

    KunderaMetadata.INSTANCE.addClientMetadata(pu, clientMetadata);
    CassandraPropertyReader reader = new CassandraPropertyReader();
    reader.read(pu);
    configuration.configure();
    return null;
}

From source file:org.cloudfoundry.reconfiguration.util.StandardPropertyAugmenter.java

private Properties loadPropertiesForLocations(Object locations) {
    List normalizedLocations;/*  w ww . jav  a  2s  . c om*/

    if (locations instanceof Object[]) {
        normalizedLocations = Arrays.asList((Object[]) locations);
    } else if (locations instanceof List) {
        normalizedLocations = (List) locations;
    } else {
        throw new IllegalArgumentException(String.format("Unable to process 'locations' value of type %s",
                locations.getClass().getName()));
    }

    Properties props = new Properties();
    for (Object location : normalizedLocations) {
        props.putAll(loadPropertiesForLocation(location));
    }

    return props;
}

From source file:net.jcreate.e3.table.skin.processor.VelocityTemplateProcessor.java

public void init(Properties pProperties) {
    Properties props = VelocityHelper.getDefaultProperties();
    props.putAll(pProperties);
    ve = VelocityHelper.getVeocityEngine(props);
}

From source file:net.sf.jabb.util.db.impl.ProxoolDataSourceProvider.java

public DataSource createDataSource(String source, String config) {
    String[] cfgs = config.split(PropertiesLoader.DELIMITERS, 2);
    if (cfgs.length != 2) {
        log.warn("Wrong configuration format for '" + source + "' : " + config);
        return null;
    }/*w  ww.j  a v a 2  s  .  c o  m*/

    DataSource ds = null;
    try {
        DirectDataSourceConfiguration lowerConfig = new DirectDataSourceConfiguration(cfgs[0]);
        Class.forName(lowerConfig.getDriverClassName());

        Properties props = propLoader.load(cfgs[1]);
        props.put("proxool.url", lowerConfig.getUrl());
        props.put("proxool.driver", lowerConfig.getDriverClassName());
        props.putAll(lowerConfig.getConnectionProperties());

        String url = "proxool." + source;
        ProxoolFacade.registerConnectionPool(url, props);
        ds = new DriverManagerDataSource(url);
    } catch (InvalidPropertiesFormatException e) {
        log.error(
                "Wrong configuration properties file format for '" + source + "' with configuration: " + config,
                e);
    } catch (IOException e) {
        log.error("Error loading configuration file for '" + source + "' with configuration: " + config, e);
    } catch (ProxoolException e) {
        log.error("Error creating Proxool connection pool for '" + source + "' with configuration: " + config,
                e);
    } catch (Exception e) {
        log.error("Error creating data source for '" + source + "' with configuration: " + config, e);
    }
    return ds;
}

From source file:org.brushingbits.jnap.email.EmailSender.java

public void send(Email email) {
    EmailAccountInfo accountInfo = defaultEmailAccount;
    JavaMailSenderImpl sender = this.defaultMailSender;
    if (email.getAccountInfo() != null) {
        accountInfo = email.getAccountInfo();
        synchronized (this.mailSenderMap) {
            sender = this.mailSenderMap.get(accountInfo);
            if (sender == null) {
                sender = new JavaMailSenderImpl();
                Properties props = new Properties(this.defaultEmailAccount.getJavaMailProperties());
                props.putAll(accountInfo.getJavaMailProperties());
                sender.setJavaMailProperties(props);
                sender.setUsername(accountInfo.getUsername());
                sender.setPassword(accountInfo.getPassword());
                this.mailSenderMap.put(accountInfo, sender);
            }//from www .j ava 2  s.c  om
        }
    }
    sender.send((MimeMessagePreparator) email);
}

From source file:org.apache.usergrid.management.cassandra.OrganizationConfigPropsImpl.java

@Override
public Properties getPropertiesMap() {
    Properties ret = new Properties(properties);
    ret.putAll(properties);
    return ret;/*from  ww w. j ava  2s .  c o  m*/
}