Example usage for java.util Properties remove

List of usage examples for java.util Properties remove

Introduction

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

Prototype

@Override
    public synchronized Object remove(Object key) 

Source Link

Usage

From source file:de.pawlidi.openaletheia.utils.PropertiesUtils.java

public static Object removeValue(Properties properties, final String key) {
    if (PropertiesUtils.isEmpty(properties) || StringUtils.isBlank(key)) {
        return null;
    }//from w  w  w.  j  a  v a  2 s  .c  o  m
    return properties.remove(key);
}

From source file:org.apache.falcon.cli.commands.BaseFalconCommands.java

static void setClientProperty(String key, String value) {
    Properties props;
    try {/*from   w w  w  .j a  va 2  s  .  c  o  m*/
        props = getClientProperties();
    } catch (FalconCLIRuntimeException e) {
        props = backupProperties;
    }
    if (StringUtils.isBlank(value)) {
        props.remove(key);
    } else {
        props.setProperty(key, value);
    }
    // Re-load client in the next call
    client = null;
}

From source file:com.jkoolcloud.tnt4j.streams.custom.kafka.interceptors.InterceptorsTest.java

private static Producer<String, String> initProducer() throws Exception {
    Properties props = new Properties();
    props.load(new FileReader(System.getProperty("producer.config")));// NON-NLS

    eventsToProduce = Utils.getInt("events.count", props, 10);
    props.remove("events.count");
    topicName = props.getProperty("test.app.topic.name", "tnt4j_streams_kafka_intercept_test_page_visits"); // NON-NLS
    props.remove("test.app.topic.name");

    Producer<String, String> producer = new KafkaProducer<>(props);

    return producer;
}

From source file:org.nuxeo.ecm.core.storage.sql.TestS3BinaryManager.java

@AfterClass
public static void afterClass() {
    Properties props = Framework.getProperties();
    props.remove(S3BinaryManager.CONNECTION_MAX_KEY);
    props.remove(S3BinaryManager.CONNECTION_RETRY_KEY);
    props.remove(S3BinaryManager.CONNECTION_TIMEOUT_KEY);
}

From source file:org.apache.falcon.shell.commands.BaseFalconCommands.java

static void setClientProperty(String key, String value) {
    Properties props;
    try {//  w w  w  .jav  a 2s  .c  o m
        props = getShellProperties();
    } catch (FalconCLIException e) {
        props = backupProperties;
    }
    if (StringUtils.isBlank(value)) {
        props.remove(key);
    } else {
        props.setProperty(key, value);
    }
    // Re-load client in the next call
    client = null;
}

From source file:sernet.gs.ui.rcp.gsimport.GstoolTypeMapper.java

public static void removeGstoolSubtypeToPropertyFile(GstoolImportMappingElement oldElement) {
    Properties properties = readPropertyFile(SUBTYPE_PROPERTIES_FILE);
    properties.remove(oldElement.getKey());
    writePropertyFile(properties, SUBTYPE_PROPERTIES_FILE);
    fireMappingRemovedEvent(oldElement);
}

From source file:Main.java

/**
 * Fix properties keys./*from w  w w. j a v  a 2 s. c  o  m*/
 *
 * @param prop
 *            the prop
 */
public static void fixPropertiesKeys(final Properties prop) {
    final Enumeration<Object> keys = prop.keys();
    while (keys.hasMoreElements()) {
        final String currentKey = (String) keys.nextElement();
        final String fixedKey = fixPropertyKey(currentKey);
        final String value = prop.getProperty(currentKey);
        prop.remove(currentKey);
        prop.setProperty(fixedKey, value);
    }
}

From source file:org.eclipse.kura.net.admin.visitor.linux.util.KuranetConfig.java

public static void deleteProperty(String key) throws IOException, KuraException {
    Properties properties = KuranetConfig.getProperties();

    if (properties != null) {
        if (properties.containsKey(key)) {
            s_logger.debug("Deleting property {}", key);
            properties.remove(key);
            KuranetConfig.storeProperties(properties);
        } else {/*from w w w  .ja  v a 2s  .c o  m*/
            s_logger.debug("Property does not exist {}", key);
        }
    }
}

From source file:sernet.gs.ui.rcp.gsimport.GstoolTypeMapper.java

public static void editGstoolSubtypeToPropertyFile(GstoolImportMappingElement oldElement,
        GstoolImportMappingElement mappingEntry) {
    Properties properties = readPropertyFile(SUBTYPE_PROPERTIES_FILE);
    properties.remove(oldElement.getKey());
    properties.put(mappingEntry.getKey(), mappingEntry.getValue());
    writePropertyFile(properties, SUBTYPE_PROPERTIES_FILE);
    fireMappingChangedEvent(mappingEntry);
}

From source file:com.knowbout.hibernate.HibernateUtil.java

/**
 * This will add properties to the hibernate configuration for each entry that has 
 * a non null value and will remove properties for entries will a null value. It will also attempt 
 * to close the old SessionFactory and create a new one based on the new properties.
 * All sessions must be closed before this method is called.
 * @param properties/*w w w.  j  av a  2 s  .c  o  m*/
 */
public synchronized static void setProperties(HashMap<String, String> properties) {
    Properties currentProps = config.getProperties();
    Set<Entry<String, String>> entries = properties.entrySet();
    for (Entry<String, String> entry : entries) {
        if (entry.getValue() == null) {
            currentProps.remove(entry.getKey());
        } else {
            currentProps.setProperty(entry.getKey(), entry.getValue());
        }
    }
    if (sessionFactory != null) {
        sessionFactory.close();
        sessionFactory = null;
    }
}