Example usage for java.util Dictionary toString

List of usage examples for java.util Dictionary toString

Introduction

In this page you can find the example usage for java.util Dictionary toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.openhab.binding.zigbee.internal.ZigbeeActiveBinding.java

/**
 * {@inheritDoc}//from  www . j  av a  2s  .  com
 */
@Override
public void updated(Dictionary<String, ?> config) throws ConfigurationException {
    if (config == null)
        return;
    System.out.println("ZIGBEEEEEEEEEEEEEEEEEEEE:" + config.toString());
    // Check the serial port configuration value.
    // This value is mandatory.
    if (StringUtils.isNotBlank((String) config.get("port"))) {
        port = (String) config.get("port");
        logger.info("Update config, port = {}", port);
    }
    if (StringUtils.isNotBlank((String) config.get("ip"))) {
        ipAddress = (String) config.get("ip");
        logger.info("Update config, ipAddress = {}", ipAddress);
    }
    if (StringUtils.isNotBlank((String) config.get("healtime"))) {
        try {
            healtime = Integer.parseInt((String) config.get("healtime"));
            logger.info("Update config, healtime = {}", healtime);
        } catch (NumberFormatException e) {
            healtime = null;
            logger.error(
                    "Error parsing 'healtime'. This must be a single number to set the hour to perform the heal.");
        }
    }
    if (StringUtils.isNotBlank((String) config.get("refreshInterval"))) {
        try {
            refreshInterval = Integer.parseInt((String) config.get("refreshInterval"));
            logger.info("Update config, refreshInterval = {}", refreshInterval);
        } catch (NumberFormatException e) {
            refreshInterval = 10000;
            logger.error("Error parsing 'refreshInterval'. This must be a single number time in milliseconds.");
        }
    }
    if (StringUtils.isNotBlank((String) config.get("pollingQueue"))) {
        try {
            pollingQueue = Integer.parseInt((String) config.get("pollingQueue"));
            logger.info("Update config, pollingQueue = {}", pollingQueue);
        } catch (NumberFormatException e) {
            pollingQueue = 2;
            logger.error("Error parsing 'pollingQueue'. This must be a single number time in milliseconds.");
        }
    }
    if (StringUtils.isNotBlank((String) config.get("timeout"))) {
        try {
            timeout = Integer.parseInt((String) config.get("timeout"));
            logger.info("Update config, timeout = {}", timeout);
        } catch (NumberFormatException e) {
            timeout = null;
            logger.error("Error parsing 'timeout'. This must be an Integer.");
        }
    }
    if (StringUtils.isNotBlank((String) config.get("setSUC"))) {
        try {
            isSUC = Boolean.parseBoolean((String) config.get("setSUC"));
            logger.info("Update config, setSUC = {}", isSUC);
        } catch (NumberFormatException e) {
            isSUC = false;
            logger.error("Error parsing 'setSUC'. This must be boolean.");
        }
    }

    // Now that we've read ALL the configuration, initialise the binding.
    initialise();
}

From source file:in.andres.kandroid.ui.TaskEditActivity.java

@Override
public void onGetDefaultColors(boolean success, Dictionary<String, KanboardColor> colors) {
    kanboardColors = colors;//from   w  ww  .  ja  v  a 2 s.  co m
    colorArray = new int[kanboardColors.size()];
    int i = 0;
    Enumeration<String> iter = kanboardColors.keys();
    while (iter.hasMoreElements()) {
        String key = iter.nextElement();
        colorArray[i] = kanboardColors.get(key).getBackground();
        i++;
    }
    Log.d(Constants.TAG, colors.toString());
    setButtonColor();
}

From source file:org.codice.ddf.spatial.ogc.csw.catalog.source.CswSource.java

/**
 * Searches every query response for previously unknown content types
 *
 * @param response A Query Response/*from  w  w  w.j a  v  a  2s  .c o  m*/
 */
private void addContentTypes(SourceResponse response) {
    if (response == null || response.getResults() == null) {
        return;
    }

    if (contentTypeMappingUpdated) {
        LOGGER.debug("{}: The content type mapping has been updated. Removing all old content types.",
                cswSourceConfiguration.getId());
        contentTypes.clear();
    }

    for (Result result : response.getResults()) {
        Metacard metacard = result.getMetacard();
        if (metacard != null) {
            addContentType(metacard.getContentTypeName(), metacard.getContentTypeVersion(),
                    metacard.getContentTypeNamespace());
        }
    }

    Configuration[] managedConfigs = getManagedConfigs();
    if (managedConfigs != null) {

        for (Configuration managedConfig : managedConfigs) {
            Dictionary<String, Object> properties = managedConfig.getProperties();
            Set<String> current = new HashSet<String>(
                    Arrays.asList((String[]) properties.get(CONTENTTYPES_PROPERTY)));

            if (contentTypeMappingUpdated || (current != null && !current.containsAll(contentTypes.keySet()))) {
                LOGGER.debug("{}: Adding new content types {} for content type mapping: {}.",
                        cswSourceConfiguration.getId(), contentTypes.toString(),
                        cswSourceConfiguration.getContentTypeMapping());
                properties.put(CONTENTTYPES_PROPERTY, contentTypes.keySet().toArray(new String[0]));
                properties.put(CONTENT_TYPE_MAPPING_PROPERTY, cswSourceConfiguration.getContentTypeMapping());
                try {
                    LOGGER.debug("{}: Updating CSW Federated Source configuration with {}.",
                            cswSourceConfiguration.getId(), properties.toString());
                    managedConfig.update(properties);
                } catch (IOException e) {
                    LOGGER.warn("{}: Failed to update managedConfiguration with new contentTypes, Error: {}",
                            cswSourceConfiguration.getId(), e);
                }
            }
        }
    }
}