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.enonic.cms.framework.util.PropertiesUtil.java

/**
 * Interpolate properties names like ${..}.
 *//*w  w  w  .ja va  2s. c o m*/
public static Properties interpolate(final Properties props) {
    Properties target = new Properties();

    Properties source = new Properties();
    source.putAll(System.getProperties());
    source.putAll(props);

    StrLookup lookup = StrLookup.mapLookup(source);
    StrSubstitutor substitutor = new StrSubstitutor(lookup);

    for (Object key : props.keySet()) {
        String value = props.getProperty((String) key);

        try {
            value = substitutor.replace(value);
        } catch (IllegalStateException e) {
            // Do nothing
        }

        target.put(key, value);
    }

    return target;
}

From source file:de.micromata.genome.gwiki.utils.PropUtils.java

public static String fromProperties(Map<String, String> map) {
    Object om = map;/*from  w ww .j a  v  a 2s .c  o  m*/
    if (om instanceof Properties) {
        return fromProperties((Properties) om);
    }
    Properties props = new Properties();
    props.putAll(map);
    return fromProperties(props);
}

From source file:com.floreantpos.license.FiveStarPOSLicenseGenerator.java

public static String generateLicense(Properties templateProperties, InputStream privateKeyInputStream,
        File licenseFile) throws FileNotFoundException, NoSuchAlgorithmException, InvalidKeySpecException,
        IOException, InvalidKeyException, SignatureException {

    PrivateKey privateKey = readPrivateKey(privateKeyInputStream);
    String encoded = templateProperties.toString();
    String signature = FiveStarPOSLicenseGenerator.sign(encoded.getBytes(), privateKey);

    OutputStream output = new FileOutputStream(licenseFile);
    Properties licenseProperties = new OrderedProperties();
    licenseProperties.putAll(templateProperties);
    licenseProperties.setProperty(License.SIGNATURE, signature);
    licenseProperties.store(output, "License file");
    output.close();//from  w ww  .jav a2  s.co  m

    return signature;
}

From source file:org.bonitasoft.engine.home.BonitaHomeClient.java

public static Properties getProperties() throws BonitaHomeNotSetException, ServerAPIException, IOException {
    final File clientFolder = getInstance().getBonitaHomeClientFolder();
    final Properties defaultProperties = PropertiesManager
            .getProperties(FileUtils.getFile(clientFolder, "work", "bonita-client-community.properties"));
    final Properties customProperties = PropertiesManager
            .getProperties(FileUtils.getFile(clientFolder, "conf", "bonita-client-custom.properties"));
    final Properties result = new Properties();
    result.putAll(defaultProperties);
    result.putAll(customProperties);/* w w  w  .j a v a  2 s.  c o  m*/
    return result;
}

From source file:org.apache.synapse.config.SynapsePropertiesLoader.java

/**
 * Loads the properties//from  www. ja va 2s. com
 * This happen only cached properties are null.
 *
 * @return Synapse Properties
 */
public static Properties loadSynapseProperties() {

    if (reload) {

        if (log.isDebugEnabled()) {
            log.debug("Loading synapse properties from a property file");
        }

        cacheProperties.putAll(MiscellaneousUtil.loadProperties(SynapseConstants.SYNAPSE_PROPERTIES));
        reload = false;

    } else {

        if (log.isDebugEnabled()) {
            log.debug("Retrieving synapse properties from the cache");
        }
    }

    // Original properties needed to be preserved
    Properties tempProperties = new Properties();
    tempProperties.putAll(cacheProperties);
    return tempProperties;
}

From source file:net.xy.jcms.controller.configurations.AbstractPropertyBasedConfiguration.java

/**
 * parses an string to an property object
 * //from www.j av  a 2 s .c om
 * @param configString
 * @param mounted
 *            where this configuration was inserted e.g. root.fragmentOne adjusts relative pathes of the form
 *            .comp4.comp5 with the given mountpoint to comp1.comp4.comp5
 * @return value
 */
protected static Properties initPropertiesByString(final String configString, final String mount) {
    final Properties prop = new Properties();
    prop.putAll(initMapByString(configString, mount));
    return prop;
}

From source file:gobblin.util.JobConfigurationUtils.java

/**
 * Get a new {@link Properties} instance by combining a given system configuration {@link Properties}
 * object (first) and a job configuration {@link Properties} object (second).
 *
 * @param sysProps the given system configuration {@link Properties} object
 * @param jobProps the given job configuration {@link Properties} object
 * @return a new {@link Properties} instance
 *//*ww w.  j  a v  a  2s .  c o  m*/
public static Properties combineSysAndJobProperties(Properties sysProps, Properties jobProps) {
    Properties combinedJobProps = new Properties();
    combinedJobProps.putAll(sysProps);
    combinedJobProps.putAll(jobProps);
    return combinedJobProps;
}

From source file:gobblin.util.PropertiesUtils.java

/**
 * Combine a variable number of {@link Properties} into a single {@link Properties}.
 *///w  ww.  j  av a  2  s .  c om
public static Properties combineProperties(Properties... properties) {
    Properties combinedProperties = new Properties();
    for (Properties props : properties) {
        combinedProperties.putAll(props);
    }
    return combinedProperties;
}

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

/**
 * Copy of the manual properties/* w w w . j ava 2  s .c  om*/
 * 
 * @return {@link Properties}
 */
private static synchronized Properties copyOfGlobalProperties() {
    // return new Properties( runtimeProperties ); returns an empty prop ??

    Properties prop = new Properties();
    prop.putAll(globalPlaceholderProperties);

    return prop;
}

From source file:org.apache.openejb.util.PropertyPlaceHolderHelper.java

public static void holdsWithUpdate(final Properties props) {
    final Properties toUpdate = holds(props);
    props.putAll(toUpdate);
}