Example usage for java.util Properties entrySet

List of usage examples for java.util Properties entrySet

Introduction

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

Prototype

@Override
    public Set<Map.Entry<Object, Object>> entrySet() 

Source Link

Usage

From source file:almira.weblogic.JndiInjectorTest.java

@Test
public void tokenizesPropertyPairs() {
    Properties parsedProperties = injector.getProperties(ARGUMENTS);
    for (Entry<Object, Object> entry : parsedProperties.entrySet()) {
        Object key = entry.getKey();
        Assert.assertTrue(PROPERTIES.containsKey(key));
        Assert.assertEquals(PROPERTIES.get(key), entry.getValue());
    }/*from  www  .j a  v a2s . co  m*/
}

From source file:com.netflix.conductor.server.ConductorConfig.java

@Override
public Map<String, Object> getAll() {
    Map<String, Object> map = new HashMap<>();
    Properties props = System.getProperties();
    props.entrySet().forEach(entry -> map.put(entry.getKey().toString(), entry.getValue()));
    return map;//from  w ww  .j a v a  2 s  . c om
}

From source file:com.od.jtimeseries.component.logging.LoggingPropertyPlaceholderConfigurer.java

protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
        throws BeansException {
    super.processProperties(beanFactoryToProcess, props);
    for (Map.Entry<Object, Object> e : props.entrySet()) {
        m.info("Property-->'" + e.getKey() + "'='" + e.getValue() + "'");
    }//from   w  ww.j a  va 2  s .  c o m
}

From source file:de.vandermeer.skb.mvn.pm.model.PM_Context.java

/**
 * Sets the build version information on the context (creates {@link Ctxt_BuildVersion} objects).
 * @param buildVersions the build version properties
 * @throws IllegalArgumentException if any argument was problematic
 *///from ww w.  ja  v a  2s  .  co m
public void setBuildVersions(Properties buildVersions) {
    StrBuilder errors = new StrBuilder();
    for (Entry<Object, Object> p : buildVersions.entrySet()) {
        try {
            Ctxt_BuildVersion bv = new Ctxt_BuildVersion(p.getKey().toString(), p.getValue().toString());
            this.buildVersions.put(bv.getId(), bv);
        } catch (Exception ex) {
            errors.append(ex.getMessage()).appendNewLine();
        }
    }
    if (errors.size() > 0) {
        throw new IllegalArgumentException(
                "PM Context, problems loading build versions, see below\n" + errors.toString());
    }
}

From source file:com.enonic.vertical.adminweb.PropertiesInfoModelFactory.java

private Properties stripPasswords(Properties secretProperties) {
    Properties publicProperties = new Properties();
    for (Map.Entry<Object, Object> prop : secretProperties.entrySet()) {
        if (prop.getKey() instanceof String) {
            String key = (String) prop.getKey();
            if (key.matches(".*[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]$")) {
                publicProperties.put(key, "****");
            } else {
                publicProperties.put(key, prop.getValue());
            }//from  w w w . j  a v  a2 s  .  c  om
        } else {
            publicProperties.put(prop.getKey(), prop.getValue());
        }
    }

    return publicProperties;
}

From source file:org.apache.kylin.rest.service.AdminService.java

/**
 * Get Java Env info as string//from  w  ww . ja v  a 2  s .  c  o  m
 */
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN)
public String getEnv() throws ConfigurationException {
    PropertiesConfiguration tempConfig = new PropertiesConfiguration();
    OrderedProperties orderedProperties = new OrderedProperties(new TreeMap<String, String>());
    // Add Java Env

    String content = "";
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    // env
    Map<String, String> env = System.getenv();

    for (Map.Entry<String, String> entry : env.entrySet()) {
        orderedProperties.setProperty(entry.getKey(), entry.getValue());
    }

    // properties
    Properties properties = System.getProperties();

    for (Map.Entry<Object, Object> entry : properties.entrySet()) {
        orderedProperties.setProperty((String) entry.getKey(), (String) entry.getValue());
    }

    for (Map.Entry<String, String> entry : orderedProperties.entrySet()) {
        tempConfig.addProperty(entry.getKey(), entry.getValue());
    }

    // do save
    tempConfig.save(baos);
    content = baos.toString();
    return content;
}

From source file:org.jasig.irclog.SpelEventFormatter.java

@SuppressWarnings("unchecked")
public void setFormatExpressions(Properties expressions) {
    this.formatExpressions.clear();

    for (final Map.Entry<Object, Object> expressionItr : expressions.entrySet()) {
        final String key = (String) expressionItr.getKey();

        final Class<IrcEvent> eventClass;
        try {/*from   w  w  w  .ja va  2  s.co m*/
            eventClass = (Class<IrcEvent>) Class.forName(key);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e.getMessage(), e);
        }

        final String expressionText = (String) expressionItr.getValue();
        final Expression expression = this.expressionParser.parseExpression(expressionText);

        this.logger.debug("Compiled expression '" + expression.getExpressionString() + " for " + eventClass);

        this.formatExpressions.put(eventClass, expression);
    }
}

From source file:blast.shell.jline.BlastConsoleFactory.java

private void addSystemProperties(CommandSession session) {
    Properties sysProps = System.getProperties();
    for (Map.Entry<Object, Object> entry : sysProps.entrySet()) {
        session.put((String) entry.getKey(), entry.getValue());
    }/*from   w ww  .ja v a  2  s. c  om*/
}

From source file:gaffer.data.element.Element.java

public void copyProperties(final Properties properties) {
    for (final Map.Entry<String, Object> entry : properties.entrySet()) {
        putProperty(entry.getKey(), entry.getValue());
    }//from  ww  w. j av a2s.  c om
}

From source file:com.conversantmedia.mapreduce.tool.PosixParserRequiredProps.java

/**
 * Verifies that the properties don't contain undefined options which will
 * cause the base parser to blowup.//from w  w w . j  a  v a2s  .  c  o m
 *
 * @param options                  the options config
 * @param properties               overriding properties
 * @throws UnrecognizedOptionException   if a property exists that isn't
 *                               configured in the options.
 */
protected void validateProperties(Options options, Properties properties) throws UnrecognizedOptionException {
    if (properties != null) {
        for (Entry<Object, Object> e : properties.entrySet()) {
            String arg = (String) e.getKey();
            boolean hasOption = options.hasOption(arg);
            if (!hasOption) {
                throw new UnrecognizedOptionException("Unrecognized option: " + arg, arg);
            }
        }
    }
}