Example usage for java.util Dictionary put

List of usage examples for java.util Dictionary put

Introduction

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

Prototype

public abstract V put(K key, V value);

Source Link

Document

Maps the specified key to the specified value in this dictionary.

Usage

From source file:org.energy_home.jemma.ah.internal.greenathome.GreenathomeAppliance.java

public void updateAppliance(Dictionary props) throws ApplianceException {

    log.debug("updateAppliance");
    String appliancePid = (String) props.get("appliance.pid");
    if (appliancePid == null)
        throw new ApplianceException("appliance.pid is null");
    synchronized (lockGatH) {
        if (hacService != null) {
            try {
                // !!! Energy@home webui compatibility
                String[] ids = getDeviceIds(appliancePid);
                appliancePid = ids[0];/*from   w  w w.  j av  a 2s.co  m*/
                Integer endPointId = new Integer(ids[1]);
                IAppliance appliance = greenathomeEndPoint.getPeerAppliance(appliancePid);
                props.put(IAppliance.APPLIANCE_TYPE_PROPERTY, appliance.getDescriptor().getType());
                if (appliance.getEndPointIds().length > 2) {
                    ApplianceConfiguration applianceConfig = new ApplianceConfiguration(
                            appliance.getEndPointIds(),
                            convertToMap(this.hacService.getManagedConfiguration(appliancePid)));
                    applianceConfig.updateName(endPointId,
                            (String) props.get(IAppliance.APPLIANCE_NAME_PROPERTY));
                    applianceConfig.updateCategoryPid(endPointId,
                            (String) props.get(IAppliance.APPLIANCE_CATEGORY_PID_PROPERTY));
                    applianceConfig.updateLocationPid(endPointId,
                            (String) props.get(IAppliance.APPLIANCE_LOCATION_PID_PROPERTY));
                    applianceConfig.updateIconName(endPointId,
                            (String) props.get(IAppliance.APPLIANCE_ICON_PROPERTY));
                    this.hacService.updateAppliance(appliancePid,
                            new Hashtable(applianceConfig.getConfigurationMap()));
                } else {
                    this.hacService.updateAppliance(appliancePid, props);
                }
            } catch (HacException e) {
                throw new ApplianceException(e.getMessage());
            }
        } else
            throw new IllegalStateException("hap service not bound");

    }
}